[tinyusb] Reject logger.hardware_uart: USB_CDC (#16417)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Keith Burzinski
2026-05-14 15:29:56 -05:00
committed by GitHub
parent 348b92910e
commit 7436d1c199
3 changed files with 22 additions and 1 deletions
+12 -1
View File
@@ -9,7 +9,7 @@ from esphome.components.esp32 import (
add_idf_sdkconfig_option,
)
import esphome.config_validation as cv
from esphome.const import CONF_ID
from esphome.const import CONF_HARDWARE_UART, CONF_ID
CODEOWNERS = ["@kbx81"]
CONFLICTS_WITH = ["usb_host"]
@@ -55,6 +55,17 @@ def _final_validate(config):
raise cv.Invalid(
"The 'tinyusb' component requires at least one USB class component"
)
# tinyusb owns the USB OTG peripheral. The logger's USB_CDC backend routes
# the ROM console through that same peripheral, so the two cannot coexist.
# (USB_SERIAL_JTAG is a separate peripheral and is fine alongside tinyusb.)
logger_config = full_config.get("logger")
if logger_config and logger_config.get(CONF_HARDWARE_UART) == "USB_CDC":
raise cv.Invalid(
"'tinyusb' cannot be used with 'logger.hardware_uart: USB_CDC' "
"because both share the USB OTG peripheral. Set "
"'logger.hardware_uart' to a hardware UART (e.g. UART0), or to "
"USB_SERIAL_JTAG on variants that support it (ESP32-S3, ESP32-P4)"
)
return config
@@ -1 +1,6 @@
<<: !include common.yaml
# S2 defaults logger to USB_CDC, which conflicts with tinyusb on the shared
# USB OTG peripheral; route the logger to UART0 so the fixture builds.
logger:
hardware_uart: UART0
@@ -1,5 +1,10 @@
<<: !include tinyusb_common.yaml
# S2 defaults logger to USB_CDC, which conflicts with tinyusb on the shared
# USB OTG peripheral; route the logger to UART0 so the fixture builds.
logger:
hardware_uart: UART0
usb_cdc_acm:
interfaces:
- id: usb_cdc_acm1