Questions about wiced_timer

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
LJYe_2922526
Level 5
Level 5
25 likes received 10 likes received 5 likes given

I'm working with 20706 and WICED studio 6. For our application we need to rely on the timer to track events.

Looking at the API and examples, here are some questions:

1) Functions like wiced_init_timer(), wiced_start_timer() and wiced_stop_timer() all return wiced_result_t, which might not be WICED_SUCCESS. Can they actually fail? Why would they fail? How do I recover from the failure? If any of them fails, I'm left in a very awkward position, and without knowing more, the only logical thing left to do is reset the system...

2) Would starting a timer affect system sleep? Does the type of the timer matter (periodic vs. one-shot, ms vs. s)?

3) Are there any timing constraints on timer callbacks? How long can my callback function run without breaking the system?

Thanks!

1 Solution
Anonymous
Not applicable

1) a) wiced_init_timer will return WICED_ERROR if wiced_timer_t* or wiced_timer_callback_t parameters are NULL.

    b) The start_timer will return WICED_BADARG if you do not specify a timeout value.

These APIs shouldn't fail if all the parameters that are passed are correct (value and format).

2) Yes, if there is a timer running, then the device won't go to sleep till the timer is stopped.

3) I don't think we have quantified this number.

4) No, timer callbacks are not called in an ISR. Yes, many callbacks are called from an ISR.

5) No, callbacks cannot preempt each other.

View solution in original post

0 Likes
3 Replies
LJYe_2922526
Level 5
Level 5
25 likes received 10 likes received 5 likes given

Quick follow up question:

The timer callbacks are not called in an Interrupt Service Routine, correct? Are any callbacks like rx data callback called in an ISR?

Thanks.

0 Likes

Slight panic here: Can callbacks of different types preempt each other?

0 Likes
Anonymous
Not applicable

1) a) wiced_init_timer will return WICED_ERROR if wiced_timer_t* or wiced_timer_callback_t parameters are NULL.

    b) The start_timer will return WICED_BADARG if you do not specify a timeout value.

These APIs shouldn't fail if all the parameters that are passed are correct (value and format).

2) Yes, if there is a timer running, then the device won't go to sleep till the timer is stopped.

3) I don't think we have quantified this number.

4) No, timer callbacks are not called in an ISR. Yes, many callbacks are called from an ISR.

5) No, callbacks cannot preempt each other.

0 Likes