8000 Disabling USB_SERIAL_JTAG on esp32c3 to free up the pins. · Issue #16414 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Disabling USB_SERIAL_JTAG on esp32c3 to free up the pins. #16414

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
JustDr00py opened this issue Dec 14, 2024 · 2 comments · Fixed by #16236
Closed

Disabling USB_SERIAL_JTAG on esp32c3 to free up the pins. #16414

JustDr00py opened this issue Dec 14, 2024 · 2 comments · Fixed by #16236

Comments

@JustDr00py
Copy link

Port, board and/or hardware

esp32c3

MicroPython version

MicroPython v1.25.0-preview.114.gbdda91fe7.dirty on 2024-12-14; ESP32C3 module with ESP32C3

Reproduction

import espnow
from machine import Pin
from time import sleep

relay = Pin(19, Pin.OUT)

while True:
    relay.on()
    sleep(1)
    relay.off()
    sleep(1)

Expected behaviour

Relay to Turn on and off.

Observed behaviour

Traceback (most recent call last):
File "", line 13, in
ValueError: invalid pin

Additional Information

previous branch sdkconfig.c3usb

CONFIG_ESP32C3_REV_MIN_3=y
CONFIG_ESP32C3_BROWNOUT_DET=y
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y
CONFIG_ESP32C3_BROWNOUT_DET_LVL=4
CONFIG_ESP_CONSOLE_UART_DEFAULT=
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

master branch sdkconfig.c3usb

CONFIG_ESP32C3_REV_MIN_3=y

# Workaround for https://github.com/espressif/esp-idf/issues/14456
CONFIG_ESP_SYSTEM_HW_STACK_GUARD=n

Usually I can block CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y and pin 18 and 19 work but not in this case?

Code of Conduct

Yes, I agree

@JustDr00py JustDr00py added the bug label Dec 14, 2024
@andrewleech
Copy link
Contributor

The CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG was removed in #15523 and in particular 0a11832c as part of a long series of attempts to improve the configurability of stdio across all the esp32 chips.

From the specific change comment I think you might be able to instead add CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=n to the sdkconfig to disable the USB out and free up the pins that way.

For reference the other extra settings were removed in #15610 as the defaults were more appropriate and/or were the same so there was not need to add them here.

@andrewleech andrewleech changed the title Missing Parameters in sdkconfig.c3usb Disabling USB_SERIAL_JTAG on esp32c3 to free up the pins. Dec 18, 2024
@projectgus
Copy link
Contributor
projectgus commented Jan 7, 2025

Currently it may be possible to free up the USB Serial/JTAG pins on C3 by changing mpconfigboard.h or mpconfigport.h and setting #define MICROPY_HW_ESP_USB_SERIAL_JTAG 0, and also changing CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=n as described by @andrewleech. The second part is a bug.

After #16236 is merged then you will only need #define MICROPY_HW_ESP_USB_SERIAL_JTAG 0 to get the same result.

Longer term I have a patch in development to automatically allow changing the USB pin modes on any build config, if USB is not currently in use. This is tracked in #14217 (although that issue mentions S3 only in the title.)

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

Successfully merging a pull request may close this issue.

3 participants
0