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

nrf52832 custom board power on question

onkey_full_20170814.hex onkey_0000.hex onkey_boot_s132.hex This time 14.0 sdk was updated.

There was a problem after the update

Problems when uploading bootloader

  1. custom board : remove 32.76khz cyristal
  • Power on -> do not run -> hw reset -> run

  • power on -> do not run -> power off -> power on -> do not run -> hw reset -> run

  1. custom board : No remove 32.76khz cyrisal
  • power on -> run -> power off -> power on -> run -> hw reset -> run

Why does not runing the board remove 32.76khz cyristal?

The code changes below : (nrf_sdh.c) 168 line

nrf_clock_lf_cfg_t const clock_lf_cfg =
{
    .source        = 0,
    .rc_ctiv       = 16,
    .rc_temp_ctiv  = 2,
#ifdef S132
    .accuracy      = 7
#else
    .xtal_accuracy = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
#endif
};
  • Does your custom board have the optional external 32kHz crystal mounted or not? If you are physically removing the 32kHz crystal then you need to modify the code to use the internal RC oscillator instead of the external crystal, i.e. you must modify the SoftDevice clock configuration section in the sdk_config.h file to the following

    // </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_XTAL_ACCURACY  - External crystal clock accuracy used in the LL to compute timing windows. 
      
    // <0=> NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM 
      
    #ifndef NRF_SDH_CLOCK_LF_XTAL_ACCURACY 
    #define NRF_SDH_CLOCK_LF_XTAL_ACCURACY 0
    #endif
    

    and clock_lf_cfg should then be defined as:

    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 S132
            .accuracy      = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #else
            .xtal_accuracy = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #endif
        };
    

    Note: This change must be done in both the application and the bootloader code!

  • bootlaoder : sdk_config.h

    application : sdk_config.h

    full hex : onkey_full_20170814.hex

    I modified it as follows and symptoms are the same.

    examples\dfu\bootloader_secure_ble\pca10040\config\sdk_config.h examples\ble_peripheral\ble_app_uart\pca10040\s132\config\sdk_config.h

    //

    #ifndef NRF_SDH_CLOCK_LF_SRC

    #define NRF_SDH_CLOCK_LF_SRC 0

    #endif

    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV

    #define NRF_SDH_CLOCK_LF_RC_CTIV 16

    #endif

    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV

    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2

    #endif

    #ifndef NRF_SDH_CLOCK_LF_XTAL_ACCURACY

    #define NRF_SDH_CLOCK_LF_XTAL_ACCURACY 0

    #endif

  • You did not answer my first question: Does your custom board have the optional external 32kHz crystal mounted or not? Have you also implemented the change in nrf_sdh.c, i.e.

    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 S132
            .accuracy      = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #else
            .xtal_accuracy = NRF_SDH_CLOCK_LF_XTAL_ACCURACY
        #endif
        };
    
  • my custom board is 2EA

    frist board 32khz remove : not run

    second board 32khz mount : run

    nrf_sdh.c change

  • The configuration in my answer, i.e. the internal RC configuration, should work on both boards. Can you debug the board without the 32kHz crystal and see what kind of error code you get from nrf_sdh_ble_enable() in main.c ?

Related