In this blog, I would like to share how to handle the internal RC on the NRF52 chipset.

In the reference schematic of the nRF52832, there is an option to use internal RC or external 32KHz. For example, the GPIO P0.00 and P0.01 can be connected to external 32KHz crystal (as the optional feature).

In the datasheet, the PPM of the internal RC is 500ppm.

If you are using the internal RC for the BLE application, you need to do the configuration at the sdk_config.h.

//==========================================================
// <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.

// <0=> NRF_CLOCK_LF_SRC_RC
// <1=> NRF_CLOCK_LF_SRC_XTAL
// <2=> NRF_CLOCK_LF_SRC_SYNTH

#ifndef NRF_SDH_CLOCK_LF_SRC
#define NRF_SDH_CLOCK_LF_SRC 0
#endif

// <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval.
#ifndef NRF_SDH_CLOCK_LF_RC_CTIV
#define NRF_SDH_CLOCK_LF_RC_CTIV 16
#endif

// <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature.
// <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
// <i>  if the temperature has not changed.

#ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 16
#endif

// <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.

// <0=> NRF_CLOCK_LF_ACCURACY_250_PPM
// <1=> NRF_CLOCK_LF_ACCURACY_500_PPM
// <2=> NRF_CLOCK_LF_ACCURACY_150_PPM
// <3=> NRF_CLOCK_LF_ACCURACY_100_PPM
// <4=> NRF_CLOCK_LF_ACCURACY_75_PPM
// <5=> NRF_CLOCK_LF_ACCURACY_50_PPM
// <6=> NRF_CLOCK_LF_ACCURACY_30_PPM
// <7=> NRF_CLOCK_LF_ACCURACY_20_PPM
// <8=> NRF_CLOCK_LF_ACCURACY_10_PPM
// <9=> NRF_CLOCK_LF_ACCURACY_5_PPM
// <10=> NRF_CLOCK_LF_ACCURACY_2_PPM
// <11=> NRF_CLOCK_LF_ACCURACY_1_PPM

#ifndef NRF_SDH_CLOCK_LF_ACCURACY
#define NRF_SDH_CLOCK_LF_ACCURACY 1
#endif

Meanwhile, Nordic Softdevice S132v6.1.x / S112v6.1.x / S140v6.1.x or later, there is an additional option for the RC calibration.

It would increase the RX windows for further calibration (default is enabled inside the softdevice).

  • If extended RC calibration is enabled and the internal RC oscillator (@ref NRF_CLOCK_LF_SRC_RC) is used as the SoftDevice LFCLK source, the SoftDevice as a peripheral will by default try to increase the receive window if two consecutive packets are not received. If it turns out that the packets were not received due to clock drift, the RC calibration is started. This calibration comes in addition to the periodic calibration that is configured by @ref sd_softdevice_enable(). When using only peripheral connections, the periodic calibration can therefore be configured with a much longer interval as the peripheral will be able to detect and adjust automatically to clock drift, and calibrate on demand.