You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
Arduino IDE 2.2.1
Espressif SoC revision.
ESP32 V2.0.13
Operating System used.
Windows
How did you build your project?
Eclipse IDE
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32 dev board
Power Supply used.
USB
What is the expected behavior?
I expect that a bluetooth serial slave can connect to the bluetooth serial (SPP) master, which is created on the ESP32 board. The slave should find the bluetooth serial port UUID, and then connect to it, using that UUID.
What is the actual behavior?
Instead, the slave could not connect to the master in the ESP32 board. Because the bluetooth serial UUID is not advertised, the slave can not find the SPP master. So I started checking the bluetoothserial.cpp driver in the ESP 2.0.13 library.
In the function "esp_spp_cb()", at the ESP_SPP_INIT_EVT event, I found that the bluetooth serial service only was started in slave mode, by calling the function "esp_spp_start_srv()". After I changed the code in the ESP_SPP_INIT_EVT to also call the function "esp_spp_start_srv()" in master mode, the slave could connect to the SPP service.
The original code in the "esp_spp_cb()" in BluetoothSerial.cpp is:
As you can see, in the code, the line:
esp_spp_start_srv(ESP_SPP_SEC_NONE, ESP_SPP_ROLE_SLAVE, 0, _spp_server_name);
has been changed to:
esp_spp_start_srv(ESP_SPP_SEC_NONE, _isMaster ? ESP_SPP_ROLE_MASTER : ESP_SPP_ROLE_SLAVE, 0, _spp_server_name);
and is placed outside the if (!_isMaster) { statement.
Attached, my complete project, for the ESP32 board, in a zip file. Also the changed BluetoothSerial.cpp file can be found there. ESP32_Myomed.zip
Steps to reproduce.
Build the project in the zip file, using the Arduino IDE
Load the bin file into the ESP32 Dev board
Connect to the dev board using a Bluetooth SPP client connection, to a bluetooth connector on eg a PC, with the name "raspberrypi'
The PC app should find the SPP service UUID on the ESP32 dev board:
With the original BluetoothSerial.cpp file, the SPP service can not be found.
With the changed BluetoothSerial.cpp file, the SPP service should be found!!
Debug Logs.
I have not found the solution to the bug using a log.
I found the bug, by looking into the BluetoothSerial.cpp source code.
More Information.
No response
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
ESP32 Bluetooth SPP service not started in Master mode
ESP32 Bluetooth SPP service not started in Master mode (IDFGH-11185)
Oct 4, 2023
Answers checklist.
IDF version.
Arduino IDE 2.2.1
Espressif SoC revision.
ESP32 V2.0.13
Operating System used.
Windows
How did you build your project?
Eclipse IDE
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32 dev board
Power Supply used.
USB
What is the expected behavior?
I expect that a bluetooth serial slave can connect to the bluetooth serial (SPP) master, which is created on the ESP32 board. The slave should find the bluetooth serial port UUID, and then connect to it, using that UUID.
What is the actual behavior?
Instead, the slave could not connect to the master in the ESP32 board. Because the bluetooth serial UUID is not advertised, the slave can not find the SPP master. So I started checking the bluetoothserial.cpp driver in the ESP 2.0.13 library.
In the function "esp_spp_cb()", at the ESP_SPP_INIT_EVT event, I found that the bluetooth serial service only was started in slave mode, by calling the function "esp_spp_start_srv()". After I changed the code in the ESP_SPP_INIT_EVT to also call the function "esp_spp_start_srv()" in master mode, the slave could connect to the SPP service.
The original code in the "esp_spp_cb()" in BluetoothSerial.cpp is:
My changed code is:
As you can see, in the code, the line:
esp_spp_start_srv(ESP_SPP_SEC_NONE, ESP_SPP_ROLE_SLAVE, 0, _spp_server_name);
has been changed to:
esp_spp_start_srv(ESP_SPP_SEC_NONE, _isMaster ? ESP_SPP_ROLE_MASTER : ESP_SPP_ROLE_SLAVE, 0, _spp_server_name);
and is placed outside the if (!_isMaster) { statement.
Attached, my complete project, for the ESP32 board, in a zip file. Also the changed BluetoothSerial.cpp file can be found there.
ESP32_Myomed.zip
Steps to reproduce.
Debug Logs.
More Information.
No response
The text was updated successfully, but these errors were encountered: