What do the acl_disconn_cmpl_stat error codes mean?

InfiniteArray
Posts: 9
Joined: Wed Jun 12, 2024 8:29 am

What do the acl_disconn_cmpl_stat error codes mean?

Postby InfiniteArray » Wed Jun 12, 2024 8:36 am

I am currently debugging an issue while trying to connect an ESP32 with a Meta Quest 3. The pairing is successful, but then is always terminated 3 seconds later. Setting the error log to verbose gives me:

[ 41477][BluetoothSerial.cpp:609] esp_bt_gap_cb(): ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT ACL disconnection complete status event: reason 278, handle 129

According to ChatGTP, reason 278 is 0x116 which stands for "Connection Terminated Due to MIC Failure." however, no such error exists in Espressif's list of error codes https worse yet, 0x116 isn't even a valid error code according to the list.

I have tried plugging "278" into the esp_err_to_name function but all it returns is "ERROR".

What does "ACL disconnection complete status event: reason 278" mean?

Many thanks!
IA

InfiniteArray
Posts: 9
Joined: Wed Jun 12, 2024 8:29 am

Re: What do the acl_disconn_cmpl_stat error codes mean?

Postby InfiniteArray » Thu Jun 13, 2024 2:25 pm

Some additional information, I installed the ESP-IDF and ran the bt_spp_acceptor demo. With that, the output was:

Code: Select all

I (1157) SPP_ACCEPTOR_DEMO: ESP_SPP_INIT_EVT
I (1167) SPP_ACCEPTOR_DEMO: ESP_SPP_START_EVT handle:129 sec_id:55 scn:1
I (1177) SPP_ACCEPTOR_DEMO: event: 10
I (1177) SPP_ACCEPTOR_DEMO: Own address:[08:3a:8d:0d:93:16]
I (1187) main_task: Returned from app_main()
W (27077) BT_HCI: hcif conn complete: hdl 0x81, st 0x0
I (27087) SPP_ACCEPTOR_DEMO: event: 16
W (27087) BT_HCI: hcif link supv_to changed: hdl 0x81, supv_to 8000
I (27367) SPP_ACCEPTOR_DEMO: ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: 903415
I (32347) SPP_ACCEPTOR_DEMO: authentication success: Meta Quest 3 bda:[c0:dd:8a:82:a6:c7]
W (36387) BT_HCI: hci cmd send: disconnect: hdl 0x81, rsn:0x13
W (36457) BT_HCI: hcif disc complete: hdl 0x81, rsn 0x16
I (36457) SPP_ACCEPTOR_DEMO: event: 17
We can see that the Meta Quest 3 successfully authenticated, but then shortly after:

Code: Select all

W (36387) BT_HCI: hci cmd send: disconnect: hdl 0x81, rsn:0x13
W (36457) BT_HCI: hcif disc complete: hdl 0x81, rsn 0x16
hdl 0x81 probably stands for handle 0x81 and refers to the connection but what does "rsn: 0x13" stand for?
This also isn't one of the defined ESP32 error codes.

InfiniteArray
Posts: 9
Joined: Wed Jun 12, 2024 8:29 am

Re: What do the acl_disconn_cmpl_stat error codes mean?

Postby InfiniteArray » Thu Jun 13, 2024 2:34 pm

Sorry for double-post but ChatGTP served up the answer:
0x13 is from the Bluetooth Specification and indicates that the remote user terminated the connection.

At this point I am led to conclude that it is not the ESP32 that is disconnecting but the Quest 3. The 0x119 may also be related to Bluetooth rather than espressif, though the Bluetooth Core spec does not mention it.

FiwiDev
Posts: 22
Joined: Wed Jan 22, 2020 12:32 am

Re: What do the acl_disconn_cmpl_stat error codes mean?

Postby FiwiDev » Mon Jul 29, 2024 10:15 pm

InfiniteArray wrote:
Wed Jun 12, 2024 8:36 am
I am currently debugging an issue while trying to connect an ESP32 with a Meta Quest 3. The pairing is successful, but then is always terminated 3 seconds later. Setting the error log to verbose gives me:

[ 41477][ I ][BluetoothSerial.cpp:609] esp_bt_gap_cb(): ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT ACL disconnection complete status event: reason 278, handle 129

According to ChatGTP, reason 278 is 0x116 which stands for "Connection Terminated Due to MIC Failure." however, no such error exists in Espressif's list of error codes https worse yet, 0x116 isn't even a valid error code according to the list.

I have tried plugging "278" into the esp_err_to_name function but all it returns is "ERROR".

What does "ACL disconnection complete status event: reason 278" mean?

Many thanks!
IA
Ah ChatGPT, where all wisdom in the planet originated....LOL!


A simple traceback of the data types from BluetoothSerial.cpp:609 shows that the enum type in question is "esp_bt_status_t":
Untitled.png
Untitled.png (31.55 KiB) Viewed 1039 times
Chasing down the definition of "esp_bt_status_t" (simple F12 or two from VSCode) leads us to "esp_bt_defs.h", where we find that "278" corresponds to ESP_BT_STATUS_HCI_CONN_CAUSE_LOCAL_HOST.
Untitled2.png
Untitled2.png (36.86 KiB) Viewed 1039 times
https://github.com/espressif/esp-idf/bl ... defs.h#L71
--or same file in Arduino-ESP32 v3.x--
https://github.com/espressif/esp32-ardu ... defs.h#L71

Unfortunately, I came across this thread searching for a solution to the exact same error, so......I'm afraid I don't have the solution to the problem. Just an actual answer (probably soon to be parroted by dumb ChatGPT) to the original question.

FiwiDev
Posts: 22
Joined: Wed Jan 22, 2020 12:32 am

Re: What do the acl_disconn_cmpl_stat error codes mean?

Postby FiwiDev » Mon Jul 29, 2024 10:19 pm

gonna be a LOT more difficult to trace down the HCI error code, because no enum types are provided:
https://github.com/espressif/esp-idf/bl ... mds.c#L192

You'd have to modify the code to add an assert and backtrace to figure out the call stack...

Who is online

Users browsing this forum: Google [Bot] and 134 guests