I can't release( STOP ) HFCLK( XTAL ) source after I first started HFCLK source.

Hello, 

I am using nRF52840 DK, and SDK version 17.1.0.

I want to dynamically control CLOCK source.

I tried to release( STOP )  HFCLK( XTAL ) source using nrf_drv_clock_hfclk_release() function after I first started HFCLK source, but it seems not to be working properly. ( HFCLK NOT STOPPED after using this function. )

Is it possible to dynamically STOP HFCLK( XTAL ) source while the board is on and connected to another board by BLE ?

Thanks.

Shossy

  • Thank you for your reply,

    I want to check the following. 

    In summary, I must not completely release(STOP) HFCLK source by 

    while(nrf_drv_clock_hfclk_is_running()){

       nrf_drv_clock_hfclk_release();

    }

    after explicitly starting HFCLK source in advance ??

    ( If I use only once the function nrf_drv_clock_hfclk_release() , I can not completely release( STOP ) HFCLK source. )

    Is this understanding correct ??

    This is fatal thing for my study.

    Thanks.

  • Yes and no, that is not entirely correct. If you call nrf_drv_clock_hfclk_request() 1 time, and then call nrf_drv_clock_hfclk_release() the HFXO will be stopped (unless the SoftDevice use it, and in that case, it will be stopped when the SoftDevice is done using it).

    But it is right that you should never call any of the release or request functions in a loop. It would break the concept of counting up requests and counting down releases, which is there to ensure that the HFXO is always enabled as long as it is need (anywhere in the code, potentially in some library or driver implementation do now know about or another part of the code a colleague of you wrote that you don't know about), and immediately disabled when no longer needed.

Related