Dear Nordic Support Team,
Defining NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE3_Msk;
and NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE3_Msk;
without specifing NRF_RTC1->CC[3]
and NRF_RTC1->EVENTS_COMPARE[3]
handler management resulting by freezing the nRF51822 after a complete RTC tick round : 512 seconds.
The current consumption rises to a stable 4mA and nothing no longer response (GPIOTE, RTC, WFI, ...). Chip is dead unitl next reboot, even watch dog doesn't response.
It takes me some times to find this problem out. Therefore I publish for the records. I there some guys from Nordic to confirm this behavior or it is a nRF51 RTC bug?
BTW, the CC[0] is highly used in this code, so this problem doesn't occurred when nothing happend to RTC1.
/**@brief
* Function for initializing the RTC1 counter.
*/
static void rtc1_init()
{
NRF_RTC1->PRESCALER = APP_TIMER_PRESCALER;
NVIC_SetPriority(RTC1_IRQn, APP_IRQ_PRIORITY_LOW);
NVIC_ClearPendingIRQ(RTC1_IRQn);
NVIC_EnableIRQ(RTC1_IRQn);
// Configure timer for clock
NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE3_Msk;
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE3_Msk;
//NRF_RTC1->CC[3] = TICKS_1_SEC; //If not defined, the chip will freeze in 512 seconds
NRF_RTC1->TASKS_START = 1;
nrf_delay_us(MAX_RTC_TASKS_DELAY);
}
/**@brief Function for handling the RTC1 interrupt.
*
*/
void RTC1_IRQHandler(void)
{
if (NRF_RTC1->EVENTS_COMPARE[0] != 0)
{
NRF_RTC1->EVENTS_COMPARE[0] = 0;
NRF_RTC1->CC[0] += TIMER_INTERVAL;
kernel_setSignal(SIGNAL_64HZ);
}
/*
if(NRF_RTC1->EVENTS_COMPARE[3] != 0)
{
NRF_RTC1->EVENTS_COMPARE[3] = 0;
//Watch Dog
NRF_WDT->RR[0] = WDT_RR_RR_Reload;
NRF_RTC1->CC[3] += TICKS_1_SEC;
increment_time();
kernel_setSignal(SIGNAL_1HZ);
}
*/
}