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 again,

    I just tried SDK 17.0.2 and I am still experiencing the issue. When I replace it with the line suggested by Kenneth, it starts to work.

    I tried to change the APP_TIMER_CONFIG_RTC_FREQUENCY to 1 but that did not fix the issue.
    If understand this correct then in my case when it calculates the difference between counter and CC, it gets -1 and that value is unsigned so it goes to UNIT32_MAX that is than masked with 24bits so that it would get a value in the range of RTC counter.

    Is this how it should be, that this is an illegal value and should assert?
    Do you have guesses why does my program end up in this scenario?

    Thank you,
    /Erik

Children
Related