Hi,
I'm developing a BLE DFU controller with bluepy on a RPi3. The peripheral that is being updated is a nRF51 device on SDK 12.3.0, with the secure bootloader and experimental buttonless DFU service.
The script seems to DFU perfectly fine, and now I want to properly handle any faults/errors that can occur during the DFU process.
One big issue that I'm having occurs when I stop the DFU process after uploading the softdevice and bootloader completely, but before I've uploaded anything from the application. On the next connection to the Nordic device, when I select the init packet ([06 01]) I receive the offset for the length of the softdevice bootloader init packet. When I attempt to send the application OR the softdevice BIN file, on create object commands I receive responses [60 01 08]. I cannot seem to find anywhere in the documentation what error code '08' represents (unless I'm mistaken, this only goes up to 6?).
Here are some of my generated logs from my script:
sd_bl.dat [WRITE] ctrl --> 02 00 01 [RESPONSE] recv <-- 60 02 01 [WRITE] ctrl --> 06 01 [RESPONSE] recv <-- 60 06 01 00 01 00 00 95 00 00 00 a7 c8 66 94 [DFU] crc32.match. [WARNING] image.previously.sent.. [WARNING] initiating.execute.as.precaution [WRITE] ctrl --> 04 [RESPONSE] recv <-- 60 04 0a [WARNING] error.response.opcode.4 [WARNING] error.response.result.10 # Note that the below happens with application.dat too! sd_bl.bin [WRITE] ctrl --> 02 00 01 [RESPONSE] recv <-- 60 02 01 [WRITE] ctrl --> 06 02 [RESPONSE] recv <-- 60 06 01 00 10 00 00 00 00 00 00 00 00 00 00 [WRITE] ctrl --> 02 00 01 [RESPONSE] recv <-- 60 02 01 [WRITE] ctrl --> 01 02 00 10 00 00 [RESPONSE] recv <-- 60 01 08
I re-created the 'bad state' of the device as above and then used a phone with nRFConnect to DFU the device to see how this should be handled. Here are the logs I see:
[DFU] Notification received from [...], value (0x): 60-04-0A [DFU] Invalid system components. Trying to send application. Data written to [...], value (0x): 06-01 Data written to [...], value (0x): 02-00-00 Data written to [...], value (0x): 60-01-01 .. (now sends data objects) ..
However I tried sending these exact commands ([06, 01], [02, 00, 00], [60, 01, 01]) but still get the same response [60, 01, 08].
Any ideas or guidance on what is happening and how to handle this? I'm sure I'm missing something really simple in the protocol.