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

Dual Bank DFU CRC computation failed *after* copy to bank 0

I'm building a custom system based on the NRF52832 and S132 SoftDevice with SDK 14.2.0.

Our secure bootloader (bonded) is based on  examples/dfu/bootloader_secure_dfu. It's button handling is removed (no buttons) and more debug is added.

During a DFU of an application only package the data is successfully transferred to bank 1. The DFU controller requests a CRC at some point and I can see it's value on RTT output of response_crc_cmd_send().

Then after reset, the valid image is copied to bank 0 in nrf_dfu_app_continue().

After the copy is complete the CRC is calculated and compared with a stored value in dfu_settings. The calculated CRC matches the one send to the controller before boot.
The comparison fails and this leaves bank 0 invalid.

We don't have any input, thus no way to force the bootloader into DFU again. Our device is bricked.

I've been trying to debug this but lack understanding. For instance: what is the source of the CRC value in the dfu_settings?

I'm generating the DFU image using nrfutil version 3.5.0 with the following make target:

(OUTPUT_DIRECTORY)/$(PROJECT_NAME)-$(GIT_VERSION).zip: $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
    nrfutil pkg generate  --debug-mode \
        --application $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex \
        --application-version-string $(GIT_VERSION_CLEAN) \
        --hw-version 30000 \
        --sd-req 0x9D \
        --key-file "$(KEYFILE)" \

Parents
  • Hi,

    It is hard to change bootloader size during DFU, mainly because the bootloader start address is written to a UICR register. Also because bank size and location calculations (for where to download and move firmware images to and from) depend on where the bootloader begins, so that extra care must be taken if changing bootloader size during DFU. While possible, it does require a lot of effort.

    It is much easier to stick to the same bootloader size. That size may be larger than the one we provide with the SDK, as long as you set the project settings flash start and flash size values correctly. In addition, the BOOTLOADER_START_ADDR define should also get this value, and it should be written to UICR. This should happen automatically for the various toolchains, as the value is fetched from the project settings for flash, but double checking never hurts.

    I suspect that you get two separate errors. One when adding debug (related to changed bootloader size), and one when not adding debug (hard to tell what happens there). I found your private thread and will look into the files that you provided there.

    Regards,
    Terje

Reply
  • Hi,

    It is hard to change bootloader size during DFU, mainly because the bootloader start address is written to a UICR register. Also because bank size and location calculations (for where to download and move firmware images to and from) depend on where the bootloader begins, so that extra care must be taken if changing bootloader size during DFU. While possible, it does require a lot of effort.

    It is much easier to stick to the same bootloader size. That size may be larger than the one we provide with the SDK, as long as you set the project settings flash start and flash size values correctly. In addition, the BOOTLOADER_START_ADDR define should also get this value, and it should be written to UICR. This should happen automatically for the various toolchains, as the value is fetched from the project settings for flash, but double checking never hurts.

    I suspect that you get two separate errors. One when adding debug (related to changed bootloader size), and one when not adding debug (hard to tell what happens there). I found your private thread and will look into the files that you provided there.

    Regards,
    Terje

Children
No Data
Related