8000 Unable to configure pin 18 & 19 as GPIO output in ESP32C3 · Issue #12479 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Unable to configure pin 18 & 19 as GPIO output in ESP32C3 #12479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pbdaran opened this issue Sep 19, 2023 · 5 comments
Closed

Unable to configure pin 18 & 19 as GPIO output in ESP32C3 #12479

pbdaran opened this issue Sep 19, 2023 · 5 comments
Labels

Comments

@pbdaran
Copy link
pbdaran commented Sep 19, 2023

I compiled the micropython code by cloning it from github, for ESP32C3. After flashing the firmware.bin, I tried to configure the pins 18 and 19 as GPIO output. But getting an error as invalid pins.
I did the same procedure few weeks back and it was all fine then.
Is it caused by any recent changes in micropython?

@pbdaran pbdaran added the bug label Sep 19, 2023
@jimmo
Copy link
Member
jimmo commented Sep 19, 2023

@pbdaran We changed the firmware to enable the USB serial/jtag interface by default. Originally we didn't enable this because the engineering sample chips didn't support it.

This is on pins 18 & 19 (which are the D+/D- pins for the USB interface).

You can override this (to disable it again) by setting CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=n in boards/ESP32_GENERIC_C3/sdkconfig.c3usb`.

@pb
8000
daran
Copy link
Author
pbdaran commented Sep 20, 2023

Thank you, @jimmo!
I set CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=n in the sdkconfig file.
Now I can use the pins 18 & 19 as GPIO.

@MetroMushrooms
Copy link

@jimmo Have you figured out a way to go about this with the s3? I've tried a few solutions including this one and the closest I've come is logging a ton of external interference on gpio 19, but no control over it.

@rini711
Copy link
rini711 commented Mar 13, 2025

I am using ESP-IDF v5.2.2 and micropython version v5.2 for ESP32C3.

After flashing the firmware.bin, I tried to configure the pins 18 and 19 as GPIO output. But getting an error as invalid pins.

I set CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=n in boards/ESP32_GENERIC_C3/sdkconfig.c3usb` and set #define MICROPY_HW_ESP_USB_SERIAL_JTAG 0 in mpconfigport.h file,

Also, Tried commenting out below lines in - /mpconfigport.h
// Enable stdio over USB Serial/JTAG peripheral
#ifndef MICROPY_HW_ESP_USB_SERIAL_JTAG
#define MICROPY_HW_ESP_USB_SERIAL_JTAG (SOC_USB_SERIAL_JTAG_SUPPORTED && !MICROPY_HW_USB_CDC)

but still getting error as invalid pins.

How can i resolve this issue and configure the pins 18 and 19 as GPIO output.
@jimmo @pbdaran @andrewleech @projectgus @garywill @ALL @MetroMushrooms

@fortuna
Copy link
fortuna commented Apr 2, 2025

I figure it out.

You need to configure those pins as input with a pull-up resistor, as per https://gitlab.com/tidklaas/hip-badge/-/blob/4e7ef0a6cbe69c84d8b86f08941768e6e8785b10/firmware/blinkenlights/main/control.c#L422-424

To flash is a pain. I wrote the instructions at https://github.com/fortuna/ESPHomeBadge?tab=readme-ov-file#known-flashing-issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
0