Hi i want to make a low power delay ms (blocking) function for nrf52805 without softdevice and without NRFx, just writing to the registers.
void RTC1_IRQHandler(void)
{
NRF_RTC1->TASKS_STOP=1;
NRF_RTC1->EVENTS_COMPARE[0]=0;
}
void helperLowPowerDelayMs(uint16_t ms)
{
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART=1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0){};
NRF_RTC1->TASKS_STOP=1;
NRF_RTC1->TASKS_CLEAR=1;
NRF_RTC1->CC[0]=ms*33;
NRF_RTC1->EVENTS_COMPARE[0]=0;
NRF_RTC1->INTENSET=RTC_INTENSET_COMPARE0_Enabled<<RTC_INTENSET_COMPARE0_Pos;
NVIC_ClearPendingIRQ(RTC1_IRQn);
NVIC_SetPriority(RTC1_IRQn,1);
NVIC_EnableIRQ(RTC1_IRQn);
NRF_RTC1->TASKS_START=1;
__WFI();
NVIC_DisableIRQ(RTC1_IRQn);
}
The RTC1 events_tick never gets set, the rtc1 event cc 0 never gets set. the isr does not execute
.
what is the problem?