Repository navigation
Description
Symptom
bash autoresearch esp32p4 --simd (with or without --no-fbuild) reproducibly fails with:
Connecting to device... ok
Sending testSimd RPC...
SIMD TEST ERROR: Serial write error: Write timeout
This blocks every RPC over --simd on ESP32-P4: testSimd, testSimdBenchmark, and by extension measureParlio. Reproducible across PIE-on, PIE-off (#2538), and now wave8ExpandBenchmark (#2539). Forced the workaround of capturing boot-time output via esp_rom_printf on COM25 (see companion issue) instead of a proper RPC round-trip.
Root cause (decoded this session)
The AutoResearch P4 build runs with:
CDC On Boot : 0
Arduino USB Mode : 1
With CDC_ON_BOOT=0, the Arduino-ESP32 core maps Serial to UART0 (pins 37/38), not the USB-Serial-JTAG peripheral. So:
- The firmware's RPC server (which reads from
Serial) listens on UART0. - The host tool (
fbuild monitor/serial_interface.py) opens COM25 = the USB-Serial-JTAG. - The tool's writes go to USB-Serial-JTAG; the firmware never receives them → write timeout.
ESP-IDF [I][esp32-hal-...] core logs do reach COM25 (they go via the ROM console), which is why esp_rom_printf works as a one-way capture rail. The boot-time benchmark output from #2539 confirms this empirically.
Proposed fix
Set both build flags in the P4 PlatformIO env (and the fbuild equivalent):
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
This routes Serial (HardwareSerial → HWCDCSerial) to the USB-Serial-JTAG, which is what the host tool talks to. Note from prior session memory: feat/autoresearch-esp32p4-hwcdc already attempted this fix but was not pushed.
After the fix:
bash autoresearch esp32p4 --simdshould produce the testSimd JSON resultsmeasureParlioworks → we can capture full encode_us before/after for PRs like perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 #2539- Boot benchmarks can switch from
esp_rom_printfback toFL_PRINT(companion issue)
Verification plan
- Set both flags in
ci/platformio/configs/esp32p4.ini(or equivalent fbuild config). - Rebuild AutoResearch; verify boot log shows
CDC On Boot: 1. - Run
bash autoresearch esp32p4 --simd --no-fbuild— expect testSimd JSON, not write timeout. - Run
measureParlioagainst perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 #2539 build: nibble-LUT vs byte-LUT full encode_us A/B.
Impact while broken
- Every per-issue measurement on P4 needs an
esp_rom_printfboot-time workaround. - Can only predict full-encode improvements (e.g. perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 #2539 measured 1.66× expansion → predicts ~1.28× encode, not directly measured).
- No bidirectional debug — only one-way boot output.
Refs #2519 (debug build A/B that worked when this routing was correct), #2536/#2538, #2526/#2539.
Activity
refactor(autoresearch): wave8 expansion bench is RPC-driven + adds tr…
perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 (#…
test(parlio): #2548 add boot-time ISR-streaming functional validation (…
test(parlio): #2548 convert PARLIO streaming validation from boot-tim…
perf(parlio): #2548 add eager-queue + encode/wait breakdown instrumen…
perf(parlio): #2548 add eager-queue + encode/wait breakdown instrumen…
perf(parlio) + lint: gate eager-queue to fits-in-ring frames + ban es…
refactor(autoresearch): gate runSimdTests() behind FL_RUN_SIMD_TESTS_…
fix(esp32p4): route Serial to USB-Serial-JTAG so AutoResearch RPC wor…
chore(esp32): eliminate runtime esp_rom_printf call sites (#2751)