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

How to clear RTC interrupt?

Hi all,

I have an TICK interrupt on RTC1 on nRF51822, but the program keeps cycling in the interrupt - as if the interrupt is never cleared?

Here's my code:

void RTC1_IRQHandler(void) {

// Clear all events (also unexpected ones)
    NRF_RTC1->EVENTS_COMPARE[0] = 0;
    NRF_RTC1->EVENTS_COMPARE[1] = 0;
    NRF_RTC1->EVENTS_COMPARE[2] = 0;
    NRF_RTC1->EVENTS_COMPARE[3] = 0;
    NRF_RTC1->EVENTS_TICK       = 0;
    NRF_RTC1->EVENTS_OVRFLW     = 0;

//Also try to clear this way: 
    NRF_RTC1->INTENCLR = 0xff;
    NRF_RTC1->EVTENCLR = 0xff;

  //Run timers:
  SWTimers_timeouts_check();

  //Run scheduler:
  Scheduler_isr();

}
Related