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

nrf_pwr_mgmt_run not returning

Hi,

I have the nRF52DK setup with SES. I can build the example ble_peripheral projects and I can run them in the debugger without any issues.

I also have a Telit BlueDev+S50 development board (which contains a Telit Bluemod+S50 module, which itself contains a nRF52832) that I have connected to the nRF52DK board via the JTAG connector. I can program and debug the BlueDev+S50 board without any problems.

The issue I have is running on the BlueDev+S50. When the execution got to the sd_softdevice_enable() function call, this function would not return. After searching online, I found that by enabling the 32kHz clock before calling this function (with the following code) allowed the function to return:

NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSTAT_SRC_Xtal << CLOCK_LFCLKSTAT_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
;
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;

Also, changing to the LF RC oscillator worked.

We will be developing our own hardware using the BlueMod+S50 and I wanted to know if this is a hardware issue and maybe something that can be avoided in the new product as it feels like a bit of a hack. I would like to know the reason this is extra code seems to be required.

Thanks

Pete

  • PS. There is a link of the BlueDev+S50 board which allows the 23kHz crystal to be disabled. The link is in the enabled position.

  • Hi,

    The 32 kHz is optional and is usually not mounted on third-party modules. Apply the following settings to your sdk_config.h file to make the Softdevice use the internal clock source:

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

    This will also make the Softdevice calibrate the RC osc periodically to comply with the 500 ppm clock accuracy required by spec. You do not need to start the clock source before sd_softdevice_enable()

    Regards,

    Vidar

  • Hi

    The third-party board does contain a 32kHz crystal and it does run correctly. The problem is that the Softdevice doesn't start it correctly, it only works if my code starts the crystal. We will be using a 32kHz crystal on our new product so I want to know why the Softdevice isn't starting it, but my code does start it.

    Thanks

    Pete

  • Hi Pete,

    Sorry, I read through the question a bit fast and just assumed it was the usual problem with using the wrong clock settings. The Softdevice is doing the same thing as you code except that it enters System ON while waiting for the crystal to ramp up. And I don't think I have seen this problem before where you have to "manually" start the crystal before calling sd_enabled(). Do the BLE peripheral projects seem to function normally when you add the code to start the LF crystal? E.g., if you can connect to it, etc. 

    Best regards,

    Vidar

  • Hi

    Yes, the example projects all work fine on the Telit dev board if I enable the LF clock before calling sd_softdevice_enable(). And they work fine on the nRF52DK board without the need to enable the clock first.

    Pete

Related