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

Bootloader example on custom nRF52832 board

Hello.

I'm trying to get the example bootloader Segger project (secure_bootloader_ble_s132_pca10040) running on a custom board I have that uses the nRF52832 as its core.

Out of the box, I've got the bootloader example to work on the PCA10040 dev board so I can familiarize myself with the steps.

However, I am unable to get this to work with my customer board. So far, the main modifications I made were to change the BOOT button option in the sdk_config.h to the button I used for my board. Segger says the bootloader was downloaded to the device properly but when I scan for Bluetooth devices, DfuTarg doesn't show up as a device.

What are some other modifications I need to look into to get that part running? Am I missing some other configuration steps?

  • Hello,

    I guess it may be the LF clock source, or do you have the optional 32Khz crystal mounted on your board? If you don't have it you need to select the internal RC oscillator as the clock source in sdk_config.h. These are the relevant clock settings if you use SDK 16.0.0:

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

     

  • Hi Vidar,

    Thanks for the response. I completely forgot to consider the clock source for the SoftDevice. I'm currently using nRF SDK15.3 but modified the sdk_config according to the descriptions.

    This board currently does not use an external crystal, so I'm going off the internal RC oscillator. I made these modifications but I'm still not seeing it being advertised.

    While stepping through to debug and find the cause, I found that the device is hitting a HardFault Handler somewhere after nrf_dfu_settings_init()

    What should I be on the lookout for to prevent this from happening?

    #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
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

  • Hi,

    Please check if you're using the standard 512/64 memory option and not the 256/32 one (IC revisions and variants). The Hardfault may indicate that the settings data is being written outside of the valid memory range. The linker settings will need to be adjusted in that case. 

  • Yes, I am using 512/64. Target device - nRF52832_xxAA (which is also what I'm using on my custom board).

  • Thanks for confirming the chip variant. Could you try to quickly make the same changes to the bootloader in SDK 16.0.0 or SDK 15.2.0 (clock and button) and try to run it on your custom board? Alternatively, confirm that the bootloader start address and MBR param page address are correctly stored at address 0xff8 and 0xffc. The bootloader in SDK 15.3.0 had this data included in the hex file, and it could easily get overwritten depending on the programming sequence. 

Related