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

sdk14 external oscillator

Hi, I'm trying to use nRF52832 by external oscillator(ash7k-32.768KGZ-T). When i use SDK13, i just add clock setting like below.

	NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) | (CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) | (CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);

NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
{
	/* Nothing to do */
}	

I changed SDK version to 14.0.0 and i added clock above code in dfu project. But, my dfu project is not working.

How do i change clock source code to use bypass external oscillator?

Thanks. Regards Youngjun.

Parents
  • Since it is a DFU app then you are probably using the soft device. If so, you are supposed to access the clocks through the API's and not by writing directly to the registers.

    Only if you use the API's will the SD know what your intentions are. Likely the SD is just writing over your register settings.

  • Sounds like you got it working. You can also look at how the ble_peripheral examples on how they enable the SD and set the clock parameters. Generally the config side is something like:

    // Low frequency clock source to be used by the SoftDevice
    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                     .rc_ctiv       = 0,                                \
                                     .rc_temp_ctiv  = 0,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
    
        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
        // Initialize the SoftDevice handler module.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
    

    Then later on the SD enable happens and the SD now has the clock config info.

Reply
  • Sounds like you got it working. You can also look at how the ble_peripheral examples on how they enable the SD and set the clock parameters. Generally the config side is something like:

    // Low frequency clock source to be used by the SoftDevice
    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                     .rc_ctiv       = 0,                                \
                                     .rc_temp_ctiv  = 0,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
    
        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
        // Initialize the SoftDevice handler module.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
    

    Then later on the SD enable happens and the SD now has the clock config info.

Children
No Data
Related