Page 1 of 1

BLE and BluetoothSerial not working together

Posted: Thu Dec 31, 2020 1:08 am
by matthew798
Hi all,

I am hoping this is an easy one. I am hoping to use BLE (for blufi, which I have got working nicely) to work at the same time as Bluetooth classic SPP. The goal is to be able to (re)configure wifi at any time while connected to an ELM327 over a bluetooth (to serial) connection.

Unfortunately, using both BLE and BTSerial together doesn't work. Using each one individually works fine.

Here is how I am starting both services:

Code: Select all

BLEDevice::init("BLE_TEST");
SerialBT.begin("SERIALBT_TEST", true);
//start Blufi...
//Connect to ELM327...
Just having these two lines together causes the BLE to not appear when scanning using the official espressif Blufi app (it works without the BTSerial line).

I tried initializing bluetooth myself, before either of the two lines has a chance to touch it:

Code: Select all

esp_bt_controller_config_t btCfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();

  ESP_ERROR_CHECK(esp_bt_controller_init(&btCfg));
  ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BTDM));
  ESP_ERROR_CHECK(esp_bluedroid_init());
  ESP_ERROR_CHECK(esp_bluedroid_enable());
But it makes no difference.

Any insight?