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

Serial DFU fails validation

Hi

I am using SDK V. 15.3.0 and Softdevice S132 6.1.1 on a nRF52832. I am developing two devices, one of with is battery powered and one that is connected to a serial interface. Both devices connect via BLE.

The battery powered device allows application update via DFU over BLE using the secure boot loader and the nRF Android app.

Now I am working on the DFU over serial for the second device. Using the same key as with the BLE update, I get this message when updating with nrfutil:

nrfutil -v  -o nrfutil.log dfu serial --package update-0.0.1.zip --baud-rate=115200 -fc false -p COM39 --connect-delay 1
  [##################################--]   95%  00:00:07
Traceback (most recent call last):
...
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\__main__.py", line 956, in do_serial
    dfu.dfu_send_images()
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\dfu\dfu.py", line 102, in _dfu_send_image
    self.dfu_transport.send_firmware(data)
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 302, in send_firmware
    self.__execute()
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
    self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
  File "c:\bernhard\pyhton2.7\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 502, in __get_response
    raise NordicSemiException('Extended Error 0x{:02X}: {}'.format(resp[3], data))
pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x0C: The hash of the received firmware image does not match the hash in the init packet.

The command to build the update package:

nrfutil pkg generate  --hw-version 52 --application-version-string "0.0.1" --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --sd-req 0xb7  --key-file private.key --application app.hex update-0.0.1.zip

Any hint how to fix this is highly welcome. I am puzzled since this works well over BLE without much difference.

Thanks

Bernhard

  • Hi, 

    The error suggests that after the image is received on the nRF52 side, the calculation (post validation) of the image received showing that the hash of the packet doesn't match with the hash in the init packet. 

    You would need to check if : 

    - The image you received and stored properly (read the flash out and compare it with the original image) 

    - Check if the calculation in post validation postvalidate_app() is correct

    - Check if the hash received in the init packet is parsed correctly. 

    Please see Hung Bui's answer in this post.

    -Amanda H. 

Related