Hi all. I am using nRF5 SDK 15.0.0 and the S140 SoftDevice v6.0.0 to develop on an nRF52840. Due to software infrastructure constraints, I am unable to implement DFU using Nordic-provided tools. Instead I rely on a custom dual-bank update process that involves storing a binary blob in a specific region in flash (0x70000 - 0xE0000). Once the blob transfer is completed, I reboot and use the GPREGRET register to identify a pending DFU in the custom bootloader after a software reset. I don't have any direct Nordic DFU functionality in the bootloader main code, and it conducts no flash operations before exiting and starting the main application. Despite this, rebooting with the GPREGRET register set to 0xB1 causes memory corruption in my payload region where the binary blob is stored. I've tried the following to confirm that GPREGRET setting is where the problem arises (checked with nrfjprog memrd):
- Binary transfer: No corruption after entering main app
- Binary transfer + software reset: No corruption after entering main app
- Binary transfer + setting GPREGRET + manual power cycle (to zero out retained values): No corruption after entering main app
- Binary transfer + setting GPREGRET + software reset: Corrupted binary blob/payload data
With this new finding, I have a handful of questions that I'm concerned about because I need to ensure my custom OTA DFU process is as error-free as possible:
- What does setting GPREGRET trigger after a reboot, aside from holding the values that were set?
- How can I prevent the flash region where my binary blob is stored from being modified, unless done so directly in custom code via the bootloader main?
- Are there any other registers I can use to pass a flag to the bootloader without triggering any SDK functionality?