Hi All,
I would like the nrf51822 sleep, wake up and then continues advertising.
I try following code:
NVIC_DisableIRQ(RTC1_IRQn);
NRF_RTC1->EVTENCLR = RTC_EVTEN_TICK_Msk;
NRF_RTC1->INTENCLR = RTC_INTENSET_TICK_Msk;
NRF_RTC1->EVENTS_TICK = 0;
NRF_RTC1->TASKS_STOP = 1;
NRF_RTC1->TASKS_CLEAR = 1;
NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk;
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk;
NRF_RTC1->CC[0] = (sleep_time*32768)>>5;
NVIC_EnableIRQ(RTC1_IRQn); NRF_RTC1->TASKS_START = 1;
__WFI();
NRF_RTC1->TASKS_STOP = 1;
NRF_RTC1->TASKS_CLEAR = 1;
NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk;
NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk;
NRF_RTC1->EVENTS_TICK = 1;
NRF_RTC1->EVTENSET = RTC_EVTEN_TICK_Msk;
NRF_RTC1->INTENSET = RTC_INTENSET_TICK_Msk;
but the chip reset after wake up... any step I missed?