ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Stef
New user
Posts: 5
Joined: 31 Jul 2018, 16:51

ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#1 Post by Stef » 10 Aug 2024, 23:43

hello,

On the ESP32C3 it seems that GPIO 20 and 21 are blocked if USB serial (which runs on GPIO18 and 19) is used (USB HWCDC).
None of the GUI screens allows you to touch GPIO 20 and 21.

A work around is to uncheck "Enable Serial Port Console", now you can do everything with GPIO 20,21, after that Enable the Serial Port again.

I tested this on a custom build by Visual Studio, based on the sources mega-20240414.

cheers, Stef

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#2 Post by Ath » 11 Aug 2024, 10:04

That's correct, and working as intended (AFAICS) :)
When looking at the GPIO pins for ESP32-C3 these pins are reserved for RX and TX, but as a lot of C3 boards come without a serial chip installed, you can disable the serial fall-back to make these pins available for other uses.
/Ton (PayPal.me)

Stef
New user
Posts: 5
Joined: 31 Jul 2018, 16:51

Re: ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#3 Post by Stef » 11 Aug 2024, 11:37

I don't understand your "intended"
I have
- Serial Port = "USB HWCDC" (thus using GPIO 18,19)
- Serial Fallback to Serial 0 = unchecked
So there's no need at all to block GPIO 20, 21

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#4 Post by Ath » 11 Aug 2024, 12:34

Ah, so probably it needs a small fix there. I'll have a look soon.

Update: That still was a TODO in the code... Adding the code now.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#5 Post by Ath » 11 Aug 2024, 13:49

@Stef I've created PR #5101 to solve this open TODO.
A GH Actions run is busy building binaries, you can download a matching build from there for testing (you'll need a free Github account to be able to download). Please report your findings here.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32C3, GPIO 20,21 are blocked when Serial Console over USB is enabled

#6 Post by TD-er » 11 Aug 2024, 17:20

Stef wrote: 10 Aug 2024, 23:43 hello,

On the ESP32C3 it seems that GPIO 20 and 21 are blocked if USB serial (which runs on GPIO18 and 19) is used (USB HWCDC).
None of the GUI screens allows you to touch GPIO 20 and 21.

A work around is to uncheck "Enable Serial Port Console", now you can do everything with GPIO 20,21, after that Enable the Serial Port again.

I tested this on a custom build by Visual Studio, based on the sources mega-20240414.

cheers, Stef
Nope, thats\'s not the work-around.
You need to select "HW Serial 0" instead of "USB HWCDC" and you may also uncheck "Fallback to Serial 0", but that should not matter if you already have set the main serial port for the console to Serial0.

As long as you have HWCDC (or USBCDC on the ESP32-S2) selected, the USB interface is started at boot and thus those pins will not work the same as when you have not selected them for the console.

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests