ESP32-C3 ESP IDF Monitor Issue

Hello,

I’m working with the Xiao ESP32-C3 in C language using the ESP IDF in Visual Studio Code.

I’ve compiled and successfully programmed the board but when I run “monitor”… I get the following:

PS Z:\ESP32\Projects\HelloWorld\hello_world> set IDF_PATH=z:\ESP32\esp\esp-idf PS Z:\ESP32\Projects\HelloWorld\hello_world> z:\ESP32\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe z:\ESP32\esp\esp-idf\tools\idf_monitor.py -p COM10 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 z:\ESP32\Projects\HelloWorld\hello_world\build\hello_world.elf

--- WARNING: GDB cannot open serial ports accessed as COMx

--- Using [\\.\COM10](file://./COM10) instead...

--- esp-idf-monitor 1.3.2 on [\\.\COM10](file://./COM10) 115200 ---

--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

ESP-ROM:esp32c3-api1-20210207

Build:Feb 7 2021

rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (USB_BOOT) Saved PC:0x400462e2

0x400462e2: ets_efuse_get_wp_pad in ROM

wait usb download

Even when I follow the “IO boot strapping guide” it doesn’t change the results. I’ve changed the USB UART baudrate to 115200 and I’ve enabled USB CDC for serial monitor.

Does anyone know why this happens with this board? I’ve run serial monitor with an espressif board and that other board does not run into this issue.

Thanks,
Nick

Hi there,
I believe you need the 2nd Serial port on the chip to use the CDC. Try that?

Configure ESP32-C3 Built-in JTAG Interface
ESP32-C3 has a built-in JTAG circuitry and can be debugged without any additional chip.
 **Only an USB cable connected to the D+/D- pins is necessary**. The necessary connections are shown in the following section.

Please verify that the ESP32-C3 pins used for USB communication are not connected to 
some other HW that may disturb the JTAG operation.

this LINK may help you.

HTH
GL :slight_smile: PJ

Hi PJ,

Thank you for your response.

I originally tried JTAG but ran into issues with OPENOCD; it seems like those issues have since disappeared. Now when I try to program my xiao esp32-c3 via JTAG in OPENOCD I get the issue below.

I’ve looked at the instructions on the espressif website and it hasn’t helped come to some solution. I’ve followed their instructions a couple of times to see if I was doing anything wrong. I also tried following the instructions under " Q3: I want to reflash the bootloader with factory firmware" on this page: Getting Started | Seeed Studio Wiki but it didn’t solve my issue. Is there a possibility that the boot partition table is different from the standard esp32-c3? Are there any board files I can reference to change my menuconfig to suit this xiao esp32-c3 board?

Thanks,
Nick

[OpenOCD]

Open On-Chip Debugger v0.12.0-esp32-20230419 (2023-04-18-22:02)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

[OpenOCD]

debug_level: 2

[OpenOCD]

Info : only one transport option; autoselecting 'jtag'

[OpenOCD]

Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001

Info : esp_usb_jtag: capabilities descriptor set to 0x2000

[OpenOCD]

Warn : Transport "jtag" was already selected

z:\ESP32\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230419\openocd-esp32\bin\openocd.exe

[OpenOCD]

Info : Listening on port 6666 for

[OpenOCD]

 tcl connections

Info : Listening on port 4444 for telnet connections

[OpenOCD]

Info : esp_usb_jtag: serial (D4:F9:8D:00:BD:18)

[OpenOCD]

Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255

[OpenOCD]

Info : clock speed 40000 kHz

[OpenOCD]

Info : JTAG tap: esp32c3.cpu tap/device found

[OpenOCD]

: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)

[OpenOCD]

Info : datacount=2 progbufsize=16

[OpenOCD]

Info : Examined RISC-V core; found 1 harts

[OpenOCD]

Info :  hart 0: XLEN=32, misa=0x40101104

Info : starting gdb server for esp32c3 on 3333

[OpenOCD]

Info : Listening on port 3333 for gdb connections

[OpenOCD]

Info : accepting 'tcl' connection on tcp/6666

Info : dropped 'tcl' connection

[OpenOCD]

Info : accepting 'tcl' connection on tcp/6666

[OpenOCD]

Flashing z:/ESP32/Projects/helloworld/project-name/build/bootloader/bootloader.bin at 0x0

** program_esp input args <0x0 verify> **

[OpenOCD]

Info : JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)

[OpenOCD]

Info : Reset cause (3) - (Software core reset)

[OpenOCD]

Info : [esp32c3] Found 8 triggers

[OpenOCD]

❌ Error: Failed to get flash maps (-6)!

Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'.

Warn : Failed to get flash mappings (-4)!

[OpenOCD]

Info : Auto-detected flash bank 'esp32c3.flash' size 4096 K

[OpenOCD]

