Programming nRF52840 with nrfutil DFU

Hi, 

I've a firmware built using SoftDevice S140 and I can program it fine on nRF52840 dongle using nRF Connect programmer application. 

Now I'm trying to achieve the same using nrfutil but have so far failed. For some odd reason nrfutil does not seem to program the SoftDevice at all  but only the application (or writes the application over SoftDevice?). I'm using nrfutil 6.1.6 and nRF5_SDK_17.1.0_ddde560.

Is there something obviously wrong with my commands? These hex files work fine when used with nRF Connect programmer.

$ nrfutil pkg generate --hw-version 52 --sd-req 0x00 --sd-id=0x100 --softdevice s140_nrf52_7.2.0_softdevice.hex --application ble_app_hid_composite_bridge_pca10059_s140.hex --application-version 1 dfu.zip


Package appears fine.

$ nrfutil pkg display dfu.zip

DFU Package: <dfu.zip>:
|
|- Image count: 2
|
|- Image #0:
|- Type: softdevice
|- Image file: s140_nrf52_7.2.0_softdevice.bin
|- Init packet file: s140_nrf52_7.2.0_softdevice.dat
|
|- op_code: INIT
|- signature_type: UNSIGNED
|- signature (little-endian): N/A
|
|- fw_version: 0xFFFFFFFF (4294967295)
|- hw_version 0x00000034 (52)
|- sd_req: 0x00, 0x100
|- type: SOFTDEVICE
|- sd_size: 153140
|- bl_size: 0
|- app_size: 0
|
|- hash_type: SHA256
|- hash (little-endian): b'd2af0ef71c6b009b727ccec580f949c19af7024c644ee11121cac5d010f02a19'
|
|- boot_validation_type: ['VALIDATE_GENERATED_CRC']
|- boot_validation_signature (little-endian): [b'']
|
|- is_debug: False

|
|- Image #1:
|- Type: application
|- Image file: ble_app_hid_composite_bridge_pca10059_s140.bin
|- Init packet file: ble_app_hid_composite_bridge_pca10059_s140.dat
|
|- op_code: INIT
|- signature_type: UNSIGNED
|- signature (little-endian): N/A
|
|- fw_version: 0x00000001 (1)
|- hw_version 0x00000034 (52)
|- sd_req: 0x00, 0x100
|- type: APPLICATION
|- sd_size: 0
|- bl_size: 0
|- app_size: 39260
|
|- hash_type: SHA256
|- hash (little-endian): b'313862386fd0a94e3ffecb674b43173027d2c9771c7c68e1fd60af3e0c82eb4c'
|
|- boot_validation_type: ['VALIDATE_GENERATED_CRC']
|- boot_validation_signature (little-endian): [b'']
|
|- is_debug: False

And the programming succeeds.

$ nrfutil dfu usb-serial -pkg dfu.zip -p COM10 -b 115200

Device programmed.


However dongle does not boot. nRF Connect programmer it shows that there is only the application and that the Softdevice is missing.



Flash looks like this when programmed correctly with nRF Connect.

Parents
  • Hi,

    I see the same on my end. Programming applications seem to work, but SoftDevice programming does not. I am not able to explain this at the moment, so I need to look further into it.

    Update:

    I am not entirely sure what the issue is, but you can split the operation in two for now:

    1. Generate a zip with only SoftDevice:

    $ nrfutil pkg generate --hw-version 52 --sd-id 0x100 --softdevice s140_nrf52_7.2.0_softdevice.hex sd.zip

    2. Generate a zip with only application (note that the --sd-req is 0x100 here and not 0x00):

    $ nrfutil pkg generate --hw-version 52 --sd-req 0x100 --application ble_app_hid_composite_bridge_pca10059_s140.hex --application-version 1 app.zip

    3. Program SoftDevice via nrfutil:

    nrfutil dfu usb-serial -pkg sd.zip -p COM13 -b 115200

    4. Program application via nrfutil:

    nrfutil dfu usb-serial -pkg app.zip -p COM13 -b 115200

  • Thank you for looking into this. I can confirm that the split DFU workaround works! I can continue with this approach, thanks again!

  • It turns out there is a bug in nrfutil that was introduces in version 6.1.5 that causes an issue with the generated zip image. If you use nrfutil 1.6.4 or older to generate the zip you should be good (even if you use the latest nrfutil to do the actual DFU operation).

Reply Children
Related