esp32-c3 native usb problems

john11
Posts: 14
Joined: Wed Jan 13, 2021 7:37 pm

esp32-c3 native usb problems

Postby john11 » Tue Aug 10, 2021 3:47 pm

I'm have a custom rev 3 esp32-c3 wroom module with gpio 18/19 connected to USB D-/+.
I'm using platform.io and have openocd v0.10.0-esp32-20210721

When I connect the board I can see the following device appears:

Code: Select all

Status     Class           FriendlyName                 InstanceId     
------     -----           ------------                 ----------
OK         USBDevice       USB JTAG/serial debug unit   USB\VID_303A...
Using openocd I get the following:
.\openocd -f board/esp32c3-builtin.cfg
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:35)
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
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
Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
Error: esp_usb_jtag: could not find or open device!

Any ideas why?

Using esptool I get the following:
Uploading .pio\build\esp32-c3\firmware.bin
esptool.py v3.1
Serial port COM4
Connecting...
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:af:6d:90
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00044fff...
Flash params set to 0x022f
Compressed 17856 bytes to 11151...
Writing at 0x00000000... (100 %)

A fatal error occurred: Timed out waiting for packet content

Using esp-prog I get the following:
Building .pio\build\esp32-c3\firmware.bin
esptool.py v3.1
Merged 1 ELF section
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio\build\esp32-c3\firmware.bin
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:35)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

adapter speed: 5000 kHz

Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1

Any ideas would be appreciated!
-- john

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

Re: esp32-c3 native usb problems

Postby ESP_Sprite » Wed Aug 11, 2021 1:13 am

What OS is this on?

john11
Posts: 14
Joined: Wed Jan 13, 2021 7:37 pm

Re: esp32-c3 native usb problems

Postby john11 » Wed Aug 11, 2021 5:17 am

Its on Windows 10. I just verified the same version of openocd on Linux where it works just fine.
Is upload suppose to work with both esptool and esp-work?

-- john

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp32-c3 native usb problems

Postby chegewara » Wed Aug 11, 2021 11:37 am


john11
Posts: 14
Joined: Wed Jan 13, 2021 7:37 pm

Re: esp32-c3 native usb problems

Postby john11 » Wed Aug 11, 2021 12:31 pm

That bug is marked as resolved in the 21/07 release that I tried.
Are you suppose to use esptool or esp-prog to upload a firmware to the module using the io18/19 native usb?

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp32-c3 native usb problems

Postby chegewara » Wed Aug 11, 2021 12:42 pm

No, i am using just regular "idf.py flash" to upload firmware, but i didnt test with PIO.
The problem i got with openocd was that i had to add elf file name in command line.

Im not sure if this can help you to solve the issue, but i thought i will provide that info.
I missed the fact its working for you with linux, my OS is Ubuntu 20, so i cant help you windows, sorry.

User avatar
ESP_Roland
Posts: 263
Joined: Tue Oct 09, 2018 10:28 am

Re: esp32-c3 native usb problems

Postby ESP_Roland » Wed Aug 11, 2021 3:33 pm

The built-in JTAG requires some drivers with special setup. The drivers can be installed by one the latest versions of the Windows Tools Installer or directly running the command from
https://docs.espressif.com/projects/esp ... sb-drivers

john11
Posts: 14
Joined: Wed Jan 13, 2021 7:37 pm

Re: esp32-c3 native usb problems

Postby john11 » Thu Aug 12, 2021 9:55 am

Hi Roland,

I already had the driver installed using PowerShell cmd.
Anyway, I found Zadig where I found two "USB JTAG/serial debug unit" (Interface 0 and 2).

Interface 0
==========
Driver "usbser v10.0.19041.906" [green arrow ==>] WinUSB (v6.1.7600.16385)
WCID had red cross mark

Interface 2
==========
Driver "usbser v10.0.19041.906" [green arrow ==>] WinUSB (v6.1.7600.16385)
WCID had green check mark

Then I replaced the driver using Zadig to libusbK for both interfaces and after this it seems to work (despite getting LIBUSB_ERROR_NOT_SUPPORTED):

.\openocd.exe -f board\esp32c3-builtin.cfg
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:35)
Info : only one transport option; autoselect 'jtag'
Warn : Transport "jtag" was already selected
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: 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

Does that look okay from openocd point of view?

--john

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

Re: esp32-c3 native usb problems

Postby ESP_Sprite » Thu Aug 12, 2021 9:58 am

Not Roland, but that OpenOCD output indeed looks like what you'd expect for a working JTAG setup.

john11
Posts: 14
Joined: Wed Jan 13, 2021 7:37 pm

Re: esp32-c3 native usb problems

Postby john11 » Thu Aug 12, 2021 1:15 pm

It seems to be working. But very slow:

PS C:\projects\proj1> C:\Users\john\.platformio\packages\tool-openocd-esp32\bin\openocd.exe -d2 -s C:/Users/john/.platformio/packages/tool-openocd-esp32/share/openocd/scripts -f interface/esp_usb_jtag.cfg -f target/esp32c3.cfg -c "adapter_khz 5000" -c "program_esp {{.pio\build\esp32-c3\firmware.bin}} 0x10000 verify" -c "program_esp {{C:/Users/john/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin}} 0x0000 verify" -c "program_esp {{C:/projects/proj1/.pio/build/esp32-c3/partitions.bin}} 0x8000 verify" -c "program_esp {{C:/Users/john/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin}} 0xe000 verify" -c "reset run; shutdown"
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:35)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : only one transport option; autoselect 'jtag'
adapter speed: 40000 kHz

Warn : Transport "jtag" was already selected
adapter speed: 5000 kHz

Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 5000 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
Info : JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)
Here I had a delay for several minutes
Info : Flash mapping 0: 0x10020 -> 0x3c030020, 34 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 130 KB
Another delay
Info : Auto-detected flash bank 'esp32c3.flash' size 4096 KB
Info : Using flash bank 'esp32c3.flash' size 4096 KB
** Programming Started **
Programming has been running for 10 minutes now :?

Any ideas why it's so slow?

Who is online

Users browsing this forum: Bing [Bot] and 77 guests