This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Change Clock Source with Firmware

SDK 15.2, API 6.1

I have 1 firmware and 2 PCB it operates. PCB A was an external crystal and the sdk_config file is setup for the operation. However, PCB B uses internal crystal.

Before we were able to pick the source rather than relying on the sdk_config file. I cannot figure out how to set the clock in SDK 15.2. Previously we did this

// fob/tlbx boards use different slow clocks
    nrf_clock_lf_cfg_t* p_clk_cfg;
    nrf_clock_lf_cfg_t clock_cfg_a  = NRF_CLOCK_LFCLKSRC_A;
    nrf_clock_lf_cfg_t clock_cfg_b = NRF_CLOCK_LFCLKSRC_B;

    if(mode() == MODE_A)
    {
        p_clk_cfg = &clock_cfg_a;
    }
    else
    {
        p_clk_cfg = &clock_cfg_b;
    }

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(p_clk_cfg, ble_new_event_handler);

Related