after setting CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC the 32mhz start working from rc instead from XTAL

Hello

I am using the nrf52833, zephyr version 3.199, sdk 0.14.1. In our board we didn't connect the 32khz oscillator, so I configure the board with:

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
after setting this I can cee that my application (we use radio paripherial that need hfxo) do not work correctly and when I check with oscilloscope the 32mhz xtal there is no clock. 
I try to make same configuration with the nrf-52833-dk and see the same results.
I try configuring directly the clock register to work with the 32mhz xtal. After calling this code I can see that the xtal is back and I can see the 32mhz clock on the pins and the HFCLKSTAT register indicate xtal running. but after continue running the app the clock disappear and the  HFCLKSTAT  state is rc, running.
It seems to me that the zephyr OS try to reconfigure the clock back to RC even if I reconfigure it in the code to XTAL.
When I do not set  CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC to y I do not have this problem and the osc is alway xtal and I can see the signal on the xtal pin
 
Is there any dependency that when I set 32k to rc source it also set the 32m to rc mode?
Thanks
Ilan
Parents Reply Children
  • Hi Hieu,

    Thank you very much, I check with the clock initialization you sent me, and you are correct, if I use it I can set CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y, and the 32Mhz oscillator is running.

    I will use your clock initialization code and stay with CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH so the 32K clock will be sync to the 32M oscillator and be more accurate.

    Thanks!

  • Great. Please just remember that if you use the synthesized source for LFCLK, then it's likely that when the system goes into sleep, HFCLK will still need to run even though it could be turned off. That will be quite the influence on the power consumption in sleep mode.

    Please feel free to close this question when you are done. Or I can close it sometime in the future if you don't have any other questions.

Related