Multiple BLE connections

kevinevans
Posts: 7
Joined: Thu Aug 25, 2022 10:34 pm

Multiple BLE connections

Postby kevinevans » Tue Feb 07, 2023 9:10 pm

Is it possible to have multiple concurrent BLE connections on the ESP32? The documentations says it supports up to 9 client devices, but I can't even get two concurrent connections using the GATT security server example code (https://github.com/espressif/esp-idf/tr ... ity_server). Is there something that I should be setting to get multiple connections? BLE 4.2 should support a higher number of connections regardless of its role (central vs peripheral).

Here's what I'm using as the client code (on two separate devices):
  1. import asyncio
  2. from bleak import BleakScanner, BleakClient
  3.  
  4. address = 'f4:12:fa:d9:7f:52'
  5.  
  6. async def main(address):
  7.     async with BleakClient(address, timeout=30) as client:
  8.       for service in client.services:
  9.         print('-------------------')
  10.         print(service)
  11.  
  12.         for c in service.characteristics:
  13.           print('+- ', c)
  14.           if 'read' in  c.properties:
  15.             print('   ', await client.read_gatt_char(c))
  16.           else:
  17.             print('   no read')
  18.  
  19.       await asyncio.sleep(100000)
  20.  
  21.  
  22. asyncio.run(main(address))
Using the script above, I can get one client to connect and hold open its connection. But on the second device, it times out and I cannot connect to the BLE device.

Who is online

Users browsing this forum: No registered users and 133 guests