sayanee
September 23, 2022, 3:33am
1
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
macOS Monterey 12.6
VS Code version 1.71.2
PlatformIO VS Extension Core 6.1.4
, Home 3.4.3
Board: Espressif ESP32-S3-DevKitC-1-N8R2
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
2 Likes
sayanee
September 23, 2022, 7:06am
3
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
borland
September 23, 2022, 8:54pm
4
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
sayanee:
CDC on Boot enabled
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 .
1 Like
sayanee
September 29, 2022, 8:19am
6
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
3 Likes
sayanee
September 29, 2022, 8:25am
7
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 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
opened 09:47PM - 19 Jul 22 UTC
closed 09:14PM - 02 Aug 22 UTC
Status: Awaiting triage
Area: Peripherals API
### Board
Custom Designed board with ESP32S3Wroom-1U
### Device Descripti… on
ESP32S3Wroom with 16 MB of flash and 8 MB of PSRAM
### Hardware Configuration
It is our custom design board and we have added a few functionalities to it.
### Version
v2.0.4
### IDE Name
Arduino IDE
### Operating System
Windows 10
### Flash frequency
DIO 80 MHz and QIO 80 MHz
### PSRAM enabled
yes
### Upload speed
921600
### Description
An important note is as I have S3 Wroom 1U with 16 MB Flash, I choose ESP32 S3 Dev Module in Board selection in Arduino IDE and also I select OPI PSRAM to program our custom-designed board.
1. After each upload, I always get SHA-256 comparison failed, how can I solve it?
2. Sometimes I get heap poisoning issues as shown in Debug message. Is it because the ESP32 S3 Arduino code is still in development mode(not stable)?
### Sketch
```cpp
For most standard sketches, I get the following in S3 chip;
SHA-256 comparison failed:
Calculated: 9477899d59fa5164e630d8218cb3994031873358e9105b31f53911d2dfd36c72
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
```
### Debug Message
```plain
CORRUPT HEAP: Bad head at 0x3fce5a6c. Expected 0xabba1234 got 0x3fce0014
assert failed: multi_heap_free multi_heap_poisoning.c:253 (head != NULL)
Backtrace:0x403777a6:0x3fce2d000x4037a8f1:0x3fce2d20 0x4038031d:0x3fce2d40 0x4037ff8f:0x3fce2e70 0x40377a75:0x3fce2e90 0x4038034d:0x3fce2eb0 0x42007c1b:0x3fce2ed0 0x42008cb8:0x3fce2f00 0x42001fac:0x3fce2f20 0x42002111:0x3fce2f40 0x42001f22:0x3fce2f60 0x42001daf:0x3fce2f80 0x4200e7bd:0x3fce3030
ELF file SHA256: 0000000000000000
Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2a (SPI_FAST_FLASH_BOOT)
Saved PC:0x4202cbfe
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
SHA-256 comparison failed:
Calculated: 9477899d59fa5164e630d8218cb3994031873358e9105b31f53911d2dfd36c72
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98c0
[ 124][D][esp32-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 6 = 80 Mhz, APB: 80000000 Hz
[ 124][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
```
### Other Steps to Reproduce
Thank you!
### I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
1 Like
//Esp32 c3 mini
[env:esp32-c3-devkitc-02]
platform = espressif32
board = esp32-c3-devkitc-02
framework = arduino
upload_port = COM5
monitor_speed = 115200
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
monitor_rts = 0
monitor_dtr = 0