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

app_timer2 assert in on_compare_evt after upgrade from SDK 16 to SDK 17

Hi,

After upgrading from SDK 16 to SDK 17 my device started to assert on app_timer2.c line 298:

ASSERT(app_timer_cnt_diff_compute(drv_rtc_counter_get(p_instance),
                                          drv_rtc_compare_get(p_instance, 0)) < APP_TIMER_SAFE_WINDOW);

This happens way more often when running without debugger/RTT.

I checked my app timer handlers and i could not notice that any of them would take too long time to finish. Have not measured tho.
Assert happens both while advertising and in connected state.
As soon as I switch back to SDK 16, everything is fine again.

Has something changed in sdk_config.h? Do I need to update some values?

Some details:

  • device nrf52840
  • running device as a peripheral
  • s140 softdevice

/Erik

Parents Reply
  • Hi Krzysztof,

    I was not able to make my app to work with log level 4 as there were a lot of dropped logs or with deferred log off, it was spending too much time printing the messages.

    However, I started to investigate by removing timers one by one and I noticed that at some point it started to work. So... I have one repeated timer that runs with 1ms period + I am using libuarte with 

    #define NRF_LIBUARTE_ASYNC_WITH_APP_TIMER 1


    If they both are active, the timer will assert.
    If only one of them is active, it will be fine.

    I measured the time it spends in the 1ms timer handler and it was under 1 app timer tick (the diff between start and end was zero). So it cannot be that I am spending too much time in the handler.

    It seems that this issue with app_timer2 might be somehow connected to libuarte when app_timer is used for its timeout handling.

    /Erik

Children
Related