B

Info : Using flash bank 'esp32c3.flash' size 4096 KB

** Programming Started **

[OpenOCD]

Info : PROF: Erased 24576 bytes in 394.692 ms

[OpenOCD]

Info : PROF: Data transferred in 299.109 ms @ 80.2383 KB/s

[OpenOCD]

Info : PROF: Wrote 24576 bytes in 719.257 ms (data

[OpenOCD]

transfer time included)

** Programming Finished in 2000 ms **

** Verify Started **

[OpenOCD]

Info : PROF: Flash verified in 209.225 ms

[OpenOCD]

** Verify OK **

** Flashing done for bootloader/bootloader.bin in 2211 ms **

Flashing z:/ESP32/Projects/helloworld/project-name/build/project-name.bin at 0x10000

** program_esp input args <0x10000 verify> **

[OpenOCD]

Info : JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)

[OpenOCD]

Info : Reset cause (3) - (Software core reset)

[OpenOCD]

** Programming Started **

[OpenOCD]

❌ Error: Algorithm timed out after 40001 ms.

[OpenOCD]

Info : [esp32c3] Halt cause (2)

[OpenOCD]

 - (Illegal Instruction)

[OpenOCD]

❌ Error: ra = 0x4038180a

[OpenOCD]

❌ Error: sp = 0x3fc84770

[OpenOCD]

❌ Error: gp = 0x0

[OpenOCD]

❌ Error: tp = 0x0

[OpenOCD]

❌ Error: t0 = 0x0

[OpenOCD]

❌ Error: t1 = 0x0

[OpenOCD]

❌ Error: t2 = 0x0

[OpenOCD]

❌ Error: s0 = 0x14

[OpenOCD]

❌ Error: s1 = 0x60008000

[OpenOCD]

❌ Error: a0 = 0x78

[OpenOCD]

❌ Error: a1 = 0x0

[OpenOCD]

❌ Error: a2 = 0x0

[OpenOCD]

❌ Error: a3 = 0x10c80218

[OpenOCD]

❌ Error: a4 = 0x0

[OpenOCD]

❌ Error: a5 = 0x2

[OpenOCD]

❌ Error: a6 = 0xa0000000

[OpenOCD]

❌ Error: a7 = 0x14

[OpenOCD]

❌ Error: s2 = 0x0

[OpenOCD]

❌ Error: s3 =

[OpenOCD]

 0x0

[OpenOCD]

❌ Error: s4 = 0xffe7ffff

[OpenOCD]

❌ Error: s5 = 0x3

[OpenOCD]

❌ Error: s6 = 0x10c80218

[OpenOCD]

❌ Error: s7 = 0x1fff00

[OpenOCD]

❌ Error: s8 = 0xa000

[OpenOCD]

❌ Error: s9 = 0x0

[OpenOCD]

❌ Error: s10 = 0xa0

[OpenOCD]

❌ Error: s11 = 0x14

[OpenOCD]

❌ Error: t3 = 0x0

[OpenOCD]

❌ Error: t4 = 0x0

[OpenOCD]

❌ Error: t5 = 0x0

[OpenOCD]

❌ Error: t6 = 0x0

[OpenOCD]

❌ Error: pc = 0x0

[OpenOCD]

❌ Error: mstatus = 0x201800

[OpenOCD]

❌ Error: mepc = 0x0

Error: mcau

[Flash]

Failed to flash the device (JTag), please try again [got response: '-1', expecting: '0']

[OpenOCD]

❌ se = 0x2

Error: Failed to wait algorithm (-302)!

Error: Algorithm run failed (-302)!

Error: Failed to run flasher stub (-302)!

** Flashing Failed **

-1

type or paste code here

I looked around and found the solution here: Debug an ESP32-C3 via its JTAG interface

For this board, JTAG flashing is stable and repeatable if IO8 is connected to 3.3V. JTAG debugging works great too!

Now I’m having an issue with serial monitor. I’m currently running ESP IDF installed via visual studio code (entirely windows-based). After flashing, I run serial monitor and get the following response:

PS Z:\ESP32\Projects\helloworld\project-name> set IDF_PATH=z:\ESP32\esp\esp-idf
PS Z:\ESP32\Projects\helloworld\project-name> z:\ESP32\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe z:\ESP32\esp\esp-idf\tools\idf_monitor.py -p COM8 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 z:\ESP32\Projects\helloworld\project-name\build\project-name.elf
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM8 instead...
--- esp-idf-monitor 1.3.2 on \\.\COM8 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Connection to \\.\COM8 failed. Available ports:
COM8

Hi there,
Yea, be sure no other windows are open with that port on or open , like the Arduino IDE monitor com8, also I would check the baud rate , may be limited to 9600 for monitor?
my .02
HTH
GL :slight_smile: PJ