Buttonless DFU connect timeout issue on custom board

Hi,

I followed the DFU to SDK example post on https://www.u-blox.com/en/docs/UBX-19050198 to add Buttonless DFU to an application (I modified \ble_peripheral\ble_app_hrs). The details of firmware updates and HEX file generation are in section 5. Then All the testing in section 6 is successful when I used nRF52832DK to test uploading new version hrs application though buttonless DFU (using nRFconnect and another DK). The SDK I used is 17.0.2.

Then I repeated everything on my custom nRF52832 board, with the same changes applied to my custom application.

I also updated the secure bootloader under “\examples\dfu\secure_bootloader” for my custom board to generate “secure_bootloader_ble_s132_custom.hex”. The main changes are (1) Replace board.c, board.h (remove all the buttons and unused LEDs related code, since my board has no button and only two LEDs), add custom_board.h. (2) Changed softdevice clock setting macros in sdk_config.h, since I do not use external 32MHz crystal.  The bootloader was tested successfully with my customer board. I can see “DfuTarg” as the advertising name. OTA firmware upload is successful with my custom application .zip file (generated with command “nrfutil pkg generate --application custom.hex --application-version-string "2.0.0" --hw-version 52 --sd-req 0x101 --key-file private.key app_v2.zip”)

However, after I generated the combined .hex following steps in section 5, (merge bl_setting.hex, such successfully tested bootloader, softdevice image, and my updated application), downloaded such combined .hex file to my custom board. Recycle power and connect my custom board and application through nRF connect, click DFU button and start OTA uploading, the DFU always gives a message says “dfu failed with error: connect time out” after about 10 seconds waiting.

The downloaded .hex file (bl_set_s132_app.hex) is generated as below

  • nrfutil settings generate --family NRF52 --application custom.hex --application-version-string "1.2.3" --bootloader-version 0 --bl-settings-version 2 bl_setting.hex
  • mergehex --merge bl_setting.hex secure_bootloader_ble_s132_custom.hex s132_nrf52_7.2.0_softdevice.hex --output bl_set_s132.hex
  • mergehex --merge bl_set_s132.hex custom.hex --output bl_set_s132_app.hex

Then I download to custom board though

  • nrfjprog -f nrf52 –recover
  • nrfjprog --program bl_set_s132_app.hex

The .zip file for uploading though buttonless DFU is generated as below.

nrfutil pkg generate --application custom.hex --application-version-string "2.0.0" --hw-version 52 --sd-req 0x101 --key-file private.key app_v2.zip

Since I did exactly the same changes and everything is working on nRF52832DK, may I know what is the possible cause of such “connect time out” issue on my customer board? For example, does bootloader use a timer and accidently occupied by my customer application? It could explain why modified secure_bootloader can do OTA upload successfully, but DFU button on my application has time out error. If so, how to check that?

I already tried method (add “do while” to  sd_ble_gatts_hvx) following the link https://devzone.nordicsemi.com/f/nordic-q-a/38655/buttonless-dfu-sdk-14-2-dfu-failed-with-error

But it still does not working for me.

Appreciate all the helps and suggestions.

