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:
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