I did not use softdevice; //this my code
void SysClk_LFInit(void)
{
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
{
//Do nothing.
}
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
SysClk_Calibration();
}
void RTC_Init(void)
{
// ?? RTC??.
NRF_RTC1->PRESCALER = 32;//COUNTER_PRESCALER ;
NRF_RTC1->CC[0] = 33;
// COMPARE_COUNTERTIME * RTC_FREQUENCY;
// Enable TICK event and TICK interrupt:
// NRF_RTC1->EVTENSET = RTC_EVTENSET_TICK_Msk;
// NRF_RTC1->INTENSET = RTC_INTENSET_TICK_Msk;
NRF_RTC1->EVTENSET = RTC_EVTENCLR_COMPARE0_Msk;
NRF_RTC1->INTENSET = RTC_EVTENCLR_COMPARE0_Msk;
NVIC_SetPriority(RTC1_IRQn,1);
NVIC_EnableIRQ(RTC1_IRQn);
}
void RTC1_IRQHandler(void)
{
if(NRF_RTC1->EVENTS_COMPARE[0] != 0 )
{
NRF_RTC1->TASKS_CLEAR = 1;
NRF_RTC1->EVENTS_COMPARE[0] = 0;
rtc_time_flag = true;
}
}
//this is my loop in main
while(1)
{
if(rtc_time_flag == true)
{
rtc_time_flag = false;
}
__SEV();
__WFI();
}
After into sheep mode by _WFI(),It can not wakeup when the RTC1_IRQ coming. why?