I want to restart HFCLK clock source earlier than within 12 RTC Counter increments after I released HFCLK source.

Hello,

 

I am using nRF52840 DK, and SDK version 17.1.0

 

I dynamically and explicitly request and restart HFCLK clock source after I released HFCLK clock source while using BLE connection, and I noticed that RTC Counter is incremented by 12 to restart HFCLK clock source in the case of using 32.768 kHz RTC Counter increment frequency.

 

I want to know how I can explicitly restart HFCLK clock source earlier than within 12 RTC Counter increments ( within 367us ), after I released HFCLK source.

Is there any configuration requirement about sdk_config.h?

 

I release and restart HFCLK clock source by following way.

 

HFCLK release :

  nrf_drv_clock_hfclk_release();

  

  while(nrf_drv_clock_hfclk_is_runnnig()){

                 ;                      // Just Waiting

  }

 

HFCLK restart :

   NRF_LOG_INFO(“Internal Counter Before = %d”, NRF_RTC2->COUNTER);

   nrf_drv_clock_hfclk_request();

  

  while( !(nrf_drv_clock_hfclk_is_runnnig()) ){

                 ;                      // Just Waiting

  }

   NRF_LOG_INFO(“Internal Counter After = %d”, NRF_RTC2->COUNTER);

Thanks.

Shossy

  • Hi Shossy, 

    Please correct me if I'm wrong. 
    You are releasing and wait until the HFCLK is stopped. Then you request and wait for it to start again. The time it take from stop to start is at least 12 cycles of the RTC2 counter. And your question is how to reduce it to short time ? 


    As far as I know, I don't think there is an option to reduce that time. The starting time of the HFCLK depends mostly on the start up time of the crystal. You may want to look for a crystal which has shorter start up time. 

    Could you give us more information on what you want to achieve by restarting the HFCLK ? I assume you are doing some other activity between BLE events  ? 

  • Thank you for your reply.

    Yes, I am releasing HFCLK clock source and, some time after, I request and restart HFCLK, and I want to reduce the time it take from HFCLK request to HFCLK startup( it currently takes 12 RTC cycles. )

    I now understand that there may not be an option to do this. This is hardware ( crystal ) problem in the first place.

    What I want to achieve is just to restart the HFCLK and to increase clock resolution for usage, and I wonder if there is a way how I can explicitly restart HFCLK earlier than within 12 RTC counter increments. 

    Thank you.

    Shossy.

  • Hi Shossy, 

    Yes, there isn't any option to shorter the start up /restart time of the HFCLK except for choosing the crystal that has shorter start up time. 

    Is it possible that you restart the HFCLK earlier ? So it still take 12 RTC cycle , but you can trigger the reset of HFCLK earlier. You can user a timer to do that. 

    I don't fully understand what you meant by " to restart the HFCLK and to increase clock resolution for usage," Could you elaborate ? 

Related