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

app timer sometimes expires immediately

Hello,

I am using nrf52840 and SDK 15.3.0. and the device wakes up every hour and every day for reporting data.

So I am using app timer to wake up also using app_timer to check timeout for sensor communication response.

And sometimes that sensor communication response ends up with timeout because the app timer expires immediately.

I found some similar questions like below in this devzone and tried to use 64hz rtc1 scale not to exceed MAX_RTC_COUNTER_VAL/2 and the issue looks gone.

My question is was this app timer bug fixed before SDK 15.3.0 or any plan to fix it?

https://devzone.nordicsemi.com/f/nordic-q-a/11738/app_timer-expires-immediately---sdk-10

https://devzone.nordicsemi.com/f/nordic-q-a/29665/sdk-13-app_timer-24-hour-long-timer

Thank you.

Parents
  • Hi,

    The MAX_RTC_COUNTER_VAL/2 is present in most SDK versions. I recommend you use the app_timer2 implementation (app_timer2.c) from SDK 16. If you are using 15.3, just copy that to your older SDK version. app_time2 is a complete rewrite, and it is the default in SDK 16. It does not suffer from the same bugs as the old app_timer implementation.

  • Seems like it works.

    So the apptimer2 supports 64 bit tick counter as well right?

    I was using extra code that calculates rtc1 with overflow counter for supporting a long time os tick counter but it looks like I can use apptimer2 get_now() instead of implementing extra code. Am I correct? or do I need some more set up to avoid rtc counter reset issue? I have never seen rtc counter reset issue with apptimer2 so far but my testing time was not enough and just want to make sure.

    Thanks!

Reply
  • Seems like it works.

    So the apptimer2 supports 64 bit tick counter as well right?

    I was using extra code that calculates rtc1 with overflow counter for supporting a long time os tick counter but it looks like I can use apptimer2 get_now() instead of implementing extra code. Am I correct? or do I need some more set up to avoid rtc counter reset issue? I have never seen rtc counter reset issue with apptimer2 so far but my testing time was not enough and just want to make sure.

    Thanks!

Children
Related