the reasons of BLE disconnection

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
nigelyang
Offline
Last seen:1 month 5 days ago
Joined:2018-03-20 08:24
the reasons of BLE disconnection

hi Dialog,

I am developing my project based on "ble_sps_peripheral" project code. The disconnection of ble communication caused by unknown reasons frequently. I monitored my system by RTT viewer and got the error log as below.
"handle_disconnected: conn_idx=0000 address=4a:a8:62:20:b2:4b reason=31" and sometime reason =8. Could you tell me what meaning of reason=8 or =31? where can i find the all reasons' meanings?

thanks for your answer.

Device:
PM_Dialog
Offline
Last seen:1 day 12 hours ago
Staff
Joined:2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

These messages are placed into the controller code, so you are able to find the reasons’ meaning into the ble_hci_error_t structure of the ble_common.h header file. The 0x08 (BLE_HCI_ERROR_CON_TIMEOUT) is a connection timeout, so either the peripheral or the central didn’t coordinate into the supervision timeout during connection, and the result they disconnected automatically. The 31 = 0x1f (BLE_HCI_ERROR_UNSPECIFIED_ERROR) is an unspecified error might be due for window widening becoming too high. I strongly suggest you to add the following definitions into the ble_config.h header file and increase the supervision timeout (the default is 1 second) and optionally the connection intervals.

#define defaultBLE_PPCP_INTERVAL_MIN (BLE_CONN_INTERVAL_FROM_MS(10)) // 10ms

#define defaultBLE_PPCP_INTERVAL_MAX (BLE_CONN_INTERVAL_FROM_MS(20)) // 20ms

#定义defaultBLE_PPCP_SLAVE_LATENCY (0) / / number of events

#define defaultBLE_PPCP_SUP_TIMEOUT (BLE_SUPERVISION_TMO_FROM_MS(1000)) // 1s

Thanks, PM_Dialog