Repository navigation
fix(examples): route the console to UART0 in every usb_device example - #804
Merged
Merged
Conversation
bldc_haptics, can_bridge, coredump, mcp266 webapp and telemetry examples left the console on USB-Serial-JTAG (the CAN bridge and MCP266 ones selected it explicitly), which shares the S3 / P4 native USB PHY with USB-OTG: TinyUSB takes that port, so the examples did not enumerate with a stock sdkconfig. Use UART0 as the primary console with USB-Serial-JTAG secondary, like the ota / switch_pro / msc / xinput examples, and fix the READMEs that claimed the console stays on USB-Serial-JTAG. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
|
✅Static analysis result - no issues found! ✅ |
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR routes the primary console of five espp::UsbDevice examples to UART0 so TinyUSB can use the native USB PHY, while documenting the new console connection requirements.
Changes:
- Selects UART0 as the primary console and USB-Serial-JTAG as a secondary console in five example configurations.
- Updates CAN bridge, MCP266, and telemetry documentation to describe UART0 console usage.
- Explains the USB-Serial-JTAG/USB-OTG PHY conflict on ESP32-S3 and ESP32-P4.
| File | Description |
|---|---|
components/telemetry/example/sdkconfig.defaults |
Routes the telemetry example console to UART0. |
components/telemetry/example/README.md |
Documents separate native-USB flashing and UART0 monitoring. |
components/mcp266/webapp_example/sdkconfig.defaults |
Routes the MCP266 webapp console to UART0. |
components/mcp266/webapp_example/README.md |
Updates MCP266 console and build instructions. |
components/coredump/example/sdkconfig.defaults |
Routes the coredump example console to UART0. |
components/canopen/can_bridge_example/sdkconfig.defaults |
Routes the CAN bridge console to UART0. |
components/canopen/can_bridge_example/README.md |
Updates CAN bridge console and build instructions. |
components/bldc_haptics/example/sdkconfig.defaults |
Routes the BLDC haptics console to UART0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+16
to
+17
| # USB-Serial-JTAG stays the SECONDARY console so early-boot / bootloader logs are | ||
| # still visible on the native USB port before the app brings up TinyUSB. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Five
espp::UsbDeviceexamples left the system console on its default, USB-Serial-JTAG (two of them selected it explicitly). On the ESP32-S3 and -P4 that peripheral shares the native USB port's PHY with USB-OTG, which TinyUSB takes over, so out of the box the vendor / CDC interfaces never came up on that port. Theota,switch_pro,msc_exampleandxinput_exampleexamples already route the console to UART0; this brings the rest in line:bldc_haptics/example,canopen/can_bridge_example,coredump/example,mcp266/webapp_example,telemetry/example:CONFIG_ESP_CONSOLE_UART_DEFAULT=ywith USB-Serial-JTAG as the secondary console (early-boot logs still visible on the native port before TinyUSB starts), replacing the explicitCONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=yin the CAN bridge and MCP266 examples.The bldc_haptics and coredump examples additionally route the console onto their CDC port at runtime (
tinyusb_console_init), which is unaffected by the boot-time default.CANopen / DS402 follow-up to #803
Reviewed every other
espp::Twaiuser for the same missing-initialize()bug: thetwai,canopen,mcp266andmcp266webapp examples all callinitialize()before use, and thecanopencomponent itself is transport-agnostic (it never owns a node). The rest of the bridge request handler (CAN_TX / SET_CONFIG / STOP / GET_STATUS) guards the bus state correctly, and the CAN console and DS402 panel drive START exactly as the firmware expects. No further code changes were needed there.Test plan
IDF_COMPONENT_MANAGER=0(as CI does) and the resulting sdkconfig selects UART0can_bridge_exampleon an S3 devkit enumerates over the native USB port with a stocksdkconfig; DS402 panel START brings the bus up🤖 Generated with Claude Code
https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU