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

HFXO control while using Radio

Hello,

Is that true I only need the HFXO to be on right before issuing NRF_RADIO->TASKS_START = 1?

As long as the radio is not in TX/RX status, the HFXO can be turned off?

Thanks!

  • Hello,

    Yes, that is correct, and you can turn off the crystal afterwards to lower the idle current. Just remember to take the HFXO startup time into account to be sure the the clock is ready before you start the RADIO. For comparison, our Softdevice (Bluetooth stack) ramps up the crystal about 1.5 ms prior to radio activity

  • Hi Vidar, Thanks for the figure, which is helpful!

    Currently, I am having an issue that when I am turning on/off the HFXO (using hfxo_start and hfxo_stop function shown below) according to the usage of radio, at some point, the HFCLK stopped running, i.e. the running bit o HFCLKSTAT is 0 all times after issuing the HFCLKSTARTED task. 

    void clocks_hfxo_start(void){

        // Start HFCLK and wait for it to start.

        if (NRF_CLOCK->HFCLKSTAT != 0x00010001) {

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

                    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);  // blocked at here
            while (NRF_CLOCK->HFCLKSTAT != 0x00010001);
        }
    }

    void clocks_hfxo_stop(void){

        // make sure the clock source is xtal
        if((NRF_CLOCK->HFCLKSTAT & 0x00000001) != 0) {

            // make sure the clock is running
            if((NRF_CLOCK->HFCLKSTAT & 0x00010000) != 0) {

                NRF_CLOCK->TASKS_HFCLKSTOP = 1;
                while((NRF_CLOCK->HFCLKSTAT & 0x00000001) != 0);
            }
        }
    }

    How should I debug this?

  • Sorry, I read the wrong bit. So the HFCLK is running actually, but not using HFXO after issuing HFCLKSTARTED task.

  • Hi,

    I'm not sure why it gets stuck in that state. Is this easy to replicate on your board, and have you tried it on a nordic DK? I used your code in the SDK blinky example, but did not manage to replicate the issue on my end.

    It should be sufficient to just wait for the EVENTS_HFCLKSTARTED event when starting the crystal and it usually shouldn't be neccessary to a wait function after the clock stop task either.

    Best regards,

    Vidar

Related