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

  • Hi Weizhen, 
    I'm sorry for the late response. 
    I have tested here and reproduced the issue. I dig a little bit more and I think I found the bug. 
    In nrf_bootloader_app_start() in nrf_bootloader_app_start.c we disable all interrupts and then we call NRF_LOG_FLUSH();

    This will cause a dead loop inside serial_tx() if you use  UART for logging. Resulting the app never executed. 
    if you call  NRF_LOG_FLUSH(); before disabling interrupts

    NVIC->ICER[0]=0xFFFFFFFF;
    NVIC->ICPR[0]=0xFFFFFFFF;

    it should work. 

  • Thanks, Bui, I think this fix works for me. but we also found another bug, which feels the usb dfu in this version do not clear NRF_POWER->GPREGRET after flash or time out. used when we working on nrf52832 with gpregret enter mode, the chip can go back to application after flash and time out, but now it stay in bootloader mode until power off the chip, which will reset the NRF_POWER->GPREGRET

  • Hi Weizhen, 

    Could you check dfu_enter_flags_clear() function inside nrf_bootloader_init() ? It's called right after dfu_enter is checked true. 

    GPREGRET  register should be erased inside that function. 

Related