Open
Description
Board
ESP32-C3-DevKitM-1
Device Description
Nothing, just the board itself
Hardware Configuration
It's just creating a BLE Server like in the arduino examples
Version
v2.0.5
IDE Name
PlatformIO
Operating System
Windows 10
Flash frequency
40 Mhz
PSRAM enabled
no
Upload speed
115200
Description
It seems like BLE is kind of broken on the ESP32 C3&S3 compared to the ESP32 OG.
When trying to connect to the device, for once only my phone is able to see the ESP32 C3 not my PC even though I have a Bluetooth 5 card.
In addition to that the ESP32 C3 spits out multiple errors and doesn't connect properly.
The errors are all related to the pairing security:
E (14434) BT_SMP: smp_calculate_link_key_from_long_term_key failed to update link_key. Sec Mode = 2, sm4 = 0x00
E (14435) BT_SMP: smp_derive_link_key_from_long_term_key failed
E (14442) BT_BTM: btm_proc_smp_cback received for unknown device
[ 14177][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_PID
[ 14183][I][BLEDevice.cpp:249] gapEventHandler(): key type = ESP_LE_KEY_PCSRK
[ 14192][I][BLEDevice.cpp:253] gapEventHandler(): ESP_GAP_BLE_AUTH_CMPL_EVT
E (14656) BT_BTM: BTM_GetSecurityFlags false
E (14746) BT_BTM: BTM_GetSecurityFlags false
E (15016) BT_BTM: BTM_GetSecurityFlags false
E (29868) BT_BTM: Device not found
E (29869) BT_HCI: hci connection params reply command error 0x2
Library like ESP32 BLEKeyboard or ESP32 BLE Gamepad don't work at all on the ESP32 C3 and S3.
Sketch
/*
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp
Ported to Arduino ESP32 by Evandro Copercini
updates by chegewara
*/
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
BLEDevice::init("ESP32 C3");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE
);
pCharacteristic->setValue("Hello World says Neil");
pService->start();
// BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue
pAdvertising->setMinPreferred(0x12);
BLEDevice::startAdvertising();
Serial.println("Characteristic defined! Now you can read it in your phone!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
}
Debug Message
04:35:18.343 ->E (26465) BT_SMP: smp_calculate_link_key_from_long_term_key failed to update link_key. Sec Mode = 2, sm4 = 0x00
04:35:18.343 -> E (26466) BT_SMP: smp_derive_link_key_from_long_term_key failed
04:35:18.343 ->
04:35:18.388 -> E (26474) BT_BTM: btm_proc_smp_cback received for unknown device
04:35:18.621 -> E (26724) BT_BTM: BTM_GetSecurityFlags false
04:35:18.621 ->
04:35:18.668 -> E (26799) BT_BTM: BTM_GetSecurityFlags false
04:35:18.668 ->
04:35:19.043 -> E (27136) BT_BTM: BTM_GetSecurityFlags false
04:35:19.043 ->
04:35:23.695 -> E (31824) BT_BTM: BTM_GetSecurityFlags false
04:35:23.695 ->
04:35:23.883 -> E (31974) BT_BTM: BTM_GetSecurityFlags false
04:35:23.883 ->
04:35:23.883 -> E (31989) BT_BTM: BTM_GetSecurityFlags false
04:35:23.883 ->
04:35:23.930 -> E (32049) BT_BTM: BTM_GetSecurityFlags false
04:35:23.930 ->
04:35:23.977 -> E (32071) BT_BTM: BTM_GetSecurityFlags false
04:35:23.977 ->
04:35:23.977 -> E (32086) BT_BTM: BTM_GetSecurityFlags false
04:35:23.977 ->
04:35:24.022 -> E (32131) BT_BTM: BTM_GetSecurityFlags false
04:35:24.022 ->
04:35:24.067 -> E (32154) BT_BTM: BTM_GetSecurityFlags false
04:35:24.067 ->
04:35:24.067 -> E (32169) BT_BTM: BTM_GetSecurityFlags false
04:35:24.067 ->
04:35:24.067 -> E (32184) BT_BTM: BTM_GetSecurityFlags false
04:35:24.067 ->
04:35:24.114 -> E (32199) BT_BTM: BTM_GetSecurityFlags false
04:35:24.114 ->
04:35:24.114 -> E (32221) BT_BTM: BTM_GetSecurityFlags false
04:35:24.114 ->
04:35:24.114 -> E (32236) BT_BTM: BTM_GetSecurityFlags false
04:35:24.114 ->
04:35:24.162 -> E (32251) BT_BTM: BTM_GetSecurityFlags false
04:35:24.162 ->
04:35:24.162 -> E (32266) BT_BTM: BTM_GetSecurityFlags false
04:35:24.162 ->
04:35:24.255 -> E (32341) BT_BTM: BTM_GetSecurityFlags false
04:35:24.255 ->
04:35:24.255 -> E (32364) BT_BTM: BTM_GetSecurityFlags false
04:35:24.255 ->
04:35:24.255 -> E (32379) BT_BTM: BTM_GetSecurityFlags false
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.