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

App will not run on target when LFCLK is not present

SDK14.2.0 sd132v5.0.0 nRF52832

I've looked for a solution to my issue on the discussion forum, but can't find an answer. I am working with the buttonless DFU peripheral example. It works perfectly on my board when the LFCLK is running, but when I disconnect the LFCLK on my dev board (to match my custom product hardware) the App will not start. I've tried setting the LFCLK to both Synth and RC in the sdk_config.h file, and neither option makes any difference. My dev board has two dip switches that can isolate the LFCLK crystal, so it's easy to check with and without the clock. As soon as I turn the clock on, the App starts and runs normally.

Does anyone have any advice on what the problem might be? Hopefully we don't have to redesign our hardware to add a LFCLK crystal!!

Thanks

Parents
  • Thanks for the link. I can't find hundreds of answers, but all the answers I did find (including your link) point to a config setting change for SDK 14.0 which I have tried but it does not work.

  • There are two entries in sdk_config.h for the LFRC.  Without reading through all the docs, I'm not sure what the difference is.  Just change both.

    Around line 174:

    // <o> CLOCK_CONFIG_LF_SRC  - LF Clock Source
     
    // <0=> RC
    // <1=> XTAL
    // <2=> Synth

    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 0
    #endif

    And around line 3367:

    //==========================================================

    // <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

    If you are using a custom BSP then this may change.  The examples are written around the dk's.

    If you still have doubts over it being configured correctly you can always follow the ble config struct through the code to make sure it is correct.  The config parameters just get passed to the SD when it is started.

    Setting it directly in nrf_sdh.c would solve the problem too.  Though I think Nordic would encourage you to work within the structure of the SDK.

    In nrf_sdh.c the config is layed out:

        // Notify observers about starting SoftDevice enable process.
        sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLE_PREPARE);

        nrf_clock_lf_cfg_t const clock_lf_cfg =
        {
            .source        = NRF_SDH_CLOCK_LF_SRC,
            .rc_ctiv       = NRF_SDH_CLOCK_LF_RC_CTIV,
            .rc_temp_ctiv  = NRF_SDH_CLOCK_LF_RC_TEMP_CTIV,
        #ifdef S140
            .xtal_accuracy = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #else
            .accuracy      = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #endif
        };

  • Thank you very much, this is super helpful! I'll give this a try.

Reply Children
  • That fixed it! Thanks again, you just saved me a ton of time and rework!

    For others that run into this problem. To summarize:

    In SDK14 when running on custom hardware with no LFCLK you have to change the settings for the Softdevice and for the Drivers per  instructions above. You also need to set values for NRF_SDH_CLOCK_LF_RC_CTIV and NRF_SDH_CLOCK_LF_RC_TEMP_CTIV. There are some recommendations posted in other threads that I used:

    NRF_SDH_CLOCK_LF_RC_CTIV=32

    NRF_SDH_CLOCK_LF_RC_TEMP_CTIV=2

  • Please note that there is a change introduced in S132 v.5.0.0, from the migration document:

    RC Oscillator accuracy
    The RC oscillator accuracy can now be set to any of the defined NRF_CLOCK_LF_ACCURACY values and there is no default value anymore.
    In other words, the nrf_clock_lf_cfg_t::accuracy parameter now has the same functionality when used with the RCOSC clock
    source as with the XTAL clock source. The RC oscillator accuracy should be set to a value appropriate for the chip.

    I.e., make sure that you use #define NRF_SDH_CLOCK_LF_XTAL_ACCURACY 1, when using the LFRC.

Related