ESP32-S3-Zero does not work on PlatformIO

Ok, I maked first tests. Wifi Station and AP works when I reduce Tx Power. It’s tricky when use softAP. Have to add delay between init softAP and set Tx Power. I read somewhere on the internet that it was due to a poorly designed radio path. Similar problems were in the small C3 module. I will make some tests where I will find a max txPower for my module. Thanks for help! Here working codes.

STA:

#include <WiFi.h>

const char* ssid = "ssid";
const char* password = "password123";

void setup() {
    Serial.begin(115200);
    delay(1000);
    
    Serial.println("Connecting to WiFi...");
    WiFi.begin(ssid, password);
    WiFi.setTxPower(WIFI_POWER_8_5dBm);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    
    Serial.println("\nConnected!");
    Serial.print("IP: ");
    Serial.println(WiFi.localIP());
}

void loop() {}

AP:

#include <WiFi.h>

const char* ssid = "ESP32_AP";
const char* password = "12345678";

void setup() {
    Serial.begin(115200);
    delay(1000);
    
    Serial.println("Creating SoftAP...");
    WiFi.softAP(ssid, password);
    delay(200);
    WiFi.setTxPower(WIFI_POWER_8_5dBm);
    
    Serial.println("\nSoftAP ready!");
    Serial.print("IP: ");
    Serial.println(WiFi.softAPIP());
}

void loop() {}

excellent :slightly_smiling_face:it work for me too

Thanks a lot! I used your board definition and it works on a simple example but I have a sketch that runs well when compiled in Arduino IDE but crashes in platformio with that board definition. The hardware is esp32-s3-zero. The sketch is about BLE HID. I can see the board advertised to connect on my smartphone but when I connect the board crashes. As I said, if I compile it in Arduino IDE that doesn’t happen. Same code. Do you think there might be something missing in the board definition about the board capabilities or build parameters? I couldn’t get the ESP LOG to work and that might help. I know I’m not giving you much info. It’s ok if you can’t help. Thanks anyways!!

EDIT: Now it works and I don’t know why. :flushed: I do know that the problem happens with -DCORE_DEBUG_LEVEL=5 and it disappears with level 2,1 or removing the argument, but I put that argument after the first mysterious crashes. I don’t know why it failed before.

I don’t think that this is because of the settings but more of the platform versions used.

Please compare the used Arduino Core versions.

Then choose a platform version that matches the Arduino version used in your ArduinoIDE.

I don’t know what to compare with what. For me it’s all a lot of names that might or might not mean the same. :sweat_smile:

Do you think it’s 3.1.1 in Arduino IDE and 3.2.x in PlatformIO?

“framework” is not the same as “core” but I don’t know what to compare then.

Thank you!!

You are using espressif32 @6.10.0 which is Espressif Arduino 2.0.17.

In ArduinoIDE you are using Espressif Arduino 3.1.1, which is not available official to platformio.

So there is a difference in the major version 2.x vs. 3.x!

But you can use pioarduino to get Arduino 3.x in PlatformIO. For 3.1.1 you have to use

platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip

It works very well. But it started working before the change so IDK.
Thanks a lot!

Hi, I have the same board,

https://www.waveshare.com/esp32-s3-zero.htm

and since that board is not available in PlatformIO’s “board manager”.
Here is the platformio.ini file :slight_smile:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_upload.flash_size = 4MB
board_build.partitions = default.csv
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DBOARD_HAS_PSRAM

I got a success when uploading … unfortunately it has no effect on my board (connected). I tried to keep pressed the “BOOT” button while plugin the USB-C cable before uploading … but does not look like it is the issue.

On behalf I have successfully managed to upload and read serial port with Arduino 2.0 IDE.

Any clue ? Will we have soon an updated “Board configuration” release into PlatformIO for that typical board ESP32-S3 Zero from WaveShare ?

Thank you,
Cédric

Try this + -DARDUINO_USB_CDC_ON_BOOT=1

After uploading your sketch you might need to reset the board manually. Since this board is using the native USB for serial monitoring, the connection will be interrupted during a reset. Therefore you might need to reconnect the monitor.

; Flash: 4MB QD, PSRAM: 2MB QD
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags =
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT=1

It said the upload is a success, but no it does not work. Reset manually the board does not help either.

