Update Softdevice via DFU (2025 update)

I'm wondering if this feature is still supported. 
I'd like to update some devices from SD 5 to 7.1
I saw an old post and wanted fresh info. 

 Update Softdevice via DFU 

If this is the same, I can

  • make a new bootloader with SD 7.1 
  • create a DFU package for app + bootloader + SD 7.1

and that's still the solution ? 

Thanks!

Parents
  • Hi ms360,

    From the SoftDevice version number, it looks like you are trying to upgrade from nRF5 SDK v14.x.0 to v16.0.0, is that correct?

    If there are some changes between that are highly desirable for your project, I will not stop you. However, please keep in mind that every bootloader update comes with a risk of the device being bricked.

    Regarding updated info, the thread you cited is from late August 2020, dealing with nRF5 SDK v17.0.0, so the information there should actually be as fresh as it gets with the nRF5 SDK. Please remember that the nRF5 SDK hasn't been worked on for more than 4 years now.

    I checked v14.2.0 update solution and that of v16.0.0, and the design seems to remain the same between them. You would just need to make sure that the Bootloader start address doesn't change, because there is no way to change that.

    There is a change in the bootloader settings format. Bootloaders from nRF5 SDK v15.2.0 and earlier use bootloader settings version 1, while those from v15.3.0 and later only support bootloader settings version 2. You will need to enable backward compatibility for the old settings version.

    Another thing to check is to make sure the new application is compatible with the old application's persistent data. You can check this by flashing without erase the SoftDevice, bootloader, and application individually on a device running the old setup, with existing data. A device from the field would be best. A test device running the hex dump from a device from the field should be equally good. An entirely new test device should also work.

    Finally, I didn't know updating BL + SD + App all at once was possible. However, if that is too big to do, you can update BL + SD first, then application, as mentioned in the documents linked above.

    I hope that helps.

    Hieu

  • Sorry I meant I'd like to upgrade to SD v7.2.0. I'm using SDK 17.1.0 

  • I can't think of a reason why you would meet SD version check failed like this...

    Can you retry with only 0x9D for --sd-req?

  • So this was unexpected, just specifying 0x9d yielded the same result!
    As if it concatenates --sd-req and --sd-id

    DFU failed again. 

    nrfutil pkg generate --hw-version 52 --app-boot-validation VALIDATE_ECDSA_P256_SHA256\

    --sd-req 0x009D --bootloader _bootloader/bootloader_chc_v1.01.06.hex --bootloader-version 10106 \

    --application _build/chc.hex --application-version 10425\

    --key-file private.key --softdevice ../nRF5_SDK_17.1.0_ddde560-mirror/components/softdevice/s132/hex/s132_nrf52_7.2.0_softdevice.hex\

    --sd-id 0x101 1.04.25_bl_v1.01.06.zip

    |- Image count: 2

    |

    |- Image #0:

       |- Type: sd_bl

       |- Image file: sd_bl.bin

       |- Init packet file: sd_bl.dat

          |

          |- op_code: INIT

          |- signature_type: ECDSA_P256_SHA256

          |- signature (little-endian): b'01cbe4315a1a1f0dcda1b5f400de6c9213496ee29b576bf0ad1221c80651cccd1575fe9d2a1b8efe0eee18cfae6f456a75233741f46039419dccd907f906cbbe'

          |

          |- fw_version: 0x0000277A (10106)

          |- hw_version 0x00000034 (52)

          |- sd_req: 0x101, 0x9D

          |- type: SOFTDEVICE_BOOTLOADER

          |- sd_size: 149868

          |- bl_size: 23644

          |- app_size: 0

          |

          |- hash_type: SHA256

          |- hash (little-endian): b'ed4b49e552fe7d411a49c3e1a0ba7c82254515e2d5eaaa9b46e370dadd0052ec'

          |

          |- boot_validation_type: ['VALIDATE_GENERATED_CRC', 'VALIDATE_GENERATED_CRC']

          |- boot_validation_signature (little-endian): [b'', b'']

          |

          |- is_debug: False

  • I notice the ZIP file name is exactly the same. Did the second command run actually create a new file?
    It doesn't make sense that the ZIP package specifies both 0x9D and 0x101 as sd-req when you only pass just 0x9D.

    Let's try something vastly different, 0x99 for sd-req, and 0x111 for sd-id?

