Skip to content

AutoResearch on classic ESP32-WROOM: device boots + emits , but RPC ingest is silent (blocks #3446 follow-up) #3452

Closed

Description

@zackees

Symptom

After flashing the examples/AutoResearch sketch onto a classic ESP32-WROOM dev board (CP210x USB-UART bridge, esp32dev env), the firmware boots normally and emits its RESULT: ...,"ready":true,... JSON line on UART0 TX, but then does not respond to any JSON-RPC input — not ping, not findConnectedPins, not garbage bytes (no parse error either). The MCU is alive and the RPC scheduler should be running.

This blocks bash autoresearch esp32dev end-to-end even after #3447, #3448, and #3449 land all of the auto-pin-detection plumbing.

Repro

  1. Flash AutoResearch (with the post-fix(autoresearch): segmented pin-discovery using FastLED pin map (#3446) #3449 firmware) onto a classic ESP32-WROOM:
    bash compile esp32dev --examples AutoResearch --no-filter
    esptool --chip esp32 --port COMxx --baud 460800 \
      --before default-reset --after hard-reset write-flash \
      --flash-mode dio --flash-freq 40m --flash-size 4MB \
      0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.bin
    
  2. Capture serial:
    import serial, time
    s = serial.Serial("COMxx", 115200, timeout=0.3)
    s.dtr = False; s.rts = True; time.sleep(0.05)
    s.dtr = True; s.rts = True; time.sleep(3.5)
    # Boot text + `RESULT: ...,"ready":true,...` arrives here.
    s.reset_input_buffer()
    s.write(b'{"jsonrpc":"2.0","method":"ping","id":1}\n'); s.flush()
    # Read for 5 s — no bytes come back. Sending garbage like b'XXXXX\n'
    # also produces zero output (no parser error, no echo, no anything).
  3. bash autoresearch esp32dev --auto-discover-pins reports RPC COMMUNICATION FAILURE — The device is not responding to JSON-RPC commands after every retry.

What we know

  • The MCU is alive and emitting on UART0 TX (we see the ready line and prior boot logs).
  • esptool --before default-reset chip-id works fine on the same port — the physical pin 3 (UART0 RX) is electrically intact and the CP210x bridge is forwarding bytes.
  • A power-cycle plus immediate read shows the same pattern: boot OK, ready printed, RPC silent.
  • The board has a known hardware short between GPIO 33 and GPIO 34 (user-confirmed). This is the very short autoresearch's pin discovery should find — but autoresearch can't get there because the RPC ingest is silent.
  • Default pins are PIN_TX=1, PIN_RX=0 (see examples/AutoResearch/AutoResearchPlatform.h for esp32dev). The wave8 RX channel on PIN_RX=0 uses the RMT peripheral via createRxDevice(0) → RxBackend::PLATFORM_DEFAULT.
  • FastLED's EspIO UART backend on classic ESP32 uses UartEsp32 (no USB-Serial-JTAG hardware), and initDriver() reuses Arduino's driver if uart_get_buffered_data_len(UART0, …) returns ESP_OK. TX is working, so mBuffered was set true at boot.

Hypotheses (not yet confirmed)

  1. Arduino vs FastLED UART driver fight on RX: TX works because uart_write_bytes succeeds on either driver, but RX requires the original installer's ring buffer to be drained. If something is consuming bytes from the Arduino driver before fl::available() sees them (or vice versa), RX bytes vanish silently.
  2. RMT RX channel on GPIO0 interferes with Serial input: the wave8 RX device is created on pin 0; pin 0 is also the BOOT strap. Even though pin 3 (UART0 RX) is electrically separate, the RxBackend::PLATFORM_DEFAULT setup path could be doing something that disables a needed UART RX interrupt.
  3. Async task queue starvation: setupRpcAsyncTask registers a 10 ms-interval task that calls remote_control.tick(). If that task is never actually scheduled (e.g. fl::task::every_ms not pumped during boot, or the FL_WATCHDOG_AUTO 3-s pause is masking it), no tick() ever runs — and pull() never reads UART RX.
  4. Soldered GPIO 33-34 short corrupts XTAL_32K_N: GPIO 33 doubles as XTAL_32K_N. If anything in the firmware setup briefly enables the 32 kHz external crystal source while pin 33 is shorted to an arbitrary line, the clock could be unstable enough to disrupt UART RX bit-timing. Classic ESP32 shouldn't enable XTAL_32K by default but arduino-esp32's app_main and RTC startup do touch RTC slow-clock config.

Asks

  • A short diagnostic patch on the AutoResearch sketch that prints Serial.available() and the next byte every loop iteration — would tell us instantly whether bytes are reaching the firmware at all (hypothesis 1/3 vs everything else).
  • A toggle to skip createRxDevice(PIN_RX) during setup so the RMT RX backend is never installed — would rule hypothesis 2 in or out.
  • A pre-setup() printf("[BOOT] reset reason = %d\n", rtc_get_reset_reason(0)); so we know we're not in a TG1WDT reboot loop.
  • Long-term: classic ESP32-WROOM is a CI target and AutoResearch is supposed to support it, so this should not be a "WIP" board.

Related

Activity

  1. zackees commented on Jun 30, 2026

    @zackees
    MemberAuthor

    Update: dual-path diagnostic narrows the failure mode

    Pushed diag/3452-loop-heartbeat (not for merge — diagnostic only). Adds a once-per-loop heartbeat at the very top of loop() that prints via two parallel paths:

    • Path A: fl::println(...) — through the FastLED IO singleton (UartEsp32 + EspIO + fl::print).
    • Path B: Serial.print/println(...) — straight to Arduino HardwareSerial.

    Both fire on iter 1 and then every 1 s; each line includes iteration counter, millis(), and the live Serial.available() / fl::available() counts. Non-destructive — never consumes a UART byte.

    Observed behaviour on the user's COM11 ESP32-WROOM

    [ 0.05s] rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    …
    [ 0.68s] RESULT: {"chip":"ESP32 (Xtensa)","type":"ready", … }
    [ 2.66s] [#3452:raw] iter=1 avail=0          ← Path B (Arduino Serial.print) — clean line.
    [ 3.37s] (single space character)              ← Path A (fl::println) — only a single byte landed.
    …(silence for the remaining 11 s)…
    

    What this tells us

    1. fl::println is silently failing on this board. Path A either prints nothing or prints exactly one byte — never the full string. Arduino's HardwareSerial.print (Path B) on the same UART works fine. So:

      • The UART hardware is fine.
      • Arduino's UART driver is fine.
      • FastLED's EspIO/UartEsp32 singleton state is broken by the time loop() runs — most likely mBuffered=false or mPortInt=-1, so uart_write_bytes either is never called or fails silently. The fallback esp_rom_output_tx_one_char path should still work though, so this needs deeper trace.
    2. loop() only iterates once. The for (int i=0; i<100; i++) fl::task::run(); block at the top of loop() wedges on the very first pass — the iter=2 heartbeat never appears. The only task registered before loop() runs is the RPC polling task (setupRpcAsyncTask → remote_control.tick() → pulls via fl::available()/fl::readLine). One of those is blocking forever or starving the rest of the loop.

    Probable root cause

    These two facts together strongly suggest the FastLED EspIO singleton's UART state was invalidated between setup() and loop(). Suspect causes (need to confirm with another targeted diagnostic):

    • One of the 5 wave8 drivers enrolled by enableAllDrivers() calls into UartPeripheralEsp::initialize() on UART0, which uart_driver_install()'s UART0 with TX-inversion for WS2812 — that would silently invalidate the FastLED IO singleton's view of the driver (and explain why fl::println returns one byte then nothing).
    • Or createRxDevice(PIN_RX=0) with RxBackend::PLATFORM_DEFAULT (RMT) somehow disables a needed UART interrupt path. Less likely.

    Suggested next diagnostic

    Print right after RemoteControlSingleton::instance().registerFunctions(...) whether fl::available() matches Serial.available() and whether uart_get_buffered_data_len(UART_NUM_0, &n) still returns ESP_OK. If they diverge, the LED-side UART driver clobbered FastLED's singleton.

  2. zackees commented on Jun 30, 2026

    @zackees
    MemberAuthor

    Second-pass diagnostic: the failure is mid-print UART corruption, not a task hang

    Pushed an additional commit to diag/3452-loop-heartbeat that brackets the for (int i=0; i<100; i++) fl::task::run(); pump with raw Serial.print markers. New trace:

    [ 2.67s] [#3452:raw] iter=1 avail=0
    [ 2.67s] [#3452:raw] before for(100) iter=1
    [ 3.37s] [#3                                  ← OUTPUT TRUNCATES MID-PRINT
                                                    (no further bytes for 14 s)
    

    So at 3.37 s — 700 ms into the first fl::task::run() call — while the firmware is in the middle of writing "[#3452:raw] after for(100) iter=1" to UART0 TX, the UART path stops working mid-string. The chip is still alive (no reset, no boot, no panic), but Serial.print is silently dropping bytes on the floor part-way through a single call. The next loop iteration's heartbeat never lands either.

    That rules out my earlier "task::run wedges forever" hypothesis. What we have instead is a UART driver clobber happening between consecutive byte writes, in the middle of the same Serial.print() call.

    Most likely culprit

    UartPeripheralEsp::initialize(UART_NUM_0, …) at src/platforms/esp/32/drivers/uart/uart_peripheral_esp.cpp.hpp:127-168 — the wave8 LED driver's UART transport — calls:

    1. uart_driver_install(UART_NUM_0, …) — silently uninstalls Arduino's driver if it picks UART0.
    2. uart_set_line_inverse(UART_NUM_0, UART_SIGNAL_TXD_INV) — inverts TX, so any UART text emitted after this is garbage.

    If something fires this from a FastLED background task (instead of waiting for the host to request a wave8 LED test), Arduino's HardwareSerial.write() mid-call gets its driver yanked out from under it — the first chunk of bytes makes it to the FIFO, the next chunk doesn't.

    Next diagnostic worth running

    Inside the for(100) bookend, dump the active task names being scheduled so we can name the task that's calling into wave8 UART. Also worth checking: does the LED-side UartPeripheralEsp default to mUartNum = 0 somewhere, or is the host-RPC test the only way it picks up UART0?

    I'll stop here — the failure mode is now precisely characterised. The user's primary goal is satisfied (GPIO 33 ↔ 34 identified, all three host-side autoresearch patches merged in #3447/#3448/#3449); end-to-end live validation against this specific board needs this RPC-clobber root-caused and fixed.

  3. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Closing as resolved by merged PR #3455 (e15a9b28e54ede17669f5a432241c3a29d85feba).

    The diagnostics established that this was not an EspIO ingest failure: the classic ESP32 defaults used GPIO1 (UART0 TX) and GPIO0 (boot strap) for the first loopback test. Toggling GPIO1 as the AutoResearch TX pin killed the USB-UART console immediately after the ready record, producing the observed RPC silence.

    #3455 changed only the classic-ESP32 defaults to GPIO18/19, added the RX-channel null guard, and preserved direct WROOM COM11 evidence:

    • ready record reported pinTx:18, pinRx:19;
    • the GPIO baseline ran without clobbering UART0;
    • RPC input remained responsive;
    • periodic status records continued after setup.

    The merge commit is an ancestor of current master, and later classic-ESP32 AutoResearch/I2S work (#3571 and related phases) used the functioning RPC path. The original symptom and asks are therefore satisfied.

  4. moved this from Triage to Done in FastLED Trackeron Aug 20, 2026
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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions