esp32-snippets
esp32-snippets copied to clipboard
RFH: Can't connect to BLE device.
ESP32, arduino platform. I have a task blocked on connect and a different task (watchdog) that would kill the connect one after time out. Basically something like the example here
I think the device is not properly behaving and the log shows:
[V][BLEClient.cpp:97] connect(): >> connect(ef:2d:1e:49:30:46)
[I][BLEDevice.cpp:614] addPeerDevice(): add conn_id: 0, GATT role: client
[V][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegEvt (0x3ffbaf78), owner: <N/A> for connect
[V][FreeRTOS.cpp:198] take(): Semaphore taken: name: RegEvt (0x3ffbaf78), owner: connect
[V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 0
[V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: RegEvt (0x3ffbaf78), owner: connect for connect
[D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
[V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 0
[V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: Unknown
[V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 0
[D][BLEClient.cpp:177] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
[V][FreeRTOS.cpp:143] give(): Semaphore giving: name: RegEvt (0x3ffbaf78), owner: connect
[V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: RegEvt (0x3ffbaf78), owner: <N/A>
[V][FreeRTOS.cpp:189] take(): Semaphore taking: name: OpenEvt (0x3ffbafdc), owner: <N/A> for connect
[V][FreeRTOS.cpp:198] take(): Semaphore taken: name: OpenEvt (0x3ffbafdc), owner: connect
[V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: OpenEvt (0x3ffbafdc), owner: connect for connect
*** timeout (TASK KILL) happens here ****
*** the following events follow immediately the TaskKill ***
[V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 41
[D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
[V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 41
[V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: Unknown
Suspicious: the part where gattClientEventHandler [esp_gatt_if: 4] ... Unknown
Also suspicious: event type 41 (ESP_GATTC_DISCONNECT_EVT) right immediately after the task::kill. If the client never connected, why it's observing disconnection?
Possible race condition due to BLE device mis-behaving?