Crash Loop on ESP32-S3-WROOM-1-N8R8
Jotschi opened this issue · 1 comments
Jotschi commented
I'm currently trying to narrow it down but I believe the error happens when sendInfo of websocket.cpp is invoked.
assert failed: insert_free_block heap_tlsf.c:233 (current && "free list cannot have a null entry")
The S3 N8R8 has 8MB PSRAM.
Jotschi commented
Update: I was able to fix/workaround the issue by adding a custom allocator which uses SPI and the PSRAM for the JSON document:
#include <Arduino.h>
#include <ArduinoJson.h>
struct SpiRamAllocator {
void* allocate(size_t size) {
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM);
}
void deallocate(void* pointer) {
heap_caps_free(pointer);
}
void* reallocate(void* ptr, size_t new_size) {
return heap_caps_realloc(ptr, new_size, MALLOC_CAP_SPIRAM);
}
};
Details: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/
Unfortunately now the ESP32 crashes when I try to invoke the first request.
assert failed: spinlock_acquire spinlock.h:122 (result == core_id || result == SPINLOCK_FREE)
Returning a basic hello world works.