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

Secure DFU example not working

We're strumbling getting the secure DFU examples to work.

Setup

  • PCA10040 as DFU initiator using nrfutil

  • PCA10028 as DFU receiver

  • nRF5_SDK_12.1.0_0d23e2a

  • nrfToolbox on iPhone version 4.2.0


 0>INFO:Inside main
 0> :INFO:In nrf_bootloader_init
 0> :INFO:In real nrf_dfu_init
 0> :INFO:running nrf_dfu_settings_init
 0> :INFO:Enter nrf_dfu_continue
 0> :INFO:Single: Invalid bank
 0> :INFO:Enter nrf_dfu_app_is_valid
 0> :INFO:Return false in valid app check
 0> :INFO:In nrf_dfu_transports_init
 0> :INFO:num transports: 1
 0> :INFO:vector table: 0x00036000
 0> SDH:INFO:sd_ble_enable: RAM START at 0x20002c00
 0> SDH:WARNING:sd_ble_enable: app_ram_base should be adjusted to 0x200025e0
 0> SDH:WARNING:ram size should be adjusted to 0x5a20 
 0> :INFO:After nrf_dfu_transports_init
 0> :INFO:------- nrf_dfu_flash_init-------
 0> :INFO:Waiting for events
 0> :INFO:Received select object
 0> :INFO:Valid Command: NRF_DFU_OBJECT_OP_SELECT
 0> :INFO:Sending Object Info: [0x60, 0x06, 0x01 max: 0:x00000100 0:x00000000, CRC:0x00000000]
 0> :INFO:Received create object
 0> :INFO:Before OP create command
 0> :INFO:Valid Command Create
 0> :INFO:Sending Response: [0x1, 0x1]
 0> :INFO:Set receipt notif
 0> :INFO:Sending Response: [0x2, 0x1]
 0> :INFO:Before OP write command
 0> :INFO:Received calculate CRC
 0> :INFO:Valid Command CRC
 0> :INFO:Sending CRC: [0x60, 0x03, 0x01, 0:x0000000e, CRC:0xaf4b0076]
 0> :INFO:Received execute object
 0> :INFO:Before OP execute command
 0> :INFO:Valid command execute
 0> :INFO:
 0> FF FF FF FF FF FF FF FF 01 00 FE FF 76 30        ............v0  
 0> :INFO:
 0> :INFO:Handler: Invalid protocol buffer stream
 0> :INFO:Sending Response: [0x4, 0x5]

nrfutil version 2.0.0

nrfutil -v dfu ble -ic NRF52 -pkg blink_green.zip -p COM58 -n "DfuTarg" -f

> BLE: Found target advertiser, address: 0xD3C27DB07FB1, name: DfuTarg
BLE: Connecting to 0xD3C27DB07FB1
BLE: Connected to <pc_ble_driver_py.ble_driver.BLEGapAddr object at 0x0000000003CD3048>
BLE: Connected to target
BLE: Service Discovery
BLE: Using default ATT MTU
BLE: Enabling Notifications
BLE: Set Packet Receipt Notification 0
Sending init packet...
BLE: Selecting Object: type:1
Traceback (most recent call last):
  File "c:\python27\scripts\nrfutil-script.py", line 9, in <module>
    load_entry_point('nrfutil==2.0.0', 'console_scripts', 'nrfutil')()
  File "c:\python27\lib\site-packages\click\core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 696, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 636, in ble
    dfu.dfu_send_images()
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu.py", line 122, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu.py", line 90, in _dfu_send_image
    self.dfu_transport.send_init_packet(data)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_ble.py", line 261, in send_init_packet
    response = self.__select_command()
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_ble.py", line 362, in __select_command
    return self.__select_object(0x01)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_ble.py", line 374, in __select_object
    (max_size, offset, crc)= struct.unpack('<III', bytearray(response))

struct.error: unpack requires a string argument of length 12

RTT output

> INFO:Inside main
 0> :INFO:In nrf_bootloader_init
 0> :INFO:In real nrf_dfu_init
 0> :INFO:running nrf_dfu_settings_init
 0> :INFO:Enter nrf_dfu_continue
 0> :INFO:Single: Invalid bank
 0> :INFO:Enter nrf_dfu_app_is_valid
 0> :INFO:Return false in valid app check
 0> :INFO:In nrf_dfu_transports_init
 0> :INFO:num transports: 1
 0> :INFO:vector table: 0x00036000
 0> SDH:INFO:sd_ble_enable: RAM START at 0x20002c00
 0> SDH:WARNING:sd_ble_enable: app_ram_base should be adjusted to 0x200025e0
 0> SDH:WARNING:ram size should be adjusted to 0x5a20 
 0> :INFO:After nrf_dfu_transports_init
 0> :INFO:------- nrf_dfu_flash_init-------
 0> :INFO:Waiting for events
 0> :INFO:Set receipt notif
 0> :INFO:Sending Response: [0x2, 0x1]
 0> :INFO:Received select object
 0> :INFO:Valid Command: NRF_DFU_OBJECT_OP_SELECT
 0> :INFO:Sending Object Info: [0x60, 0x06, 0x01 max: 0:x00000100 0:x00000000, CRC:0x00000000]

So both are not working, what are we doing wrong?

Related