Help understanding how to test the BLE UART Example using nRF52832 and test the data using nrf connect app

Hi,

I am working om a project in which i need to send few data through NRF52832 serial port and via BLE I need to update the same to  NRF connect app 

I have tested the same with NRF52840 DK it worked fine but when i am trying to do the same with  NRF52832 it is getting struck inside the soft device enable function

I am using the MDBT42Q-512KV2 Module from RayTAC

I am using the example codes from the Nordic website " nRF5_SDK_14.2.0_17b948a "

and the 

 In the  ble_stack_init(); function it get struck in the below line   

ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler);

This is the example path

C:\Nordic_Semi\nRF5_SDK_14.2.0_17b948a\examples\ble_peripheral\ble_app_uart\pca10040\s132

is there any change to be done to test ?

Can some one explain me where am i missing or how can i resolve this issue 

Thanks,

Rakesh

  • Hi,

    sd_softdevice_enable() will start the 32.768  kHz LF clock, and will block until the clock is started. The default configuration of the SDK examples is to use an external 32.768 kHz crystal, and if it does not exist, sd_softdevice_enable() will never return. So you need to modify your configuration to use the internal LFRC oscillator instead by adjusting sdk_config.h as explained in this post.

  • Hi I have checked the sdk_config.h file as well as nrf_sdh.c file 

    how to change the clock source to internal from the below 

    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
    };

    #ifdef ANT_LICENSE_KEY
    ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler, ANT_LICENSE_KEY);
    #else
    ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler);
    #endif

  • Hi,

    Please look at the sdk_config.h snippet from the post I linked to in my previous post. This shows exactly what you need to configure in your sdk_config.h. No other changes should be needed. Including here for simpler reference:

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

    To break it down, set NRF_SDH_CLOCK_LF_SRC to 0 to specify that LFRC should be used. The other configurations are for configuring calibration and the accuracy. Set these as well as you see in the snippet.

Related