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

RTC0 IRQ/event on overflow?

In my project I need to be able to get time from a continuously running RTC. The softdevice uses RTC0, and app_timer uses RTC1 (and starts and stops it).

(annoyingly I have to support nRF51 and nRF52 so I can't just use RTC2)

I've been using RTC0, but of course it rolls over every 512 seconds.

Presumably I can't set up an IRQ because the softdevice does that, but is there some event or callback that I can use to get notified when the RTC has rolled over? Or do I just have to make sure I always wake up after less than 512 seconds so I can check for overflows?

thanks!

Parents
  • Queueing a <512 second repeating timer is a simpler solution than I had in mind. The handler would tick the long-running clock MSB. But wouldn't you need to start it so that it expired exactly when the RTC rolls over? I don't understand why the RTC would stop (if the app_timer library is bulletproof)? But it would be nice to have an existing implementation of a long-running clock (using app_timer) that is provably correct. In my case I am not using SoftDevice, so I can use the RTC that app_timer is not using, at the expense of more current.

Reply
  • Queueing a <512 second repeating timer is a simpler solution than I had in mind. The handler would tick the long-running clock MSB. But wouldn't you need to start it so that it expired exactly when the RTC rolls over? I don't understand why the RTC would stop (if the app_timer library is bulletproof)? But it would be nice to have an existing implementation of a long-running clock (using app_timer) that is provably correct. In my case I am not using SoftDevice, so I can use the RTC that app_timer is not using, at the expense of more current.

Children
No Data
Related