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.
Parents
  • Hi,

    To use LFRC instead of LFXO use this in your Kconfig (for instance in prj.conf or in a board configuratin file if you have that for your custom board):

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

    (The DK borad files will use crystal by default, by setting CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y)

    To use DCDC, include BOARD_ENABLE_DCDC=y in the configuration when using nRF Connect SDK 2.7.0 or earlier. Also use the following for nRF54L (and other boards in main or SDK 2.8.0 or later):

    &vregmain {
    	status = "okay";
    	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
    };

    (If using LDO use NRF5X_REG_MODE_LDO instead of  NRF5X_REG_MODE_DCDC).

  • Hi,

       Thanks for your quick response. 

       I need an interface to modify the low speed crystal type.

       Because our project one firmware is needed for multiple hardware.

      eg:

    void main (void)
    {
        /* dcdc */
        uint8_t dcdc_type = 0;
        dcdc_type = read_dcdc_type_from_flash(); /* just a example */
        NRF_REGULATORS->VREGMAIN.DCDCEN = dcdc_type;
        
        /* xtal or rc(ppm) */
        
    }

Reply Children
No Data
Related