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

RTC interrupt does not wake up nRF52

I am having issues waking up nRF52 with s132 using the RTC interrupt. The same code is used on nRF51 with s130 and does not show this behavior.

The RTC is configured and the interrupts are fired and handled as expected every 10ms. The Softdefice is running but no advertising is enabled. The RTC configuration looks like:

NRF_RTC1->PRESCALER = 0;
NRF_RTC1->CC[0] = 32768 / 100;
NRF_RTC1->INTENCLR = 0xffffffffUL;
NRF_RTC1->INTENSET = (RTC_INTENSET_COMPARE0_Set << RTC_INTENSET_COMPARE0_Pos);
NRF_RTC1->TASKS_START = 1;

result = sd_nvic_ClearPendingIRQ (RTC1_IRQn);
ASSERT (result == NRF_SUCCESS);
result = sd_nvic_SetPriority (RTC1_IRQn,NRF_APP_PRIORITY_LOW);
ASSERT (result == NRF_SUCCESS);
result = sd_nvic_EnableIRQ (RTC1_IRQn);
ASSERT (result == NRF_SUCCESS);

The problem occures when sending the nRF52 into sleep mode with:

result = sd_app_evt_wait();

Compared to the nRF51 the nRF52 is not woken up by the RTC interrupt. Setting the Send Event on Pending bit in the System Control Register fixes the problem but it should not be necessary to set it:

SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

Why is it necessary to set the the bit on nRF52? The interrupt for RTC is enabled and fired when the CPU is not sleeping. Did I miss a configuration on nRF52 which is not needed on nRF51?

Related