Page 1 of 1

ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Wed Jun 08, 2022 7:31 am
by mzincali
I've connected my ESP32C3's GPIO18 and GPIO19 to the USB connector in the hopes that I can directly communicate with it over USB. I am not sure what the next step is. Do I need special drivers? What are the use cases for this? Can I use those pins/USB for uploading programs, or am I only limited to console output? The c3 datasheet, Section 3.4.9 USB Serial/JTAG Controller seems promising, but I don't see details on how to use it.

I would love some advice and/or pointers to documents that explain how to use these two pins via the USB. Thank you.

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Wed Jun 08, 2022 7:39 am
by ESP_Sprite
There's no unified place for this, but it's certainly documented:

https://docs.espressif.com/projects/esp ... nsole.html <- 'user manual' for serial part of this device
https://docs.espressif.com/projects/esp ... index.html <- OpenOCD (JTAG debugging) details
https://www.espressif.com/sites/default ... ual_en.pdf chapter 28 <- all the nitty-gritty technical under-the-hood details

Wrt drivers: unless you're on Windows, you don't need them. If you are on Windows, I think you need them for the JTAG bit - you can simply install esp-idf via the installer, and it should by default install the drivers for you.

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Wed Jun 08, 2022 9:26 am
by mzincali
Thank you!

For a brief moment the device showed up on my Mac with as a "USB JTAG/serial debug unit". I tried uploading a simple sample (SimpleTime), and after that I somehow must have screwed up the state of the GPIO18 and 19 pins, and now I don't see the device on my Mac anymore. Any ideas?

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Wed Jun 08, 2022 11:06 am
by ESP_Sprite
It's possible that a program re-initializes GPIO18 and 19 as standard GPIOs; that will effectively disable the USB device. You can get it back by making GPIO9 low (if your devboard has a 'boot' button, press and hold that) and resetting the ESP32C3; that puts it into download mode and the USB device should be available by default then.

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Thu Jun 09, 2022 6:21 pm
by mzincali
It's odd, I don't do anything with pins 18 and 19, but doing some simple networking, and that knocks the connection over the USB off.

I've since been testing other things and everything else is working: I have an LED, a couple of interrupt lines that I can trigger, a piezo, etc. The USB JTAG/serial connection is a pleasant surprise, as I expected to program the board via some pads we placed under the board, and then we'd use an FTDI/USB but that's almost not needed anymore.

I say almost; I still can't make any serial writes to the console. The console is empty. (I'm using Arduino 2.0 IDE for now for simplicity, but will eventually be using Platform.io, if that makes a difference). Is there anything I can do to get the serial monitor to work over the USB JTAG? Thanks!

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Fri Jun 10, 2022 1:22 am
by ESP_Sprite
Ah. You may be running into a know issue (fixed in current master) where WiFi can disable USB-JTAG-serial. Solution is here.

Re: ESP32C3 - using pin GPIO18, 19 for USB?

Posted: Fri Jun 10, 2022 11:07 pm
by mzincali
Awesome, thank you!

I still can't make any serial writes to the console. The console is empty. (I'm using Arduino 2.0 IDE for now for simplicity, but will eventually be using Platform.io, if that makes a difference). Is there anything I can do to get the serial monitor to work over the USB JTAG? Thanks!