JTAG error with ESP32-S3-DevKitC

pbeam66
Posts: 3
Joined: Sun Aug 06, 2023 9:56 pm

JTAG error with ESP32-S3-DevKitC

Postby pbeam66 » Mon Aug 07, 2023 9:24 pm

I purchased a new ESP32-S3-DevKitC with the hope of developing using the internal JTAG. I have previously had success with the ESP-WROVER-KIT, but I was looking for something smaller, without an LCD, etc. I am using a Windows 10 platform, Visual Studio Code plug-in, and esp-idf tools v 5.1. I can build code and upload over a serial port, but I cannot upload or debug with the intneral JTAG. OpenOCD gives the output below. It appears to have a problem with "esp_common.cfg, line 4. Is this actually an error with the config file or does this indicate the USB device is not detected? I am using the USB marked "USB" on the DevKitC.

Code: Select all

[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

C:\Users\rpaul\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230419\openocd-esp32\bin\openocd.exe

[OpenOCD]
Info : only one transport option; autoselecting 'jtag'

[OpenOCD]
Info : esp_usb_jtag: VID set
[OpenOCD]
 to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000

[OpenOCD]
Warn : Transport "jtag" was already selected

[OpenOCD]
Info : Listening on port 6666 for tcl connections

[OpenOCD]
Info : Listening on port 4444 for telnet connections

[OpenOCD]
❌ Error: esp_usb_jtag: could not find or open device!

[OpenOCD]
❌ C:\Users\rpaul\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230419/openocd-esp32/share/openocd/scripts/target/esp_common.cfg:4: Error: 
at file "C:\Users\rpaul\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230419/openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 4

[OpenOCD]
[Stopped] : OpenOCD Server
esp_common.cfg contents:

Code: Select all

# SPDX-License-Identifier: GPL-2.0-or-later
#

catch {[source [find target/esp_version.cfg]]}
set _OPENOCD_VER [ version ]
if { [info exists EXPECTED_VER] && [string first $EXPECTED_VER $_OPENOCD_VER] == -1 } {
    echo "WARNING!!! OpenOCD binary version ($_OPENOCD_VER) doesn't match the .cfg file version ($EXPECTED_VER)"
}

# Common ESP chips definitions
if { [info exists ESP_RTOS] } {
	set _RTOS "$ESP_RTOS"
} else {
	set _RTOS "FreeRTOS"
}

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: JTAG error with ESP32-S3-DevKitC

Postby ESP_igrr » Tue Aug 08, 2023 1:28 pm

pbeam66 wrote:
Error: esp_usb_jtag: could not find or open device!
this indicates that OpenOCD wasn't able to find the device in the system. Could you try to open Device Manager and check which device appears in the system when you plug in the development board? What are its VID and PID? Do they match the expected ones (0x303a:0x1001)?

pbeam66
Posts: 3
Joined: Sun Aug 06, 2023 9:56 pm

Re: JTAG error with ESP32-S3-DevKitC

Postby pbeam66 » Tue Aug 08, 2023 5:30 pm

That is helpful. I was uncertain whether the error was actually a config file or a USB connection error. Better than DeviceManager, I use USBLogView and it indicates the folowing:

Event Type Event Time Description Device Type Vendor ID Product ID USB Class USB SubClass
Plug 8/8/2023 1:07:25 PM USB Composite Device Unknown 303a 1001 00 00
Plug 8/8/2023 1:07:25 PM USB Serial Device Communication 303a 1001 02 02
Plug 8/8/2023 1:07:25 PM USB JTAG debug unit Unknown 303a 1001 00 00

Now, I have some good news and some bad news. The good news is that when I manually run "openocp -f board/esp32s3-builtin.cfg" it works without the previous error. The bad news is that I do not know why. Is it necessary to program the S3-DevKitC via serial before trying to do JTAG? I went straight to JTAG right out of the box and had errors.

The other thing I did was go back to my WROVER-KIT, plug it in (with the S3 unplugged), and ran Openocd manually to see that it would connect -- it did.

This is resolved, but I don't understand why it works now and did not before. Thanks.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: JTAG error with ESP32-S3-DevKitC

Postby ESP_igrr » Wed Aug 09, 2023 7:14 am

pbeam66 wrote: Is it necessary to program the S3-DevKitC via serial before trying to do JTAG? I went straight to JTAG right out of the box and had errors.
It depends on whether the program flashed into the chip is reconfiguring USB pins or not. If it does, you might have flash some temporary program (like "blink" example) first to make sure the USB port is in its default state.

supra124
Posts: 1
Joined: Fri Nov 03, 2023 8:40 pm

Re: JTAG error with ESP32-S3-DevKitC Still Occurs

Postby supra124 » Fri Nov 03, 2023 9:04 pm

Hello,

I've been running into the same issue with a similar setup. I started from the command line, and I get an error similar to the original posts:

My input:
openocd -f board/esp32s3-builtin.cfg


The output:
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
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_NOT_FOUND
Error: esp_usb_jtag: could not find or open device!

I know my Esp32-S3 is properly plugged in; I've used both USBLogView and Device Manager to confirm that the proper port is being used:

Event Type Event Time Device Name Description Device Type Drive Letter Serial Number Vendor ID Product ID Vendor Name Product Name Firmware Revision USB Class USB SubClass USB Protocol
Plug 11/3/2023 3:44:50 PM Port_#0001.Hub_#0002 USB Composite Device Unknown 84:F7:03:C0:71:D4 303a 1001 1.01 00 00 00
Plug 11/3/2023 3:44:50 PM 0000.0014.0000.001.000.000.000.000.000 USB Serial Device Communication COM5 303a 1001 1.01 02 02 00
Plug 11/3/2023 3:44:50 PM 0000.0014.0000.001.000.000.000.000.000 WinUsb Device Unknown 303a 1001 1.01 00 00 00
(I did find it odd that instead of recognizing the device as a JTag interface, it is just a WinUsb. Not sure if this is major, but I think it could be changed with Zadig.)

The desired 303a and 1001 are in the .cfg file, and they match the Hardware IDs found in Device Manager:

USB\VID_303A&PID_1001&REV_0101&MI_00
USB\VID_303A&PID_1001&MI_00

I've run into this issue while using both Eclipse and the Command Line. I've checked all the relevant .cfg files to make sure things are in the right spot.

I've tried updating any drivers, but nothing has worked. My only conclusion is that OpenOCD cannot communicate with the ESp32-S3 board because of some kind of permission issue, but I have no idea what that would be. Any help would be appreciated.

rana.roy
Posts: 3
Joined: Thu Feb 15, 2024 11:54 am

Re: JTAG error with ESP32-S3-DevKitC

Postby rana.roy » Thu Feb 15, 2024 12:04 pm

I am using the ESP32-C3 devkitC02 and trying to setup the openOCD to debug. But, I am also having the same issue.

Open On-Chip Debugger 0.11.0+dev-00728-gb6f95a16c (2024-01-31-11:34)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
/home/rana/workspace/zephyr/boards/riscv/esp32c3_devkitm/support/openocd.cfg:8: Error: Can't find interface/ftdi/esp32_devkitj_v1.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 26
at file "/home/rana/workspace/zephyr/boards/riscv/esp32c3_devkitm/support/openocd.cfg", line 8
FATAL ERROR: command exited with status 1: /home/rana/.local/zephyr-sdk-0.16.5/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/rana/workspace/zephyr/boards/riscv/esp32c3_devkitm/support -s /home/rana/.local/zephyr-sdk-0.16.5/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/rana/workspace/zephyr/boards/riscv/esp32c3_devkitm/support/openocd.cfg -c 'tcl_port 6333' -c 'telnet_port 4444' -c 'gdb_port 3333' -c 'reset init'

Your suggestions will very grateful.

grantb
Posts: 10
Joined: Thu Oct 18, 2018 9:51 pm

Re: JTAG error with ESP32-S3-DevKitC

Postby grantb » Thu Nov 21, 2024 6:03 pm

So everyone gave up? I'm interested in using the ESP-PROG 10-pin header with my S3 DevKitC and this page has some great info:

https://www.visualmicro.com/page/ESP32S ... gging.aspx

About the STRAP_JTAG_SEL strapping pin for being able to control whether standard (pad) JTAG or USB-JTAG is used. on most documents I find that it's GPIO3 that can be used for this function, but espfuse tells me that it's actually GPIO10. Anyone make any headway?
STRAP_JTAG_SEL (BLOCK0) = False R/W (0b0)
Set this bit to enable selection between usb-to-jtag and pad-to-jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0

DIS_PAD_JTAG (BLOCK0) = False R/W (0b0)
Set this bit to disable JTAG in the hard way. JTAG is disabled permanently

SOFT_DIS_JTAG (BLOCK0) = 0 R/W (0b000)
Set these bits to disable JTAG in the soft way (odd number 1 means disable ). JTAG can be enabled in HMAC module

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: JTAG error with ESP32-S3-DevKitC

Postby ESP_Sprite » Fri Nov 22, 2024 1:57 am

grantb wrote:
Thu Nov 21, 2024 6:03 pm

About the STRAP_JTAG_SEL strapping pin for being able to control whether standard (pad) JTAG or USB-JTAG is used. on most documents I find that it's GPIO3 that can be used for this function, but espfuse tells me that it's actually GPIO10. Anyone make any headway?
STRAP_JTAG_SEL (BLOCK0) = False R/W (0b0)
Set this bit to enable selection between usb-to-jtag and pad-to-jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0
Datasheet confirms it's GPIO3. I think the GPIO10 indication is a copy/paste from the ESP32C3 that no one corrected. I'll poke the team responsible for that.

grantb
Posts: 10
Joined: Thu Oct 18, 2018 9:51 pm

Re: JTAG error with ESP32-S3-DevKitC

Postby grantb » Fri Nov 22, 2024 3:42 pm

Thanks for your help! I posted an issue:

https://github.com/espressif/esptool/issues/1037

grantb
Posts: 10
Joined: Thu Oct 18, 2018 9:51 pm

Re: JTAG error with ESP32-S3-DevKitC

Postby grantb » Fri Nov 22, 2024 8:13 pm

SOLVED: I was able to get this to work today. To use pad JTAG (such as my ESP-PROG), I needed to set the efuse STRAP_JTAG_SEL to one so that *GPIO3* can be used as a strapping pin to point the JTAG at the "pads" instead of USB-JTAG. I used a jumper to ground GPIO3.

There may be other solutions that work also. I recommend first making sure that JTAG works with a vanilla ESP32 because there are pitfalls there as well (such as the well known driver swap using Zadig). I am using Espressif IDE and the only time I needed the CLI, was to set the eFuse.

Who is online

Users browsing this forum: Baidu [Spider], ok-home and 198 guests