I port the DFU OTA bootloader from 52840 to 52832. It is using:
- SDK v15.3.0
- SoftDevice S132 v6.1.1
- nrfUtil v5.0.0 to generate the zip package.
It is running on custom board. On PC side, I use nRFConnect for Desktop v3.4.1 with 52840 DK board.
I made all necessary changes to port it to 52832 (replaced the crypto to micro_ecc, updated sdk_config.h, added libraries, etc.). It works fine on 52840, however, I got this error on 52832.
It connects and started sending, and then the error occurred during the first "EXECUTE" command.
First, I got EXECUTE error, INVALID_OBJECT. Then I implemented the suggestion here: https://devzone.nordicsemi.com/f/nordic-q-a/51088/dfu-execute-code-4-failed-result-code-5
I still got the same EXECUTE error, but now it's because of different cause - Insufficient Resources.
Found the issue with the spread out of the hex file (gap in the middle). It's fixed now.
Now, I got this SELECT error.
DFU failed with error: When writing 'SELECT' command to Control Point Characteristic of DFU Target: Could not write SELECT command: Device disconnected.
2020-07-17T21:24:48.787Z DEBUG GATTC_EVT_WRITE_RSP time:2020-07-17T21:24:48.788Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:15 writeOp:1 offset:0 len:0
2020-07-17T21:24:48.787Z INFO Attribute value changed, handle: 0x0F, value (0x): 04
2020-07-17T21:24:48.929Z DEBUG 901/ 0 <- [02 39 00 00 00 00 00 00 00 0f 00 01 03 00 60 04 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:4 ack#:3 payload_length:11 data_integrity:1 header_checksum:5 err_code:0x0
2020-07-17T21:24:48.929Z DEBUG 904 -> [N/A] type: ACK reliable: no seq#:0 ack#:5 payload_length:0 data_integrity:0 err_code:0x0
2020-07-17T21:24:48.930Z DEBUG GATTC_EVT_HVX time:2020-07-17T21:24:48.930Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:15 type:1 len:3
2020-07-17T21:24:48.930Z INFO Attribute value changed, handle: 0x0F, value (0x): 60-04-01
2020-07-17T21:24:48.944Z DEBUG 905 -> [00 9c 00 00 01 01 00 0f 00 00 00 02 00 01 06 02 ] type: VENDOR_SPECIFIC reliable:yes seq#:3 ack#:5 payload_length:10 data_integrity:1 header_checksum:6 err_code:0x0
2020-07-17T21:24:48.976Z DEBUG 902/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:4 payload_length:0 data_integrity:0 err_code:0x0
2020-07-17T21:24:48.976Z DEBUG 903/ 0 <- [01 9c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:5 ack#:4 payload_length:6 data_integrity:1 header_checksum:ad err_code:0x0
2020-07-17T21:24:48.977Z DEBUG 906 -> [N/A] type: ACK reliable: no seq#:0 ack#:6 payload_length:0 data_integrity:0 err_code:0x0
2020-07-17T21:24:54.974Z DEBUG 904/ 0 <- [02 11 00 00 00 08 ] type: VENDOR_SPECIFIC reliable:yes seq#:6 ack#:4 payload_length:6 data_integrity:1 header_checksum:ac err_code:0x0
2020-07-17T21:24:54.974Z DEBUG 907 -> [N/A] type: ACK reliable: no seq#:0 ack#:7 payload_length:0 data_integrity:0 err_code:0x0
2020-07-17T21:24:54.974Z DEBUG GAP_EVT_DISCONNECTED time:2020-07-17T21:24:54.975Z connHandle:0 reason:8 reasonName:connectionTimeout
2020-07-17T21:24:54.974Z DEBUG Destroying DFU transport.
2020-07-17T21:24:54.974Z ERROR DFU failed with error: When writing 'SELECT' command to Control Point Characteristic of DFU Target: Could not write SELECT command: Device disconnected.
Update:
I found that I can make it work if I load debug build (running independently), and connect J-Link to the board to open RTT channel (via J-Link RTT Viewer).
Any idea? Is it the debug log level? Or something is waiting for RTT channel to open?
Weird thing is, this very same source code runs fine on 52840 custom board.