ESP32 BLE Connection speed-up
Posted: 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?
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?