Framework = arduino, espidf ESP32-S3 xTaskCreate() crashes

Making progress with framework = arduino, espidf using examples but finding xTaskCreate() throws a stack overflow. This works with just an ESP32 dev board such as the TTGO T-Display but does not work with ESP32-S3. (minimal code example below)

**Are there some other settings I am missing here to get this working with ESP32-S3 (which is my go-to board for all new development)?
**

error messages: (also some monitor weirdness that looks like mis-matched baud rate but they are definitely matched)

...
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
␛[0;32mI (1225) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations␛[0m***ERROR*** A stack overflow in task arduino_task has been detected.

Backtrace: 0x403764ed:0x3fce9d40 0x4037db79:0x3fce9d60 0x40381469:0x3fce9d80 0x4037fc6b:0x3fce9e00 0x4037dc30:0x3fce9e20 0x4037dc26:0xffffffff |<-CORRUPTED

platformio:

[env:esp32-s3-devkitc-1]
platform = espressif32
framework = arduino, espidf

monitor_speed = 115200
board = esp32-s3-devkitc-1
;board_build.arduino.memory_type = dio_opi ; set to octal in SDKconfig
board_build.partitions = default_partitions.csv

build_flags = 
	-I./src/
	-DCORE_DEBUG_LEVEL=5
	-DBOARD_HAS_PSRAM
	-mfix-esp32-psram-cache-issue
	-fmax-errors=5

Key SPIRAM settings in sdkconfig.esp32-s3-devkitc-1

CONFIG_ESP32S3_SPIRAM_SUPPORT=y

#
# SPI RAM config
#
# CONFIG_SPIRAM_MODE_QUAD is not set
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_TYPE_AUTO=y

minimal code example:

#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "sdkconfig.h"
#include <Arduino.h>

void arduinoTask(void *pvParameter)
{
    Serial.begin(115200);
    delay(100);
    Serial.println("Hello World");

    while(1) {
        Serial.println("looping");  
        delay(1000);
    }
}

extern "C" void app_main()
{
    // initialize arduino library before we start the tasks
    initArduino();

    xTaskCreate(&arduinoTask, "arduino_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}

default_partition.csv:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x140000,
app1,     app,  ota_1,   0x150000,0x140000,
spiffs,   data, spiffs,  0x290000,0x170000,
coredump, data, coredump,,        64K

Okay. So give it more stack if it says stack overflow.

Hello Max,
Well yes, of course… silly me to assume that examples should actually work with the chips listed as supported… especially with such a minimal program, I was surprised to see a stack overflow 8^(

I believe the configMINIMAL_STACK_SIZE is just simply too small for the ESP32-S3.

I triangulated on a value that works…an additional 380 words of stack.

xTaskCreate(&arduinoTask, "arduino_task", configMINIMAL_STACK_SIZE + 380, NULL, 5, NULL);

Thanks Max for helping me with the “obvious”.

I submitted an issue to https://github.com/platformio/platform-espressif32/issues/1190 as configMINIMAL_STACK_SIZE appears inadequate for ESP32-S3 in examples #1190

Pete