What low-frequency clock sources can I use?

Guest gravatar image

asked 2013-08-19 10:17:43 +0100

stefanbirnir gravatar image

updated 2014-10-16 10:42:26 +0100

When initializing the S110 softdevice, I can choose between the different clock sources as defined by the nrf_clock_lfclksrc_t enum:

/**@brief Possible lfclk oscillator sources. */
  NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM,                       /**< LFCLK Synthesized from HFCLK.                    */
  NRF_CLOCK_LFCLKSRC_XTAL_500_PPM,                        /**< LFCLK crystal oscillator 500 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_250_PPM,                        /**< LFCLK crystal oscillator 250 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_150_PPM,                        /**< LFCLK crystal oscillator 150 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_100_PPM,                        /**< LFCLK crystal oscillator 100 PPM accuracy.       */
  NRF_CLOCK_LFCLKSRC_XTAL_75_PPM,                         /**< LFCLK crystal oscillator 75 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_50_PPM,                         /**< LFCLK crystal oscillator 50 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_30_PPM,                         /**< LFCLK crystal oscillator 30 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_XTAL_20_PPM,                         /**< LFCLK crystal oscillator 20 PPM accuracy.        */
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION,        /**< LFCLK RC oscillator, 250ms  calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION,        /**< LFCLK RC oscillator, 500ms  calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION,       /**< LFCLK RC oscillator, 1000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION,       /**< LFCLK RC oscillator, 2000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION,       /**< LFCLK RC oscillator, 4000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION,       /**< LFCLK RC oscillator, 8000ms calibration interval.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION,  /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/
  NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/

What does the different sources here mean, and what is the consequence of using them?

edit retag flag offensive close delete report spam

2 answers

Sort by » oldest newest most voted
olha gravatar image

answered 2013-08-19 10:29:43 +0100

stefanbirnir gravatar image

updated 2014-10-16 10:33:31 +0100

The softdevice needs a low-frequency clock to be able to do the protocol timing. With this enum, you tell the softdevice what kind of clock source you use, and the accuracy of it. In general you have 3 options for this source:

  • External crystal: Using an external 32.768 kHz crystal is the option that gives the lowest current consumption. If you have this on your board, you should use it. You have to choose the appropriate accuracy for your crystal, so that the softdevice can take the accuracy into consideration to know how much the clock may drift over a certain period. It will use this information to make sure it compensates correctly and wakes up the chip just when needed.

Enums used for this mode with softdevice: NRF_CLOCK_LFCLKSRC_XTAL_x_PPM, where x is the accuracy of your crystal.

When not using softdevice, external 32kHz crystal is started with the following code:

When not using a softdevice, starting external 32kHz crystal is done with the following code:


    // Wait for the low frequency clock to start
  • Internal RC oscillator: The chip have an internal RC oscillator that has an accuracy of 250 ppm when calibrated. The only thing you can choose through this enum for the RC is the calibration interval. As given in the nRF51822 PS, the accuracy is specified when the temperature is relatively stable, and it is calibrated every 4 seconds, so this is the calibration interval that should be used for most (all?) applications.

When the RC is calibrated, the 16 MHz clock must run while calibration is ongoing, which causes an increase in the average current consumption of about 6-7 µA with a 4 s interval. The RC also uses more current than a crystal, so the total increase will most likely be 8-10 µA, compared with a 20 ppm crystal.

Enums used for this mode: NRF_CLOCK_LFCLKSRC_RC_250_PPM_xMS_CALIBRATION, where x is the wanted calibration interval, typically 4000 ms.

In recent SDK's, there has been added options with calibration relative to temperature change which has the enum NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_xMS_CALIBRATION. This will have lower current consumption than NRF_CLOCK_LFCLKSRC_RC_250_PPM_xMS_CALIBRATION options as the RC is only calibrated if there is a temperature change of 0.5 deg C or more. The frequency drift of the RC is in fact a result of temperature change. The internal TEMP peripheral on the nRF51 is used to make a temperature measurement. If there is a temperature change of 0.5 deg C or greater since the last calibration, then the nRF51 is re-calibrated. If the temperature change is <0.5 deg C, then the RC is not calibrated. The calibration of the RC takes 17ms but measuring the temperature only takes 35us, which explains why measuring the temperature consumes less current then when calibrating. If there are frequent temperature changes, the current consumption increase will be worst case 8-10 uA compared to a 20ppm crystal. If there are infrequent temperature changes, then the current consumption increase is around ~2uA best case compared to a 20ppm crystal.

  • A synthesized 32.768 kHz clock: This tells the softdevice to use the 16 MHz clock to synthesize a low-frequency clock. Since the low-frequency clock is used in the sleeping periods between for example conneciton evetns, this means that the 16 MHz must always run, giving a substantial increase in current consumption (most likely mA average current consumption instead of µA).

In general, there should never be a reason to use this clock source, and you should always be able to use the RC oscilator instead of the synthesized clock.

Enums used for this mode: NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, which should not be used.

edit flag offensive delete publish link more

What do you mean "which should not be used" ? What are the options for LFCLKSRC if I want to use S110? Reference designs in nRF51822 data sheet show single crystal 16MHz, no 32KHz additional XTAL. To use BLE do I have to have the 32KHz xtal? Thanks.

Liam Goudge ( 2014-05-09 01:55:08 +0100 )editconvert to answer

answered 2014-04-10 06:42:10 +0100


We have connectivity problem, device disconnects in few seconds after successful operation.

Issue was narrowed down to 32.768 kHz crystal (datasheet is attached) operation, problem exists even after adjusting load capacitors and achieving few ppm tolerance (initial tolerance is +/- 20 ppm) plus changing associated software settings.

We have replaced our own crystal and loading capacitors by crystal along with capacitors from evaluation board. Connectivity was improved, but still it disconnects sometimes.

Please provide 32.768 kHz crystal replacement guidelines; our product must have small size crystal.

Thank you,

TWI team


edit flag offensive delete publish link more



Mohamed, were you able to solve your Disconnection issues which were caused by the LFCLK? I ask because I may be experiencing a similar issue. Thanks

Locky ( 2015-03-09 20:26:56 +0100 )editconvert to answer

I am facing the same problem too. I have a 32.768KHz external crystal with 20ppm accuracy, but BLE disconnects after a few seconds. Using the internal RC oscillator does not show this problem.

ujwal ( 2015-08-18 07:47:31 +0100 )editconvert to answer

Have you resolved this issue? I'm having the same problem with my external 32khz crystal. It disconnects after a few seconds.

Sam Clay ( 2015-10-29 22:40:05 +0100 )editconvert to answer

We ended up changing the capacitors, which seemed to resolve it. Also, please take a look at https://devzone.nordicsemi.com/questi...

ujwal ( 2015-10-29 23:53:38 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools



Asked: 2013-08-19 10:17:43 +0100

Seen: 15,259 times

Last updated: Oct 16 '14