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

Power consumption when changing HFCLK

When I changed HFCLK from "64 MHz internal oscillator (HFINT)" to "64 MHz crystal oscillator (HFXO)", the power consumption when executing sd_app_evt_wait() became larger.
I would like to reduce the power consumption to the same level as "64 MHz internal oscillator (HFINT)". Is there any way to deal with this?

"64 MHz internal oscillator (HFINT)":2.3uA
"64 MHz crystal oscillator (HFXO)"  :396uA


■Environment
  nRF52810
  s112

■situation
The following code was added at startup to change HFCLK.

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;

    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);

Currently, when executing sd_app_evt_wait(), I just call the function without any control.
When HFCLK is changed, do we need to do any control?
For example, is it necessary to take the following actions before and after executing sd_app_evt_wait function?

    NRF_CLOCK->TASKS_HFCLKSTOP = 1;                 //add

    err = sd_app_evt_wait();
    APP_ERROR_CHECK( err );

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;             //add
    NRF_CLOCK->TASKS_HFCLKSTART = 1;                //add


    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);    //add

Parents Reply
  • Thank you for your answer!

    I used the softdevice api you gave me, but it didn't lower the power consumption.
    I implemented the following after nrf_sdh_enable_request.

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

    Is there a problem with the above response?
    If there is any other way to change the oscillator other than the above, please let me know.

    Also, the following link says that the oscillator is automatically switched.
    Does the external oscillator work without the above settings in the first place?
    devzone.nordicsemi.com/.../nrf52832-external-hfxo

    I have one more question to add.

    If I use the software device API to switch to using an external oscillator instead of switching directly to using an external oscillator in the registers, will I still get more current?

Children
  • If you need an accurate HFCLK while the chip is running CPU, then you need to request and release the HFCLK while awake. However since the chip will wakeup frequent, and the time to startup the external HFCLK require 1.5ms, this will have a higher power consumption hit on average. My impression is that the majority of applications out there dont' do this (the don't start the external HFCLK), is there are particular reason why you need the external HFCLK while executing code?

    Kenneth

Related