docs(esp32p4): correct USB CDC warning — only CDC_ON_BOOT is toxic#12
Conversation
The previous comment lumped ARDUINO_USB_MODE=1 in with
ARDUINO_USB_CDC_ON_BOOT=1 as a flag to avoid. That was wrong.
Per the Arduino-ESP32 core source (cores/esp32/{HWCDC,USBCDC,main}.cpp,
platform.txt):
- ARDUINO_USB_MODE only selects HWCDC vs TinyUSB when CDC_ON_BOOT=1.
With CDC_ON_BOOT=0 (our default) Serial falls back to UART0 regardless
of USB_MODE — the flag has no observable effect.
- =1 selects HWCDC (passive ROM-backed USB-Serial/JTAG). Bounded ~2s
write timeouts; does not wait for host enumeration.
- =0 selects TinyUSB, which IS the stack that blocks waiting for the
host. P4's upstream default is 0; C3/C5/C6/H2/C61 force =1 via
platform.txt.
Update the comment to point users at the actual toxic flag
(CDC_ON_BOOT=1) and explain that USB_MODE is left unset because it
doesn't matter while CDC-on-boot is disabled.
No build-flag changes; comment-only.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 51 minutes and 37 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Comment-only fix to the
platforms/platformio.esp32p4.iniwarning block added in PR #11.The previous comment lumped
ARDUINO_USB_MODE=1together withARDUINO_USB_CDC_ON_BOOT=1as flags to avoid. After reading the Arduino-ESP32 core source (cores/esp32/{HWCDC,USBCDC,main}.cpp) andplatform.txt, that conflation was wrong.What
ARDUINO_USB_MODEactually doesSerialwhenCDC_ON_BOOT=1. WithCDC_ON_BOOT=0(our default),Serialfalls back to UART0 regardless ofUSB_MODEand the flag has no observable effect.=1→ HWCDC (passive ROM-backed USB-Serial/JTAG peripheral). Bounded ~2s write timeouts; does not wait for host enumeration.=0→ TinyUSB. This is the stack that blocks waiting for the host. It's the actual hang source whenCDC_ON_BOOT=1is paired with it.platform.txthard-codes=1for C3/C5/C6/H2/C61. S3 defaults to=1; P4 defaults to=0.Why no build-flag change
ARDUINO_USB_MODEdoesn't matter for our envs because we don't setCDC_ON_BOOT=1. Leaving it unset matches each chip's upstream default and avoids cosmetic noise. Only the comment needed correcting — the comment was misleading future readers into thinkingUSB_MODE=1was itself dangerous.Test plan
pio run -c platforms/platformio.esp32p4.inistill succeeds (no build-flag change)🤖 Generated with Claude Code