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

app_timer counter resets unexpectedly (not overflowing but reset to 0)

Hi,

I have several timers and they will be app_timer_start() several time. I am not using APP_TIMER_MODE_REPEATED because they are not started immediately after they expire. I have my own linked-list to keep track of all timers. Whenever the first timer in the list timeouts (which is always true because of implementation), I 

1. Remove it from the list and execute its handler

2. Deduct the timeout values of remaining timers in the list by the value of app_timer_cnt_get()

3. app_timer_start() the first timer by its timeout value

Here is the thing. I know app_timer_cnt_get() will overflow at 0xFFFFFF so I did some checks upon calling it. It turns out, the counter goes back to 0 before reaching 0xFFFFFF (not even close. It reset at around 0x19810 in one case). Why would that happen? Does app_timer_start() or app_timer_stop() reset the counter? Is it possible that when the voltage drops to a certain level, the timer resets itself?

I'm using lfclk for the clock. 

Thanks

Parents Reply Children
No Data
Related