ESP32 S3 continuously resetting instead of printf'ing anything

On my ESP32 S3 board… why am I getting just repeated…

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:QIO, clock div:1
load:0x3fce3808,len:0x164c
ets_loader.c 78

My platformio.ini is simply:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = espidf
monitor_speed = 115200

and main.c is simply:

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

void app_main(void)
{
    for (;;) {
        printf("Hello world!\n");
        vTaskDelay(1000/portTICK_PERIOD_MS);
    }
}

Seems like this should simply work. What stupid thing have I done wrong? The board I’m using is either the Heltec Wifi Kit V3 or the Lilygo T-Display S3.

Try what’s said in Boot loop on ESP32-C3 · Issue #622 · platformio/platform-espressif32 · GitHub, aka adding

board_build.flash_mode = dio

into the platformoi.ini.

You’re a prince among men! Worked like a charm.

1 Like

Hi, and sorry for reviving this topic. I had the same issue, modified the .ini file and it seems that it works for the blink example. However, I am trying to convert my only Arduino framework project into and idf component using platform io.

At 600FE000 len 00002000 (8 KiB): RTCRAM␛[0m
␛[0;32mI (356) spi_flash: detected chip: gd␛[0m
␛[0;32mI (360) spi_flash: flash io: dio␛[0m
␛[0;33mW (364) spi_flash: Detected size(16384k) larger than the size in the binary image header(8192k). Using the size in the binary image header.␛[0m
␛[0;32mI (378) sleep: Configure to isolate all GPIO pins in sleep state␛[0m
␛[0;32mI (384) sleep: Enable automatic switching of GPIO sleep configuration␛[0m
␛[0;32mI (391) cpu_start: Starting scheduler on PRO CPU.␛[0m
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
␛[0;3�+�
assert failed: spinlock_acquire spinlock.h:122 (result == core_id || result == SPINLOCK_FREE)


Backtrace:0x403770e2:0x3fce32b00x4037d855:0x3fce32d0 0x40384bf5:0x3fce32f0 0x40380ddb:0x3fce3410 0x4037ea69:0x3fce3430 0x4037ebe0:0x3fce3470 0x403781ad:0x3fce3490 0x403782a1:0x3fce34c0 0x42041119:0x3fce34e0 0x4203f50d:0x3fce3500 0x4203edcb:0x3fce3520 0x42084f3d:0x3fce3540 0x42082faa:0x3fce3560 0x42083032:0x3fce3580 0x42083c65:0x3fce35b0 0x42084926:0x3fce35e0 0x4208495b:0x3fce3620 0x42002bdc:0x3fce3640 0x40380c15:0x3fce3660




ELF file SHA256: d39ade15d33f5d0a

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40376c80
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x164c
load:0x403c9700,len:0xbb8
load:0x403cc700,len:0x2f88
entry 0x403c9954
␛[0;32mI (29) boot: ESP-IDF 4.4.2 2nd stage bootloader␛[0m
␛[0;32mI (29) boot: compile time 10:05:36␛[0m
␛[0;32mI (29) boot: chip revision: 0␛[0m
␛[0;32mI (31) boot.esp32s3: Boot SPI Speed : 80MHz␛[0m
␛[0;32mI (35) boot.esp32s3: SPI Mode       : DIO␛[0m
␛[0;32mI (40) boot.esp32s3: SPI Flash Size : 8MB␛[0m
␛[0;32mI (45) boot: Enabling RNG early entropy source...␛[0m
␛[0;32mI (50) boot: Partition Table:␛[0m
␛[0;32mI (54) boot: ## Label            Usage          Type ST Offset   Length␛[0m
␛[0;32mI (61) boot:  0 nvs              WiFi data        01 02 00009000 00006000␛[0m
␛[0;32mI (69) boot:  1 phy_init         RF data          01 01 0000f000 00001000␛[0m
␛[0;32mI (76) boot:  2 factory          factory app      00 00 00010000 00100000␛[0m
␛[0;32mI (84) boot: End of partition table␛[0m
␛[0;32mI (88) esp_image: segment 0: paddr=00010020 vaddr=3c0a0020 size=1ca04h (117252) map␛[0m
␛[0;32mI (117) esp_image: segment 1: paddr=0002ca2c vaddr=3fc97020 size=035ech ( 13804) load␛[0m
␛[0;32mI (120) esp_image: segment 2: paddr=00030020 vaddr=42000020 size=99484h (627844) map␛[0m
␛[0;32mI (236) esp_image: segment 3: paddr=000c94ac vaddr=3fc9a60c size=00each (  3756) load␛[0m
␛[0;32mI (237) esp_image: segment 4: paddr=000ca360 vaddr=40374000 size=13018h ( 77848) load␛[0m
␛[0;32mI (258) esp_image: segment 5: paddr=000dd380 vaddr=50000000 size=00010h (    16) load␛[0m
␛[0;32mI (266) boot: Loaded app from partition at offset 0x10000␛[0m
␛[0;32mI (266) boot: Disabling RNG early entropy source...␛[0m
␛[0;32mI (279) cpu_start: Pro cpu up.␛[0m
␛[0;32mI (279) cpu_start: Starting app cpu, entry point is 0x403767a0␛[0m
␛[0;32mI (257) cpu_start: App cpu up.␛[0m
␛[0;32mI (293) cpu_start: Pro cpu start user code␛[0m
␛[0;32mI (293) cpu_start: cpu freq: 160000000␛[0m
␛[0;32mI (293) cpu_start: Application information:␛[0m
␛[0;32mI (296) cpu_start: Project name:     aaespidf-mercury␛[0m
␛[0;32mI (301) cpu_start: App version:      1␛[0m
␛[0;32mI (306) cpu_start: Compile time:     Jan  9 2023 10:03:08␛[0m
␛[0;32mI (312) cpu_start: ELF file SHA256:  d39ade15d33f5d0a...␛[0m
␛[0;32mI (318) cpu_start: ESP-IDF:          4.4.2␛[0m
␛[0;32mI (323) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
␛[0;32mI (330) heap_init: At 3FC9F750 len 000408B0 (258 KiB): D/IRAM␛[0m
␛[0;32mI (336) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM␛[0m
␛[0;32mI (343) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM␛[0m
␛[0;32mI (349) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM␛[0m
␛[0;32mI (356) spi_flash: detected chip: gd␛[0m
␛[0;32mI (360) spi_flash: flash io: dio␛[0m
␛[0;33mW (364) spi_flash: Detected size(16384k) larger than the size in the binary image header(8192k). Using the size in the binary image header.␛[0m
␛[0;32mI (378) sleep: Configure to isolate all GPIO pins in sleep state␛[0m
␛[0;32mI (384) sleep: Enable automatic switching of GPIO sleep configuration␛[0m
␛[0;32mI (391) cpu_start: Starting scheduler on PRO CPU.␛[0m
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
␛[0;3��
**assert failed: spinlock_acquire spinlock.h:122 (result == core_id || result == SPINLOCK_FREE)**


Backtrace:0x403770e2:0x3fce32b00x4037d855:0x3fce32d0 0x40384bf5:0x3fce32f0 0x40380ddb:0x3fce3410 0x4037ea69:0x3fce3430 0x4037ebe0:0x3fce3470 0x403781ad:0x3fce3490 0x403782a1:0x3fce34c0 0x42041119:0x3fce34e0 0x4203f50d:0x3fce3500 0x4203edcb:0x3fce3520 0x42084f3d:0x3fce3540 0x42082faa:0x3fce3560 0x42083032:0x3fce3580 0x42083c65:0x3fce35b0 0x42084926:0x3fce35e0 0x4208495b:0x3fce3620 0x42002bdc:0x3fce3640 0x40380c15:0x3fce3660




ELF file SHA256: d39ade15d33f5d0a

Rebooting...
␀�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40376c80
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x164c
load:0x403c9700,len:0xbb8
load:0x403cc700,len:0x2f88
entry 0x403c9954
␛[0;32mI (29) boot: ESP-IDF 4.4.2 2nd stage bootloader␛[0m

Now, I am running into a boot loop.

Any quick fixes for this that you could help me with or I will have to manually go over the code and analyse what could trigger it… Thanks!

Can you go into the menuconfig and change anything with regards to the flash mode there, if setting it to dio helped in the platformio.ini?

1 Like

Actually this seems wrong. It doesn’t know that you have 16 MByte flash? Better set

board_upload.flash_size = 16MB

And see if there’s something in the Menuconfig where that needs changing too.

1 Like

Thanks for your fast reply!! I’ve changed the memory size in the ini. I think this is because I am using the board = esp32-s3-devkitc-1 and in reality I use a custom pcb with the 16mb flash ESP32-S3-WROOM-1-N16 instead of the ESP32-S3-WROOM-1-N8. The issue however was that I left a debug macro in the default blink_task function. I just deleted it and it seems like it works now… Code for reference

/* Blink Example
   This example code is in the Public Domain (or CC0 licensed, at your option.)
   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/

#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <driver/gpio.h>
#include "sdkconfig.h"
#include <Arduino.h>
#include <mercury.h>
#include <webpage.h>

Mercury device = Mercury("First_app");
Webpage webpage = Webpage("First_app");

DNSServer dnsServer;
AsyncWebServer server(80);
AsyncEventSource events("/events");
DynamicJsonDocument readings(1024);
DynamicJsonDocument thresholds(1024);

/* Can run 'make menuconfig' to choose the GPIO to blink,
   or you can edit the following line and set a number here.
*/
#define BLINK_GPIO (gpio_num_t)CONFIG_BLINK_GPIO

#ifndef LED_BUILTIN
#define LED_BUILTIN 4
#endif

void blink_task(void *pvParameter)
{
    /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
       muxed to GPIO on reset already, but some default to other
       functions and need to be switched to GPIO. Consult the
       Technical Reference for a list of pads and their default
       functions.)
    */
    gpio_pad_select_gpio(BLINK_GPIO);
    /* Set the GPIO as a push/pull output */
    gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
    
    while(1) {
        /* Blink off (output low) */
        gpio_set_level(BLINK_GPIO, 0);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        /* Blink on (output high) */
        gpio_set_level(BLINK_GPIO, 1);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }

    
}

#if !CONFIG_AUTOSTART_ARDUINO
void arduinoTask(void *pvParameter) {
    pinMode(LED_BUILTIN, OUTPUT);
    while(1) {
        digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
        webpage.processNextRequest(dnsServer);
        delay(1000);
    }
}

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

    xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
    xTaskCreate(&arduinoTask, "arduino_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}
#else
void setup() {
    Serial.begin(115200);
    D("\nin setup(), doing Mercury begin()...\n\n")
    delay(100);
    device.begin();
    D("\nin setup(), done Mercury begin()\n\n")
    delay(100);
    D("\nin setup(), starting Webpage\n\n")
    webpage.begin(dnsServer, server, events, readings, thresholds);
    xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
    //pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
    //digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    Serial.println("Hello!");
    webpage.processNextRequest(dnsServer);
    delay(1000);
}
#endif