Closed
Description
Board
ESP32 Dev Module
Device Description
Chip is ESP32-D0WD-V3 (revision 3); Auto-detected Flash size: 16MB
Hardware Configuration
None
Version
other
IDE Name
CLion with PIO
Operating System
Windows 10
Flash frequency
80 MHz
PSRAM enabled
yes
Upload speed
921600
Description
Using BLE
+ WiFi
+ heap_caps_malloc_extmem_enable(0)
causes a spontaneous crash when the AP is not found and also at other random times. The AP not found case is most easily replicated.
PIO version:
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3.zip
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/826/framework-arduinoespressif32-v4.4_work-b98c8476f2.tar.gz
Sketch
cpp
#include <WiFi.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// Set to 1 to accelerate the crash. Set to zero to see a typical use case.
#define ACCELERATED_CRASH 1
// BLE defines.
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
void setup() {
// Comment this line and the crash does not happen.
heap_caps_malloc_extmem_enable(0);
// Serial.
Serial.begin(115200);
Serial.println("Starting BLE...");
// Minimum BLE simplified from example.
BLEDevice::init("Long name works now");
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 = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
BLEDevice::startAdvertising();
Serial.println("Started BLE");
// Minimum WiFi.
Serial.println("Starting WiFi connection attempt...");
WiFi.begin("missing network", "password");
Serial.print("Available heap:");
Serial.println(ESP.getFreeHeap());
}
void loop() {
// This causes a crash to happen faster and may be useful for debugging.
// However the crash will happen even without this block.
if(ACCELERATED_CRASH){
while(!WiFi.isConnected()){
log_i("Attempting connection...");
WiFi.begin("missing network", "password");
delay(100);
}
}
delay(1000);
Serial.println("Loop");
}
### Debug Message
```plain
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Core 0 register dump:
PC : 0x4008490a PS : 0x00060c35 A0 : 0x800849dc A1 : 0x3ffbea2c
A2 : 0x3f80d868 A3 : 0xbad00bad A4 : 0x00060a23 A5 : 0x40092a6c
A6 : 0x003fffff A7 : 0x3ffbc87c A8 : 0x3ffbbd6c A9 : 0x3ffbeb1c
A10 : 0x00000010 A11 : 0x3ffc0580 A12 : 0x00000001 A13 : 0x00000002
A14 : 0x3ffc4488 A15 : 0x3f800000 SAR : 0x00000010 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x40090804 LEND : 0x4009081a LCOUNT : 0x00000000
Backtrace:0x40084907:0x3ffbea2c |<-CORRUPTED
#0 0x40084907:0x3ffbea2c in esp_timer_stop at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_timer/src/esp_timer.c:192
Other Steps to Reproduce
Please note the comments in the code.
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.