I have an iOS App which is just designed for updating our device firmware OTA. It uses the Nordic DFU library, updated to the latest cocoapod. It connects to our device, and then starts DFU with the library.
In the firmware I'm using S132 v7.0.1 SDK 16.0.0 on nRF52832.
Because the device has not connected before, when the library writes the enter bootloader command the device starts a new bond. This is written to flash on the device, but it seems that sometimes the buttonless DFU library attempts to set the bond info in the bootloader before the peer manager has finished writing to flash.
The log:
I have added some additional logs here that are not in the buttonless DFU by default to print the relevant error codes. Stepping through what is happening:
- Bonding occurs
- The buttonless lib attempts to write peer data to bootloader (1 = svci state = initialized)
- As state is initialized, in nrf_dfu_svci_handler.c line 84 peer data write is attempted
- In nrf_dfu_settings_svci.c line 83 sd_flash_write returns NRF_ERROR_BUSY
- This is returned to buttonless lib (failed to set peer data error 0x11 == 17 == NRF_ERROR_BUSY)
- Peer manager handler indicates peer data write is complete (central address resolution)
Is there any way to prevent this? It seems like it is something that should be handled in the SDK.