Reply Children
  • That's coming from a makefile target, so the name is always the same (until version change).

    So I did 

    --sd-req 0x0099
    --sd-id 0x0111
    Its definitely concatenating them. 

    |- Image #0:

       |- Type: sd_bl

       |- Image file: sd_bl.bin

       |- Init packet file: sd_bl.dat

          |

          |- op_code: INIT

          |- signature_type: ECDSA_P256_SHA256

          |- signature (little-endian): b'ffdbd34b5b16c4194e1d38b64f48410ff4f72bef6d7de85b4938ac0a744b49eb2f71cca6f9d5fff3551c288602abfb86b943d4e78bc4f5bc0e309c3a1f7ff887'

          |

          |- fw_version: 0x0000277A (10106)

          |- hw_version 0x00000034 (52)

          |- sd_req: 0x99, 0x111

  • Right, then we are indeed sure that the tool combines sd-id into sd-req. On hindsight, that makes some sense.

    I will have to reproduce this issue and investigate. I will keep you updated.

  • Thank you. This is the last big risk item on this project task. Any help is appreciated. 

  • Hi ms360,

    I was pulled into another assignment for a few days but have since returned and resumed looking into this.

    I recreated a nRF5 SDK v14.2.0 and v17.1.0 setup, with bootloaders built in debug settings, printing out into UART.
    The only difference is that I am using a nRF52840 DK instead of a nRF52 DK.

    Currently, I am starting from a simpler case. The device is first flashed with only SDK v14.2.0 bootloader and SD, and I then attempt to update it with just the bootloader and SD from SDK v17.1.0.

    With that setup, I have reproduced an issue, though I am not sure it is the same as yours. Refer to the log below:

    <debug> app: Received calculate CRC
    <info> dfu_req_handling: Before OP crc
    <debug> app: Sending CRC: [0x60, 0x03, 0x01, 0:x000316AC, CRC:0xB6B733F5]
    <debug> nrf_dfu_flash: Flash write success: addr=0x00053600, pending 1
    <debug> app: Received execute object
    <info> dfu_req_handling: Before OP execute
    <info> dfu_req_handling: Valid Data Execute
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 2
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, len=0x1B8 bytes), queue usage: 3
    <info> dfu_req_handling: Doing postvalidate
    <error> dfu_req_handling: Hash failure
    <info> dfu_req_handling: Current bank is bank 0
    <info> dfu_req_handling: Running SD version check ============== 
    <warning> dfu_req_handling: SD major version numbers mismatch. Current app will be invalidated.Current: 0. New: 7.
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 4
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, len=0x1B8 bytes), queue usage: 5
    <debug> app: Sending Response: [0x4, 0xB]
    <debug> nrf_dfu_flash: Flash write success: addr=0x00053680, pending 4
    <debug> dfu_req_handling: Response sent.
    <debug> app: Received: BLE_GAP_EVT_CONN_PARAM_UPDATE
    <debug> app: conn_sup_timeout: 500
    max_conn_interval: 6
    min_conn_interval: 6
    slave_latency 0
    <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 3
    <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 2
    <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 1
    <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
    <debug> nrf_dfu_flash: This operation had a callback, calling back to 0x000F3455.
    <debug> dfu_req_handling: All flash operations have completed.
    <debug> dfu_req_handling: Starting reset timer.
    <debug> dfu_req_handling: Attempting to reset the device.
    <debug> app: In nrf_dfu_transports_close
    <debug> app: num transports: 1
    <debug> app: Shutting down BLE transport.
    <debug> app: Disconnecting.
    <debug> app: BLE transport shut down.
    <debug> app: After nrf_dfu_transports_init
    <debug> dfu_req_handling: Reset.
    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: In real nrf_dfu_init
    <debug> nrf_dfu_settings: Running nrf_dfu_settings_init(sd_irq_initialized=false).
    <debug> nrf_dfu_flash: Calling nrf_dfu_flash_init(sd_irq_initialized=false)...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Initializing the clock.
    <debug> app: Enter nrf_dfu_continue
    <error> app: Single: Invalid bank
    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: Return false in valid app check
    <debug> app: In nrf_dfu_transports_init
    <debug> app: num transports: 1
    <debug> app: Initializing BLE DFU transport
    <debug> app: vector table: 0x000F1000
    <debug> app: vector table: 0x000F1000
    <debug> app: Error code - sd_softdevice_vector_table_base_set: 0x00000000
    <debug> app: Enabling SoftDevice.
    <warning> nrf_sdh_ble: RAM starts at 0x200027E0, can be adjusted to 0x20002128.
    <warning> nrf_sdh_ble: RAM size can be adjusted to 0x3DED8.
    <debug> app: SoftDevice enabled.
    <debug> app: nrf_dfu_settings_adv_name_is_valid FALSE
    <debug> app: Regular adv name

    It seems I have a hash failure for some inexplicable reason ...

    There is also a SD version warning that also doesn't make sense. The mismatch major version is expected, and the "current version" print is also incorrect.

    Do these look like the issue you are having?

    On the nRF Connect app's end, there doesn't seem to be any error.

    I will continue to look into this.

  • Thanks Hieu. 
    I don't have space to enable RTT logging in these bootloaders so I've been running blind there. 
    It looks like you're also failing the valid app check, that's definitely different. 

    Here is the entire nrf connect DFU attempt log 

    [10:15:07.1530] Normal: Scanner On.
    [10:15:07.1620] Normal: Device Scanned.
    [10:15:10.3570] Normal: Connected.
    [10:15:10.7420] Normal: Discovered Secure DFU Service and Device Information Services.
    [10:15:10.8600] Normal: Discovered DFU Packet and DFU Control Point Characteristics for Service Secure DFU Service.
    [10:15:11.0720] Normal: Discovered Manufacturer Name String, Model Number String, Serial Number String, Hardware Revision String, Firmware Revision String, and Software Revision String Characteristics for Service Device Information.
    [10:15:11.0720] Normal: DFU Packet has no Descriptors.
    [10:15:11.1280] Normal: Discovered Client Characteristic Configuration Descriptors for Characteristic DFU Control Point
    [10:15:11.1290] Normal: Manufacturer Name String has no Descriptors.
    [10:15:11.1290] Normal: Model Number String has no Descriptors.
    [10:15:11.1290] Normal: Serial Number String has no Descriptors.
    [10:15:11.1290] Normal: Hardware Revision String has no Descriptors.
    [10:15:11.1300] Normal: Firmware Revision String has no Descriptors.
    [10:15:11.1910] Normal: Software Revision String has no Descriptors.
    [10:15:11.6500] Normal: Appearance changed from Generic to nRF5DFU.
    [10:15:23.7330] Normal: Found valid Firmware in file:///var/mobile/Containers/Data/Application/8E89727C-516F-413B-8C85-EADC3A302582/Library/Caches/dfu_hc_chc_1.04.25_bl_v1.01.06_273A49845-A04D-42FA-B302-0435C5E27338-641-000000BFF9EDB4EB.zip for Device DFU nRF5 SDK.
    [10:15:26.1720] Normal: Connecting to XmtF...
    [10:15:26.1720] Normal: Connected to XmtF
    [10:15:26.1720] Normal: Discovering services...
    [10:15:26.1720] Normal: Services discovered
    [10:15:26.1720] Normal: Starting Secure DFU...
    [10:15:26.1720] Normal: Connected to XmtF
    [10:15:26.1720] Normal: Services discovered
    [10:15:26.1720] Normal: Secure DFU Service found
    [10:15:26.1720] Normal: Discovering characteristics in DFU Service...
    [10:15:26.1720] Normal: DFU characteristics discovered
    [10:15:26.1720] Normal: Enabling notifications for 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.2200] Normal: Notifications enabled for 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.2200] Normal: Secure DFU Control Point notifications enabled
    [10:15:26.2200] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.3090] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.3100] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600601000100000000000000000000
    [10:15:26.3100] Normal: Command object selected (Max size = 256, Offset = 0, CRC = 00000000) received
    [10:15:26.3100] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.3700] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.3700] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
    [10:15:26.3700] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4310] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.4310] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600201
    [10:15:26.4310] Normal: Packet Receipt Notif disabled
    [10:15:26.4310] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4310] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4310] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.4320] Normal: Command object sent (CRC = 8B8734E7)
    [10:15:26.4320] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.5200] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.5200] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 60030198000000e734878b
    [10:15:26.5200] Normal: Checksum (Offset = 152, CRC = 8B8734E7) received
    [10:15:26.5210] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.5800] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.7000] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600405
    [10:15:26.7000] Error: Error 5: Invalid object
    [10:15:26.7000] Warning: Invalid system components. Trying to send application
    [10:15:26.7000] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7890] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.7890] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
    [10:15:26.7890] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7890] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7900] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7900] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7900] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7900] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7900] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7910] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7910] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7910] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7910] Normal: Writing to characteristic 8EC90002-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.7910] Normal: Command object sent (CRC = 12ADAAFD)
    [10:15:26.7910] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.9110] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.9110] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600301d0000000fdaaad12
    [10:15:26.9110] Normal: Checksum (Offset = 208, CRC = 12ADAAFD) received
    [10:15:26.9110] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:26.9710] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:26.9710] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 60040b07
    [10:15:26.9710] Error: Error 7: SD version check failed
    [10:15:26.9710] Normal: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
    [10:15:27.0310] Normal: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
    [10:15:27.0310] Normal: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600c03
    [10:15:27.0310] Error: Error 3: Invalid parameter
    [10:15:27.0310] Normal: Disconnecting...
    [10:15:27.0310] Normal: Disconnected
    [10:15:27.0330] Error: DFU Failed with Error: SD version check failed
    [10:15:47.7650] Normal: Disconnected.

Related