This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Handling RTC overflow

Hi all, I have an nRF52832 which is woken up every 15 seconds by an RTC to check for ESB broadcasts. The nRF52 will be powered continuously until the battery runs out, so at some point the RTC will overflow. If the ESB does receive a packet, there will be three RTC counter compares running at once. What is the correct method of handling RTC overflow so that all of the three CCs continue to work properly? Thanks!

  • I think you do not need to "handle it" if your other math for setting the compare registers is proper modulo (clock) arithmetic. When the counter overflows, it goes back to zero and keeps counting. You can configure an event for overflow, but I don't think you need to (unless you need to count the overflows, for example to keep a long clock.) The tricky part is setting the compare register: when the counter is near overflow it is a large number, when you calculate the compare value modulo the size of the counter it yields a small number, but thats what it should be. All unsigned arithmetic.

  • Great, thanks butch. I'll just ensure that the 32-bit target counter value is modulo 24-bit before I set it.

Related