esp-idf: [TW#26501] LE Connection fail rate 10-15% after enabling BT Modem sleep
Environment
- Development Kit: [none]
- Core (if using chip or module): [ESP32]
- IDF version: 93b588a0cf7dca19ea02c08e3773ecf8e908ed45
- Development Env: [Make]
- Operating System: [Windows]
- Power Supply: [USB]
Problem Description
After enabling Bluetooth Modem sleep we see a lot more LE Connect failures between ESP32’s. 10-15% of LE create connection fails. We are not using bluedroid. I have attached the HCI log which you can see all sent/received HCI commands.
The scenario looks like this: ESP32 Central: (Full log here acl_connect_fail.zip)
Received LE Create Connection (status: pending)
Received LE Connection Complete (status: success)
Received LE Disconnect Complete (status: 0x3e Failed to be established)
ESP32 Peripheral:
EMPTY - No Connection Events at all received from the Bluetooth controller
All connection parameters can be seen in the HCI LOG I have attached.
Edit: From what I have seen the last few days it seems as it’s a little more likely to happen the first connect after both devices where reset.
Expected Behavior
I know that it’s normal for BLE to every once in a while get a quick disconnect after a connection. However 10-15% seems a little much?
Actual Behavior
Less failed LE Create Connection.
Steps to repropduce
I have not tried this with example applications yet, but our application does not do much other than below.
- Normal LE Connect from ESP32 central to ESP32 Peripheral (Both with BT Modem sleep enabled)
- Repeat until my scenario explained above is reached. 10+ tries required. Sometimes more are needed.
Debug Logs
ESP32 Central acl_connect_fail.zip
Other items if possible
Dual mode BLE/Classic The application and Bluetooth stack is running on core 1 BT Controller is running on 0
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (2 by maintainers)
@jakkra,
Let me try to answer your first two questions. Here I think there is a difference in the definition between “connection creation” and “connection establishment”, according to Bluetooth Core Spec(v5.0).
As to the connection setup procedure, the spec says,
As to the HCI event LE_Connection_Complete, the core spec says:
Coming back to the HCI error code "CONNECTION FAILED TO BE ESTABLISHED(0x3E):
My explanation for this case is, for the initiator, the connection succeeds in “connection creation” but fails in “connection establishment”, therefore results in a Disconnect event with error code (0x3e) following the LE_Connection_Complete event. The process may be that the CONN_REQ PDU has been sent by the initiator, but the advertiser fails to receive the packet, and then link supervision timer on the initiator expires. This also explains why the periperhal side does not get an LE_Connection_Complete event at all.