Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU 14.2->15.2 (BL+SD+App)

Hi,

I have migrated my projekt from SDK 14.2 to 15.2, the bootloader is basically the secure_bootloader example with some tiny adjustments. When I try to upgrade my product running on 14.2 and the old Softdevice I get the this message in nRF Connect:

"DFU failed with error: When writing 'EXECUTE' command to Control Point Characteristic of DFU Target: Operation code 4 (EXECUTE) failed on DFU Target. Result code 5 (INVALID_OBJECT)."

The DFU package is generated like this:

nrfutil pkg generate --hw-version 10100 --application-version 1 --application _build_debug/app.hex --bootloader-version 3 --bootloader ../Bootloader/_build_EP1/bootloader_nrf52832_xxaa_s132.hex --softdevice ../SDK/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex --sd-id 0xAF,0xBF --sd-req 0x9D,0xA5,0xAF,0xB7 --key-file ../private.key bl_sd_app.zip

And the bootloader settings for the application using the old Softdevice and SDK is generated like this:

$(OUTPUT_DIRECTORY)/bootloader_settings.hex: $(TARGET_HEX)
	$(NRFUTIL) settings generate \
    --family NRF52 \
    --application $< \
    --application-version 0 \
    --bootloader-version 1 \
    --bl-settings-version 1 \
    $@

Are there any obvious reason this shouldn't work?

DFU works on the old bootloader for upgrading the application (but of course not to our new migrated application) and BL+SD+APP upgrades work on the bootloader running on 15.2. 

nRF Connect has version v2.6.2 (and the BLE app 2.2.0).

BR Henrik

  • Hi Henrik.

    Can we clarify some points?

    You wish to do a DFU upgrade where you go from SDK 14.2 to 15.2?

    Which chip/board do you have?

    Which SoftDevice are you going from in SDK 14.2?

    Which SoftDevice are you going to in SDK 15.2?

    To do a DFU upgrade where you go from one SDK to another, and also change SoftDevice, you need the following things in the DFU package:

    1. Bootloader with the new SoftDevice
    2. Application with the new SoftDevice
    3. The new SoftDevice

    Looking at your nrfutil command it looks like you want to use SoftDevice S132 v6.1.0 in your new Application?

    Best regards,

    Andreas

  • Hi Andreas, 

    Sorry for the unclear post, I hope this will make things clearer :) 

    You wish to do a DFU upgrade where you go from SDK 14.2 to 15.2?

    Exaclty.

    Which chip/board do you have?

    Custom board with an nRF52832_xxaa.

    Which SoftDevice are you going from in SDK 14.2?

    S132, 5.0.0

    Which SoftDevice are you going to in SDK 15.2?

    S132, 6.1.0

    BR Henrik

  • Hi again Henrik.

    Thanks for the clarification :-)

    I have ran a test now, with success.

    Can you try to follow this procedure?

    1. Create a key.pem file.

    Use the command

    nrfutil keys display --key pk --format code private.pem

    To display it on a code format and paste this code into the dfu_public_key.c file in both SDK 14.2 and SDK 15.2

    2. Build the bootloader in SDK 14.2 with the dfu_public_key.c file in use.

    Build the bootloader in SDK 15.2 with the same dfu_public_key.c file in use.

    3. Generate the DFU package with the following command:

    nrfutil pkg generate --hw-version 52 --sd-req 0x9D,0xAF --application-version 1 --application <app_file_name>.hex --softdevice <s132_v6.1.0_name>.hex --bootloader <bootloader_with_s132_name>.hex  --bootloader-version 2 --sd-id 0xAF --key-file priv.pem dfu_package.zip

    Where you change <app_file_name>.hex, <s132_v6.1.0_name>.hex, and <bootloader_with_s132_name>.hex with the correct file names.

    4. Flash 1 device with the bootloader from SDK 14.2 and SoftDevice S132 5.0.0 and reset the device.

    Open the nRF Connect BLE Application and Connect to the "DfuTarg" (or what name you have given to the bootloader)

    And select the .zip file.

    First the SoftDevice and Bootloader are transferred:

    Then the Application, and here you can see that the transfer was a success:

    Best regards,

    Andreas

  • AH!

    Thank you for the help! I interpreted the "--sd-id 0xAF,0xBF" flag wrong when I first read the documentation. If I changed it to only "--sd-id 0xAF" in my initial post it worked!

Related