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

Crash on accessing Flash after copying SoftDevice

I'm trying to update my SoftDevice with a bootloader, which is basically the same as the one in nRF5_SDK_11.0.0_89a8197. The image is saved in bank 0 and is validated by dfu_sd_image_validate where sd_mbr_command with SD_MBR_COMMAND_COMPARE is executed. Then dfu_sd_image_swap() gets called and dfu_copy_sd executes sd_mbr_command with SD_MBR_COMMAND_COPY_SD.

But then, dfu_sd_image_validate gets called again executingsd_mbr_command with SD_MBR_COMMAND_COMPARE and nothing happens any more...

Then I printed the first 200 Bytes of bank 0 and the SoftDevice region to check if the code transfer even happened. I did this before and after dfu_copy_sd: The copying operation seems to be successful, at least for the first 200 Bytes for both code regions, BUT I could not print the image in bank 0 anymore! I even tried random regions in bank 0 and 1, and as soon as I did that, the µC didn't do anything anymore, which is probably the problem for the dfu_sd_image_validate after the copy operation.

  • As my bootloader was basically the same as one in the SDK, it was not completely. For instance, I replaced sd_image_start with the define DFU_BANK_0_REGION_START, as this was always going to be its location, thus making the variable useless.

    The problem with that is, after copying the SoftDevice image into the SoftDevice region, somehow the dfu_types.h defines like DFU_BANK_0_REGION_START returned totally wrong values. Thus all functions originally using sd_image_start got wrong parameters, which caused the crash.

Related