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
  • Hey,

    To use  RTC(Real Time Counter), you only need to configure Low Frequency Clock Source.

    If your board doesn't have an external Low Frequency Oscillator, you can use internal Low Frequency RC oscillator or synthesize the Low Frequency clock from the main oscillator.

    Please take a look at the product specification of the specific device that you are using for more information.

    All the documentation is available here

Children
Related