Built-in JTAG on ESP32-C6-WROOM-1 failing while serial over USB works

arc12_esp
Posts: 7
Joined: Thu May 22, 2025 2:22 pm

Built-in JTAG on ESP32-C6-WROOM-1 failing while serial over USB works

Postby arc12_esp » Sat Jun 14, 2025 7:19 pm

Using a test program which can be programmed over the USB to built-in JTAG adapter on an ESP32-C6-DevkitC-1 without any issue, I cannot get it to work on a custom board using an ESP32-C6-WROOM-1 module. Devkit is 8M flash and wroom is 4M flash.

I am using VSCode with the official Espressif extension. Windows 11.

On custom board there is a USB "mini" connector connected to the D+/D- pins of the WROOM module. The D+/D- traces are about 70mm long and 12mil wide. I can program using the CDC serial- i.e. using the built-in USB. There is no separate USB/UART adapter in use. The uploaded firmware has several printf() and stdout appears over the USB interface
So: I think this proves that the D+/D- connections are good.

I have checked the efuses. All the JTAG fuses are default 0. So GPIO15 strapping is ignored and the device should use the USB Serial/JTAG controller built-in interface.

BUT: when attempting to start the OpenOCD server, I always get

Code: Select all

❌ Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
❌ Error: esp_usb_jtag: could not find or open device!
C:\Users\Adam\.espressif\tools\openocd-esp32\v0.12.0-esp32-20241016\openocd-esp32\share\openocd\scripts/target/esp_common.cfg:9: Error: 
at file "C:\Users\Adam\.espressif\tools\openocd-esp32\v0.12.0-esp32-20241016\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 9
Error: [esp32c6] Unsupported DTM version: -1
Error: [esp32c6] Could not identify target type.
Checking the "Computer Management" Device Manager, and comparing the connection to the Devkit and my custom board shows the same drivers are in use for the "USB JTAG/serial debug unit" device.

I cannot think what to do! Why does the serial route of the built-in USB work, while JTAG fails?

Any ideas would be warmly welcomed!

Thanks in advance, Adam

arc12_esp
Posts: 7
Joined: Thu May 22, 2025 2:22 pm

Re: Built-in JTAG on ESP32-C6-WROOM-1 failing while serial over USB works

Postby arc12_esp » Wed Jun 18, 2025 2:11 pm

Update -
So... I decided to add minimal components to the custom board, and to add components progressively.

Initially, within absolute minimum, JTAG over USB worked.

Adding an external 32kHz crystal and associated capacitors BROKE JTAG. At this point, "sdkconfig" was left with default RTC oscilator setup.

Changing sdkconfig with

Code: Select all

CONFIG_RTC_CLK_SRC_EXT_CRYS=y
CONFIG_ESP_SYSTEM_RTC_EXT_XTAL=y
CONFIG_ESP_SYSTEM_RTC_EXT_XTAL_BOOTSTRAP_CYCLES=1000
CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES=1000
CONFIG_RTC_CLK_CAL_CYCLES=8000
JTAG now works on the newly-built board and measuring frequency using esp_clk_tree_src_get_freq_hz(SOC_MOD_CLK_RTC_SLOW, ESP_CLK_TREE_SRC_FREQ_PRECISION_EXACT, &measured_rtc_freq); gives the correct value.

HOWEVER: loading the same firmware to the initial build custom board does not fix JTAG, although esp_clk_tree_src_get_freq_hz() does report the correct value.

So... although I do not have sufficient evidence to declare "SOLVED", I think this is something worth trying if anyone else has the same issue.

Comments welcome!

Who is online

Users browsing this forum: Baidu [Spider], ChatGPT-User, coccocbot and 4 guests