ESP-IDF: 4.3.1(Stable) and 4.4(Dev) I tested them both.
DevBoard: ESP32S/ESP-WROOM-32
Problem 1:
ESP32: BLE-Client
Dev1: Secured BLE device.
Dev2: Non-Secured device.
1.Connect to Device 1, Received some data with notification.
2.Connect to Device 2, Received some data with notification.
3.Disconnect Device 2 from peer of ESP32.
4.Following messages show up, then both devices were disconnected. (Device 1 is supposed to be kept connecting.)
W (24564) BT_LOG: esp_ble_gattc_close, org conn_id = 1, generated conn_id = 258.
W (25064) AVISBLEDevice: GattClientProc: Unhandled Event: (4)ESP_GATTC_WRITE_CHAR_EVT
I (25064) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: 90b686a53db0
I (25064) BT_GATT: GATT_Disconnect conn_id=258
I (25074) BT_L2CAP: L2CA_RemoveFixedChnl() CID: 0x0004 BDA: 90b686a53db0
E (25084) BT_APPL: bta_gattc_cmpl_cback unknown conn_id = 258, ignore data
W (25084) BT_APPL: gattc_conn_cb: if=1 st=0 id=257 rsn=0x16
W (25094) BT_APPL: gattc_conn_cb: if=2 st=0 id=258 rsn=0x16
I (25104) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
W (25104) AVISBLEDevice: Device Close!
W (25114) AVISBLEDevice: Device Disconnected!
I (25114) AVISBLEDevice: Disconnecting passively. IF [1] Conn ID = 1
W (25124) BT_LOG: esp_ble_gattc_close, org conn_id = 1, generated conn_id = 257.
Program 2:
With same boards and ESP-IDF above.
ESP32: BLE-Client
Dev1: Secured BLE HID device. with Service UUID 0x1812, Characteristic UUID 0x2a4d
1.Connect to HID device.
2.Register Notification of characteristic 0x2a4d. and get ESP_GATTC_REG_FOR_NOTIFY_EVT with status=ESP_GATT_OK.
3.Try to send data from HID device to ESP32. No notification was triggled and no any error message showed up.
*As other secured devices work fine with current code, the security was supposed working well on this HID device.
*I have connected to this HID device with ESP-IDF v3 before. But I lost those source files.
*HID device is still working well with PC and IOS device as severed as an BLE Keyboard.
Would someone please give me some hints or fixing it or debugging?
Something weird with my BLE code.
Re: Something weird with my BLE code.
You didnt mentioned about procedure here, so i will ask:
Beside register for notifications, did you write to 0x2902 CCC descriptor?2.Register Notification of characteristic 0x2a4d. and get ESP_GATTC_REG_FOR_NOTIFY_EVT with status=ESP_GATT_OK.
Re: Something weird with my BLE code.
Thanks for reply. and, yes, I did write to CCCD.
And beside the HID device, notification works well on other devices. in spite of secured or not.
As it show no messages, I am not able to trace where could it be wrong.
Re: Something weird with my BLE code.
That seem to be odd. I doubt, but maybe during creating service you put too small value for GATT handles number? Or with more complicated device you depleted number of handles?
From logs i can only say that both devices are disconnected with reason 0x16 (Connection Terminated By Local Host):
From logs i can only say that both devices are disconnected with reason 0x16 (Connection Terminated By Local Host):
Code: Select all
W (25084) BT_APPL: gattc_conn_cb: if=1 st=0 id=257 rsn=0x16
W (25094) BT_APPL: gattc_conn_cb: if=2 st=0 id=258 rsn=0x16
Re: Something weird with my BLE code.
It is undoubtedly odd. That's why I named this post.chegewara wrote: ↑Fri Oct 22, 2021 8:25 amThat seem to be odd. I doubt, but maybe during creating service you put too small value for GATT handles number? Or with more complicated device you depleted number of handles?
From logs i can only say that both devices are disconnected with reason 0x16 (Connection Terminated By Local Host):Code: Select all
W (25084) BT_APPL: gattc_conn_cb: if=1 st=0 id=257 rsn=0x16 W (25094) BT_APPL: gattc_conn_cb: if=2 st=0 id=258 rsn=0x16
Actually, I did not create the server post (GATTS), but just received data from them.
BTW, the HID device will be disconnected automatically about every 5 seconds, might it be an clue....
The log you quoted is another issue, if my device (GATTC) connected to both secured and unsecured devices at same time, them will be disconnected along with the other when one of them are disconnected from client side.
Besides, it could be tough on debugging as the log is insufficient even I set to verbose level in menuconfig.
the log I posted are all I can get related to these issues.
Who is online
Users browsing this forum: No registered users and 141 guests