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

ble_stack_init nrf_sdh

I am inquiring about a custom device that hangs in the ble_stack_init(); and the result is a fatal error.

The custom device has an nRF52832 

The SDK is the SDK14

The project is a basic UART over bluetooth

The project will run without the fatal error on a nRF52832 DK

I have turned on debugging and have been given three statements:

<info> app: here
0> <debug> nrf_sdh: State request: 0x00000000
0> <debug> nrf_sdh: Notify observer 0x0002B474 => ready
0> <debug> nrf_sdh: State change: 0x00000000
0> <error> app: Fatal

Any help provided would be appreciated. 

  • Hi

    The first thing that comes to mind is that your custom device lacks either the external HF(32MHz) or LF(32.768kHz) crystal. Can you tell me more about your custom device? If the external LF clock is missing you will have to make the following changes in the sdk_config.h file:

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

    If the HF clock is missing, then you will have to revise your HW design, as this is a crucial component.

    If you could share the schematics of your custom device, that would be great. Keep in mind that this case is public though, so if you don't want to share the schematics with the community, we should set this case to private mode (where only yourself and Nordic engineers can see it). If you want me to do so, just say so, and I will set this case to private mode.

    Best regards,

    Simon

  • Simon,

    Thank you, I have both the HF and the LF. Attached is the custom device loosely based on the reference circuitry of specification v1.4. The devices are running well as it is running my application, some sensors and a display.

  • Hi

    Can you upload the datasheet to the HFCLK (32MHz) crystal that you're using? I'd like to make sure that the 20pF capacitors you have connected here. Other than that I don't see anything that should cause a fatal error in your schematics at least.

    Can you confirm that the project you're flashing to your device is the ble_app_uart example? How are you flashing the application onto your custom device, have you made sure that you have flashed the SoftDevice onto the board as well? 

    Best regards,

    Simon

  • Have many similar devices in varying stage o f development, and I did try the recipe you gave me for the non LF device and it does work. I also found a device with the LF that works both ways. I may have an issue with hardware. If the capacitance on the HF is in correct will the result be a failed nrf_sdh initialization and why? 

  • If the problem is fixed by implementing the use of the internal LF, then the issue definitely is caused by the LF clock HW. Either the 32.768 is not routed properly, or it has the wrong capacitor values. If your application works by implementing the internal LF clock, the source of this issue won't be the HF clock or its capacitors.

    Best regards,

    Simon

Related