Successful ESP32-C3 Built In USB JTAG!

BrianP
Posts: 53
Joined: Mon Apr 13, 2020 1:48 pm

Successful ESP32-C3 Built In USB JTAG!

Postby BrianP » Mon May 24, 2021 5:24 pm

I have been struggling for some time with two issues. One is that Eclipse had numerous unresolved inclusions. I don't know why but that has disappeared for the moment. It may be that you simply have to wait after a build.

I followed the instructions kindly provided by ESP_Sprite here https://www.esp32.com/viewtopic.php?f=12&t=21007#p76800 to configure my ESP32-C3 Devkit for USB. This is tricky because the resistors are so small, but I got it done.

Thereafter I could compile and upload code via the built in USB. Occasionally, for some reason, I had to manually reset but otherwise it was fine.

I had many challenges getting OpenOCD to work. I was able to use this tool https://visualgdb.com/UsbDriverTool/ to install the libusb-WinUSB driver, which allowed me to connect to the target board.

After much trial and error, I noticed that in the In Debug Configurations, Debugger tab

GDB Client Setup/Actual Executable was
<user> .espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gdb.exe

I modified this to
<user> .espressif\tools\riscv32-esp-elf\1.24.0.123_64eb9ff-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-gdb.exe


I then got an error which I was able to determine was because GDB expected a 64 bit CPU. This is because the default is 64 bit to you need to include

GDB Client Setup/Other Commands
set arch riscv:rv32


After apply, I can now debug

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Successful ESP32-C3 Built In USB JTAG!

Postby ESP_Minatel » Mon May 24, 2021 5:54 pm

Hi BrianP,

Awesome news! Thank you for sharing your experience.

BrianP
Posts: 53
Joined: Mon Apr 13, 2020 1:48 pm

Re: Successful ESP32-C3 Built In USB JTAG!

Postby BrianP » Mon May 24, 2021 7:46 pm

One thing though.

Besides the unresolved inclusions (which come and go), I cannot get Openocd to program the device first.

openocd -f interface/esp_usb_jtag.cfg -f board/esp32c3-builtin.cfg -c "program_esp blink.bin 0x10000 verify exit"

<stuff left out>
<path to scripts>\scripts/target/esp_common.cfg:101: Error: invalid command name "esp"
in procedure 'program_esp'
at file "C:\Users\bjpic\.espressif\tools\openocd-esp32\v0.10.0-esp32-20210401\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 101

Therefore, I have to select the run configuration, compile and program, switch over to the debug configuration, and debug. I don't know anything about OCD so I have no idea what this means.

joseMiguel
Posts: 22
Joined: Sun Oct 25, 2020 11:43 pm

Re: Successful ESP32-C3 Built In USB JTAG!

Postby joseMiguel » Fri Feb 03, 2023 7:04 am

Hello guys,

Thank you so much BrianP for the solution!

It works.

I was stuck on this issue for a while.

Best regards

Muchas gracias de compartir la soluccion

José Michel
José Michel

Who is online

Users browsing this forum: No registered users and 44 guests