Page 1 of 2

ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Mon Aug 30, 2021 3:31 pm
by bobolink
A Raspberry Pi 4 with (Linux Buster) is all I have.
I'd like to get jtag usb debugging on a rev. 3 ESP32C3DevKit

openocd built OK.
Open On-Chip Debugger v0.10.0-esp32-20210401 (2021-04-01-15:45)
Or the one I built yesterday
Open On-Chip Debugger v0.10.0-esp32-20210721-12-g1cdfdce2 (2021-08-29-20:28)
...
I get this error:
openocd -f board/esp32c3-builtin.cfg
Info : only one transport option; autoselect 'jtag'
Warn : Transport "jtag" was already selected
force hard breakpoints
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: esp_usb_jtag: could not find or open device!

I'm using a ESP32-C3-DevKitC-02 and on /dev/ttyUSB0 and I can program it with IDF examples.
using ESP-IDF v4.3-356-g48ae2309fd-dirty

esptool.py v3.1-dev
Found 2 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C3
Chip is unknown ESP32-C3 (revision 3)

I remember a soldering hardware mod to select the USB jtag but I think that was for an early version of the DevKit
No changes to the DEVKIT board.

Thanks for any help.

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Mon Aug 30, 2021 7:08 pm
by chegewara
bobolink wrote: I remember a soldering hardware mod to select the USB jtag but I think that was for an early version of the DevKit
No changes to the DEVKIT board.
What mod do you talk about? On espressif C3 devkit you can find pads to control if USB is native or over cp210x.
From your logs i can tell you have board with cp210x configuration, so no JTAG, but you can re-solder resistors.
bobolink wrote:Serial port /dev/ttyUSB0
Native USB is ACMx port on linux OS.

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Mon Aug 30, 2021 7:30 pm
by bobolink
Thank you chegewara.
I think I understand.
so no JTAG
Do you know what espressif hardware devkit and version supports ESP32C3 jtag over USB without soldering anything?
I want to use VSCode or Eclipse with visual real-time debugging (like with the raspberry pi pico) but don’t want to buy a j-link.
thanks

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Mon Aug 30, 2021 9:01 pm
by chegewara
I dont know about any devices that have for sure JTAG and i didnt even see such info on mouser.
My C3 devkits are from espressif, but i believe there are some boards on market, because on arduino-esp32 some people are asking to add C3 native USB support to flash boards.

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Tue Aug 31, 2021 1:16 am
by ESP_Sprite
If you get '/dev/ttyUSB0', you're seeing the external USB-to-serial converter that perhaps your board has. The native USB shows up as /dev/ttyACM0. If you have a DevkitM1, you need to move some zero-ohm links to route the USB port to the internal USB-serial-JTAG pins first, specifically R1 and R4 should be moved to R1 and R3. If these are too tiny for you, you can also take an USB cord, cut it in two, and connect the wires to +5V, GPIO18, GPIO19 and GND; the internal USB-serial_JTAG should appear there then.

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Tue Aug 31, 2021 2:26 pm
by bobolink
@ESP_Sprite
Thank you. Will put my DevKitM1 under the microscope and give it a try.
you need to move some zero-ohm links to route the USB port to the internal USB-serial-JTAG pins first, specifically R1 and R4 should be moved to R1 and R3. If these are too tiny for you, you can also take an USB cord, cut it in two, and connect the wires to +5V, GPIO18, GPIO19 and GND; the internal USB-serial_JTAG should appear there then.

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Tue Aug 31, 2021 5:14 pm
by bobolink
OK. Removed resistors and chopped up a cable.
/dev/ttyUSB0 went away and /ttyACM0 showed up--as we hoped.
ls /dev/ttyACM*
/dev/ttyACM0

However, openocd fails trying to open a USB port now. Does it need two ports? One for JTAG and one for serial?

Any help would be greatly appreciated. Those resistors aren't going back anytime soon :D
_______________________
Open On-Chip Debugger v0.10.0-esp32-20210401 (2021-04-01-15:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : Transport "jtag" was already selected
force hard breakpoints
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: esp_usb_jtag: could not find or open device!

Here is some info on the new JTAG port from ESP32-C3-DevKitM-1
35: USB 00.1: 0000 Unclassified device
[Created at usb.122]
Unique ID: DrDI.MMglq5bokX0
Parent ID: ADDn.mUqILwxEtWB
SysFS ID: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.1
SysFS BusID: 1-1.1:1.1
Hardware Class: unknown
Model: "Espressif USB JTAG/serial debug unit"
Hotplug: USB
Vendor: usb 0x303a "Espressif"
Device: usb 0x1001 "USB JTAG/serial debug unit"
Revision: "1.01"
Serial ID: "7C:DF:A1:89:25:A4"
Driver: "cdc_acm"
Driver Modules: "cdc_acm"
Speed: 12 Mbps
Module Alias: "usb:v303Ap1001d0101dcEFdsc02dp01ic0Aisc02ip00in01"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #42 (Hub)

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Tue Aug 31, 2021 5:43 pm
by chegewara
Maybe you are missing udev rules?
On Linux, this usually involves installing a file in /etc/udev/rules.d, so OpenOCD has permissions.
https://openocd.org/doc/html/Running.html

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Tue Aug 31, 2021 6:21 pm
by bobolink
Maybe you are missing udev rules?
Indeed I was.
:oops: :oops: :oops:
Thanks again chegewara (the USB, Bluetooth, BLE, ...) expert.

note to self: read ALL the instructions!
__________________________________________
/home/pi/.espressif/tools/openocd-esp32/v0.10.0-esp32-20210401/openocd-esp32/bin/openocd -f board/esp32c3-builtin.cfg
Open On-Chip Debugger v0.10.0-esp32-20210401 (2021-04-01-15:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : Transport "jtag" was already selected
force hard breakpoints
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)
Info : datacount=2 progbufsize=16
Info : Examined RISC-V core; found 1 harts
Info : hart 0: XLEN=32, misa=0x40101104
Info : Listening on port 3333 for gdb connections

Re: ESP32C3 JTAG-USB on a Raspberry Pi

Posted: Mon Mar 28, 2022 6:34 pm
by daniel060895
bobolink wrote:
Tue Aug 31, 2021 6:21 pm
Maybe you are missing udev rules?
Indeed I was.
:oops: :oops: :oops:
Thanks again chegewara (the USB, Bluetooth, BLE, ...) expert.

note to self: read ALL the instructions!
__________________________________________
/home/pi/.espressif/tools/openocd-esp32/v0.10.0-esp32-20210401/openocd-esp32/bin/openocd -f board/esp32c3-builtin.cfg
Open On-Chip Debugger v0.10.0-esp32-20210401 (2021-04-01-15:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : Transport "jtag" was already selected
force hard breakpoints
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)
Info : datacount=2 progbufsize=16
Info : Examined RISC-V core; found 1 harts
Info : hart 0: XLEN=32, misa=0x40101104
Info : Listening on port 3333 for gdb connections


Sorry, I don't understand how the problem was solved.