ESP32-C3 VSCode Platformio USB Serial Debug Not Work (SOLUTION

If you have any ESP32-C3 and trying to use it with VSCode IDE withPlatformio extension you might have problems with debug terminal (UART) if you use USB, which related to the default configurations and can be easily fixed 😎

Image

🔺 Issue Description

If you connect your board using USB (which is super convenient) and it successfully identified in the Windows Device Manager as COM port (Win + R -> devmgmt.msc) and correctly chosen in Platformio settings:

Image

But terminal not work in VSCode:

Image

❔ Causing

USB CDC not enabled by default in Platformio

🔧 Issue Fix

1) Open Explorer in VSCode (Ctrl + Shift + E) and then open platformio.ini file:

ImageImage

2) Add following configuration lines to enableUSB CDC (USB Communication):

build_flags =
                -DARDUINO_USB_CDC_ON_BOOT=1
                -DARDUINO_USB_MODE=1

For example, here is my full file (I use 115200 baud rate):

[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino

monitor_speed = 115200

build_flags =
                -DARDUINO_USB_CDC_ON_BOOT=1
                -DARDUINO_USB_MODE=1

✔ Fixed

Rebuild and reupload the code. Now terminal works fine:

Image

This solution was founded on GitHub Issues:

Image

https://github.com/platformio/platform-espressif32/issues/755#issuecomment-1087493663

61
No comments yet. Be the first to add a comment!
Cookies?