We are using NRF52840 with Softdevice 340 and several sensors connected via ANT and BLE. NRF is connected to STM32 via serial UART connection and use ANT serial protocol for communication.
To implement firmware update, NRF use buttonless DFU method to enter bootloader and wait for new firmware from STM via serial transport.
When trying to update DFU settings, nrf_dfu_settings_write() returns SUCCESS, but the flash write operation is never successful. The issue is that softdevice is not able to successfully complete nrf_dfu_flash_erase() which is called internally by nrf_dfu_settings_write(). Softdevice always response with NRF_EVT_FLASH_OPERATION_ERROR in nrf_fstorage_sys_evt_handler().
This issue is seen only when there is no ANT/BLE activity. When power meter is connected via ANT, nrf_dfu_settings_write() works as expected and softdevice returns NRF_EVT_FLASH_OPERATION_SUCCESS.
I would expect that softdevice can be busy when there is any ANT or BLE activity, but in this case softdevice refuse to write to flash when there is no wireless connection. That is not expected.
Tried playing with NRF_FSTORAGE_SD_MAX_RETRIES and NRF_FSTORAGE_SD_MAX_WRITE_SIZE, but this has no effect. During my testing, I was waiting for up to 5 seconds for softdevice to complete the flash erase operation. Should I wait more?
In what cases softdevice may need more than 5 seconds to erase single flash page when it is not loaded by wireless activities?