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

Creating a bootable first article hex image for nrf52840 based hardware.

I am using SDK 15.3.0 and need to create a single hex file to program the initial batch of our nRF52840 based HW.
Currently, I have built the bootloader project (open not secure for now) and have a bootloader.hex file.

1. As a first step I created the bootloader settings file by:

nrfutil settings generate --family NRF52840 --application app_pca10056_s140.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 setting.hex

2. Merged bootloader hex file with setting (Apparently mergehex has a limit on number of input files to merge)

mergehex -m bootloader.hex setting.hex -o final-boot.hex

3. Merged the APP + SD + BL

mergehex -m app_pca10056_s140.hex s140_nrf52_6.1.1_softdevice.hex final-boot.hex -o firstArticle.hex

4. When I use nrfjprog to erasend program firstArticle.hex, nothing happens and the system is completely dead:

nrfjprog --family nRF52 --eraseall
nrfjprog --family nRF52 --program firstArticle.hex


However, If I go back to SEGGER and launch debugger for the bootloader (the one I used hex file for the above steps), the system boots and all is happy.

Can someone point me to what I am doing wrong? For now I am not using secure boot.

Parents
  • Hopefully, the only thing you forgot is to reset the device after you programmed it. I guess if you power cycle it, it will boot up. At least if it boots up with the same hex when you debug.

    Try:

    nrfjprog --eraseall
    nrfjprog --program firstArticle.hex --verify
    nrfjprog --reset

    Note that you don't need the --family input in the later versions of nrfjprog, and that I added --verify after the program command. I recommend you use this when you program hex files. Usually everything works well without, but if there for some reason is some communication errors, this will be detected by the --verify.

    Best regards,

    Edvin

Reply
  • Hopefully, the only thing you forgot is to reset the device after you programmed it. I guess if you power cycle it, it will boot up. At least if it boots up with the same hex when you debug.

    Try:

    nrfjprog --eraseall
    nrfjprog --program firstArticle.hex --verify
    nrfjprog --reset

    Note that you don't need the --family input in the later versions of nrfjprog, and that I added --verify after the program command. I recommend you use this when you program hex files. Usually everything works well without, but if there for some reason is some communication errors, this will be detected by the --verify.

    Best regards,

    Edvin

Children
Related