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.

  • No, the bootloader can operate with no application present on the device. You may then load the application via DFU. You may flash either just a bootloader, or a bootloader, application, and bootloader setting page. The last combination is what you would do in factory production since performing DFU is too time consuming for production, but for development purposes, there is nothing wrong having a device with only a bootloader.

    Best regards,
    Rune Holmgren

  • If the application is too large the DFU operation would stop shortly into the transfer. After the init packet is transferred the size is checked against available space. This is different from the error you are describing.

    Best regards,
    Rune Holmgren

  • Hi, I tried this.

    Issue #1:

    Flashing Bootloader, Application and bootloader settings together after merging these three starts advertising in the bootloader mode i.e. as "DfuTarg" instead of starting the application.

    Is this supposed to happen? For production, I would like to create a single hex file that consists of Softdevice, application, bootloader and bootloader settings.

    ./mergehex -m softdevice6.hex app.hex -o sd_app.hex

    ./mergehex -m bootloader.hex settings.hex -o bl_settings.hex

    ./mergehex -m sd_app.hex bl_settings.hex -o sd_app_bl_settings.hex

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

    This starts advertising as "DfuTarg" instead of the name given in my application. Can you help understand what's wrong? app.hex is compiled in debug mode and settings.hex is generated after the latest compilation of app.hex.

    Issue #2

    After connecting to "DfuTarg" and trying to load my application again gives the error "Operation not permitted" from nRFconnect App.

Related