Can't connect a BLE Client to a BLE Server when changing server name

Anh-Minh
Posts: 13
Joined: Wed May 16, 2018 3:21 pm

Can't connect a BLE Client to a BLE Server when changing server name

Postby Anh-Minh » Thu May 31, 2018 12:37 pm

Hi,

I have some issues trying to connect a ESP32 Client to another ESP32 Server using BLE C++, with SampleClient and SampleServer :

With basic programs, when i run the application on both ESP32, it works well, and the Client can connect to the Server, and then, the server characteristic is written. For now, everything is normal.

The server is initialized with the following code :

Code: Select all

BLEDevice::init("ESP32")
BLEServer* pServer = BLEDevice::createServer();
...
Image

However, when i want to change my server name ( ESP322 in my example ) with :

Code: Select all

BLEDevice::init("New name")
When i run the application, the client can't find the server anymore. It detect the server, but the UUID is not recognize, consequently, the client cannot be initialized. Do you know where the problem is from ?

Image

Thank you.

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: Can't connect a BLE Client to a BLE Server when changing server name

Postby chegewara » Thu May 31, 2018 4:44 pm

Its happening because advertising packet cant be longer than 31 bytes. When you are advertising 128 bit UUID there is not much space left for device name. With name up to 5 chars it works, but with longer it wont because UUID is no included in advertising due to packet limitations.

Anh-Minh
Posts: 13
Joined: Wed May 16, 2018 3:21 pm

Re: Can't connect a BLE Client to a BLE Server when changing server name

Postby Anh-Minh » Fri Jun 01, 2018 8:54 am

Its happening because advertising packet cant be longer than 31 bytes. When you are advertising 128 bit UUID there is not much space left for device name. With name up to 5 chars it works, but with longer it wont because UUID is no included in advertising due to packet limitations.
Oh ok, i understand now. It is working fine now. Thank you ! Now, i have another problem which happens sometimes :
When the client has found the server and connects to it, sometimes, the program just freeze, until the ESP32 reboot.

Image

Image

Who is online

Users browsing this forum: Orange_Murker, slaboure and 85 guests