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

App_timer expires immediately - SDK 10

I am seeing a problem identical to what's described in this question. I'm using SDK version 10.

My timers work fine for a while, but then suddenly and seemingly at random all timers expire the instant they are started. Sometimes it goes away and the timers work again, but sometimes the only fix seems to be a restart.

I've seen two suggested solutions. One is to add a delay or a call to rtc1_compare0_set in compare_reg_update; I'm on SDK 10 and both solutions are already there:

    ...
    rtc1_compare0_set(rtc1_counter_get());  // this should prevent CC to fire again in the background while the code is in RTC-ISR
    nrf_delay_us(MAX_RTC_TASKS_DELAY);
    timer_timeouts_check_sched();
    ...

The only other solution I've found on the forum is to have a dummy timer that is always running. It's recommended in this answer.

Sadly, I do already have a dummy timer always running—I've been using it to force the RTC to stay on so I can use it for timekeeping.

Are there any other known problems or solutions with app_timer? I'm running out of ideas. Thanks!

Parents
  • We only have one board available right now, unfortunately, so I can't really send it out.

    In the mean time I've been looking into things myself. I'm printing out (using RTT) the counter value from rtc1_counter_get inside of timer_timeouts_check. Here's a mysterious progression:

       ...
        0x0DEBA9
        0x0E5B26
        0x0E6F14
        0x8E6F5E
        0x8E6FCE
        ...
    

    Somehow the high bit in the counter is getting set. This coincides exactly with when all timers begin to expire instantly (note the very close tick count gaps at the end there). Is there any possible way the RTC1 counter could get screwed up like this? I'm not using the counter at all except through app_timer.

    I'll comment again when I have further results.

    Thanks!

Reply
  • We only have one board available right now, unfortunately, so I can't really send it out.

    In the mean time I've been looking into things myself. I'm printing out (using RTT) the counter value from rtc1_counter_get inside of timer_timeouts_check. Here's a mysterious progression:

       ...
        0x0DEBA9
        0x0E5B26
        0x0E6F14
        0x8E6F5E
        0x8E6FCE
        ...
    

    Somehow the high bit in the counter is getting set. This coincides exactly with when all timers begin to expire instantly (note the very close tick count gaps at the end there). Is there any possible way the RTC1 counter could get screwed up like this? I'm not using the counter at all except through app_timer.

    I'll comment again when I have further results.

    Thanks!

Children
No Data
Related