Skip to content

esp32-c3 & BLE: E (4212) BLE_INIT: Invalid controller task prioriy or stack size #9061

@bmedici

Description

@bmedici

Board

ESP32-C3

Device Description

ESP32-C3 dev kit like this one
https://fr.aliexpress.com/item/1005005780121305.html

Hardware Configuration

Connected to nothing except USBC port for power

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

MacOS

Flash frequency

base config

PSRAM enabled

yes

Upload speed

115200

Description

framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
ESP32 BLE Arduino @ 2.0.0

When testing a BLE slave device basic sketch, I'm unable to init BLE and get this error:
E (4212) BLE_INIT: Invalid controller task prioriy or stack size

Caused by the init() line, I guess BLEDevice::init("bleslave");

Sketch

#include <Arduino.h>
#include "helpers.h"


#ifndef CONFIG_BT_BLE_50_FEATURES_SUPPORTED
  #warning "BLE: not compatible hardware"
#endif

#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"
class MyCallbacks: public BLECharacteristicCallbacks {
    void onWrite(BLECharacteristic *pCharacteristic) {
      std::string value = pCharacteristic->getValue();
      if (value.length() > 0) {
        Serial.println("*********");
        Serial.print("New value: ");
        for (int i = 0; i < value.length(); i++)
          Serial.print(value[i]);
        Serial.println();
        Serial.println("*********");
      }
    }
};




void setup() {
  common_setup();
  delay(4000);

  log("setup BLE");


  BLEDevice::init("bleslave");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );
  pCharacteristic->setCallbacks(new MyCallbacks());
  pCharacteristic->setValue("Hello World");
  pService->start();
  BLEAdvertising *pAdvertising = pServer->getAdvertising();
  pAdvertising->start();
  Serial.print("Server address:");
  Serial.println(BLEDevice::getAddress().toString().c_str());


  log("setup done");
}

void loop() {
  common_loop();
}

Debug Message

none

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions