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

nRF52 RTC issue

I'm using the nRF52-DK (SDK11.0.0+s132) and added in some example code from the RTC example (the RTC2 tick interrupt with prescaler=0 to toggle a GPIO) to the ble_hrs example. It mostly interrupts every with a 32.768kHz tick (GPIO mostly pin has 61us period; why is it not a 50% duty cycle?), but there are many instances where the timing is off as shown in this logic analyzer screen shot where the high time triggered at 150ms. What is the issue and how do I get an accurate RTC? The peripheral is just advertising (no connection from peer) and the RTC is configured and started in main() before advertising starts.

image description

Parents
  • Are you using an interrupt handler for this and do you have the softdevice running and advertising? If so it's just not going to work, there are many threads every week about this, the softdevice has a higher interrupt priority than your timer so it will interrupt it and delay your handler.

    You need to use PPI or the PWM module to generate accurate timing with the softdevice running, you cannot do it with interrupt handlers.

Reply
  • Are you using an interrupt handler for this and do you have the softdevice running and advertising? If so it's just not going to work, there are many threads every week about this, the softdevice has a higher interrupt priority than your timer so it will interrupt it and delay your handler.

    You need to use PPI or the PWM module to generate accurate timing with the softdevice running, you cannot do it with interrupt handlers.

Children
No Data
Related