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

DFU - Bootloader fails to complete update with error 'Request to copy BL failed'

Hello!

We've written a custom bootloader (based off the secure_serial_dfu example), that uses SPI instead of serial communication. I can successfully update an Application using this custom bootloader, but when I attempt to update the bootloader itself, the process fails on the final 'Execute' step with the following logs: 

<debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
<debug> app: Verifying BL: Addr: 0x00073000, Src: 0x00041084, Len: 0x00008A70
<debug> app: Bootloader not verified, copying: Src: 0x00041084, Len: 0x00008A70
<error> app: Request to copy BL failed
<error> app: SD+BL: BL copy failed
<debug> app: Could not continue DFU operation: 0x00000004

Tracing back through the DFU modules, the error code (0x04) is ultimately being returned from sd_mbr_command (called by nrf_dfu_mbr_copy_bl()  in file nrf_dfu_mbr.c), and this code seems to correspond to NRF_ERROR_NO_MEM. Depending on the function, this error code is described as either of: 

-- NRF_ERROR_NO_MEM - If no parameter page is provided (see sds for more info).

-- NRF_ERROR_NO_MEM - if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF)

I’ve looked through the docs and forums, and there is limited info about this error. This page (http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.sds%2Fdita%2Fsoftdevices%2Fs130%2Fmbr_bootloader%2Fmbr.html), describes a couple of ways to set the address of the “parameter page”. Specifically, I tried setting the address using “UICR.NRFFW[1] = … “, as suggested, and also by defining MBR_PARAM_ADDR  - neither of these changed the outcome. I see there are also some related variables in the linker file (unchanged from the secure_serial_dfu example), but it seems as though they are set correctly. 

Steps to reproduce the error:

- Build and Flash the custom SPI-DFU bootloader+Softdevice (5.1.1) -- [We are using IDAP-Link for flashing the NRF52 on our custom board]

- Make a small change (in logs) to the custom bootloader, and rebuild

- Use nrfutil to generate a ZIP package for this bootloader (specifying a higher bootloader-version). Here's the full nrfutil command: 

            nrfutil pkg generate --hw-version 52 --sd-req 0xA5 --key-file private.key --softdevice s132softdevice.hex --sd-id 0xA5 --bootloader nrf52832_bl.hex --bootloader-version 2 bootloader_v2.zip

- Unzip the package and concatenate the Init packet (.dat file) with the bootloader+softdevice image (.bin).

- Upload the concatenated binary to our custom board's Flash

- Master SPI running on custom board, then initializes the DFU process with the NRF52 chip. All steps succeed for the Init packet, and all succeed for the BL image except the final Execute command. This is where the error is displayed ("Request to copy BL failed")

-  Resetting the chip results in the original bootloader starting up, not the updated one. 

NOTE: While these steps include packaging the softdevice in the binary to use for the DFU update (creating a sd_bl.bin file), the procedure fails with the exact same error if I only update the bootloader (excluding the Softdevice from the update binary).

Environment Notes

- Custom board, using IDAP-Link to flash nrf52

- Dev Platform: Windows 10

- SDK 14.2

Any help/guidance you can provide for this issue would be very much appreciated! If there is any other information that would help to diagnose the cause of this problem, I would be happy to provide it. 

Thank you!

Parents
  • Hi,

    Could you let me know what exactly you did at this step "- Upload the concatenated binary to our custom board's Flash" ? 

    So the binary image of the bootloader is not transferred via SPI ?

    Do you transfer the init data ? 

    I assume that you has made quite a significant change in the bootloader ?

    We would need to have a look at your code to figure out what could be wrong here. 

    But have you made sure you written to NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (UICR.NRFFW[1]) the address for MBR parameter ? NRF_MBR_PARAMS_PAGE_ADDRESS by default at 0x7E000. This value need to be written to NRF_UICR_MBR_PARAMS_PAGE_ADDRESS . If you use other address you need to write that into the UICR. 

    The address of the bootloader need to be written in NRF_UICR_BOOTLOADER_START_ADDRESS as well. 

    I attached is the snippet of the code in the MBR, most likely it's the NRF_UICR_MBR_PARAMS_PAGE_ADDRESS was not pointing to correct location. 

    m_check_copy_bl_params wouldn't return NOMEM. 

  • What's the purpose of NRF_MBR_PARAMS_PAGE_ADDRESS if it needs to be set in UICR anyway?

Reply Children
Related