Cannot view the serial monitor on VS Code PlatformIO with board ESP32-S3

Hi everyone! I’m a newbie for PlatformIO. And I am unsuccessful in viewing the serial monitor with ESP32-S3 on the VS Code editor.

Boards and versions

  1. macOS Monterey 12.6
  2. VS Code version 1.71.2
  3. PlatformIO VS Extension Core 6.1.4, Home 3.4.3
  4. Board: Espressif ESP32-S3-DevKitC-1-N8R2
  5. Arduino ESP32 package version in Arduino IDE is 2.0.4

What works

Blinky sketch with serial print works on Arduino IDE with the menu option CDC on Boot enabled. I used the same code for platformIO also.

#include <Arduino.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  Serial.begin(115200);
  Serial.println("Start blinky");
}

void loop() {
  Serial.println("LED ON");
  digitalWrite(LED_BUILTIN, LOW);
  delay(200);

  Serial.println("LED OFF");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(200);
}

I am also able to compile and upload successfully to the board using platformIO on VS Code.

What does not work

I am unable to view the serial monitor on VS Code with Platform IO. Compiling, uploading and showing the blinky LED is successful. I have used the platform.ini file to define the following:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
monitor_port = /dev/cu.usbmodem14*
monitor_speed = 115200

The serial monitor shows the following, but no LED ON and LED OFF

 *  Executing task: platformio device monitor 

--- Terminal on /dev/cu.usbmodem14101 | 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

Thanks for your help!

Don`t know for S3, but for generic ESP32 I need just this in .ini file, for serial to work:

monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0

1 Like

Uh! Sigh, it went past the previous steps when I added the RTS/DTR config in platform.ini, but SHA-256 check is failing.

I checked the Espressif forum and am not sure what to do about it.

 *  Executing task: platformio device monitor 

--- forcing DTR inactive
--- forcing RTS inactive
--- Terminal on /dev/cu.usbmodem14101 | 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:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420207f2
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
SHA-256 comparison failed:
Calculated: 5830b36eadda2ccdc73ac0028cd665f9a0ae0dcfc1ccf372c71f9cc6bad2ccc4
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98c0

I have no experience with this board, but your problem is not likely with PlatformIO, but in hardware.

Since the ESP32-S3 processor runs on 3.3V, you might want to take a look at your boards schematic to see how the processor interfaces with the board’s USB and UART ports. There appears to be a 5V input pin, and only ESD and transient voltage protection, no level shifting.

You might try adding 5V input or interfacing your ESP32 S3 with your PC through a level shifter powered by 5V or FTDI serial adapter from one of the other ESP32 serial ports.

I have tried using the Serial Monitor from the PlatformIO CLI, but it has not worked for me. I personally, I would rather use a serial monitor program like PuTTY, or even the built-in Arduino Serial Monitor.

This is only intended for the STM32 Arduino core.

If you want

That translates to adding

build_flags = 
   -DARDUINO_USB_MODE=1
   -DARDUINO_USB_CDC_ON_BOOT=1

to the platformio.ini, as previously discussed in e.g. ESP32-C3 SHA-256 comparison failed and no start - #2 by maxgerhardt.

Thanks, @maxgerhardt! Indeed, my build-flags were wrong. And now I see my serial monitor.

I still do see the SHA-256 comparison failed error, but the serial monitor does come up immediately.

For future reference, this is my complete platform.ini file now:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
build_flags =
   -DARDUINO_USB_MODE=1
   -DARDUINO_USB_CDC_ON_BOOT=1
monitor_port = /dev/cu.usbmodem14*
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0

Thanks a lot, everyone! I know it’s not easy to make this work for so many boards and toolchain versions. Thanks for all the discussion and help :smiley:

1 Like

Thanks for chipping in @borland!

I did test my board with Arduino IDE and ESP-IDF on VS Code and the blinky sketch worked. So I still believe the board is OK. But I agree that it’s always important to check the input voltage.

And yes, I am like you :grin: I also use an external serial monitor like CoolTerm. But this time, the serial monitor did not come up even with the command screen or CoolTerm.

Thanks for your input. I learned something about ESD and transient voltage protection.

For framework = arduino, this is expected output since the bootloader section is not rebuilt, see comments from the developer

1 Like