ESP32-S3 tasks not working
Posted: Fri Aug 30, 2024 6:40 am
I can not get tasks to work with an ESP32-S3 dev module, but I have no problem when using ESP32s. The MCU constantly reboots with a message on the serial port about stack overflow. I have tried using stack sizes from 2000 to 10000 with the same result so I wonder if it is something more fundamental? The serial output is below, followed by the code:
***ERROR*** A stack overflow in task arduino_task has been detected.
Backtrace: 0x40376dde:0x3fcecfc0 0x4037b7b5:0x3fcecfe0 0x4037e58a:0x3fced000 0x4037ca8d:0x3fced080 0x4037e6f0:0x3fced0b0 0x4037e6e6:0x3fced0f0 0x4200210d:0x000003e8 |<-CORRUPTED
ELF file SHA256: 40291c4b1c2df599
07:27:41:482 -> Rebooting...
�07:27:41:516 -> ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403773f1
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fd0
entry 0x403c98ac
07:27:41:702 -> Hello World
looping
code
====
#include <EasyNeoPixels.h>
unsigned long previousMillis = 0; // store for Millis value
const long interval = 1000; // 1-second interval for process 1
int currentColor = 0; // Tracks the current colour: 0 = red, 1 = green, 2 = blue
void setup() {
setupEasyNeoPixels(48, 1);
xTaskCreate(arduinoTask, "arduino_task", 5000, NULL, 1, NULL);
}
void arduinoTask(void *pvParameter)
{
Serial.begin(115200);
delay(100);
Serial.println("Hello World");
while (1) {
Serial.println("looping");
delay(1000);
}
}
void loop() {
unsigned long currentMillis = millis();
// Check if it's time to change the colour
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
// Change the colour based on currentColor index
if (currentColor == 0) {
writeEasyNeoPixel(0, 10, 0, 0); // Red
currentColor = 1;
}
else if (currentColor == 1) {
writeEasyNeoPixel(0, 0, 10, 0); // Green
currentColor = 2;
}
else if (currentColor == 2) {
writeEasyNeoPixel(0, 0, 0, 10); // Blue
currentColor = 0;
}
}
}
***ERROR*** A stack overflow in task arduino_task has been detected.
Backtrace: 0x40376dde:0x3fcecfc0 0x4037b7b5:0x3fcecfe0 0x4037e58a:0x3fced000 0x4037ca8d:0x3fced080 0x4037e6f0:0x3fced0b0 0x4037e6e6:0x3fced0f0 0x4200210d:0x000003e8 |<-CORRUPTED
ELF file SHA256: 40291c4b1c2df599
07:27:41:482 -> Rebooting...
�07:27:41:516 -> ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403773f1
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fd0
entry 0x403c98ac
07:27:41:702 -> Hello World
looping
code
====
#include <EasyNeoPixels.h>
unsigned long previousMillis = 0; // store for Millis value
const long interval = 1000; // 1-second interval for process 1
int currentColor = 0; // Tracks the current colour: 0 = red, 1 = green, 2 = blue
void setup() {
setupEasyNeoPixels(48, 1);
xTaskCreate(arduinoTask, "arduino_task", 5000, NULL, 1, NULL);
}
void arduinoTask(void *pvParameter)
{
Serial.begin(115200);
delay(100);
Serial.println("Hello World");
while (1) {
Serial.println("looping");
delay(1000);
}
}
void loop() {
unsigned long currentMillis = millis();
// Check if it's time to change the colour
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
// Change the colour based on currentColor index
if (currentColor == 0) {
writeEasyNeoPixel(0, 10, 0, 0); // Red
currentColor = 1;
}
else if (currentColor == 1) {
writeEasyNeoPixel(0, 0, 10, 0); // Green
currentColor = 2;
}
else if (currentColor == 2) {
writeEasyNeoPixel(0, 0, 0, 10); // Blue
currentColor = 0;
}
}
}