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

Secure DFU Successful but Application not loading

placeholder

  • Hi.

    Could you please try to follow the steps as described here, and post every command you ran in your command line?

    Best regards,

    Andreas

  • Hi Andreas,

    Unfortunately the problem persists.

    When I generate a zip file using the ble_app_bms example this works fine (i.e. the zip file is uploaded to the device and works).

    When I generate a zip file using the led soft blink example I experience the same issue as before. The package is successfully uploaded but upon restart/reset the microcontroller does not boot into the program but remains in bootloader mode. In fact when pressing Button 4 it then enters DFU mode.

    I think that the issue seems to be related to the hex file chosen? Is there a setting perhaps that affects the boot functionality in the hex?

    Thanks

    Luke

  • Hi Luke.

    It would be nice if you could do as I suggested in my previous reply.

    Also it would be great if you could build the debug bootloader.

    Best regards,

    Andreas

  • Hi Andreas, Sorry for being unclear but the problem persists after the following the steps which you described in your previous reply. If I use the debug bootloader then what private key should I assign to my HEX files for zipping? Thank you

  • Hi.

    Please follow all these steps, and paste the output of all you do.

    Step 1.

    Generate a private key by running this command in cmd in your SDK 15.3 folder:

    nrfutil keys generate priv.pem

    Step 2.

    Generate a public key file from that private key by running this command in cmd in your SDK 15.3 folder:

    nrfutil keys display --key pk --format code priv.pem --out_file dfu_public_key.c

    You should now have a file named dfu_public_key.c in your SDK 15.3 folder.

    Step 3.

    Open the folder nRF5_SDK_15.3.0_59ac345\examples\dfu

    You see that there is a file named dfu_public_key.c, delete this file.

    Take the file you generated in step 2 and move it to this folder.

    Step 4.

    Open up the SES project in the folder nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10056_ble_debug and build it in your preferred IDE.

    After you have built it the folders: \Output\Release\Exe will appear in the folder structure. Open these folders and copy the file named secure_bootloader_ble_s140_pca10056.hex to your SDK 15.3 folder. This is the .hex file for the secure bootloader you have created. (If you for example use Segger Embedded Studio)

    Step 5.

    Open the folder nRF5_SDK_15.3.0_59ac345\components\softdevice\s140\hex, and copy the .hex file s140_nrf52_6.1.1_softdevice.hex to your SDK 15 folder.

    Step 6.

    Create an application, for example the ble_app_bms example, and copy the .hex file as you did for the bootloader to your SDK 15.3 folder (you find the .hex file in nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_bms\pca10056\s140\ses\Output\Release\Exe, named ble_app_bms_pca10056_s140.hex, if you use Segger Embedded Studio)

    Step 7.

    Generate a bootloader settings page by running this command in cmd in your SDK 15.3 folder:

    nrfutil settings generate --family NRF52840 --application ble_app_bms_pca10056_s140.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hex

    The output looks like this:

    Step 8.

    Merge the settings.hex and secure_bootloader_ble_s140_pca10056.hex together by running this command in cmd in your SDK 15 folder:

    mergehex.exe --merge settings.hex secure_bootloader_ble_s140_pca10056.hex --output my_bootloader.hex

    The output looks like this:

    Step 9.

    Generate the DFU packet by running this command in cmd in your SDK 15 folder:

    nrfutil pkg generate --hw-version 52 --application-version 3 --application ble_app_bms_pca10056_s140.hex --sd-req 0xB6 --key-file priv.pem app_dfu_package.zip

    The output looks like this:

    Step 10.

    You should now have these files in the SDK 15 folder:

    app_dfu_package.zip

    ble_app_bms_pca10056_s140.hex

    my_bootloader.hex

    priv.pem

    s140_nrf52_6.1.1_softdevice.hex

    secure_bootloader_ble_s140_pca10056.hex

    settings.hex

    Step 11.

    Open RTT-Viewer and select the board you're using.

    Open the SDK 15 folder in cmd, and write the commands:

    nrfjprog.exe -e

    nrfjprog.exe --program s140_nrf52_6.1.1_softdevice.hex --verify

    nrfjprog.exe --program my_bootloader.hex --verify -r

    You have now programmed the SoftDevice and the Bootloader including the bootloader settings page.

    Step 12.

    Open nRF Connect on your mobile phone and scan:

    When you find DfuTarg click on Connect.

    And click on the DFU button and Select distribution packet (ZIP)

    And select the file app_dfu_package.zip.

    After you have finished the device will reset and start advertising as Nordic_BMS

    Does this make things a bit clearer?

    Could you also please post all the output from RTT-Viewer if this does not work?

    Best regards,

    Andreas

Related