Hi!
Some prerequisite info:
- We are using nrf52840 boards as our peripherals
- We are using v16.0.0 SDK
- We are using the s113 SoftDevice, more specifically s113_nrf52_7.0.1_softdevice.
- Since our central code is written in .NET Core, we use Windows.Devices.Bluetooth to take care of the PC side of the bluetooth.
Now onto my question:
Our peripherals are now Secure Buttonless DFU (without bonds) ready, and we can successfully do the DFU OTA process with .NET CORE code that I have written with the help of this link. The code follows the infographics in the link, and through events raised by listening to the notifications of the DFU control point, we successfully utilize the DFU protocol.
Our problem is that we almost consistenly (around 80-85%) fail upon the first data chunk CRC check- meaning, in the data portion of the DFU procedure shown in the infographic in the link above, I send the first data chunk of 4096 bytes, and then send a "Calculate CRC" command (opcode 3) to the Control point. Checking the received CRC and offset almost consistently returns an incorrect CRC or offset (expected an offset of 4096, usually receive one between 4010 and 4093). For all DFUs that fail at this point, resending the Create command (01 02 packet_size) on the first packet again always corrects this, and the DFU continues and finishes as wanted and expected, and the software seems functional.
A Step-by-Step Example in case my explanation was unclear:
- Connect to a device with the "Buttonless DFU without bonds" Characteristic (UUID - 0x8EC90003-F315-4F60-9FB8-838830DAEA50)
- Indicate the characteristic, and send the "Enter DFU command" (opcode 1, no data besides).
- Reconnect to the "DfuTarg" device, with the original address + 1, and the DFU Control and Data Points.
- Successfully do the entire Init packet part described in the link above.
- Send a select command for the data part.
- Send a create command for the first data chunk (4096 bytes).
- Do data transfer of first chunk (no response as per the link)
- Send "Calculate CRC" command, and the check fails (as previously explained- the offset is usually 4010-4093, as opposed to 4096).
- Resend create + transfer of the first chunk.
- The rest of the DFU continues and finished without glitches or errors.
What am I doing wrong? Is it a timing issue?
Thanks!
Roi