Skip to content

ESP32-C6: RMT and PARLIO clockless TX not captured on loopback bench — UART/SPI pass on the same jumper (#3576 Phase 7) #3586

Description

@zackees

Found during the #3576 Phase 7 C6 robustness bring-up (WROOM+C6 dual-device bench, C6 = COM9, loopback jumper GPIO1→GPIO0, gpioBaseline passes at boot).

Symptom matrix (runSingleTest, 10 LEDs, ALL_ONES, RMT-RX capture)

Driver Result Capture detail
SPI ✅ 4/4 byte-exact
UART ✅ 4/4 byte-exact
RMT ❌ 0/4 captureWaitResult:1 (SUCCESS) but rawEdgesAfterWait:0; show_duration_ms:684 for four 300 µs frames (~170 ms/frame — internal TX-done timeout?)
PARLIO ❌ 0/4 captureWaitResult:0 (TIMEOUT), 0 edges; show_duration_ms:88 (~22 ms/frame vs ~0.5 ms expected)

Also: rxBackend:ISR fails to arm on C6 at all (captureWaitResult:-1) — separate bug worth its own look.

PARLIO evidence gathered (bench probes via peekMem + temp firmware instrumentation)

All taken DURING transmit (post-test reads are useless — parlio_del_tx_unit restores pads):

  • Engine debug metrics healthy: isrCount:1, txDoneCount:1, chunksQueued/Completed:1, bytesTotal/Transmitted:30/30, errorCode:0, underruns:0.
  • GPIO1 FUNC_OUT_SEL = 47 (PARL_TX_DATA0) with GPIO_ENABLE bit set — routing + OEN correct.
  • DMA payload is a real waveform (first words 0xF0F0F0F0, head popcount 417), bit_count:4224 for 240 LED bits, idle_value 0.
  • PCR_PARL_CLK_TX_CONF = 0x0005001D → div_num 29 (240 MHz / 30 = 8 MHz) — requested clock achieved per the divider register.
  • An in-firmware GPIO_IN poll on the jumpered pad during TX sees 269 edges — the wire is toggling; the RMT capture still records nothing.
  • timing=WS2811-400 (2× slower pulses) also fails → not a marginal pulse-width filter issue.

Open questions

  • Why does show() take ~22 ms (PARLIO) / ~170 ms (RMT) per 300 µs frame? Both smell like waits timing out — yet PARLIO's txDone metric increments.
  • Why does the RMT-RX capture see UART/SPI waveforms but not RMT/PARLIO ones on the same pins? (Possible interaction: RMT group interrupt sharing when RMT TX and RX run together — but that doesn't explain PARLIO.)
  • parlioStreamValidate RPC ignores its params (always 16 lanes) and its pin pool yields only 12 valid pins → channelsOk:false; needs fixing before C6 lane-sweeps can use it.

Bench context

  • C6 serial is USB-Serial-JTAG; response truncation at the 64-byte FIFO was fixed by Serial.setTxTimeoutMs(100) once a host attaches (shipping separately).
  • parlioMetrics RPC (engine debug counters) shipping separately — used for the evidence above.

Blocks: C6 PARLIO max-lane sweep ± WiFi (#3576 Phase 7). UART/SPI robustness sweeps can proceed meanwhile.

Refs #3576, #2682.

🤖 Generated with Claude Code

Activity

  1. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Scope update from the Phase 9 audit: the "transmits but capture sees zero edges" family now spans C6 PARLIO, P4 PARLIO, and S3 SPI (all arm the RMT-RX capture successfully post-#3592 and record 0 edges while UART/RMT on the same jumpers are byte-exact). Common thread to investigate: waveform rate/geometry produced by these TX paths vs the RMT-RX min-pulse filter, or pin-matrix output-enable timing on their init paths.

  2. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Forensic addendum — PR #3593 merged (derived wave8 clock + edge-probe tooling). Root cause narrowed but still open.

    Established with the new in-firmware edge probe (62 ns class resolution)

    • PARLIO's waveform IS on the wire and healthy. Old clock: 1.0 µs bit period (T1H 643/T1L 356 ns — the hardcoded 8 MHz, 25% fast; now derived → fixed). UART reference capture: perfect 1.25 µs cadence.
    • BIT_BANG captures 256 raw edges on the same RX arm → the receiver is not deaf to fast-starting TX in general.
    • Raw IDF parlio_new_tx_unit+transmit (via the new parlioRawTest RPC) works in every config permutation the engine uses (width 1/2 + dummy -1 lane, queue_nonblocking, mts=65534, dma_burst=64, depth 3/8) — sustained bursts captured every run.
    • Engine-side snapshots during its own transmit: bit_count/payload/clk-divider/pin-routing/OEN/pulls all correct and equal to the raw-working case.
    • RMT-RX register snapshots taken AT the trigger instant (waveform provably live): INT_RAW/CH2STATUS/CH3STATUS/CH2_RX_CONF1 identical between the working UART capture and the deaf PARLIO capture.
    • Sequence quirk: UART→PARLIO→UART leaves the third test failing, while PARLIO→UART passes — some cross-test state interaction in the engines/harness.

    Elimination table

    Pin routing ✓, output enable ✓, pulls ✓, clock divider ✓ (now derived), DMA completion ✓ (metrics), payload ✓, IDF driver ✓ (raw test), glitch filter ✓ (30 ns floor tried), skip-phase ✓ (0), start-low/idle level unresolved-but-probed, RX registers at waveform time ✓ identical.

    Remaining hypotheses

    • Something in the rmt_rx_channel_5 software path drops symbols/never sees callbacks specifically when the PARLIO/RMT-TX engines ran in-process (interrupt priority/allocation interplay?).
    • A GPIO-matrix input-stage interaction invisible to the peeked registers.

    Next tools if picked up again: rmt ISR-level counters (increment volatile globals in rxDoneCallback to see whether the ISR fires at all during a PARLIO frame); trigger-time INT_RAW polling loop instead of one-shot reads (ISR clears INT_RAW immediately, one-shot reads are blind).

    New portability landmines documented in the tooling: rdcycle = illegal instruction on Espressif RISC-V cores (esp_cpu_get_cycle_count() instead); classic GPIO.in is a bare u32; LED frames complete within one FreeRTOS tick (burst-poll triggers required).

  3. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Breakthrough evidence (PRs #3593, #3594 merged):

    The C6 receiver does NOT time out — it completes "naturally" with exactly one symbol: H 772,875 ns (the entire frame duration as one merged HIGH, terminated by idle). Meanwhile the TX pad (pin 1) demonstrably carries a crisp, now timing-correct waveform (edge-probe: H720/L310 ns wave8 at the derived 6.53 MHz clock; UART reference captures with perfect 1.25 µs cadence on the same probe).

    Timeline instrumentation confirms each capture arms ~2.4 ms BEFORE its transmit — no arm race.

    Everything on the RX config side is verified identical between working (UART, 240 symbols) and broken (PARLIO/RMT-TX, 1 merged symbol) captures: CH2 filter = 8 APB ticks (100 ns), divider = 2 (40 MHz), idle threshold, input mux routing (FUNC71 ← GPIO0), pad IE/pulls/drive (20 mA default).

    Interpretation

    The RMT input stage sees the frame's envelope with ALL low gaps (~310–360 ns) swallowed — for exactly the drivers whose waveforms have the tightest low gaps. Since every digital register checks out, the remaining suspects are electrical/board-level: the pin1→jumper→pin0 path degrading fast low pulses below pin 0's input threshold (the working UART/BIT_BANG waves have ≥460 ns gaps), or an RMT-input-stage sampling subtlety not visible in registers. Pin-0 in-firmware probing self-interferes (the probe artifacts its own 21.5 kHz pattern), so this needs a scope on pin 0 — one minute of oscilloscope time resolves it.

    Suggested software mitigation to try regardless

    Wave-encoder option to guarantee minimum low-gap width ≥ ~500 ns on capture-validated chips (stretch T3), or bench-only: slow the PARLIO validation chipset timing so gaps clear the degradation. Also: parlioMetrics, edgeProbe/edgeProbeRead, parlioRawTest, and the new g_rmtrx_* telemetry make the whole investigation reproducible in minutes.

  4. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Model-killing datapoint (PR #3595 merged): with the derived clock, WS2811-400 timing gives PARLIO 625 ns low gaps — still merged into a single envelope symbol — while UART's 490 ns gaps on the same jumper capture perfectly. No low-pass/electrical model survives that: the capture deafness follows the TX DRIVER, not the waveform. Combined with byte-identical RX state at waveform-live instants (input mux, filter, divider, idle threshold — all verified at trigger time), the remaining hypothesis space: (a) something these drivers' software does to the receive between arm and idle-completion (the merged symbol spans exactly frame-start→frame-end, so the receiver DOES see the boundary edges); (b) an RMT input-sampling interaction triggered by PARLIO/RMT-TX peripheral activity invisible to the peeked registers. Next steps: scope on pin 0, or IDF-internals review of rmt rx channel state during concurrent PARLIO/RMT-TX activity. Full reproduction now takes minutes with the merged tooling (edgeProbe/parlioRawTest/parlioMetrics/g_rmtrx_* telemetry).

  5. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Final synthesis of this investigation round (PR #3596 merged): the paradox is now fully instrument-verified. Pin 0 — the receiver's own pad — carries the complete crisp PARLIO waveform (passive probe through the jumper: H893/L356 ns alternation), while the RMT hardware's raw on_recv_done callback delivers exactly one pre-filter symbol spanning the entire frame as continuous HIGH (H 731 µs). All digital state (input mux FUNC71←GPIO0, filter 8 APB ticks, divider 2, idle threshold) byte-identical to working captures at waveform-live instants. Probe presence does not alter outcomes. WS2811-400's 625 ns gaps merge while UART's 490 ns gaps capture — behavior follows the TX driver, not waveform shape.

    This is beyond register-level remote debugging. Next concrete steps for whoever picks this up: (1) oscilloscope on pin 0 during a PARLIO frame (1 minute of scope time settles pad-vs-silicon); (2) ESP-IDF internals review / vendor query: under what conditions does the C6/P4 RMT RX input stage sample a pad as its envelope while GPIO_IN sees full detail — possible IO_MUX vs GPIO-matrix input path divergence for the RMT signal when specific peripherals are active; (3) try routing the RMT RX input via a DIFFERENT gpio (move the jumper) to rule out pin-0-specific behavior (LP-IO-capable pad on C6).

    All tooling to reproduce in minutes is merged: edgeProbe(passive)/edgeProbeRead, parlioRawTest, parlioMetrics, g_rmtrx_* telemetry.

  6. moved this from Triage to Done in FastLED Trackeron Aug 17, 2026
  7. zackees commented on Aug 17, 2026

    @zackees
    MemberAuthor

    Bench validation on real C6 silicon — 2026-08-17

    Ran bash autoresearch --parlio on the C6 (COM9, jumper TX=GPIO0 → RX=GPIO1, PARLIO 100 LEDs, WS2812B-V5) across three builds. Two distinct defects found, each proven by a measured state change.

    Build Failure class RX raw Raw sample
    pre-#3880 zero_capture 0 edges —
    #3880 (e52abeb26d) decode_mismatch 256 edges L0 H0 L0 H0 …
    + #3881 decode_mismatch 256 edges L29808587 H4833913 L15650462 …

    1. #3880's premise is CONFIRMED on silicon

    Routing C6 PARLIO to the GPIO ISR timestamp backend captures 256 raw edges where RMT RX captured 0. This corroborates the earlier GPIO_IN-sees-269-edges observation: the GPIO input genuinely sees what RMT RX cannot.

    2. mcpwm_capture_channel_enable() was never called — fixed in #3881

    Zero call sites anywhere in src/platforms/esp/32/drivers/gpio_isr_rx/. IDF requires the capture channel to be enabled separately from the capture timer (the C6 header: "will transit the channel state from init to enable"). The driver created the channel and enabled the timer, but never enabled the channel, so it never latched and the capture register the fast ISR reads stayed 0. The ISR was working correctly the whole time — timestamping against a dead register.

    Also fixed there: mcpwm_timer_start() runs per capture arm while stop() ran only on the error path and at teardown, so re-arming called enable on an already-enabled timer → ESP_ERR_INVALID_STATE ("timer not in init state"), three times per run.

    3. Still open: timestamps are implausible

    With #3881 the register is live, but decode still fails (0/300 bytes). WS2812B bit periods should be ~1250 ns (~100 ticks at the requested 80 MHz); observed values are in the millions — 3-4 orders of magnitude too large — with recurring round numbers (25000000, 3906250, 24390625).

    Prime suspect: capture-clock resolution. mcpwm_timer_init() warns and continues on a resolution mismatch (mcpwm_timer.cpp.hpp:243), so if C6's MCPWM_CAPTURE_CLK_SRC_DEFAULT does not deliver the requested 80 MHz, this is exactly the signature. Investigating now.

    #3880 is not a regression — it added 2 lines to the MCPWM file (gpio_status_w1tc_reg_addr) and nothing to the timer lifecycle. Both defects above are pre-existing in the ISR backend and were newly exposed by routing C6 PARLIO through it for the first time. Worth checking whether they also affect ISR-backend captures on other boards.

  8. zackees commented on Aug 17, 2026

    @zackees
    MemberAuthor

    Root cause of the remaining failure: the GPIO ISR cannot resolve WS2812-rate edges on C6

    Measured the ISR's actual capture ceiling across a full 100-LED PARLIO frame on the C6 bench (COM9, TX=GPIO0 -> RX=GPIO1), instrumenting getEdges() to compute inter-capture intervals over every captured edge:

    count=1138  n=1137  min=2000  max=3550  avg=2599  under1us=0  under500ns=0
    

    (all values in ns)

    Not one of 1137 intervals fell below 2 us. Zero under 1 us, zero under 500 ns. The distribution is tight — 2000-3550 ns, mean 2599 — which is the signature of an ISR running continuously at its service limit, not one dropping edges sporadically.

    WS2812B-V5 needs ~300 ns (T0H) resolution and produces ~4800 edges per 100-LED frame. The backend captured 1138 (~24%) and cannot physically resolve pulses shorter than ~2 us. It is off by ~6.7x.

    What this means for #3880

    #3880's premise is correct and confirmed: the C6 GPIO input genuinely sees edges RMT RX misses (256+ vs 0). But routing C6 PARLIO validation to the GPIO ISR timestamp backend cannot succeed, because the ISR cannot sample those edges fast enough to reconstruct WS2812 bit timing. The approach is not viable for WS28xx-rate signals, independent of the two bugs fixed in #3881.

    Note gpio_isr_rx_mcpwm.cpp.hpp's header claims "Fast ISR: 25-31 cycles" and ">1 MHz edge capture rate". That accounts for the assembly ISR body only. The measured 2 us at 160 MHz is ~320 cycles — dominated by ESP-IDF's interrupt entry/exit, since a handler registered through esp_intr_alloc() goes through the IDF vector with full context save/restore rather than being a true high-priority vectored interrupt. The header numbers are misleading and should be corrected.

    No available timing profile is slow enough to work around this: WS2812B-V5, SK6812, and UCS7604-800KHZ are all ~800 kHz-class, whose shortest pulses are well under the 2 us floor.

    Bugs found and fixed along the way (#3881)

    Both real, both bench-proven, both worth landing regardless:

    1. mcpwm_capture_channel_enable() was never called. IDF requires enabling the capture channel separately from the timer, so the channel never latched and the register the fast ISR reads stayed 0. Every edge carried a zero timestamp. Fixed -> timestamps went live.
    2. getEdges() converted ticks to ns in place and destructively. result_ptr aliases output_ptr, and EdgeTimestamp::time_ns is a union member overlaying EdgeEntry::timestamp, so each call re-multiplied by 12.5 (proven: two consecutive reads of one capture differed by exactly 12.5x). Fixed -> reported pulse widths went from 4.8M-41M ns to a plausible 2.0-23.4 us.

    Suggested direction

    Resolving #3586 for C6 PARLIO needs a capture path that does not take an interrupt per edge:

    Hypotheses ruled out (recorded so nobody re-chases them)

    • Capture clock resolution — device reports exactly 80000000 Hz. The hardcoded ns = ticks * 25 / 2 is correct.
    • Wrong capture register/channel — device reports 0x600140fc = MCPWM base + 0xfc = MCPWM_CAP_CH0_REG, correct for C6; hardcoded channel 0 matches IDF's allocation.
    • Edge-buffer wrap — RX wait/raw: .../256 is a display cap (AutoResearchTest.cpp:396 resizes to 256 before getRawEdgeTimes()), not an edge count. Raising it to 4096 makes the call return 0 because that vector fails to allocate on this C6 build — a separate constraint worth knowing.
  9. added a commit that references this issue on Aug 17, 2026
    71d2f2f
  10. zackees commented on Aug 17, 2026

    @zackees
    MemberAuthor

    ✅ RESOLVED — C6 PARLIO now captures and decodes byte-exactly

    TEST PARLIO lanes=1 leds=100 PASS 129ms
    ✓ AUTORESEARCH SUCCEEDED
    RESULT PASS 2 test(s)
    

    Reproduced across two consecutive runs on the C6 bench (COM9, TX=GPIO0 → RX=GPIO1, WS2812B-V5, 100 LEDs).

    Fixed in #3881 (branch fix/3586-mcpwm-capture-channel-enable).

    Why a new capture backend was required

    Neither existing path can capture WS2812-rate signals on C6:

    • RMT RX returns the whole frame as one merged HIGH symbol even though the GPIO input on the same pad sees every edge — the original report here.
    • GPIO ISR (routed here by fix(esp32-c6): validate PARLIO with GPIO ISR RX capture backend (#3586) #3880) has a measured capture ceiling of ~2 µs between edges: min=2000ns max=3550ns avg=2599ns, with zero of 1137 intervals under 1 µs on a 100-LED frame. WS2812 needs ~300 ns, so it is off by ~6.7×. The tight spread is an ISR saturated at its service rate, not one dropping edges sporadically.

    gpio_isr_rx_mcpwm.cpp.hpp's header claims "25-31 cycles / >1 MHz edge capture rate" — that counts only the assembly ISR body. The measured 2 µs ≈ 320 cycles at 160 MHz is dominated by ESP-IDF interrupt entry/exit, because a handler registered through esp_intr_alloc() runs via the IDF vector with full context save/restore. Those header numbers are misleading and worth correcting.

    The fix: PARLIO RX oversampling into DMA

    Takes no interrupt per edge. The PARLIO RX unit samples one data line at 16 MHz (62.5 ns) straight into DMA — a 100-LED frame is ~6 KB of samples. C6 has a dedicated RX unit separate from the TX unit (SOC_PARLIO_RX_UNITS_PER_GROUP=1), so PARLIO clockless TX and this capture run concurrently. A soft delimiter gates capture in software, so no external clock or valid-signal pin is needed.

    This is the C6 counterpart to the classic-ESP32 I2S-RX oversampler (#3576 Phase 3), reusing its run-length extraction and 4-phase pair decode so byte-exactness semantics match the RMT/ISR/I2S backends.

    Bench progression

    Backend Raw sample Resolution
    GPIO ISR, pre-fix L0 H0 L0 H0 dead capture register
    GPIO ISR, fixed H2475 L20962 H2463 ~2 µs floor, undecodable
    PARLIO_RX L375 H625 L1000 H500 L625 H625 L250 H62 62.5 ns, decodes byte-exact

    H625 ≈ T1H, H250 ≈ T0H, L625 ≈ T1L.

    Two bugs fixed along the way (also in #3881)

    Both real and independently bench-proven, in the GPIO ISR backend:

    1. mcpwm_capture_channel_enable() was never called anywhere in the driver. IDF requires the capture channel enabled separately from the timer, so it never latched and the register the fast ISR reads stayed 0 — every edge carried timestamp 0.
    2. getEdges() converted ticks→ns in place and destructively. result_ptr aliases output_ptr and EdgeTimestamp::time_ns is a union member over EdgeEntry::timestamp, so each call re-multiplied by 12.5 — proven by two consecutive reads of one capture differing by exactly 12.5×.

    Implementation gotchas worth recording

    • Byte order matters. Samples are scanned byte-wise in DMA order with each byte shifted so bit 7 lands at bit 31 for the leading-zero count, paired with PARLIO_BIT_PACK_ORDER_MSB. Reinterpreting the buffer as u32 (as the I2S backend does) puts the earliest-sampled byte in the low bits on a little-endian core, reversing the time order the scan depends on. This produced a distinctive symptom: valid pulses (H625, H250) interleaved with impossibly short ones (H62, H125).
    • Window sizing. DMA starts at begin() but transmit happens some ms later, so the window (32 KB ≈ 16.4 ms) must still span a whole frame.
    • Mid-frame resync. A long idle seen with fewer than kMinFrameRuns runs means sampling opened mid-frame; that fragment is discarded and capture resyncs on the next frame rather than reporting a short capture. Without this the backend reported 7-17 runs instead of a full frame.

    Hypotheses ruled out with device data

    • Capture clock resolution — device reports exactly 80000000 Hz; the hardcoded ns = ticks * 25 / 2 is correct.
    • Wrong capture register/channel — device reports 0x600140fc = MCPWM base + 0xfc = MCPWM_CAP_CH0_REG, correct for C6.
    • Edge-buffer wrap — RX wait/raw: .../256 is a display cap (AutoResearchTest.cpp:396 resizes to 256 before getRawEdgeTimes()), not an edge count.
  11. zackees commented on Aug 17, 2026

    @zackees
    MemberAuthor

    Reopened — closed prematurely by #3880

    This issue auto-closed at 2026-08-17T02:10:01Z, one second after #3880 merged, because that PR's description said "Closes #3586". That was my mistake — #3880 does not fix this issue.

    #3880's premise is correct and confirmed on silicon: the C6 GPIO input genuinely sees edges RMT RX misses. But routing validation to the GPIO ISR timestamp backend cannot work. Its capture ceiling, measured across a full 100-LED frame, is:

    count=1138  min=2000  max=3550  avg=2599  under1us=0  under500ns=0   (ns)
    

    Zero of 1137 intervals below 2 µs, against the ~300 ns WS2812 needs — off by ~6.7×.

    Leaving the issue closed would point anyone reading it at #3880 as the resolution, which is a change that measurably does not work.

    The actual fix is #3881, which adds a PARLIO_RX oversampling backend (16 MHz DMA sampling, 62.5 ns resolution, no interrupt per edge) and passes on the bench:

    TEST PARLIO lanes=1 leds=100 PASS 129ms
    

    Reopening so this closes when #3881 lands. Full detail: #3586 (comment)

  12. added a commit that references this issue on Aug 17, 2026
  13. added a commit that references this issue on Aug 17, 2026
    d62cfc8
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