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

Does the HFXO need to be restarted after waking from sleep?

On the nRF52, does the TASKS_HFCLKSTART need to be trigger again after waking up from sleep, if the the HFXO was started before going to sleep? Or does the Clock control circuitry remember that the HFXO was used the last time an HF clock was requested, and starts up the HFXO automatically?

Parents
  • Hi,

    The HFCLK will run even during sleep if you do not manually disable it, if you are referring to sleep as system OFF then you will need to reconfigure and restart it.

    When using the SoftDevice make sure that you request the HFCLK rather than start it by caling TASKS_START. ie.

    SoftDevice:

    HFCLK started by:

    uint32_t running=0;
    sd_clock_hfclk_request();
    while (!running) 
    {
        sd_clock_hfclk_is_running(&p_is_running);
    }
    

    Stopped by:

    sd_clock_hfclk_release();
    

    LFCLK is always configured when the SoftDevice running, start it by calling

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM , NULL) 
    

    NRF_CLOCK_LFCLKSRC_XTAL_50_PPM should be exchanged with the appropriate LFCLK from this struct.

    No SoftDevice

    // Start high frequency clock
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    
    // Start low frequency clock
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Wait for clock to start
    }
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    

    Best regards,

    Øyvind

Reply Children
No Data
Related