ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

MIKHAIL
Posts: 2
Joined: Wed Dec 22, 2021 6:11 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby MIKHAIL » Thu Dec 23, 2021 10:59 am

ESP_Sprite wrote:
Thu Dec 23, 2021 2:05 am
If you mean the USB-serial-JTAG device, it should simply show up as another serial port; you'd flash in the same way as you would over a 'standard' USB to serial adapter. (Note under Linux and macOS the device nodes may be named different, e.g. /dev/ttyACM0 instead of /dev/ttyUSB0)
If I connected ESP C3 pin 18 D- and pin 19 D+ to USB and UBS 5V+ to convertor on the board. And with such a connection, the board should be recognized as an automatic COM port without additional drivers or something else?

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

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby ESP_Sprite » Fri Dec 24, 2021 1:23 am

Yes. (Unless you have an app in flash that reconfigures GPIO18 or GPIO19. In that case, you want to tie GPIO9 low when you reset the chip to force the chip into bootloader mode so you can overwrite that app)

pavel26
Posts: 5
Joined: Wed Jan 12, 2022 8:49 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby pavel26 » Wed Jan 12, 2022 9:13 pm

ESP_Sprite wrote:
Fri Dec 24, 2021 1:23 am
Yes. (Unless you have an app in flash that reconfigures GPIO18 or GPIO19. In that case, you want to tie GPIO9 low when you reset the chip to force the chip into bootloader mode so you can overwrite that app)
I'm facing the same issue.

Using a ESP32-C3-MINI devkit, I was able to download and debug my code using a USB cable without a problem (but USB-to-serial bridge was in place).

Then I placed a ESP32-C3-MINI module directly on my custom board, without a USB-to-serial bridge, and brought USB-P/USB-N lines directly to a USB connector on the board. The ESP32-C3-MINI module is brand-new, so probably has default firmware from the factory.

When power is applied to ESP-C3-MINI, the USB device enumerates as a serial port - but then keeps disappearing and re-appearing again.

I followed your suggestion to pull GPIO9 low. This solved the re-numeration problem (virtual COM port is always present). However, I am unable to download firmware to the board from Visual Studio Code. VS Code hangs at this point:

Code: Select all

esptool.py v3.1-dev
Serial port COM7
Connecting...
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 34:b4:72:76:2d:a8
Uploading stub...
Running stub...
Any suggestions?

Thanks!

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

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby ESP_Sprite » Thu Jan 13, 2022 1:21 am

pavel26 wrote:
Wed Jan 12, 2022 9:13 pm
When power is applied to ESP-C3-MINI, the USB device enumerates as a serial port - but then keeps disappearing and re-appearing again.
This is known behaviour... without firmware, the RTC watchdog resets the chip every so often. In our testing, it was generally possible to flash the chip anyway: as soon as the chip enumerates and is put into download mode, the resets stop. You didn't manage to get this far?
I followed your suggestion to pull GPIO9 low. This solved the re-numeration problem (virtual COM port is always present). However, I am unable to download firmware to the board from Visual Studio Code. VS Code hangs at this point:

Hm, that is odd. In the esp-idf configuration (Menuconfig, not sure what VS calls it), under 'serial flasher config', can you enable 'Disable download stub', see if that works?

pavel26
Posts: 5
Joined: Wed Jan 12, 2022 8:49 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby pavel26 » Thu Jan 13, 2022 3:23 pm

ESP_Sprite wrote:
Thu Jan 13, 2022 1:21 am
In the esp-idf configuration (Menuconfig, not sure what VS calls it), under 'serial flasher config', can you enable 'Disable download stub', see if that works?
I tried that, but it didn't fix the problem - same behavior, hangs at "Running stub...":

Code: Select all

esptool.py v3.1-dev
Serial port COM9
Connecting...
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:61:ef:7c
Uploading stub...
Running stub...
I actually went back to the C3 development kit (not running on custom board any more). I reconfigured the resistors to bypass the USB-to-serial bridge. But it still hangs.

Has anyone actually used the built-in USB JTAG on C3?

I have not touched OpenOCD configuration at all - with USB-to-serial bridge everything worked out of the box. But I'm wondering if it's necessary to reconfigure OpenOCD?

pavel26
Posts: 5
Joined: Wed Jan 12, 2022 8:49 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby pavel26 » Thu Jan 13, 2022 3:40 pm

When development kit is configured with USB-to-serial bridge, output is as follows:

Code: Select all

esptool.py v3.1-dev
Serial port COM8
Connecting....
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:61:f0:30
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 0x00010000 to 0x00090fff...
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 527856 bytes to 283343...
Wrote 527856 bytes (283343 compressed) at 0x00010000 in 8.7 seconds (effective 484.7 kbit/s)...
Hash of data verified.
Flash params set to 0x022f
Compressed 18944 bytes to 11308...
Wrote 18944 bytes (11308 compressed) at 0x00000000 in 0.6 seconds (effective 268.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 351.9 kbit/s)...
Hash of data verified.

Also, I noticed that on Windows, the Virtual COM port driver is different when I'm using C3's internal USB JTAG vs. USB-to-serial bridge: when USB-to-serial bridge is used, Windows uses "silabser.sys"... but when C3's internal USB JTAG is used, the driver is "usbser.sys". Could that be an issue?

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

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby ESP_Sprite » Fri Jan 14, 2022 3:12 am

It shouldn't matter. I still think it's odd that the 'do not use stub' thing does not propagate... can you clean your project ('esp-idf fullclean' or simply delete the build directory) and try again?

pavel26
Posts: 5
Joined: Wed Jan 12, 2022 8:49 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby pavel26 » Fri Jan 14, 2022 2:20 pm

ESP_Sprite wrote:
Fri Jan 14, 2022 3:12 am
It shouldn't matter. I still think it's odd that the 'do not use stub' thing does not propagate... can you clean your project ('esp-idf fullclean' or simply delete the build directory) and try again?
I deleted the build directory, then checked build/config/sdkconfig.h, and this line is there:

Code: Select all

#define CONFIG_ESPTOOLPY_NO_STUB 1
Then, after a rebuild, it still gets stuck in the same place :(

pavel26
Posts: 5
Joined: Wed Jan 12, 2022 8:49 pm

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby pavel26 » Fri Jan 14, 2022 6:23 pm

I finally got it to work, but it's not a hardware issue.

Something was not configured right in the ESP-IDF plugin. I ended up uninstalling ESP-IDF, uninstalling VS Code and removing all traces of it from the hard drive (installed plugins, etc.) - and then reinstalling again.

Also had some trouble reinstalling Espressif IDF plugin for Visual Studio:

With version 1.3.0, plugin configuration doesn't work, as I kept getting the "restart Visual Studio Code and run this wizard again" message (no way to configure plugin in the VS Code IDE - maybe it can be done manually, but I don't know how to do it).

So after installing plugin 1.2.0, I was able to configure it successfully, and then flashing the chip via built-in USB also worked without any additional changes.

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

Re: ESP32-C3 Mini Devkit: Configure for Built in USB JTAG?

Postby ESP_Sprite » Sat Jan 15, 2022 2:14 am

Glad that you made it work! Strange that a software quirk affected the upload process, though.

Who is online

Users browsing this forum: No registered users and 75 guests