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
  • These values means that this is a false positive. When CC value is set it cannot be set for COUNTER+1 because it may not generate event (hw limitation). Because of that driver detects that situation and increases CC value and sets again. However, in your case the event was generated for 8928348 but because it was close, driver set CC to 8928349 and during that setting event occurred.

    Anyway, it means that assert is too strict and does not cover for this case. I will look into fixing this assert. The SDK16 version was not covering timeouts longer than 24 bits thus it was changed. For now you can get back to assert from v16 as long as you are not using timeouts > 24 bits.

Children
Related