Page 1 of 1

Bluetooth Serial Class of Device Incorrect and Cannot be Changed

Posted: Fri Feb 24, 2023 9:13 am
by TheTazzi
On ESP32 Arduino Core version 2.0.0 and newer, the class of device (COD) for classic bluetooth serial is incorrectly set.

Whereas on v1.0.6, the class of device is set to that of a PC/PDA and also allows changing it inside the BluetoothSerial.cpp file.
The exact same code is run between v1.0.6 and newer, yet the newer versions fail to set the COD and also cannot be changed:
esp_bt_cod_t cod;
cod.major = 0b00001;
cod.minor = 0b000100;
cod.service = 0b00000010110;
if (esp_bt_gap_set_cod(cod, ESP_BT_INIT_COD) != ESP_OK) { log_e("set cod failed"); return false; }

The class of device broadcasted as displayed in Bluetooth Android apps is: 7396 (0x1F00) which is incorrect.

I have wired up a multiple ESP32s which includes multiple ESP-WROOM-32D and also ESP-WROOM-32E, all have the same issue, and all work with v1.0.6 to correctly display the COD

Do note I have had to add disableCore0WDT into the sketch since v2.0.0 and newer sets off the watchdog reset when setting up the bluetooth connection.

Sketch

Code: Select all

#include <BluetoothSerial.h>

BluetoothSerial MyBT;
void setup()
{
        disableCore0WDT();
        Serial.begin(115200);
	MyBT.begin("My BT Name");

}

void loop()
{


}
Debug Message
[ 1485][BluetoothSerial.cpp:263] esp_spp_cb(): ESP_SPP_INIT_EVT
[ 1487][BluetoothSerial.cpp:270] esp_spp_cb(): ESP_SPP_INIT_EVT: slave: start
[ 1492][BluetoothSerial.cpp:397] esp_spp_cb(): ESP_SPP_START_EVT
[ 1496][BluetoothSerial.cpp:685] _init_bt(): device name set
[ 1503][BluetoothSerial.cpp:571] esp_bt_gap_cb(): ESP_BT_GAP_CONFIG_EIR_DATA_EVT: stat:0 num:4


Has anyone else had this issue or found a fix for it?

Re: Bluetooth Serial Class of Device Incorrect and Cannot be Changed

Posted: Fri Feb 24, 2023 5:11 pm
by ESP_Minatel
Hi,

Have you created a new issue on the Arduino ESP32 project on GitHub?

https://github.com/espressif/arduino-esp32/issues

Re: Bluetooth Serial Class of Device Incorrect and Cannot be Changed

Posted: Fri Feb 24, 2023 11:00 pm
by TheTazzi
ESP_Minatel wrote:
Fri Feb 24, 2023 5:11 pm
Hi,

Have you created a new issue on the Arduino ESP32 project on GitHub?

https://github.com/espressif/arduino-esp32/issues
I sure have: https://github.com/espressif/arduino-esp32/issues/7865

It is still awaiting triage. I was recommended to post on the forums to see if anyone else has noticed the same problems.

Re: Bluetooth Serial Class of Device Incorrect and Cannot be Changed

Posted: Sat Feb 25, 2023 8:12 pm
by ESP_Minatel
We will try to take a look ASAP.

Re: Bluetooth Serial Class of Device Incorrect and Cannot be Changed

Posted: Tue Mar 07, 2023 3:35 am
by TheTazzi
ESP_Minatel wrote:
Sat Feb 25, 2023 8:12 pm
We will try to take a look ASAP.
Thanks, please let us know if we can do anything to help!