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

nrf_drv_timer and sleep

The design I am working with has no RTC.  Is it possible to use nrf_drv_timer to "wake up" the CPU?  I understand I will not be able to use app_timer code, so I was trying to spin it with WFE/WFI and a timer_handler.  Here is a summary my first failed attempt:

main()

...
    // Initialize wake-up timer
    nrf_drv_timer_init(&TIMER, NULL, timer_handler);
    time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER, time_ms);
    nrf_drv_timer_extended_compare(
         &TIMER, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    nrf_drv_timer_enable(&TIMER);

...

while(TRUE){

    __SEV();
    __WFE();

   toggle_led()

}

Pretty new to Nordic, so any help would be appreciated!

Parents Reply Children
No Data
Related