Closed
Description
Board
ESP32-S3
Device Description
homemade
Hardware Configuration
homemade
Version
latest master (checkout manually)
IDE Name
ARduino IDE
Operating System
linux
Flash frequency
40
PSRAM enabled
no
Upload speed
115200
Description
Hello
v2.0.6
this is the output of the demo program using BLE_client
We are now connected to the BLE Server.
Notify callback for characteristic 0000ffe1-0000-1000-8000-00805f9b34fb of data length 2
data: AT⸮⸮⸮?�⸮$
The data length is correct, I recognize just an 'AT' command from the HC06.
Line 32 of the demo program uses the payload directly as a string (serial.print) .
Maybe just add a warning for readers: this is a payload interpreted wrongly as a string for simplicity of the demo.
Sketch
bool isNotify) {
Serial.print("Notify callback for characteristic ");
Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str());
Serial.print(" of data length ");
Serial.println(length);
Serial.print("data: ");
Serial.println((char*)pData);
Debug Message
x
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Activity
SuGlider commentedon Dec 28, 2022
Are you sure that HC-06 can be used as BLE?!
As far as I know HC-06 is Bluetooth v2.0 (classic) only.
Therefore it can't be used as BLE device.
SuGlider commentedon Dec 28, 2022
The S3 can only connect using BLE with another BLE device.
You may consider using another ESP32/C3/S3 to connect, or maybe, a BLE module such as the HM-10, instead of HC-06.
Franck78 commentedon Dec 28, 2022
well, I swear to you I'm using my HC06 with the app you pointed me (ble client ino)
May be the bug is line 32 if we say that the 'bluetooth' transports an array of byte and a size for that array.
What I call HC-06 is the small thing from aliexpress .
https://www.aliexpress.com/item/1005002168517770.html
chip is CSR BC417143 (https://www.aliexpress.com/item/32323413263.html)
apparently, original one was bt2.0
https://www.digikey.com/en/products/detail/BC417143B-IRN-E4/BC417143B-IRN-E4DKR-ND/2001050
and probably upgraded with 'core 4.0' as seen on some other datasheet
SuGlider commentedon Dec 29, 2022
Considering that your HC06 works with BLE, I can tell you that BLE doesn't understand NULL terminated strings.
The sender will send a payload with a defined length.
The receiver side will read the length and then get the payload.
If you want to
Serial.print(char *)
the payload, you shall add the'\0'
atpData[length]
.Franck78 commentedon Dec 29, 2022
it happens it is your app in need of this zero ;)
[-]missing null terminator for string[/-][+]Payload used as string, thus "prints" adds garbage[/+]SuGlider commentedon Dec 29, 2022
I'll add that to the example. Thanks.
1 remaining item