ESP32_BLE_client_uart
ESP32_BLE_client_uart copied to clipboard
Unable to connect to Nordic UART
Hi ThinkEngineer, your work has saved me tons of time and has been educational process for me. I'm completely new to this so hopefully you can help move me into right direction. I'm using the ESP_BLE_client_uart code on "Heltec WiFi kit 32 " board and seems to work up to certain point. See the serial prints below.
Not sure why, but seems, at least, that the string (or c_str) functions are truncating the last 2 digits of the ServiceUUID. Or possibly is happening before the service is created and maybe that is the issue.
UUID should be 6e400001-b5a3-f393-e0a9-e50e24dcca9e but the serialPrint is 6e400001-b5a3-f393-e0a9-e50e24dcca
[D][BLEAdvertisedDevice.cpp:418] setRSSI(): - setRSSI(): rssi: -84 [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x01 (), length: 1, data: 05 [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x09 (), length: 19, data: 69466c65785f43313138333330313037323032 [D][BLEAdvertisedDevice.cpp:407] setName(): - setName(): name: XYZ-Device [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x07 (), length: 16, data: 9ecadc240ee5a9e093f3a3b50100406e [D][BLEAdvertisedDevice.cpp:447] setServiceUUID(): - addServiceUUID(): serviceUUID: 6e400001-b5a3-f393-e0a9-e50e24dcca BLE Advertised Device found - Name: XYZ-Device, Address: d6:0b:17:92:b4:ba, serviceUUID: 6e400001-b5a3-f393-e0a9-e50e24dcca Found a device with the desired ServiceUUID! Establishing a connection to device address: d6:0b:17:92:b4:ba
- Created client
- Connected to server
This is where all processing stops. I've debugged the issue a little and find that execution seems to exit at this point (BLERemoteService* pRemoteService = pClient->getService(serviceUUID);) I have a serial.println immediately after this line that never executes.
Also, i'd like to point out that using Nordic nRF tool on my android doesn't seem to make a consistent connection either. It'll keep disconnecting and require me to keep hitting the connect button.
Any ideas or help with this would be greatly appreciated. Thanks, Dan
I can confirm that I am also experiencing this same behavior, did you ever figure out what caused it?
I was seeing too many of the same types of issues that HeadTek pointed out as well as I2C issues. I ended up moved away from the ESP32 for the project I was working on at the time because libraries were not mature enough and it sounds like they are still not ironed out.
Just want to say thank you for this great example and log positive results: I am running this code and reliable connect to the Nordics Android App and a UART service running from a python script on a raspberry. Tested the code on three different ESP32 boards but not the HeadTek.