Parents
  • I post the log details below for such failure (since "Found unbonded buttonless characteristic").

    2021-11-19T13:10:55.383Z DEBUG GATTC_EVT_DESC_DISC_RSP time:2021-11-19T13:10:55.383Z connHandle:0 gattStatus:257 gattStatusName:atterrInvalidHandle errorHandle:10 count:0 descs:[]
    2021-11-19T13:10:55.383Z DEBUG findCharacteristic: Found characteristic ID 5D:2A:F3:34:9E:C2.0.5.8
    2021-11-19T13:10:55.383Z DEBUG Found unbonded buttonless characteristic: 5D:2A:F3:34:9E:C2.0.5.8
    2021-11-19T13:10:55.384Z DEBUG 204 -> [00 9c 00 00 01 01 00 15 00 00 00 02 00 01 02 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:1 ack#:2 payload_length:10 data_integrity:1 header_checksum:20 err_code:0x0
    2021-11-19T13:10:55.385Z DEBUG 201/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:2 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.386Z DEBUG 202/ 0 <- [01 9c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:2 payload_length:6 data_integrity:1 header_checksum:c0 err_code:0x0
    2021-11-19T13:10:55.386Z DEBUG 205 -> [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.582Z DEBUG 203/ 0 <- [02 38 00 00 00 00 00 00 00 15 00 01 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:3 ack#:2 payload_length:10 data_integrity:1 header_checksum:1e err_code:0x0
    2021-11-19T13:10:55.583Z DEBUG 206 -> [N/A] type: ACK reliable: no seq#:0 ack#:4 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.583Z DEBUG GATTC_EVT_WRITE_RSP time:2021-11-19T13:10:55.583Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:21 writeOp:1 offset:0 len:0
    2021-11-19T13:10:55.583Z INFO Attribute value changed, handle: 0x15, value (0x): 02-00
    2021-11-19T13:10:55.586Z DEBUG 207 -> [00 9c 00 00 01 01 00 14 00 00 00 01 00 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:4 payload_length:f data_integrity:1 header_checksum:20 err_code:0x0
    2021-11-19T13:10:55.586Z DEBUG 204/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.587Z DEBUG 205/ 0 <- [01 9c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:4 ack#:3 payload_length:6 data_integrity:1 header_checksum:b6 err_code:0x0
    2021-11-19T13:10:55.587Z DEBUG 208 -> [N/A] type: ACK reliable: no seq#:0 ack#:5 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.782Z DEBUG 206/ 0 <- [02 38 00 00 00 00 00 00 00 14 00 01 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:5 ack#:3 payload_length:10 data_integrity:1 header_checksum:14 err_code:0x0
    2021-11-19T13:10:55.783Z DEBUG 209 -> [N/A] type: ACK reliable: no seq#:0 ack#:6 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.783Z DEBUG GATTC_EVT_WRITE_RSP time:2021-11-19T13:10:55.783Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:20 writeOp:1 offset:0 len:0
    2021-11-19T13:10:55.783Z INFO Attribute value changed, handle: 0x14, value (0x): 01
    2021-11-19T13:10:55.784Z DEBUG 207/ 0 <- [02 39 00 00 00 00 00 00 00 14 00 02 03 00 20 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:6 ack#:3 payload_length:11 data_integrity:1 header_checksum:3 err_code:0x0
    2021-11-19T13:10:55.784Z DEBUG 210 -> [N/A] type: ACK reliable: no seq#:0 ack#:7 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.784Z DEBUG GATTC_EVT_HVX time:2021-11-19T13:10:55.784Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:20 type:2 len:3
    2021-11-19T13:10:55.784Z INFO Attribute value changed, handle: 0x14, value (0x): 20-01-01
    2021-11-19T13:10:55.784Z DEBUG 211 -> [00 9d 00 00 14 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:3 ack#:7 payload_length:6 data_integrity:1 header_checksum:97 err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG Waiting for target device to disconnect.
    2021-11-19T13:10:55.785Z DEBUG 208/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:4 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG 209/ 0 <- [01 9d 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:7 ack#:4 payload_length:6 data_integrity:1 header_checksum:ab err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG 212 -> [N/A] type: ACK reliable: no seq#:0 ack#:0 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG 210/ 0 <- [02 11 00 00 00 08 ] type: VENDOR_SPECIFIC reliable:yes seq#:0 ack#:4 payload_length:6 data_integrity:1 header_checksum:b2 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG 213 -> [N/A] type: ACK reliable: no seq#:0 ack#:1 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG GAP_EVT_DISCONNECTED time:2021-11-19T13:10:59.983Z connHandle:0 reason:8 reasonName:connectionTimeout
    2021-11-19T13:10:59.983Z DEBUG Received disconnection event for target device.
    2021-11-19T13:10:59.984Z DEBUG New address for DFU target: 5D:2A:F3:34:9E:C3
    2021-11-19T13:10:59.984Z DEBUG Connecting to address: 5D:2A:F3:34:9E:C3, type: BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE.
    2021-11-19T13:10:59.994Z DEBUG 214 -> [00 8c 01 04 c3 9e 34 f3 2a 5d 01 01 a0 00 50 00 14 00 01 06 00 06 00 00 00 90 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:4 ack#:1 payload_length:1c data_integrity:1 header_checksum:65 err_code:0x0
    2021-11-19T13:10:59.995Z DEBUG 211/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:5 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.996Z DEBUG 212/ 0 <- [01 8c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:1 ack#:5 payload_length:6 data_integrity:1 header_checksum:a9 err_code:0x0
    2021-11-19T13:10:59.996Z DEBUG 215 -> [N/A] type: ACK reliable: no seq#:0 ack#:2 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG 213/ 0 <- [02 1b 00 ff ff 02 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:5 payload_length:6 data_integrity:1 header_checksum:a8 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG 216 -> [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG GAP_EVT_TIMEOUT time:2021-11-19T13:11:19.996Z connHandle:65535 src:2 srcName:bleGapTimeoutSrcConn
    2021-11-19T13:11:20.004Z INFO Connection to device timed out
    2021-11-19T13:11:20.005Z DEBUG Destroying DFU transport.
    2021-11-19T13:11:20.005Z ERROR DFU failed with error: Connect timed out..

Reply
  • I post the log details below for such failure (since "Found unbonded buttonless characteristic").

    2021-11-19T13:10:55.383Z DEBUG GATTC_EVT_DESC_DISC_RSP time:2021-11-19T13:10:55.383Z connHandle:0 gattStatus:257 gattStatusName:atterrInvalidHandle errorHandle:10 count:0 descs:[]
    2021-11-19T13:10:55.383Z DEBUG findCharacteristic: Found characteristic ID 5D:2A:F3:34:9E:C2.0.5.8
    2021-11-19T13:10:55.383Z DEBUG Found unbonded buttonless characteristic: 5D:2A:F3:34:9E:C2.0.5.8
    2021-11-19T13:10:55.384Z DEBUG 204 -> [00 9c 00 00 01 01 00 15 00 00 00 02 00 01 02 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:1 ack#:2 payload_length:10 data_integrity:1 header_checksum:20 err_code:0x0
    2021-11-19T13:10:55.385Z DEBUG 201/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:2 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.386Z DEBUG 202/ 0 <- [01 9c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:2 payload_length:6 data_integrity:1 header_checksum:c0 err_code:0x0
    2021-11-19T13:10:55.386Z DEBUG 205 -> [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.582Z DEBUG 203/ 0 <- [02 38 00 00 00 00 00 00 00 15 00 01 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:3 ack#:2 payload_length:10 data_integrity:1 header_checksum:1e err_code:0x0
    2021-11-19T13:10:55.583Z DEBUG 206 -> [N/A] type: ACK reliable: no seq#:0 ack#:4 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.583Z DEBUG GATTC_EVT_WRITE_RSP time:2021-11-19T13:10:55.583Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:21 writeOp:1 offset:0 len:0
    2021-11-19T13:10:55.583Z INFO Attribute value changed, handle: 0x15, value (0x): 02-00
    2021-11-19T13:10:55.586Z DEBUG 207 -> [00 9c 00 00 01 01 00 14 00 00 00 01 00 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:4 payload_length:f data_integrity:1 header_checksum:20 err_code:0x0
    2021-11-19T13:10:55.586Z DEBUG 204/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.587Z DEBUG 205/ 0 <- [01 9c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:4 ack#:3 payload_length:6 data_integrity:1 header_checksum:b6 err_code:0x0
    2021-11-19T13:10:55.587Z DEBUG 208 -> [N/A] type: ACK reliable: no seq#:0 ack#:5 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.782Z DEBUG 206/ 0 <- [02 38 00 00 00 00 00 00 00 14 00 01 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:5 ack#:3 payload_length:10 data_integrity:1 header_checksum:14 err_code:0x0
    2021-11-19T13:10:55.783Z DEBUG 209 -> [N/A] type: ACK reliable: no seq#:0 ack#:6 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.783Z DEBUG GATTC_EVT_WRITE_RSP time:2021-11-19T13:10:55.783Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:20 writeOp:1 offset:0 len:0
    2021-11-19T13:10:55.783Z INFO Attribute value changed, handle: 0x14, value (0x): 01
    2021-11-19T13:10:55.784Z DEBUG 207/ 0 <- [02 39 00 00 00 00 00 00 00 14 00 02 03 00 20 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:6 ack#:3 payload_length:11 data_integrity:1 header_checksum:3 err_code:0x0
    2021-11-19T13:10:55.784Z DEBUG 210 -> [N/A] type: ACK reliable: no seq#:0 ack#:7 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.784Z DEBUG GATTC_EVT_HVX time:2021-11-19T13:10:55.784Z connHandle:0 gattStatus:0 gattStatusName:success errorHandle:0 handle:20 type:2 len:3
    2021-11-19T13:10:55.784Z INFO Attribute value changed, handle: 0x14, value (0x): 20-01-01
    2021-11-19T13:10:55.784Z DEBUG 211 -> [00 9d 00 00 14 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:3 ack#:7 payload_length:6 data_integrity:1 header_checksum:97 err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG Waiting for target device to disconnect.
    2021-11-19T13:10:55.785Z DEBUG 208/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:4 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG 209/ 0 <- [01 9d 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:7 ack#:4 payload_length:6 data_integrity:1 header_checksum:ab err_code:0x0
    2021-11-19T13:10:55.785Z DEBUG 212 -> [N/A] type: ACK reliable: no seq#:0 ack#:0 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG 210/ 0 <- [02 11 00 00 00 08 ] type: VENDOR_SPECIFIC reliable:yes seq#:0 ack#:4 payload_length:6 data_integrity:1 header_checksum:b2 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG 213 -> [N/A] type: ACK reliable: no seq#:0 ack#:1 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.983Z DEBUG GAP_EVT_DISCONNECTED time:2021-11-19T13:10:59.983Z connHandle:0 reason:8 reasonName:connectionTimeout
    2021-11-19T13:10:59.983Z DEBUG Received disconnection event for target device.
    2021-11-19T13:10:59.984Z DEBUG New address for DFU target: 5D:2A:F3:34:9E:C3
    2021-11-19T13:10:59.984Z DEBUG Connecting to address: 5D:2A:F3:34:9E:C3, type: BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE.
    2021-11-19T13:10:59.994Z DEBUG 214 -> [00 8c 01 04 c3 9e 34 f3 2a 5d 01 01 a0 00 50 00 14 00 01 06 00 06 00 00 00 90 01 01 ] type: VENDOR_SPECIFIC reliable:yes seq#:4 ack#:1 payload_length:1c data_integrity:1 header_checksum:65 err_code:0x0
    2021-11-19T13:10:59.995Z DEBUG 211/ 0 <- [N/A] type: ACK reliable: no seq#:0 ack#:5 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:10:59.996Z DEBUG 212/ 0 <- [01 8c 00 00 00 00 ] type: VENDOR_SPECIFIC reliable:yes seq#:1 ack#:5 payload_length:6 data_integrity:1 header_checksum:a9 err_code:0x0
    2021-11-19T13:10:59.996Z DEBUG 215 -> [N/A] type: ACK reliable: no seq#:0 ack#:2 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG 213/ 0 <- [02 1b 00 ff ff 02 ] type: VENDOR_SPECIFIC reliable:yes seq#:2 ack#:5 payload_length:6 data_integrity:1 header_checksum:a8 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG 216 -> [N/A] type: ACK reliable: no seq#:0 ack#:3 payload_length:0 data_integrity:0 err_code:0x0
    2021-11-19T13:11:19.996Z DEBUG GAP_EVT_TIMEOUT time:2021-11-19T13:11:19.996Z connHandle:65535 src:2 srcName:bleGapTimeoutSrcConn
    2021-11-19T13:11:20.004Z INFO Connection to device timed out
    2021-11-19T13:11:20.005Z DEBUG Destroying DFU transport.
    2021-11-19T13:11:20.005Z ERROR DFU failed with error: Connect timed out..

Children
No Data
Related