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

DFU bootloader prevents to load app hex

Hi all,

I am on the DK-52 with the SDK 13.0.0.

After erasing the device, I follow this steps:

  1. upload the softdevice

    nrfjprog --reset --program s132_nrf52_4.0.2_softdevice.hex --family NRF52

  2. upload the bootloader (bootloader_secure_ble)

    nrfjprog --reset --program nrf52832_xxaa_s132.hex --family NRF52

After that the bootloader enters in DFU mode (LED1 and LED3 on)

If I try to upload my app firmware:

nrfjprog --reset --program pollen_device.hex --sectorerase --family NRF5

I get this error:

Argument provided has a wrong value. Memory access not aligned, value outside of range or similar

If I try to upload the app from my iPhone (using iOSDFULibrary) I am able to upload the app firmware, the device resets and the app starts correctly.

My app firmware has:

FLASH_START=0x1F000
SRAM_START=0x20001fe0

How do I correctly upload the app firmware via nrfjprog?

Thank you.

  • Hi Fab,

    Shouldn't the family be NRF52 instead of NRF5 ?

    nrfjprog --reset --program pollen_device.hex --sectorerase --family NRF52
    
  • Hi Hung Bui,

    Thank you. You are right, my family option is wrong. It should be NRF52. Now my app firmware uploads correctly. Unfortunately, the device remains in DFU mode and the app doesn't start even turning the device off and then on.

  • If you have a bootloader, the bootloader checks your app against the bootloader settings. You need to flash updated settings when you update the app or else the bootloader won't switch to it. You need the nrfutil utility downloaded from Nordic, and "nrfutil settings generate ..." will generate a hex file to flash.

  • Thanks, Aaron. As far as I understand, I cannot upload the app firmware using the nfrjprog anymore but I have to use the nrfutil. I have prepared the pkg file as usual:

    nrfutil  pkg generate --hw-version 52 --sd-req 0x98 --application-version 0x01 --application pollen_device.hex --key-file priv.pem pollen_device_fw.zip. 
    

    Then I have tried: nrfutil dfu ble -pkg pollen_device_fw.zip -ic NRF52

    but I get this error: Fatal Python error: PyThreadState_Get: no current thread Abort trap: 6. I am on macOS 10.13.1. Is this the right procedure? Any suggestion?

  • Anyone? I stuck here. Is there any way to upload the app firmware once the bootloader is loaded without switching the bootloader in DFU mode? This is not a trivial question. I need a procedure to upload bootloader, softdevice and my own firmware for mass production and using DFU is not an option.

1 2