I have a user who is attempting to connect multiple BLE clients (centrals) to the same single BLE server (peripheral) hosted on the ESP32. What we find is that the first client connects correctly but when we attempt to connect the second client "nothing happens". What I mean by this is that there are no signs of any events arriving at the ESP32 ... it is as though the ESP32 is no longer responding to connect requests.
This Stack Exchange post says that multiple clients should be able to connect to a single server:
https://stackoverflow.com/questions/371 ... att-server
while this Adafruit article:
https://learn.adafruit.com/introduction ... nergy/gatt
says:
"The most important thing to keep in mind with GATT and connections is that connections are exclusive. What is meant by that is that a BLE peripheral can only be connected to one central device (a mobile phone, etc.) at a time!"
The net of this post is:
1) Does the BLE specification allow multiple concurrent connections into a BLE server from multiple BLE clients?
2) If yes to #1, does the ESP32 BLE stack support this concept?
[Question]: BLE server/peripheral support of multiple concurrent client connections?
[Question]: BLE server/peripheral support of multiple concurrent client connections?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: [Question]: BLE server/peripheral support of multiple concurrent client connections?
http://embedded.fm/blog/ble-roles
A peripheral advertises
A central scans
After a peripheral makes a connection it’s called a slave
After a central makes a connection it’s called a master
After a BLE connection has been established, devices can be either a client or a server
https://stackoverflow.com/questions/240 ... le-masters
Bluetooth v4.1 specs: Slaves are permitted to have physical links to more than one master at a time.
As for question #2 someone else will have to answer. The peripheral will have to be advertising for the 2nd central to connect.
A peripheral advertises
A central scans
After a peripheral makes a connection it’s called a slave
After a central makes a connection it’s called a master
After a BLE connection has been established, devices can be either a client or a server
https://stackoverflow.com/questions/240 ... le-masters
Bluetooth v4.1 specs: Slaves are permitted to have physical links to more than one master at a time.
As for question #2 someone else will have to answer. The peripheral will have to be advertising for the 2nd central to connect.
Re: [Question]: BLE server/peripheral support of multiple concurrent client connections?
Can someone please confirm that a BLE peripheral implemented on the ESP32 can connect simultaneously to multiple centrals?
Is it as simple as changing the GAP state-machine so that advertising continues when a central connects? Or is there more that needs to be done?
An additional article that says it can't:
"One important distinction between the master and slave device in a BLE network is that a slave may only be connected to a single master, but a master may be connected to multiple slaves." --
https://www.silabs.com/community/wirele ... e_mas-gviy
Is it as simple as changing the GAP state-machine so that advertising continues when a central connects? Or is there more that needs to be done?
An additional article that says it can't:
"One important distinction between the master and slave device in a BLE network is that a slave may only be connected to a single master, but a master may be connected to multiple slaves." --
https://www.silabs.com/community/wirele ... e_mas-gviy
Re: [Question]: BLE server/peripheral support of multiple concurrent client connections?
Hi,
what i can say is, if that silabs statement is true then i am doing something wrong because i can use esp32 as peripheral and allow to connect few central peer devices.
For sure im not as good programmer as silabs programmers, and my ble knowledge is mediocre but as far as i know it is possible. For sure it is not
what i can say is, if that silabs statement is true then i am doing something wrong because i can use esp32 as peripheral and allow to connect few central peer devices.
For sure im not as good programmer as silabs programmers, and my ble knowledge is mediocre but as far as i know it is possible. For sure it is not
You have to control every attribute, indications and notifications etc. My thinking is that it is similar to web server, your app have to control data exchange between esp32 and all connected central devices.as simple as changing the GAP state-machine so that advertising continues when a central connects
Re: [Question]: BLE server/peripheral support of multiple concurrent client connections?
I see the example gattc_multi_connect: https://github.com/espressif/esp-idf/tr ... ti_connect
But that example is for connecting ESP to 3 BLE peripherals. (ESP is the Central/GATT Client)
I suspect the implementation would be similar to that example, but for ESP32 as peripheral/GATT server <--> 3 centrals. So exactly how would I go about allowing, say 3, concurrent Central devices to connect to my ESP32?
My code is currently based on https://github.com/eagi223/esp-idf_Blue ... ti-Service
But that example is for connecting ESP to 3 BLE peripherals. (ESP is the Central/GATT Client)
I suspect the implementation would be similar to that example, but for ESP32 as peripheral/GATT server <--> 3 centrals. So exactly how would I go about allowing, say 3, concurrent Central devices to connect to my ESP32?
My code is currently based on https://github.com/eagi223/esp-idf_Blue ... ti-Service
-
- Posts: 37
- Joined: Fri Dec 24, 2021 12:40 pm
Re: [Question]: BLE server/peripheral support of multiple concurrent client connections?
ESP32系列支持作为Server与多个Client相连,以官方gatt_server_service_table为例,在收到ESP_GATTS_CONNECT_EVT事件后,调用esp_ble_gap_start_advertising(&adv_params);再次开启广播即可
Who is online
Users browsing this forum: No registered users and 390 guests