When I close VSCode and open Arduino IDE 2.0, open the Serial monitor I got messages over and over …

here is a sample that I got on the serial monitor :

13:24:26.311 → rst:0x3 (RTC_SW_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
13:24:26.311 → Saved PC:0x403cdb0a
13:24:26.311 → SPIWP:0xee
13:24:26.311 → mode:DIO, clock div:1
13:24:26.311 → load:0x3fce3808,len:0x4bc
13:24:26.311 → load:0x403c9700,len:0xbd8
13:24:26.311 → load:0x403cc700,len:0x2a0c
13:24:26.311 → entry 0x403c98d0
13:24:26.311 → ESP-ROM:esp32s3-20210327
13:24:26.311 → Build:Mar 27 2021
13:24:26.311 → rst:0x3 (RTC_SW_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
13:24:26.311 → Saved PC:0x403cdb0a
13:24:26.311 → SPIWP:0xee
13:24:26.311 → mode:DIO, clock div:1
13:24:26.311 → load:0x3fce3808,len:0x4bc
13:24:26.311 → load:0x403c9700,len:0xbd8
13:24:26.311 → load:0x403cc700,len:0x2a0c
13:24:26.311 → entry 0x403c98d0
13:24:26.311 → ESP-ROM:esp32s3-20210327
13:24:26.311 → Build:Mar 27 2021
13:24:26.311 → rst:0x3 (RTC_SW_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
13:24:26.311 → Saved PC:0x403cdb0a
13:24:26.311 → SPIWP:0xee
13:24:26.311 → mode:DIO, clock div:1
13:24:26.311 → load:0x3fce3808,len:0x4bc
13:24:26.311 → load:0x403c9700,len:0xbd8
13:24:26.311 → load:0x403cc700,len:0x2a0c
13:24:26.311 → entry 0x403c98d0
13:24:26.311 → ESP-ROM:esp32s3-20210327
13:24:26.311 → Build:Mar 27 2021
13:24:26.311 → rst:0x3 (RTC_SW_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
13:24:26.311 → Saved PC:0x403cdb0a
13:24:26.311 → SPIWP:0xee

Here is the code working with IDE Arduino 2.0.

// Be carefull with USB CDC on BOOT : --> Enabled
#include <Adafruit_NeoPixel.h>

#define PIN        21 
#define NUMPIXELS 1

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

const long interval = 200;  // interval at which to blink (milliseconds)

int ledState = LOW;  // ledState used to set the LED
unsigned long previousMillis = 0;

void setup() {

 Serial.begin(9600);

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)

  pixels.clear(); // Set all pixel colors to 'off'
}

void loop() {

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW) {
      pixels.setPixelColor(0, pixels.Color(random(255),random(255),random(255)));
      Serial.println("ON");
    } else {
      pixels.setPixelColor(0, pixels.Color(0,0,0));
      Serial.println("OFF");
    }
    ledState = !ledState;

    pixels.show();
  }
}

Please show the settings from ArduinoIDE,so this can be adapted to platformio.ini

Sorry, did not see your answer. Thank you for answering so fast :smiley:

I do not know how to show you my Arduino settings … then I took that screenshot (tell me if you want something else or smarter :wink:

another update (sorry if it a mess to follow :slight_smile:

I have uploaded the code from Arduino IDE 2.0, it works and I am able to see on Arduino Serial monitor what the ESP32 is sending.
Then I closed the Arduino IDE, and launch VS code with PlatformIO, it also open the same Serial Port and the code is still running (able to see it in VS + platform IO environnement).

I did not unplugged the ESP32 (powered by USB-C from my computer).

It really looks like it is a problem related to “upload” and/or board configuration file from VS + PlatformIO.

Hope it is clear.

Cédric

Back to the beginning. We first need to find common ground.
I suggest a simple sketch for this:

main.cpp:

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print("Hello ");
  Serial.println(millis());
  delay(1000);
}

platformio.ini

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

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags = 
  -DBOARD_HAS_PSRAM
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DARDUINO_USB_MODE=1

monitor_speed = 115200

The only thing difference here is that you have disabled PSRAM in your ArduinoIDE but the Waveshare ESP32-S3-Zero is based on the ESP32-S3FH4R2 which has 2 MB of PSRAM.

Please upload this to your board via PlatformIO show the terminal output from this process. After uploading, open a serial monitor and check if you see some data.

1 Like

OK thank you for your answer.

Just try it. This is the output I get after uploading.

 *  Executing task in folder ESP32_S3_Zero_TEST: platformio run --target upload 

Processing esp32-s3-devkitc-1 (platform: espressif32; board: esp32-s3-devkitc-1; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.10.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio/build/esp32-s3-devkitc-1/firmware.elf
Checking size .pio/build/esp32-s3-devkitc-1/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.8% (used 18924 bytes from 327680 bytes)
Flash: [=         ]   7.9% (used 263425 bytes from 3342336 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/cu.usbmodem2101
Uploading .pio/build/esp32-s3-devkitc-1/firmware.bin
esptool.py v4.5.1
Serial port /dev/cu.usbmodem2101
Connecting....
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: dc:54:75:d8:e4:d8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00052fff...
Compressed 15104 bytes to 10430...
Writing at 0x00000000... (100 %)
Wrote 15104 bytes (10430 compressed) at 0x00000000 in 0.3 seconds (effective 404.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 351.5 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 481.9 kbit/s)...
Hash of data verified.
Compressed 270992 bytes to 146958...
Writing at 0x00010000... (11 %)
Writing at 0x0001c884... (22 %)
Writing at 0x000247f9... (33 %)
Writing at 0x00029f40... (44 %)
Writing at 0x00031a4b... (55 %)
Writing at 0x00037248... (66 %)
Writing at 0x0003c660... (77 %)
Writing at 0x00041daa... (88 %)
Writing at 0x0004a4e0... (100 %)
Wrote 270992 bytes (146958 compressed) at 0x00010000 in 2.5 seconds (effective 876.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
============================================================= [SUCCESS] Took 5.48 seconds =============================================================
 *  Terminal will be reused by tasks, press any key to close it. 

I have this on VS Serial Monitor repeating over and over of course :

rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cdb0a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)

and the same on Arduino IDE2.0 serial monitor (I close VS unplugged ESP32, open Arduino IDE and open serial monitor)

22:24:09.789 -> Build:Mar 27 2021
22:24:09.789 -> rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
22:24:09.789 -> Saved PC:0x403cdb0a
22:24:09.789 -> SPIWP:0xee
22:24:09.789 -> mode:DIO, clock div:1
22:24:09.789 -> load:0x3fce3808,len:0x4bc
22:24:09.789 -> load:0x403c9700,len:0xbd8
22:24:09.789 -> load:0x403cc700,len:0x2a0c
22:24:09.789 -> entry 0x403c98d0
22:24:09.789 -> ESP-ROM:esp32s3-20210327
22:24:09.821 -> Build:Mar 27 2021

any idea why ?
thank you so much for helping.
Cédric

It looks like your board resets over and over again.
The only difference I can see is PSRAM enabled in PlatformIO vs. disabled in ArduinoIDE

Please remove -DBOARD_HAS_PSRAM and upload again.

just tried this, and it has no effect, still the that loop of messages printed over and over on VSCode+PlatformIO Serial Monitor.

Just to be clear, the exact same happens with this platformio.ini?

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_upload.flash_size = 4MB
board_build.partitions = default.csv
build_flags = 
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DBOARD_HAS_PSRAM

I wonder why these settings work for everyone, but not for you.

Another question: this is the exact board you’re using?

I redo a new project with platform IO and this time it works.
I do not know exactly why !? Maybe I missed something with VSCode workspace/project or something like this. I know that we have to create a brand new project with PlatformIO homepage from VSCode.

May be several platformio.ini was open at the same time and did a mess when I upload. Anyway thank you for the support, I can program the board now, I can read info sent by ESP32-S3 Zero into serial monitor (1st time it missed the beginning of what I supposed to see, but after few launch these effect disappears).

A last question before closing this, do we have opportunity to save that configuration into “boards” on platformIO ?

Thank you

Cédric

You can create a board manifest (“waveshare_esp32_s3_zero.json”) and copy this to %HOMEPATH%/.platformio/boards/. Doing so you can simply use board = waveshare_esp32_s3_zero in your projects.

You’ll find a few custom board manifest here.

This topic is already marked as solved since May 2024 :wink:

1 Like