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!

Parents
  • 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?

  • 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

Reply
  • 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

Children
No Data
Related