Flash Write Issue Before Entering Bootloader Mode in DFU Process

        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.

Parents
  • Hi!

    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.

    Make sure to wait for the fstorage_evt_handler callback, with id= NRF_FSTORAGE_EVT_WRITE_RESULT, and result =NRF_SUCCESS , before doing the reset.

  •         I am encountering an issue with the nrf_fstorage_erase() function while trying to erase flash memory. The function returns error code 1 (NRF_ERROR_SVC_HANDLER_MISSING) when called from the DFU event handler, but it works fine when executed in the main application.

           am I missing anything else required for flash write before entering bootloader?

  • Is it the function nrf_fstorage_erase() itself that return error code 1 ? Or do you get that in the fstorage_evt_handler() ?

  •     Previously, a flash write issue occurred when writing to flash memory during active application execution.

       The issue concerns writing data to flash memory while the application is running, specifically during the DFU (Device Firmware Update) process over BLE (Bluetooth Low Energy). The goal now is to write a data buffer (30 bytes) in the DFU handler (managing this flash write effectively)

    Steps Taken:

           I attempted to manage the flash write operation using power management techniques to avoid conflicts between the DFU event and the active application, but this approach did not work as expected.

Reply
  •     Previously, a flash write issue occurred when writing to flash memory during active application execution.

       The issue concerns writing data to flash memory while the application is running, specifically during the DFU (Device Firmware Update) process over BLE (Bluetooth Low Energy). The goal now is to write a data buffer (30 bytes) in the DFU handler (managing this flash write effectively)

    Steps Taken:

           I attempted to manage the flash write operation using power management techniques to avoid conflicts between the DFU event and the active application, but this approach did not work as expected.

Children
No Data
Related