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

Change Clock Source NRF52832 app beacon example

Hello,

I am working with the newest revision of the nRF52 Development Kit and the app_beacon example. I try to change the clock source for the following code:

nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

I changeg the NRF_CLOCK_LFCLKSRC define in the file pca10040.h to

#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                 .rc_ctiv       = 0,                                \
                                 .rc_temp_ctiv  = 0,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

It is compiling with no errors but execution stops at

    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);

what else do I have to change to select the RC clock?

Parents
  • Hi Luke

    You have to set the calibration interval rc_ctiv if you are using NRF_CLOCK_LF_SRC_RC. See the documentation for the nrf_clock_lf_cfg_t struct. As it says:

    uint8_t nrf_clock_lf_cfg_t::rc_ctiv

    Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second units (nRF51: 1-64, nRF52: 1-32).

    And for nRF52 specifically:

    For nRF52, the application must ensure calibration at least once every 8 seconds to ensure +/-250ppm clock stability. The recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at least once every 8 seconds and for temperature changes of 0.5 degrees Celsius every 4 seconds. See the Product Specification for the nRF52 device being used for more information.

Reply
  • Hi Luke

    You have to set the calibration interval rc_ctiv if you are using NRF_CLOCK_LF_SRC_RC. See the documentation for the nrf_clock_lf_cfg_t struct. As it says:

    uint8_t nrf_clock_lf_cfg_t::rc_ctiv

    Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second units (nRF51: 1-64, nRF52: 1-32).

    And for nRF52 specifically:

    For nRF52, the application must ensure calibration at least once every 8 seconds to ensure +/-250ppm clock stability. The recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at least once every 8 seconds and for temperature changes of 0.5 degrees Celsius every 4 seconds. See the Product Specification for the nRF52 device being used for more information.

Children
Related