Serial.PrintIn() runs ok with Arduino IDE, but not prints to monitor console with PlatformIO

Dear Expert,
did you ever encounter this issue? My simple hello world code works with Arduino IDE but can not generate “Hello World” with VScode PlatformIO.

#include "Arduino.h"
#include <stdio.h>
void setup() {
    Serial.begin(115200); 
}

void loop() {
    Serial.println("Hello World?!\n");
    Serial.flush();
    delay(500);
}

This is my Arduino Setting:



This is my Arduino IDE Serial Monitor reads:

14:21:38.357 -> ESP-ROM:esp32s3-20210327
14:21:38.357 -> Build:Mar 27 2021
14:21:38.357 -> rst:0x1 (POWERON),boot:0x29 (SPI_FAST_FLASH_BOOT)
14:21:38.357 -> SPIWP:0xee
14:21:38.357 -> mode:DIO, clock div:1
14:21:38.357 -> load:0x3fce3808,len:0x44c
14:21:38.357 -> load:0x403c9700,len:0xbe4
14:21:38.357 -> load:0x403cc700,len:0x2a38
14:21:38.357 -> entry 0x403c98d4
14:21:38.421 -> Hello World?!
14:21:38.421 -> 
14:21:38.911 -> Hello World?!
14:21:38.911 -> 
14:21:39.399 -> Hello World?!
14:21:39.399 -> 
14:21:39.919 -> Hello World?!

If I upload the code using Arduino IDE first and then use PlatformIO to monitor, VScode PlatformIO Monitor can see “Hello World”. Everything works ok. But, The PlatformIO Monitor does not work when I upload the same code with the VScode PlatformIO.

This is my the platformio.ini code and the main.cpp contains the same hello world code as the Arduino sketch:

[env:adafruit_feather_esp32s3]
platform = espressif32
board = adafruit_feather_esp32s3
; change microcontroller
board_build.mcu = esp32s3

framework = arduino
upload_speed = 921600
board_build.f_flash = 80000000L
board_build.f_cpu = 240000000L
board_build.flash_mode = qio
monitor_port = COM21
monitor_speed = 115200
board_build.partitions = default_16MB.csv


This is what platformIO monitor shows once after I uploaded the code to my ESP32-S3-WROOM-1-N16R2 board with PlatformIO->Upload and Monitor.

