Replies: 1 comment
|
Hi, did you get this solved? I'm facing similar problem, after conn_id 255 the program just hangs. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone!
Here's my scenario, I've a ESP32 (ESP32-DevKit board) that connects to a server (always the same), fetch some data and disconnect from it, the connection and disconnection is initiated by my code. This connect/disconnect loop is done several times during the day because the server isn't always close.
After some time I've noticed that the code hanged at
bleClient->connect(advDevice);, enabling CORE_DEBUG_LEVEL to show INFO logs I've found out that the code hangs when m_appId reaches 255 because the last log output is:[BLEDevice.cpp:623] addPeerDevice(): add conn_id: 1, GATT role: clientLooks like m_appId/conn_id increments every time a connection is made and it never decrementes.
I've changed CORE_DEBUG_LEVEL to VERBOSE to get more details:
[2096656][V][BLEClient.cpp:98] connect(): >> connect(ea:10:d6:ed:8d:68)
[2096662][I][BLEDevice.cpp:623] addPeerDevice(): add conn_id: 255, GATT role: client
[2096670][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegEvt (0x3ffe9e60), owner: <N/A> for connect
[2096680][V][FreeRTOS.cpp:198] take(): Semaphore taken: name: RegEvt (0x3ffe9e60), owner: connect
[2096689][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: RegEvt (0x3ffe9e60), owner: connect for connect
[2096689][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_REG_EVT
[2096710][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_EVT
[2096718][V][BLEUtils.cpp:1444] dumpGattClientEvent(): [status: ESP_GATT_OK, app_id: 0xff]
[2096726][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_REG_EVT
[2096737][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: RegEvt (0x3ffe9e60), owner: connect
[2096746][V][FreeRTOS.cpp:77] wait(): << wait: Semaphore released: name: RegEvt (0x3ffe9e60), owner: <N/A>
[2096756][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: OpenEvt (0x3ffe9304), owner: <N/A> for connect
[2096765][V][FreeRTOS.cpp:198] take(): Semaphore taken: name: OpenEvt (0x3ffe9304), owner: connect
[2096775][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: OpenEvt (0x3ffe9304), owner: connect for connect
[2098640][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CONNECT_EVT
[2098651][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_CONNECT_EVT
[2098660][V][BLEUtils.cpp:1311] dumpGattClientEvent(): [conn_id: 0, remote_bda: ea:10:d6:ed:8d:68]
[2098669][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CONNECT_EVT
[2098680][D][BLEDevice.cpp:607] updatePeerDevice(): update conn_id: 255, GATT role: client
[2098689][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_OPEN_EVT
[2098700][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_OPEN_EVT
[2098708][V][BLEUtils.cpp:1402] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, remote_bda: ea:10:d6:ed:8d:68, mtu: 23]
[2099522][V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 46
[2099521][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
[2099542][V][BLEUtils.cpp:951] gattClientEventTypeToString(): Unknown GATT Client event type: 46
[2099542][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: Unknown
[2099558][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CFG_MTU_EVT
[2099569][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_CFG_MTU_EVT
[2103791][V][BLEUtils.cpp:1049] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT
[2103801][V][BLEUtils.cpp:1253] dumpGapEvent(): [status: 0, bd_addr: ea:10:d6:ed:8d:68, min_int: 16, max_int: 60, latency: 0, conn_int: 60, timeout: 400]
[2103815][D][BLEClient.cpp:493] handleGAPEvent(): BLEClient ... handling GAP event!
Looks like the code is waiting for the OpenEvt semaphore that usually is given at ESP_GATTC_OPEN_EVT that never happens.
But why?
Additional information, once the code disconnects from the server with
bleClient->disconnect()then I check forbleClient->isConnected()beforeBLEDevice::deinit()to free resources for other tasks.All reactions