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

Error while programming bootloader on nRF52832 QFAB IC using nrfjprog

I have a custom board of nRF52832-QFAB-B0 on which my application works well with SDK15.0.0 & SD132 v6.0.0 

To perform DFU,

1. I copied the relevant parts of ble_app_buttonless_dfu example,

2. Increased the vendor specific uuid count to 2 in the sdk_config, now that I have two services - custom service & DFU service.

3. Included the required libraries and headers into my project as prompted by the error messages in SEGGER embedded studio and ran.

4. Got the following error in my log: "missing bootloader"

To program bootloader, I followed the steps in infocenter:

1. Cleared the flash

nrfjprog wipe

2. Programmed the softdevice SD132 v6.0.0 

nrfjprog program -d nrf52 -c ../../SDK_15.0.0/components/softdevice/s132/hex/s132_nrf52_6.0.0_softdevice.hex

3. Modified the secure_bootloader with the following settings in memory segments & linker. Memory map changed since my IC variant is nRF52832 QFAB-B0 with 256kB Flash & 32kB RAM

Common Linker -> Section Placement macros:

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x40000

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x8000

FLASH_START=0x38000

FLASH_SIZE=0x6000

RAM_START=0x200057b8

RAM_SIZE=0x2848

Common Build->Memory segments:

FLASH RX 0x0 0x40000

RAM RWX 0x20000000 0x8000

uicr_mbr_params_page RX 0x10001018 0x4

mbr_params_page RX 0x0003E000 0x1000

bootloader_settings_page RX 0x0003F000 0x1000

uicr_bootloader_start_address RX 0x10001014 0x4

4. Generated the Bootloader settings hex file with the following command:

nrfutil settings generate --family NRF52QFAB --application pca10040/s132/ses/Output/Debug/Exe/ble_app_template_pca10040_s132.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

5. Merged bootloader and settings file using mergehex

mergehex -m bootloader.hex settings.hex -o bootloader_settings.hex

6. Now to program the bootloader I use nrfjprog

./nrfjprog --reset --program ../mergehex/glo_bootloader_settings.hex --family NRF52 --sectoranduicrerase

which throws an error:

Parsing hex file.

ERROR: The file specified is not a valid hex file, has data outside valid areas

ERROR: or does not have data in valid areas.

Parents
  • Hi,

    The error you are getting indicates that some part of the hex file has data outside of the flash. The first step is to check each hex file before they are merged to see if there are regions outside the range 0x00000000 - 0x00040000 (you may still have data in the UICR region). This online tool can be a suitable way to do this with.

    In addition to the steps you have described I noticed that you need to update the value of BOOTLOADER_START_ADDR and BOOTLOADER_SETTINGS_ADDRESS in the bootloader source code. These defines are used runtime by the MBR and bootloader and have to match the project settings.

    Best regards,
    Rune Holmgren

  • Hi, I finally figured out.

    Apart from setting the BOOTLOADER_SETTINGS_ADDRESS, NRF_MBR_PARAMS_PAGE_ADDRESS, I had to make another change in sdk_config.h ( I didn't have to change BOOTLOADER_START_ADDR btw in SES project. It was pointing to CODE_START which I didn't have to change)

    There was one more difference between DK and my board apart from QFAA & QFAB. It's that my board did not have a 32KHz crystal.  Silly of me to not think about this.

    So I had to change the clock parameters of the sdk_config.h file.

    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 7 //20_PPM


    Please let me know if these values are good.

  • Specifically I had to change this in the secure_bootloader project for the board to advertise as "DfuTarg". I am able to connect to it and load my application.zip via nrfConnect app.

Reply Children
Related