failing to open gattc connection to ble device (ESP_GATT_CONN_FAIL_ESTABLISH and ESP_GATT_ERROR)

haircuts4men
Posts: 3
Joined: Fri Jan 12, 2024 2:39 pm

failing to open gattc connection to ble device (ESP_GATT_CONN_FAIL_ESTABLISH and ESP_GATT_ERROR)

Postby haircuts4men » Fri Jan 12, 2024 2:46 pm

github issue: https://github.com/espressif/esp-idf/issues/12970

IDF version: release/v5.2
Board: ESP-WROOM-32D

I am trying to connect my board to a DiFluid Microbalance scale that uses BLE. I used the bluedroid BLE gatt_client example as the base for my code with minor adaptations (I have ensured that the problem also happens on the original example), the only slightly substantial one being that I wait for ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT to arrive after calling esp_ble_gap_stop_scanning before connecting to the device, because i read in a potentially relevant github issue https://github.com/espressif/esp-idf/is ... -578377457 that it might help.

When calling esp_ble_gattc_open it sends back two events: ESP_GATTC_DISCONNECT_EVT with reason set to ESP_GATT_CONN_FAIL_ESTABLISH and ESP_GATTC_OPEN_EVT with status set to ESP_GATT_ERROR, in that order.

Here's a log with relevant traces set to DEBUG:

Code: Select all

I (1595) LUCAS: ESP_GATTC_REG_EVT
I (1605) LUCAS: registering gatt client, app_id: 0, if: 4
I (1605) main_task: Returned from app_main()
I (1615) LUCAS: ble scan started
I (1695) BT_BTM: BTM_CheckAdvData type=0x01
I (1695) BT_BTM: BTM_CheckAdvData type=0x19
I (1695) BT_BTM: BTM_CheckAdvData type=0x03
I (1795) BT_BTM: BTM_CheckAdvData type=0x01
I (1795) BT_BTM: BTM_InqDbRead: bd addr [f412fa10e846]

I (1795) BT_BTM: BTM_CheckAdvData type=0x01
I (1805) BT_BTM: BTM_CheckAdvData type=0x19
I (1805) BT_BTM: BTM_CheckAdvData type=0x03
I (1815) BT_BTM: BTM_CheckAdvData type=0x09
I (1815) LUCAS: found device "Microbalance 302069"
I (1825) LUCAS: ble scan stopped
I (1825) BT_GATT: GATT_Connect gatt_if=4
I (1835) BT_L2CAP: L2CA_ConnectFixedChnl() CID: 0x0004  BDA: f412fa10e846
I (1845) BT_BTM: BTM_InqDbRead: bd addr [f412fa10e846]

I (1845) BT_GATT: GATT_GetConnIdIfConnected status=0

W (2025) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e
W (2115) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e
W (2205) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e
I (2295) BT_GATT: GATT_GetConnIdIfConnected status=0

W (2295) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x3e
W (2305) BT_APPL: gattc_conn_cb: if=4 st=0 id=4 rsn=0x3e
W (2305) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e
E (2315) LUCAS: ESP_GATTC_DISCONNECT_EVT, reason = 0x3e
E (2315) LUCAS: ESP_GATTC_OPEN_EVT - status = 0x85

Who is online

Users browsing this forum: No registered users and 227 guests