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!