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

nrf_sdh_enable_request causes restart with custom board

I have a custom board uses nRF52810. When I flash my board with examples include SoftDevice (sdk 16.0.0) nRF52810 restarts.
I am debugging with oscillascop and seeing that the code stucks on ble_stack_init(), actually nrf_sdh_enable_request(). It returns NRF_SUCCESS but still causes restart The example I am playing is ble_app_uart (peripheral one). I am flashing in pca10040e folder (s112) which is compatible with nRF52810. What is wrong with my board?

  • When I switch NRF_SDH_CLOCK_LF_SRC to RC in sdk_config.h, it passes ble_stack_init() but stucks somewhere else.
  • The problem occurs with other examples includes SoftDevice as well.

 

  • Hi

    Have you removed the DEVELOP_IN_NRF52832 and NRFX_COREDEP_DELAY_US_LOOP_CYCLES  defines from the compile flags? This is necessary to make a PCA10040e example run natively on an nRF52810 SoC. It is described in the Infocenter.

    Do you have the external clocks on your custom board (see the reference schematics)? X1 is required for the SoftDevice/radio to run at all, and X2 is optional, as you'll need to use the internal RC oscillator or synthesized LF clock instead if you leave it out of your design.

    Best regards,

    Simon

  • 1. I have removed the DEVELOP_IN_NRF52832 and NRFX_COREDEP_DELAY_US_LOOP_CYCLES  defines from the compile flags, did not work.

    2. I have a 32.768kHz external crystal, I need to use it. What the configuration should be in sdk_config.h ?

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

  • When using the external LF clock, the default configurations of the clock are correct, so you shouldn't change anything there. Please confirm that you're using the external HF clock in your design as well.

    Best regards,

    Simon

  •     NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos;
        NRF_CLOCK->TASKS_LFCLKSTART = 1;
        while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0){
          print_int_to_io(2,1);
        }
    
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0){
          print_int_to_io(4,1);
        }

    When I test my hardware with code mentioned above, my program makes an infinite loop in second while (while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)). My hardware guy says, "Yes we are using HF clock as you can see in our hardware schematic."

  • If the HF clock doesn't start and is stuck like this, that means there's something wrong with the crystal. It's either not the correct part, mounted incorrectly, or the capacitivity is loaded incorrectly. Can you upload, or link to, the datasheet of the HF crystal that you're using and check that it is mounted correctly on your board?

    Best regards,

    Simon

Related