Processing adafruit_feather_esp32s3 (platform: espressif32; board: adafruit_feather_esp32s3; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/adafruit_feather_esp32s3.html
PLATFORM: Espressif 32 (6.3.2) > Adafruit Feather ESP32-S3 2MB PSRAM
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-oc
d-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
 - 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\adafruit_feather_esp32s3\firmware.elf
Checking size .pio\build\adafruit_feather_esp32s3\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   9.6% (used 31544 bytes from 327680 bytes)
Flash: [          ]   4.2% (used 276857 bytes from 6553600 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, olim
ex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM21
Forcing reset using 1200bps open/close on port COM21
Waiting for the new upload port...
Uploading .pio\build\adafruit_feather_esp32s3\firmware.bin
esptool.py v4.5.1
Serial port COM21
Connecting....
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:85:18:b4:2f:04
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
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 0x00053fff...
Compressed 15040 bytes to 10331...
Writing at 0x00000000... (100 %)
Wrote 15040 bytes (10331 compressed) at 0x00000000 in 0.3 seconds (effective 359.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 513.3 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 747.0 kbit/s)...
Hash of data verified.
Compressed 277216 bytes to 158089...
Writing at 0x00010000... (10 %)
Writing at 0x0001c4c9... (20 %)
Writing at 0x0002466d... (30 %)
Writing at 0x00029c42... (40 %)
Writing at 0x0002efbc... (50 %)
Writing at 0x00034239... (60 %)
Writing at 0x0003a53c... (70 %)
Writing at 0x00044b77... (80 %)
Writing at 0x0004a36f... (90 %)
Writing at 0x0004fd61... (100 %)
Wrote 277216 bytes (158089 compressed) at 0x00010000 in 2.6 seconds (effective 845.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
--- Terminal on COM21 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_
on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x29 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4

The PlatformIO monitor does not see “Hello World?!” but some strange messages:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4

Your board definition adafruit_feather_esp32s3 has

  -DARDUINO_USB_CDC_ON_BOOT=1

which would correspond to the Arduino Setting

  USB CDC On Boot: "Enabled"

which is disabled in your Arduino IDE settings (see your screenshot)

With this setting enabled, all Serial.print statements are routed to the native USB port on the ESP32. If you want to use the RX/TX pin and/or the USB2Serial Chip you have either to disable this setting by adding

build_flags=
  -DARDUINO_USB_CDC_ON_BOOT=0

to your platformio.ini or use Serial0 in your sketch.

2 Likes

Thank You Sir. But, after disabling the CDConBoot, I still can not see the hello world. Could anyone help me to dig a little deeper on this issue?

When I uses below platformio.ini and USB2Serial Chip:

[env:adafruit_feather_esp32s3]
platform = espressif32
board = adafruit_feather_esp32s3
; change microcontroller
board_build.mcu = esp32s3

framework = arduino
upload_speed = 921600
board_build.f_flash = 80000000L
board_build.f_cpu = 240000000L
board_build.flash_mode = qio
board_build.partitions = default_16MB.csv

build_flags =
   -DARDUINO_USB_CDC_ON_BOOT=0
monitor_port = /dev/cu.usbmodem14*
monitor_speed = 115200

I got compile warning:

Processing adafruit_feather_esp32s3 (platform: espressif32; board: adafruit_feather_esp32s3; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/adafruit_feather_esp32s3.html
PLATFORM: Espressif 32 (6.3.2) > Adafruit Feather ESP32-S3 2MB PSRAM
HARDWARE: ESP32S3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olim
ex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - 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
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduinoVariant\variant.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\src\main.cpp.o
Building .pio\build\adafruit_feather_esp32s3\bootloader.bin
Generating partitions .pio\build\adafruit_feather_esp32s3\partitions.bin
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
esptool.py v4.5.1
Creating esp32s3 image...
Merged 1 ELF section
Successfully created esp32s3 image.
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\FirmwareMSC.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\HWCDC.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\HardwareSerial.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\IPAddress.cpp.o
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\IPv6Address.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\Print.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\Stream.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\Tone.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\USB.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\USBMSC.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\WMath.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\WString.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\base64.cpp.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\cbuf.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-adc.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-bt.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-gpio.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-i2c-slave.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-matrix.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-misc.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-psram.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-rgb-led.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-rmt.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-timer.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-tinyusb.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-touch.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\esp32-hal-uart.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\firmware_msc_fat.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\main.cpp.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\stdlib_noniso.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\wiring_pulse.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Compiling .pio\build\adafruit_feather_esp32s3\FrameworkArduino\wiring_shift.c.o
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "ARDUINO_USB_CDC_ON_BOOT" redefined
<command-line>: note: this is the location of the previous definition
Archiving .pio\build\adafruit_feather_esp32s3\libFrameworkArduino.a
Linking .pio\build\adafruit_feather_esp32s3\firmware.elf
Retrieving maximum program size .pio\build\adafruit_feather_esp32s3\firmware.elf
Checking size .pio\build\adafruit_feather_esp32s3\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   6.0% (used 19756 bytes from 327680 bytes)
Flash: [          ]   4.0% (used 263621 bytes from 6553600 bytes)
Building .pio\build\adafruit_feather_esp32s3\firmware.bin
esptool.py v4.5.1
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
================================================================== [SUCCESS] Took 16.86 seconds ==================================================================

 *  Terminal will be reused by tasks, press any key to close it. 

Monitor gave this message:

--- Available ports:
---  1: COM8                 'Standard Serial over Bluetooth link (COM8)'
---  2: COM9                 'Standard Serial over Bluetooth link (COM9)'
---  3: COM21                'Silicon Labs CP210x USB to UART Bridge (COM21)'
---  4: COM22                'USB Serial Device (COM22)'
--- Enter port index or full name: 3
--- Terminal on COM21 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter,
 time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x28 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4

I also tried to connect with a USB cable directly to the USB connector. But, still I can not see the hello world. The monitor gave me these message.

--- Available ports:
---  1: COM8                 'Standard Serial over Bluetooth link (COM8)'
---  2: COM9                 'Standard Serial over Bluetooth link (COM9)'
---  3: COM21                'Silicon Labs CP210x USB to UART Bridge (COM21)'
---  4: COM22                'USB Serial Device (COM22)'
--- Enter port index or full name: 4
--- Terminal on COM22 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter,
 time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cd9f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4

I also tried:

  • I enable the CDConBoot by setting (-DARDUINO_USB_CDC_ON_BOOT=1). The resulting Monitor messages are the same as above and the compile error was gone.
  • I added the following two lines to platformio.ini based on this post. There is no error. But, Monitor messages are the same as above.
monitor_rts = 0
monitor_dtr = 0

However, Once I changed the platformio.ini to another board and a different csv file, the issue was magically solved. Could any expert know what default board setting and csv configurations cause this difference?
This is my new platformio.ini. I only changed the board from adafruit_feather_esp32s3 to esp32-s3-devkitc-1 and the CSV file from default_16MB.csv to my.csv:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
; change microcontroller
board_build.mcu = esp32s3

framework = arduino
upload_speed = 921600
board_build.f_flash = 80000000L
board_build.f_cpu = 240000000L
board_build.flash_mode = qio
board_build.partitions = my.csv

monitor_port = /dev/cu.usbmodem14*
monitor_speed = 115200

The Monitor now has the “Hello Word?!” reading:

--- Available ports:
---  1: COM8                 'Standard Serial over Bluetooth link (COM8)'
---  2: COM9                 'Standard Serial over Bluetooth link (COM9)'
---  3: COM21                'Silicon Labs CP210x USB to UART Bridge (COM21)'
--- Enter port index or full name: 3
--- Terminal on COM21 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter,
 time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x29 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
E (78) esp_core_dump_flash: No core dump partition found!
E (78) esp_core_dump_flash: No core dump partition found!
Hello World?!

Hello World?!

Hello World?!

You have used different board settings in platformio.ini (first adafruit_feather_esp32s3 and now esp32-s3-devkitc-1).
In addition, you set some extra parameters that should not be necessary for a “standard board”.
All these settings must match your board.

The settings you have made differ from your Arduino IDE settings (e.g. the 16 MB partition, whereas you have only set 4MB in the Arduino IDE).

Please try a minimal settings:

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

Then only change settings what really needs to be changed.

Which board do you use exactly?
What specification does it have (size of flash, size of PSRAM)?

By the way: You can choose the COM port to be used in the bottom statusbar:
image

1 Like

Yes, Sir. I tried your code and it works perfect.

And, this is the Monitor reading.

--- Terminal on COM21 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter,
 time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x29 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
Hello World?!

Hello World?!

Hello World?!

Hello World?!

Hello World?!

Hello World?!

Hello World?!

My board is ESP32-S3-WROOM-1-N16R2.

16MB Flash, 384kB ROM, 2MB SRAM based on Digikey

your solution @sivar2311 works well but…
I am using ESP32 for sensors that wake up from sleep, measure things, send over ESPnow and go to sleep. Entire process takes around 120-350ms depending what they measure.
And I recently tried S3 with that project and there is a small issue: because it is NOT hardware serial but built in USB inside S3, the time of 350ms is not enough for ESP32-S3 to get connected to Platformio, so there is no print on screen.
Everything else works.
When I use the same S3 with the sketch, where it does not go to sleep so fast, all is visible again.
Any solution for that?

thank you

Hi @zyghom

When the ESP32S3 goes into deep sleep, the built-in USB controller is shut down. This causes the computer to lose the “virtual” COM port.

When the ESP wakes up again, it takes some time for the USB connection to be established and the “virtual” COM port on your computer to be set up again.

In your serial terminal program, you would have to wait exactly the time for the “virtual” COM port to become available and only then open the connection (before it is lost again as the ESP goes into deep sleep).

I think for your application the built-in USB is not a solution. You need to use UART with an external USB to serial chip that keeps the serial connection to the computer while the ESP32 is in deep sleep.

@sivar2311 - you confirmed what I was thinking
thank you

So, if I may ask you: how do I define Serial on S3?
And to which GPIO should I connect?
Something like this? (espressif says: Serial on any GPIO)

#define RX_PIN 1
#define TX_PIN 2
SoftwareSerial mySerial(RX_PIN, TX_PIN);  
mySerial.begin(115200);
mySerial.println("hello world");

As I wrote in my first post in this thread, you can either disable USB CDC and use Serial or use Serial0 (if USB CDC is enabled). You don’t have to use SoftwareSerial.

Since you don’t make use of the USB capabilities I suggest to disable USB CDC and simply use Serial.

OK, maybe I am making something up, but I am now at such thing and it works - should I do it different way? I need to define GPIOs somewhere, right?

HardwareSerial mySerial(0);
mySerial.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
mySerial.println("hello world");

No, you don’t need to define GPIO’s or create an extra Serial object.

If you have USB CDC enabled, just use Serial0.
In this case Serial0 is connected to the RX and TX gpio’s.

  Serial0.println("Hello World");

If USB CDC is disabled just use Serial.
In this case Serial is connected to the RX and TX gpio’s.

  Serial.println("Hello World");
1 Like

@sivar2311
See, this is what I just realised because I was confused about GPIOs and in https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/HardwareSerial.cpp I found:

#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 9
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX1 15
#endif
#endif

and similar for TX1
So, if I don’t use GPIO definition, by default RX=15 and TX=16 on S3 (unless I want to change them)
so now, because I have common sketch for all my devices (ESP32, S2, S3, C3), for the boards with S3 I added in config.h:

#define USE_UART
#define RX_PIN 1
#define TX_PIN 2

and further in the setup():

#ifdef USE_UART 
    Serial.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
  #else 
    Serial.begin(115200);
  #endif

that OK now? I mean: it works

1 Like

If you are developing an application for different ESP modules, this looks like a viable solution.

1 Like