ESP32 BLE Connection speed-up

elDi@mond
Posts: 19
Joined: Fri Feb 04, 2022 10:42 am

ESP32 BLE Connection speed-up

Postby elDi@mond » Wed May 17, 2023 10:01 am

Greeting all!
I have several (4 at now, and up to 16 in future) ESP32 devices working thru BLE. At some moment one device recieve new data from phone and must to resend it to another devices thru BLE.
So, i initing connection via esp_ble_gattc_open(...), then check status of connection in case of ESP_GATTC_SEARCH_RES_EVT, and after than i writing and reading into charachteristic.
So i got this timings:

[Codebox]
(0) DEVICE: --==--== Data recieve started ==--==--
(104) DEVICE: ESP_GATTS_CONNECT_EVT, conn_id 0, remote xx:xx:xx:xx:xx:xx
(1469) DEVICE: Connection established
(1617) DEVICE: HANDSHAKE succes!
(1619) DEVICE: Trying to exchange devices IDs...
(1700) DEVICE: Trying to init recieving of 0x01 data
(1778) DEVICE: BLE_START_RECIEVE_STREAM succes!
(1897) DEVICE: BLE_REQUEST_DATA_STREAM succes!
(1979) DEVICE: BLE_END_RECIEVE_STREAM succes!
(1979) DEVICE: -=-= STREAM_DATA succed =-=-
[/Codebox]

Average syncronization time 2-2.3 sec. As you can see, most of the time, is connection establishing. betwen esp_ble_gattc_open() and ESP_GATTC_SEARCH_RES_EVT
I've tryed to migrate esp_ble_gattc_search_service() at ESP_GATTC_OPEN_EVT and it cause error when i tried to write characteristic
So, my question is there any way to speed-up connection?

elDi@mond
Posts: 19
Joined: Fri Feb 04, 2022 10:42 am

Re: ESP32 BLE Connection speed-up

Postby elDi@mond » Thu May 25, 2023 6:59 am

Bump :|

MicroController
Posts: 1733
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 BLE Connection speed-up

Postby MicroController » Thu May 25, 2023 12:06 pm

If not done already, try and bond the devices. This may speed up encryption setup and service discovery.

Who is online

Users browsing this forum: No registered users and 111 guests