Skip to content

esp_bt_controller-init failed #1977

@Admsher

Description

@Admsher

Problem Description

I was trying out the SDA2DP example on esp-idf v 5.3 and am stuck with an error in which the Bluetooth init is first acknowledged and then it says init failed.

Image

Device Description

ES32 One: https://www.waveshare.com/wiki/ESP32_One

Sketch

#define HELIX_LOGGING_ACTIVE false
#include "AudioTools.h"
#include "AudioTools/AudioLibs/A2DPStream.h"
#include "AudioTools/AudioLibs/AudioSourceSDFAT.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"

const char *startFilePath="/music/";
const char* ext="mp3";
AudioSourceSDFAT source(startFilePath, ext, 15);
A2DPStream out;
MP3DecoderHelix decoder;
AudioPlayer player(source, out, decoder);

void setup() {
  Serial.begin(115200);
  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
  // setup player
  // Setting up SPI if necessary with the right SD pins by calling 
  SPI.begin(14, 12, 13, 15);
  player.setVolume(0.8);
  player.begin();

  // setup output - We send the test signal via A2DP - so we conect to a Bluetooth Speaker
  auto cfg = out.defaultConfig(TX_MODE);
  cfg.silence_on_nodata = true; // prevent disconnect when there is no audio data
  cfg.name = "CLIP 5";  // set the device here. Otherwise the first available device is used for output
  //cfg.auto_reconnect = true;  // if this is use we just quickly connect to the last device ignoring cfg.name
  out.begin(cfg);
}

void loop() {
  player.copy();
}

Other Steps to Reproduce

enable Bluetooth and BLE in esp-idf which is needed to compile it in the first place. Strangely it works on Arduino IDE

What is your development environment (incl. core version info)

ESP-IDF v5.3

I have checked existing issues, discussions and online documentation

  • I confirm I have checked existing issues, discussions and online documentation

Activity

pschatzmann

pschatzmann commented on Mar 25, 2025

@pschatzmann
Owner

Did you follow the instructions ?

After a second thought: But this does not make any sense to me: IDF doesn't support SPI.begin(14, 12, 13, 15); and
#include "AudioTools/AudioLibs/AudioSourceSDFAT.h"

This only works with the Arudino API!

And finally: I am closing this issue becaus you ignored this basic advice!

Admsher

Admsher commented on Mar 25, 2025

@Admsher
Author

I have used arduino-esp32 for the same to include ArduinoSDFAT.h and SDFat in my workspace . I hope it makes sense why these two are in the environment. I also checked the flags and they were enabled in my build.

pschatzmann

pschatzmann commented on Mar 25, 2025

@pschatzmann
Owner

I have never looked into the Arduino as component scenario, so I can't really help, but my guess would be that it must be related to the configuration: Maybe you can take it from Arduino.

If you find the root cause, please share it with the community!

ps. I found this here: I had the same issue, took me a long time to figure it out, it's a missing "#define ARDUINO_ARCH_ESP32", which has something to do with "-DARDUINO_ARCH_ESP32" not configured correctly.

Admsher

Admsher commented on Mar 27, 2025

@Admsher
Author

So the issue has been resolved and turns it was indeed an arduino-esp32 issue: espressif/arduino-esp32#11167 this PR resolves the BLE problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pschatzmann@Admsher

        Issue actions

          esp_bt_controller-init failed · Issue #1977 · pschatzmann/arduino-audio-tools