Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

ravid_bn
Posts: 5
Joined: Sun May 14, 2023 1:44 pm

Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ravid_bn » Sun May 14, 2023 1:59 pm

Hello,

I have received an esp32-s3-devkitm-1 board and tried flushing and debugging the blink example on it.
I have followed many threads on the subject and replaced the driver in many options and almost to all available driver.
But all solution could not solve it for me.

Then I realized that ESP-IDF tools provide an inf file in which device Hardware ID (VID_303A&PID_1001&MI_02) is different from the Hardware ID as it recognized by windows (USB\VID_303A&PID_4001&MI_00)
The result is that the device is never recognized as usb_jtag_debug_unit and therefore the wrong driver is loaded, and openOCD can not find it.

I tried changing only the setting at esp_usb_jtag.cfg so it will search for PID 4001 instead of 1001 but bellow is what openOCD printed out:
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x4001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Warn : Interface already configured, ignoring
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x4001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
adapter speed: 40000 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : esp_usb_jtag: serial (123456)
Error: esp_usb_jtag: error finding/claiming JTAG interface on device!

Does any one encounter that problem? do you have any solution to it?

Thanks in advance

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

Re: Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ESP_Sprite » Sun May 14, 2023 2:45 pm

You likely have firmware in the S3 that uses the USB-OTG peripheral and you're seeing that rather than the USB-serial-JTAG. Suggest you turn on the S3 in download mode, i.e. hold 'boot', press and release 'reset' and release 'boot' and try again; you should be seeing the USB-serial-JTAG then. (Obviously, you also need to change your openocd config back.)

ravid_bn
Posts: 5
Joined: Sun May 14, 2023 1:44 pm

Re: Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ravid_bn » Tue May 16, 2023 7:31 am

Wow!!
That was on the spot!!!
Thanks a lot!!!
I could not find such instructions anywhere

ravid_bn
Posts: 5
Joined: Sun May 14, 2023 1:44 pm

Re: Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ravid_bn » Tue May 16, 2023 3:02 pm

Hi again,

Thanks to ESP_Sprite my esp32-s3-devkitm-1 was identified by Windows 10 as "USB/Serial debug unit" When "Restoring to default driver" using "USB Driver Tool" I found the following listed in device manager:
USB JTAG/serial debug unit (interface 0) (COM17)
USB JTAG/serial debug unit (interface 2) (COM16)
And USB Composite device is also recognized with the same DevID
Trying to install either WinUSB or Libusb-WinUSB using "USB Driver Tool" or using "Zadig 2.8" to either install "WinUSB (Microsoft)", "libusb-win32", "WinUSB (libusb)" or libusk result with COM port disappearing.
Only when returning to "USB Serial (CDC)" the COM port apeared again and flash_erase and flash were possible using the UART as a flashing port.
But I could not by any way use the jtag for debugging.
Any suggestion to what I'm doing wrong?

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

Re: Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ESP_Sprite » Wed May 17, 2023 7:57 am

I'm not really familiar with Windows, but I think you specifically need to install winusb on the 2nd interface, not on interface 0 or the composite device itself. You could also see if you can reinstall ESP-IDF using the Windows installer ( https://dl.espressif.com/dl/esp-idf/ ); I think that also installs the drivers properly.

ravid_bn
Posts: 5
Joined: Sun May 14, 2023 1:44 pm

Re: Using usb_jtag_debug_unit driver on esp32-s3-devkitm-1

Postby ravid_bn » Wed May 17, 2023 1:08 pm

Hello ESP_Sprite,

So far you have been most helpful, but unfortunately I still couldn't debug the blink example through the jtag.
I have installed the WinUSB driver for the 2nd interface.
I now have interface 0 as the UART connection and I'm able to flash and erase.
my setting.json look like that :
{
"C_Cpp.intelliSenseEngine": "Tag Parser",
"idf.adapterTargetName": "esp32s3",
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
],
"idf.flashType": "UART",
"idf.portWin": "COM4"
}

Interface 0 is connected to COM4

but when executing \blink> openocd.exe -f board\esp32s3-builtin.cfg
The following output is printed.
When board in download mode:
Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:48)
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
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: serial (F4:12:FA:44:16:00)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000
Warn : target esp32s3.cpu1 examination failed
Info : starting gdb server for esp32s3.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x400488F4, debug_reason=00000000
Info : [esp32s3.cpu0] Reset cause (1) - (Power on reset)
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000
Error: [esp32s3.cpu1] Unexpected OCD_ID = 00000000

After pressing the reset button:
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: Failed to exec JTAG queue!
Error: Failed to read debug stubs address location (-104)!
Polling target esp32s3.cpu0 failed, trying to reexamine
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: [esp32s3.cpu0] Unexpected OCD_ID = 0b339fd2
Examination failed, GDB will be halted. Polling again in 100ms
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: Failed to exec JTAG queue!
Error: Failed to read debug stubs address location (-104)!
Polling target esp32s3.cpu0 failed, trying to reexamine
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: [esp32s3.cpu0] Unexpected OCD_ID = 0b339fd2
Examination failed, GDB will be halted. Polling again in 300ms
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: Failed to exec JTAG queue!
Error: Failed to read debug stubs address location (-104)!
Polling target esp32s3.cpu0 failed, trying to reexamine
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: [esp32s3.cpu0] Unexpected OCD_ID = 0b339fd2
Examination failed, GDB will be halted. Polling again in 700ms
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: missing data from bitq interface
Error: Failed to exec JTAG queue!

and so on....

I am obviously doing something wrong, but I can not figure out what it is.
Do you recommend moving to Linux?
Do you have any other suggestion?

Thank for helping me so far, and thank in advance if you can give me the right instructions.

Ravid

Who is online

Users browsing this forum: No registered users and 72 guests