-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Bluetoothserial with Password pairing only works on ESP32 v1.0.1 #6061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Example code that works fine with v1.0.1 and can't connect with v2 (v2.0.2 and latest): #include "BluetoothSerial.h"
BluetoothSerial SerialBT;
uint8_t address[6] = { 0x20, 0x13, 0x01, 0x18, 0x02, 0x26 };
const char *pin = "1234";
bool connected;
void setup() {
Serial.begin(115200);
SerialBT.begin("ESPBT", true);
SerialBT.setPin(pin);
Serial.println("The device started in master mode, make sure remote BT device is on!");
connected = SerialBT.connect(address);
if(connected) {
Serial.println("Connected Succesfully!");
} else {
while(!SerialBT.connected(10000)) {
Serial.println("Failed to connect. Make sure remote device is available and in range, then restart app.");
}
}
}
void loop() {
if (SerialBT.available()) {
Serial.write(SerialBT.read());
}
delay(5);
} Tested with platformio: [env:esp32-v1]
platform=espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DCORE_DEBUG_LEVEL=6
[env:esp32-v2.0.2]
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2idf/platform-espressif32-2.0.2.zip
board = esp32doit-devkit-v1
framework = arduino
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
build_flags = -DCORE_DEBUG_LEVEL=6
[env:esp32-v2-upstream]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32doit-devkit-v1
framework = arduino
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
build_flags = -DCORE_DEBUG_LEVEL=6
Debug output is not helpful: V1 (OK):
V2 Upstream (not OK):
platformio-project: BLE works fine with 2.0.2. |
Is it easily possible to increase debug-level of the IDF/BlueDroid? (using platformio). I tried the IDF SPP_INITIATOR_DEMO and this also can't connect. |
Try calling void setup() {
Serial.begin(115200);
SerialBT.setPin(pin); // setPin() shall come before begin()
SerialBT.begin("ESPBT", true);
Serial.println("The device started in master mode, make sure remote BT device is on!");
connected = SerialBT.connect(address);
if(connected) {
Serial.println("Connected Succesfully!");
} else {
while(!SerialBT.connected(10000)) {
Serial.println("Failed to connect. Make sure remote device is available and in range, then restart app.");
}
}
} |
@SuGlider thanks for the hint, but it does not solve the issue. I suspect that cause is lying "deeper", so I opened an issue at espressif/esp-idf. |
Workaround: I was able to connect with Arduino-ESP32 2.0.2, by using an own SDK configuration that disables SSP. See https://community.platformio.org/t/using-latest-esp32-arduino-but-with-own-idf-configuration/26000/2 : platformio.ini: [env:esp32-v2-upstream]
platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.2/platform-espressif32-2.0.2.zip
board = esp32doit-devkit-v1
framework = arduino, espidf
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git SDK-Config: https://github.com/euphi/ESP32_BTTacho/blob/main/sdkconfig.esp32-v2-upstream Patch for BluetoothSerial.cpp (commenting out symbols that need SSP enabled): |
In my testing with trying to connect an ESP32 using the Arduino core as Bluetooth Serial Master to an HC05 in slave mode, failure to connect begins with any version after 1.0.6. I think that the issue is with the change from |
Hello, can you please retest this on v2.0.3-rc1? |
@VojtechBartoska |
As already mentioned the problem lays "deeper": |
@euphi Thanks for linking IDF ticket, we will investigate this further with ESP-IDF team. Adding this to the Roadmap. |
Is mine the same issue? https://github.com/espressif/arduino-esp32/discussions/6785 |
Ian--
Previously you mentioned a work around with the SDK configuration and SSP settings. I tired to do what you suggested in the Arduino environment, but was not succesfull.
Can you provide me with any more information on what to settings to change?
Regards
Richard Marantz
…________________________________
From: Ian Hubbertz ***@***.***>
Sent: Monday, April 11, 2022 12:36 PM
To: espressif/arduino-esp32 ***@***.***>
Cc: Richard Marantz ***@***.***>; Comment ***@***.***>
Subject: Re: [espressif/arduino-esp32] Bluetoothserial with Password pairing only works on ESP32 v1.0.1 (Issue #6061)
As already mentioned the problem lays "deeper":
The problem can be reproduced without using Arduino framework, but IDF only. So root cause is in the IDF: espressif/esp-idf#8394<espressif/esp-idf#8394> .
—
Reply to this email directly, view it on GitHub<#6061 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHVADAN3TPOW7PRHXQKGQ7LVER5NXANCNFSM5KX34ZLQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Has anyone gotten anywhere with this issue? "Bluetoothserial with Password pairing only works on ESP32 v1.0.1 #6061" Really needing a fix for this issue. My program is on hold tell then.........Help |
@PilnyTomas Can you please revisit this? Test it if it's still valid as a first step, thank you. |
I have a question - why are you trying to connect 2 masters together? |
@PilnyTomas Who is this question directed at? AFAIK, This issue has always been about the ESP32 as master connecting with a slave (like the HC05 or HC06) which requires a password. |
I'm sorry, I'm confused with the other related issues.
is working with the default
|
I can confirm that with Arduino-ESP32 2.0.6. , BluetoothSerial 2.0.0 I can connect to an HC05 in slave mode with password "1234". The issue appears to have been fixed by this commit and the Arduino core using idf 4.4.1. EDIT: Fix link |
@cattledogGH I'm glad to hear that. |
Board
ESP32
Device Description
So, there's this Code
which I am using for getting data using UART and sending that data to the Bluetooth terminal for further processing.
The only thing I want to add here is password pairing for Bluetooth.
I tried the ESP-IDF example named gatt_security_server and it works well. But I faced issues in incorporating Bluetooth Serial in it.
I also searched a lot in this, but all I can see is open issues with no solutions.
PS: The code is working fine if I downgrade the ESP32 version to 1.0.1 in Arduino IDE. I found this method in one of the comments: LINK
I was wondering if you guys could help me out so that this code works with the latest ESP32 version.
Hardware Configuration
Only serial.
Version
v1.0.6
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
40MHz
PSRAM enabled
no
Upload speed
115200
Description
Works with v1.0.1 but not with the latest board version
Sketch
https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: