arduino-esp32
arduino-esp32 copied to clipboard
SerialToSerialBT with PIN code enabled connects to smartphone withtout asking for PIN code
Board
ESP32 Dev Module /Wemos D1 mini ESP32
Device Description
ESP32 dev board (WROOM 32D) also tested with Wemos/Lolin D1 mini ESP32 Version
Hardware Configuration
nothing attached
Version
other
IDE Name
Arduino 1.8.13
Operating System
Windows 11
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921000
Description
Official ESP32 Version v2.0.16 installed via Arduino IDE Board manager
Sketch
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP BT PIN Test");
SerialBT.setPin("7788");
}
void loop() {
}
Debug Message
11:40:37.521 -> [ 4][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
11:40:37.567 -> [ 36][V][esp32-hal-uart.c:330] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
11:40:37.567 -> [ 45][V][esp32-hal-uart.c:416] uartBegin(): UART0 not installed. Starting installation
11:40:37.567 -> [ 56][V][esp32-hal-uart.c:463] uartBegin(): UART0 initialization done.
11:40:38.033 -> [ 519][I][BluetoothSerial.cpp:683] _init_bt(): device name set
11:40:38.033 -> [ 519][I][BluetoothSerial.cpp:263] esp_spp_cb(): ESP_SPP_INIT_EVT
11:40:38.033 -> [ 531][I][BluetoothSeri[a l . c5p3p1:]9[0I3]][ BsleutePtiono(t)h:S epriina:l .7c7p8p8:
2
11:40:38.079 -> 70] esp_spp_cb(): ESP_SPP_INIT_EVT: slave: start
11:40:38.079 -> [ 543][I][BluetoothSerial.cpp:146] btSetPin(): pin set
11:40:38.079 -> [ 547][I][BluetoothSerial.cpp:571] esp_bt_gap_cb(): ESP_BT_GAP_CONFIG_EIR_DATA_EVT: stat:0 num:4
11:40:38.079 -> [ 557][I][BluetoothSerial.cpp:397] esp_spp_cb(): ESP_SPP_START_EVT
11:41:07.844 -> [ 30329][I][BluetoothSerial.cpp:587] esp_bt_gap_cb(): ESP-BT_GAP_* unknown message: 16
11:41:09.388 -> [ 31870][V][BluetoothSerial.cpp:523] esp_bt_gap_cb(): authentication success: S23 von Eugen
11:41:13.566 -> [ 36031][I][BluetoothSerial.cpp:587] esp_bt_gap_cb(): ESP-BT_GAP_* unknown message: 17
Other Steps to Reproduce
Smartphone asks If i would like to pair and pairs with ESP32 without asking for a PIN and also doesn't show any PIN to compare...
Also you can use in core included example SerialToSerialBT.ino with uncommented #define USE_PIN, It doesn't asks for any PINs also.
in #6061 was mentioned that PIN issue was fixed, but maybe only if connect ESP master to (ESP) slave? In my case ESP32 is a slave and Smartphone (Samsung Galaxy S23) is a master.
My old issue was clossed, but I still don't have any solution: #4566
I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Hello everyone, Does anyone have a solution? When pairing an ESP32 module with a smartphone, I would like this module to request a predefined password in the code.... This with the “BluetoothSerial.h” library i just added 'true' in SerialBT.begin("ESP BT PIN Test", true); but still doesnt work... It seems that the following code is correct but the connection is made directly without a pin code `# include "BluetoothSerial.h"
BluetoothSerial SerialBT;
const char* pin="1234";
void setup() { Serial.begin(9600);
SerialBT.setPin(pin); SerialBT.begin("ESP BT PIN Test", true); Serial.println("The device ESP32 started, now you can pair it with bluetooth!");
} void loop(){ {`
Unfortunately, this is not possible without compiling your own libraries, but you can set it up with Simple Secure Pairing (a random connect string).
Thanks for your answer,
SSP is giving the smartphone the code to enter....
I would like to have that kind of behavior, like in the Meshstastic Program but it semms to be very difficult to do.