This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sometime, the timer handler is not called with FreeRTOS.

Sometime, the timer handler is not call immediately after calling app_timer_start().

environment
- nrf52840
- SDK 15
- with FreeRTOS
- timer task priority is higher
- timeout_ticks = 1 (app_timer_start)

mechanism (maybe)
1. Call app_timer_start(timeout_ticks = 1).
2. app_timer_start() calls xTimerStart to send COMMAND_START to timer task.
3. The system timer increments tick count by interrupt.
3. Timer task processes COMMAND_START. (timer task priority is higher than the caller.)
4. Timer task calls prvInsertTimerInActiveList().
5. prvInsertTimerInActiveList() detects that timeout is already expire.
6. prvInsertTimerInActiveList() does not call vListInsert.
    prvInsertTimerInActiveList() returns pdTRUE.
7. Timer task calls pxCallbackFunction() immediately.
8. app_timer_callback() is called.
9. But, at this time, since pinfo->active is false, pinfo->func is not called.
    because, timing of "pinfo->active = true" is the last of app_timer_start().

I think that this problem can be fix by changing timing of "pinfo->active = true".
How about it?

Thanks,

Related