How to modify the low-speed crystal oscillator type and power supply mode in the code?

NCS2.7.0

board:nrf54L15

We need a hardware to equip the nrf54l15 hardware, such as using internal or external low-speed crystal, power supply method is DCDC or LDO, etc.

Just like the old SDK, you can modify these in the code, but ncs can change it in the configuration file.

eg:

1. burn param to uicr

2. read uicr param 

3. code set param(xtal rc or dcdc ldo)

 
 change dcdc or ldo
old SDK
sd_power_dcdc_mode_set NRF_POWER_DCDC_ENABLE
change xtal or rc
old SDK
I can modify clock_lf_cfg to decide whether to use internal or external crystal.
sd_softdevice_enable clock_lf_cfg,app_error_fault_handler);
I found that ncs uses clock control, but I don't know how to change it. Please give me some suggestions.
I tried restarting the clock this way but I don't know if it's possible.
  • Hi,

    I am not sure what you are attempting to show by the code snippet screenshots?

    As discussed earlier, switching clock source compile time is supported, and that is handled by Kconfigs. There are other relevant configs, but the most important it to set CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y to use the RC and CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y to use the xtal. This should wrok out of the box on any device wihtout needing to do any code changes. Does it not for you?

    Or are you starting to work on a way to modify the LF clock source run-time? If so, that is not supporte dand would requier changes (I also suspect it may get a bit dirty as this was never designed to be run-time configurable). If this is what you are doing and are having problems, then please share your changes in form of a diff or similar and explain the thinking behind it and how it behaves, so that I can try to understand on my end and perhaps provide some clues.

  • Hi,

        Thanks for your response. We have decided to use the method you provided to make two firmware.

Related