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

Using external clk for lfclk

Hi

I'm using SDK 15.2.0 SD 6.1.0

I'm using external RTC device and I am connected the external RTC 32.7k Hz output square Wave to XL1 and XL2 is connected to ground.

I would like to ask for your advice how to configure the soft device and the clk to operate from the external clock and not from a crystal.

Shimon

Parents
  • Have you seen this post, I think it answers your question.

    Best regards,

    Simon

  • Hi,

    I've read this post, though I'm using SDK 15 and the set of the LFCLK done in the SDK_Config.h file.

    In the SDK_Config.h there are three places to set LFCLK:

    /**************** First CLOCK peripheral driver ***************************/

    // <e> NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver
    //==========================================================
    #ifndef NRFX_CLOCK_ENABLED
    #define NRFX_CLOCK_ENABLED 1
    #endif
    // <o> NRFX_CLOCK_CONFIG_LF_SRC - LF Clock Source

    // <0=> RC
    // <1=> XTAL
    // <2=> Synth
    // <131073=> External Low Swing
    // <196609=> External Full Swing

    #ifndef NRFX_CLOCK_CONFIG_LF_SRC
    #define NRFX_CLOCK_CONFIG_LF_SRC 1

    /****************** Second CLOCK peripheral driver - legacy layer ***********************/

    // <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer
    //==========================================================
    #ifndef NRF_CLOCK_ENABLED
    #define NRF_CLOCK_ENABLED 1
    #endif
    // <o> CLOCK_CONFIG_LF_SRC - LF Clock Source

    // <0=> RC
    // <1=> XTAL
    // <2=> Synth
    // <131073=> External Low Swing
    // <196609=> External Full Swing

    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 1
    #endif

    /****************** Third oftDevice clock configuration ***********************/

    // </h>
    //==========================================================

    // <h> Clock - SoftDevice clock configuration

    //==========================================================
    // <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 //0
    #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 2 //0
    #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 //7
    #endif

    Please advise how can I define the order of LFCLK setup, as you can see the SoftDevice clock configuration do not contain // <131073=> External Low Swing  // <196609=> External Full Swing options

    Shimon

Reply
  • Hi,

    I've read this post, though I'm using SDK 15 and the set of the LFCLK done in the SDK_Config.h file.

    In the SDK_Config.h there are three places to set LFCLK:

    /**************** First CLOCK peripheral driver ***************************/

    // <e> NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver
    //==========================================================
    #ifndef NRFX_CLOCK_ENABLED
    #define NRFX_CLOCK_ENABLED 1
    #endif
    // <o> NRFX_CLOCK_CONFIG_LF_SRC - LF Clock Source

    // <0=> RC
    // <1=> XTAL
    // <2=> Synth
    // <131073=> External Low Swing
    // <196609=> External Full Swing

    #ifndef NRFX_CLOCK_CONFIG_LF_SRC
    #define NRFX_CLOCK_CONFIG_LF_SRC 1

    /****************** Second CLOCK peripheral driver - legacy layer ***********************/

    // <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer
    //==========================================================
    #ifndef NRF_CLOCK_ENABLED
    #define NRF_CLOCK_ENABLED 1
    #endif
    // <o> CLOCK_CONFIG_LF_SRC - LF Clock Source

    // <0=> RC
    // <1=> XTAL
    // <2=> Synth
    // <131073=> External Low Swing
    // <196609=> External Full Swing

    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 1
    #endif

    /****************** Third oftDevice clock configuration ***********************/

    // </h>
    //==========================================================

    // <h> Clock - SoftDevice clock configuration

    //==========================================================
    // <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 //0
    #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 2 //0
    #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 //7
    #endif

    Please advise how can I define the order of LFCLK setup, as you can see the SoftDevice clock configuration do not contain // <131073=> External Low Swing  // <196609=> External Full Swing options

    Shimon

Children
Related