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

USB Dfu cause hash not match issue.

hi,

I am working on nrf52833 dfu. right now I received an error 

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.

it happened when 96% finished.

my dfu memory settings is :

FLASH (rx) : ORIGIN = 0x74000, LENGTH = 0xA000
RAM (rwx) : ORIGIN = 0x20002ae8, LENGTH = 0x1d518
uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
bootloader_settings_page (r) : ORIGIN = 0x0007F000, LENGTH = 0x1000
uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4
mbr_params_page (r) : ORIGIN = 0x0007E000, LENGTH = 0x1000

and my application is :

FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x4D000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000

  • Hello,

    Can you please show me what nrfutil commands you used to generate and transfer the DFU image? And did you do any changes to the bootloader project? Or does it also occur in the unmodified bootloader project? (you will, of course, need to replace the dfu_public_key.c in the unmodified bootloader project.

    Best regards,

    Edvin

  • I have not change the bootloader code, the only thing I change is makefile and config file, due to there is no example for pca10100 usb with softdevice s140.and also I change the public_key
    I use nrfutil dfu usb-serial -pkg <.zip file> -p <serial port> -fc 0 to flash, and use nrfutil pkg generate --hw-version 52 --sd-req 0xCA --application-version 1 -- application <hex file> --key-file <priv.pen file> <output> to generate the package

  • So what bootloader project did you start with? I suggest you look into starting with the SDK17\examples\dfu\secure_bootloader\pca10056_usb,

    But you need to change the memory settings. 

    Does your bootloader and/or application support BLE as well as USB?

    Your dfu memory settings suggests that you have a softdevice, but your application does not.

    Let's assume you have a softdevice:

    You should change your application's ram to the same as your bootloader's to account for the softdevice.

    There are some other things you should change in the makefile as well. What does your preprocessor definitions and assembly flags look like? (CFLAGS and ASMFLAGS). Perhaps there are some of those that suggests you are using a different chip?

    Also, make sure to set the TARGETS := nrf52833_xxaa_s140.

    I assume you have checked, but are you 100% sure that you used the same key to generate the dfu image as you used in the bootloader? (that you are using the matching private key for the bootloader's public key).

  • yes, I use the same key. my application support BLE. so right now my application works if I flash it. since bootloader start, I can assum the bootloader is working too. the wired part is it stop at 96%.

  • [##################################--] 96% 00:00:11
    Traceback (most recent call last):
    File "/usr/local/bin/nrfutil", line 8, in <module>
    sys.exit(cli())
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1015, in usb_serial
    timeout)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 970, in do_serial
    dfu.dfu_send_images()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 100, in _dfu_send_image
    self.dfu_transport.send_firmware(data)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 302, in send_firmware
    self.__execute()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 421, in __execute
    self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
    File "/usr/local/lib/python3.7/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.
    make: *** [flash_pkg] Error 1

Related