Flash And Monitor ESP32-C3 via USB Serial/JTAG in VSCode in Windows 10

lotharyx
Posts: 12
Joined: Fri Dec 13, 2019 4:41 am

Flash And Monitor ESP32-C3 via USB Serial/JTAG in VSCode in Windows 10

Postby lotharyx » Tue Apr 29, 2025 3:28 pm

Hello everyone. I'm working with an ESP32-DevKitM-1 with the C3-MINI-1U module. In order to replicate the final design, I have connected a USB Micro-B connector to the proper pins on the devkit to use the C3's internal USB Serial/JTAG peripheral. I am able to flash via this interface, having selected "ESP32-C3 chip (via builtin USB-JTAG)" for OpenOCD Board Configuration. However, I don't know how to configure the monitor to use that interface inside VSCode.

I think the problem might be that the serial interface doesn't show up as a COMx port in Device Manager, so I have nothing to set for the "Select Port to Use" option. When I plug in the USB cable, I see two "USB JTAG/serial debug unit" devices listed under "Universal Serial Bus devices", and nothing new under "Ports (COM & LPT)".
USB_Devices.PNG
USB_Devices.PNG (16.09 KiB) Viewed 1301 times
Ports.PNG
Ports.PNG (41.46 KiB) Viewed 1301 times
I guess I might have the wrong driver installed for one of the endpoints (using Zadig). Right now both interfaces are set to use WinUSB (v6.1.7600.16385):
Zadig.png
Zadig.png (141.8 KiB) Viewed 1301 times

What do I need to change to be able to use the USB Serial/JTAG serial port for monitoring in VSCode?

lotharyx
Posts: 12
Joined: Fri Dec 13, 2019 4:41 am

[SOLVED] Flash And Monitor ESP32-C3 via USB Serial/JTAG in VSCode in Windows 10

Postby lotharyx » Tue Apr 29, 2025 3:41 pm

Figured it out. It was definitely the wrong drivers with Zadig.

The correct set is:

USB JTAG/serial debug unit (Interface 0) should be USB Serial (CDC) (usbser 1.0.0.0)
USB JTAG/serial debug unit (Interface 2) should be WinUSB (v6.1.7600.16385)

With this setup, OpenOCD can find the JTAG adapter, and the serial monitor shows up as a COMx serial port for monitoring.

Here's additional information that was important in getting this working.

In settings.json, these things were significant:

Code: Select all

    
    "idf.openOcdConfigs": [
        "board/esp32c3-builtin.cfg"
    ],
    "idf.portWin": "COM9",
    "idf.flashType": "JTAG",
    "idf.customExtraVars": {
        "IDF_TARGET": "esp32c3"
    },
For some reason, the IDF tools wanted to set idf.openOcdConfigs to the -bridge configuration, which is incorrect. COM9 is the port that the serial device appears as in my environment.

Also, in sdkconfig, these settings were important for me:

Code: Select all

CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
CONFIG_ESP_CONSOLE_UART_NUM=-1
# CONFIG_CONSOLE_UART_DEFAULT is not set
# CONFIG_CONSOLE_UART_CUSTOM is not set
# CONFIG_CONSOLE_UART_NONE is not set
# CONFIG_ESP_CONSOLE_UART_NONE is not set
CONFIG_CONSOLE_UART_NUM=-1
This is important in my case because I do want the console going to the JTAG/Serial device, but I do not want it going to UART0, which is connected to another microcontroller in my design.

Who is online

Users browsing this forum: No registered users and 1 guest