Skip to content

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

Closed

Description

@zackees

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:

Verification plan

  1. Set both flags in ci/platformio/configs/esp32p4.ini (or equivalent fbuild config).
  2. Rebuild AutoResearch; verify boot log shows CDC On Boot: 1.
  3. Run bash autoresearch esp32p4 --simd --no-fbuild — expect testSimd JSON, not write timeout.
  4. Run measureParlio against 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

Refs #2519 (debug build A/B that worked when this routing was correct), #2536/#2538, #2526/#2539.

Activity

  1. added 8 commits that reference this issue on May 29, 2026
  2. added 2 commits that reference this issue on May 31, 2026
    3ccfe93
    713edd6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions