ESP32S3 cannot use Bluetooth Serial under Arduino framework

I am experiencing linker errors while compiling my ESP32-S3 project using the PlatformIO environment. The error messages indicate multiple undefined references to Bluetooth functions, including esp_spp_connect, esp_bt_gap_resolve_eir_data, and several others related to Bluetooth Serial capabilities.

To resolve this issue, I have already attempted the following steps:

  1. Added the necessary library files to the lib folder.
  2. Created a new project from scratch.

Despite these efforts, the errors persist. I would appreciate any guidance on how to properly link the required libraries or any additional steps I might need to take to resolve these linker issues.
platform.ini:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
build_flags =
    ; -D CONFIG_BT_ENABLED
    ; -D CONFIG_BLUEDROID_ENABLED
     -D CONFIG_BT_SPP_ENABLED
     -D CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
    -D BT_MODE_CLASSIC_BT
    -D BT_MODE_BTDM

main.cpp:

#include <BluetoothSerial.h>
#include <Arduino.h>
BluetoothSerial SerialBT;

void setup() {
    Serial.begin(115200);
    if (!SerialBT.begin("ESP32_Device")) {
        Serial.println("An error occurred initializing Bluetooth!");
    } else {
        Serial.println("Bluetooth Device is Ready to Pair");
    }
}

void loop() {
    if (SerialBT.available()) {
        char incoming = SerialBT.read();
        Serial.print(incoming);
    }
}

Detailed error message content:rocessing esp32-s3-devkitc-1 (platform: espressif32; board: esp32-s3-devkitc-1; - Pastebin.com

The ESP32-S3 does not support Bluetooth Classic - See ESP32-S3 can not use Bluetooth Classic · Issue #8023 · espressif/arduino-esp32 · GitHub

1 Like