WE are working on nRF52832 and nRF5 SDK 15.0.0. Currently working on the BLE FOTA process and have successfully completed DFU up to this point. Our next goal is to save configuration data to the internal flash memory before entering bootloader mode. However, we are encountering an issue when attempting to add flash write functionality within the DFU event handler—the code appears to get stuck, and the flash write operation is not performed as expected. As a result, we are unable to enter bootloader mode.
We have already attempted the following methods without success:
1] Using the nrf_fstorage (with SoftDevice) library: We attempted to write data to flash memory within the BLE_DFU_EVT_BOOTLOADER_ENTER event handler. After writing the configuration data, we set the GPREGRET register and performed a system reset. Unfortunately, this approach did not produce the desired results.
2] Changing the flash address: We tried modifying the flash address, but this led to conflicts, and the issue was not resolved.
3] Delaying the system reset: We tried delaying the system reset while writing to flash using the power management library. However, this did not prevent the conflicts from occurring.
As of now, we have not been able to successfully write the configuration data to the internal flash memory before initiating the DFU process.
Could you kindly guide us on how to properly save the configuration data to the internal flash memory before entering bootloader mode without causing conflicts with the DFU process? Specifically, we would appreciate recommendations on the following:
1] The correct sequence of operations for writing data to the internal flash memory while ensuring that DFU-related tasks are not affected.
2] Any alternative approaches we should consider for this purpose.
3] Any key considerations to keep in mind when saving configuration data prior to entering bootloader mode.