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

NRFX RTC Driver - How to stop compare interrupt handler disabling interrupts

I'm using the nrfx_rtc drivers on RTC2 to generate a regular interrupt once a second, using compare interrupts.

My problem is that the nrfx_rtc interrupt handler disables compare events and interrupts, so the interrupt only happens once. I want it to repeat by clearing the counter in the compare interrupt handler.

See nrfx_rtc.c irq_handler() which calls nrf_rtc_event_disable() and nrf_rtc_int_disable()

I can work around it by putting the following in the NRFX_RTC_INT_COMPARE0 handler

      NRF_RTC2->EVTENSET = (1UL << 16);
      NRF_RTC2->INTENSET = (1UL << 16);

but this is a real cludge, bypassing nrfx drivers. How should I do this properly, using nrfx drivers?

I'm using nRF52840 (PAN1780 module), SDK 17.0.2, Nordic SES 5.34a

Many thanks