Skip to content

fix(esp32p4): route Serial to USB-Serial-JTAG so AutoResearch RPC works - #2620

Merged
zackees merged 1 commit into
masterfrom
fix/2541-esp32p4-usb-cdc-on-boot
May 31, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2541-esp32p4-usb-cdc-on-boot

Conversation

@zackees

@zackees zackees commented May 31, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add ARDUINO_USB_MODE=1 and ARDUINO_USB_CDC_ON_BOOT=1 to the ESP32_P4 board definition in ci/boards.py
  • This wires Serial to HWCDCSerial on the USB-Serial-JTAG peripheral, matching the COM port the host tools (fbuild monitor / serial_interface.py) open
  • Unblocks every RPC over bash autoresearch esp32p4 --simd — testSimd, testSimdBenchmark, wave8ExpandBenchmark, parlioEncodeBenchmark

Closes #2541.

Why

With CDC On Boot: 0 the firmware was listening on UART0 (pins 37/38) while the host wrote to the USB-Serial-JTAG COM port. Every RPC died with Write timeout. The companion esp_rom_printf boot-time workaround was the only way to capture measurements.

Test plan

Unblocks #2540 once verified on hardware.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Enhanced ESP32_P4 board serial communication configuration to enable USB-based serial output on boot.

The ESP32-P4 build was using the platform default `CDC On Boot: 0`, which
maps the Arduino `Serial` object to UART0 (pins 37/38). The host tool
(`fbuild monitor` / `serial_interface.py`) opens the USB-Serial-JTAG COM
port, so every RPC write hit a "Write timeout" — blocking `testSimd`,
`testSimdBenchmark`, `wave8ExpandBenchmark`, `parlioEncodeBenchmark`, and
forcing the `esp_rom_printf` workaround for boot-time benchmarks.

Add `ARDUINO_USB_MODE=1` + `ARDUINO_USB_CDC_ON_BOOT=1` to the ESP32_P4
board definition so `HardwareSerial` is wired to `HWCDCSerial` on the
USB-Serial-JTAG peripheral, matching the COM port the host tool talks to.

Closes #2541

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented May 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cc85ccc7-21ea-4871-bcab-7d385fcae568

📥 Commits

Reviewing files that changed from the base of the PR and between 21bf87b and b173909.

📒 Files selected for processing (1)
  • ci/boards.py

📝 Walkthrough

Walkthrough

ESP32_P4 board configuration in ci/boards.py is updated with two new defines: ARDUINO_USB_MODE=1 and ARDUINO_USB_CDC_ON_BOOT=1. These flags configure the Arduino-ESP32 core to route Serial output through the USB-Serial-JTAG peripheral instead of UART0.

Changes

ESP32_P4 USB CDC Configuration

Layer / File(s) Summary
USB CDC on boot configuration
ci/boards.py
ESP32_P4.defines entries enable USB CDC on boot and route serial via USB-Serial-JTAG by adding ARDUINO_USB_MODE=1 and ARDUINO_USB_CDC_ON_BOOT=1.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

Poem

A rabbit hops to fix a route,
Where serial signals lost their way,
USB-JTAG now stands to tout,
The ESP32_P4 saves the day! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: routing Serial to USB-Serial-JTAG on ESP32-P4 to fix AutoResearch RPC functionality.
Linked Issues check ✅ Passed The PR implements the exact fix proposed in #2541: adding ARDUINO_USB_MODE=1 and ARDUINO_USB_CDC_ON_BOOT=1 to ESP32_P4 board configuration to route Serial to USB-Serial-JTAG and resolve RPC write timeouts.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective: only the ESP32_P4 board definition in ci/boards.py was modified with the two required Arduino USB defines.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2541-esp32p4-usb-cdc-on-boot

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit 3ccfe93 into master May 31, 2026
7 of 8 checks passed
zackees added a commit that referenced this pull request May 31, 2026
…C-only) (#2624)

Follow-up to #2618. The SIMD validation suite, Wave8 expansion bench, and
PARLIO encode bench are now invoked exclusively via their RPC handlers
(`testSimd`, `wave8ExpandBenchmark`, `parlioEncodeBenchmark` — all
registered in AutoResearchRemote.cpp). Drop the `#ifdef
FL_RUN_SIMD_TESTS_AT_BOOT` / `FL_BENCH_WAVE8_AT_BOOT` /
`FL_BENCH_PARLIO_AT_BOOT` invocation blocks from AutoResearch.ino's
setup() — keeping these as opt-in "bridge" macros leaves scaffolding
that future edits quietly reactivate, defeating the move off the boot
path. Update the file-level doc comments in AutoResearchWave8Expand.h
and AutoResearchParlioEncode.h to reflect RPC-only invocation.

If RPC routing is broken on a platform (e.g. ESP32-P4 Serial misroute
fixed in #2620), the correct response is to fix the routing — not to
re-introduce a boot-time bridge.

Co-authored-by: Claude Opus 4.7 <[email protected]>
@zackees
zackees deleted the fix/2541-esp32p4-usb-cdc-on-boot branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(esp32p4): testSimd RPC write-timeout — Serial routes to UART0 instead of USB-Serial-JTAG

1 participant