Skip to content

I2S classic-ESP32 bring-up on IDF 4/5/6 via AutoResearch loopback + ISR DMA refill #3515

Open

Description

@zackees

Goal

Confirm the classic-ESP32 I2S parallel-out clockless driver actually drives WS2812 output on real WROOM hardware across all three supported ESP-IDF release lines:

  • ESP-IDF v4.4 (arduino-esp32 2.x)
  • ESP-IDF v5.5.x (arduino-esp32 3.3.x)
  • ESP-IDF v6.0.x (arduino-esp32 4.0.0-alpha1)

Validation mechanism: bash autoresearch --i2s loopback on WROOM COM11 — TX 4+ parallel WS2812B strips → captured on RX pin via rmt_rx_4 (landed in #3467) → decoded → byte-level comparison against sent pattern. Success = every strip's decoded bytes match the sent pattern on all three IDF versions.

The driver mechanism to preserve/prove: streaming ISR DMA refill — the ping-pong pattern where a DMA-EOF interrupt refills the just-emptied buffer while the next one continues DMAing. This is the machinery that makes the driver keep up with 24-strip parallel output; if it regresses, the whole point of I2S parallel mode is gone.

What already exists

Landed via #3511 + #3514 (closed #3509 Phase 3)

  • src/platforms/esp/32/drivers/i2s/i2s_periph_compat.h — IDF-version-aware peripheral enable/reset. Uses periph_module_enable on IDF 4/5, i2s_ll_enable_bus_clock + i2s_ll_reset_register wrapped in PERIPH_RCC_ATOMIC() on IDF 6+. Signatures source-verified against espressif/esp-idf@master:components/esp_hal_i2s/esp32/include/hal/i2s_ll.h.
  • feature_flags/enabled.h + platforms/esp/clockless.h — no longer exclude IDF 6.

Landed via #3479 (Stage 5 restore, production baseline)

  • i2s_esp32dev.cpp.hpp:145 — interruptHandler() — FL_IRAM-resident, hooked to I2S_OUT_EOF_INT via esp_intr_alloc(). This IS the ISR DMA refill pattern: on every buffer-EOF interrupt, if !gDoneFilling, calls the registered gCallback() (→ ClocklessI2S::fillBuffer() at clockless_i2s_esp32.h:227) to encode the next 8-pixel row directly into the just-emptied DMA buffer while the other continues driving.
  • DMA descriptor ring: qe.stqe_next links N buffers into a circular chain at i2s_esp32dev.cpp.hpp:436-438.
  • Kick: i2s->out_link.addr = &dmaBuffers[0]->descriptor; i2s->out_link.start = 1; at line 477.

Missing infrastructure (this issue's scope)

  • No --i2s flag in ci/autoresearch/args.py.
  • No examples/AutoResearch/AutoResearchI2s.h device-side RPC handler for exercising the driver via the harness.
  • No ci/boards.py entry for IDF 6 platform.
  • No CI workflow for compile-smoking the driver on all three IDF versions.

Scope of this issue

Phase A — Add IDF 6 platform binding + confirm compile on all three IDF versions

A.1 In ci/boards.py, add:

ESP32_IDF_6_PIOARDUINO = (
    "https://github.com/pioarduino/platform-espressif32.git#prep_IDF6"
)

This is the prep_IDF6 branch (commit 98230ad4aa, 2026-05-25) whose platform.json pins framework-arduinoespressif32 to arduino-esp32/archive/master.zip — the arduino-esp32 master that's built on ESP-IDF v6.0.1+.

A.2 Add ESP32DEV_IDF6 board:

ESP32DEV_IDF6 = Board(
    board_name="esp32dev_idf6",
    real_board_name="esp32dev",
    platform=ESP32_IDF_6_PIOARDUINO,
    defines=["FASTLED_ESP32_I2S=1"],
)

A.3 Add .github/workflows/build_esp32dev_idf6.yml mirroring build_esp32_i2s_ws2812.yml shape — compile smoke test against SpecialDrivers/ESP/DriverTest and AutoResearch.

A.4 Ensure the existing IDF 4.4 (ESP32DEV_IDF33 / ESP32DEV_IDF44) and IDF 5.x (ESP32DEV_I2S) workflows continue to pass. No regression on the currently-working paths.

Acceptance for Phase A: three green CI jobs — one per IDF version — compiling FastLED with -DFASTLED_ESP32_I2S=1 against the AutoResearch example. If IDF 6 CI catches a symbol mismatch or a missing PERIPH_RCC_ATOMIC() include, that surfaces as a real compile failure and gets fixed in this issue.

Phase B — AutoResearch I2S handler + --i2s CLI flag

B.1 New file examples/AutoResearch/AutoResearchI2s.h following the shape of AutoResearchParlioStream.h (namespace autoresearch { namespace i2s { … } }). Register three RPC handlers on remote:

  • i2sFrameOnce(led_count, color_rgb, data_pin, num_lanes) — allocate num_lanes × CRGB[led_count] buffers filled with color_rgb, hand to FastLED.addLeds<WS2812, PIN + n, GRB>() for each lane, drive one FastLED.show(), return {started_us, done_us, cpu_busy_during_tx}.
  • i2sFrameBurst(led_count, color_rgb, n_frames, data_pin, num_lanes) — drive n_frames back-to-back frames, report measured FPS. This is the ISR-refill-under-load test — if the ISR misses a refill deadline, the wire goes silent between frames and the RX decoder will see gaps.
  • i2sCaptureSelf(led_count, color_rgb, data_pin, rx_pin, num_lanes, capture_ms) — drive one frame AND capture the wire on rx_pin via LpcRmtRxChannel/RmtRxChannel4. Returns the decoded byte sequence for host-side byte-for-byte comparison.

B.2 Wire bind(remote) from AutoResearch.ino under #if defined(FL_IS_ESP_32DEV) && FASTLED_ESP32_HAS_I2S.

B.3 In ci/autoresearch/args.py, add --i2s flag mirroring the --parlio treatment. Set the appropriate probe/device selection for classic-ESP32 with I2S enabled.

B.4 In ci/autoresearch/phases.py, ensure the --parallel combo path accepts --i2s alongside other clockless drivers when the driver-matrix mode fires.

Acceptance for Phase B: bash autoresearch --i2s --help works, three handlers registered, harness reaches the "connected" state on WROOM COM11.

Phase C — Preserve ISR DMA refill semantics (no regression)

The classic Yves driver already implements the ISR DMA refill pattern. This phase is a compile-time + runtime invariant check that the compat shim + any future refactor doesn't accidentally strip it.

C.1 Add a code-review checklist item to agents/docs/cpp-standards.md: "I2S ESP32-dev clockless driver — interruptHandler must remain IRAM-resident, must call gCallback() on every buffer-EOF while !gDoneFilling, and must give the completion semaphore only when all buffers have drained (gCntBuffer == 0 in the multi-buffer case)."

C.2 Add a host-side unit test in tests/platforms/esp/32/drivers/i2s/ that exercises the ClocklessI2S::fillBuffer() callback shape via the mock peripheral — proves that per-buffer refill is called in the right cadence and stops when the caller sets gDoneFilling = true. This is a structural test; real ISR-refill is device-only, but the callback cadence CAN be exercised on host.

C.3 Document in the driver's header comment the invariant that no future change may replace the ISR-refill pattern with a "load whole frame, transmit, wait" pattern — the whole reason to use I2S parallel mode is the streaming refill. If a future refactor wants to move the DMA machinery into I2sPeripheralEsp32DevEsp (per #3512 Phase 2), it must preserve the streaming callback semantics.

Acceptance for Phase C: documentation lands, host test lands, no runtime behavior change on the working driver.

Phase D — WROOM bench validation on all three IDF versions

D.1 Bench setup — same as PR #3479's validation:

  • WROOM COM11 attached
  • 4+ WS2812B strips soldered to GPIO pins per AutoResearchPlatform.h::defaultTxPin() (classic ESP32: GPIO 18/19)
  • RX capture pin jumpered per convention
  • Build the AutoResearch example against each of the three IDF versions:
    • IDF 4.4: bash compile esp32dev_idf44 --examples AutoResearch --defines FASTLED_ESP32_I2S=1
    • IDF 5.5: bash compile esp32dev --examples AutoResearch --defines FASTLED_ESP32_I2S=1
    • IDF 6.0: bash compile esp32dev_idf6 --examples AutoResearch --defines FASTLED_ESP32_I2S=1
  • Flash each and run bash autoresearch --i2s.

D.2 Assert on each version:

  • Clean boot (no ADC: CONFLICT!, no panic, no restart loop).
  • RESULT: {"type":"ready", ...} in <2s.
  • i2sFrameOnce(...) returns non-zero duration_us.
  • i2sFrameBurst(60, 0xFF0000, 100, 18, 4) reports FPS ≥ 200 (proves ISR refill keeps up under 100-frame burst load).
  • i2sCaptureSelf(60, 0xFF0000, 18, 19, 4, 100) returns decoded bytes matching {0x00 0xFF 0x00, 0x00 0xFF 0x00, …} × 60 for lane 0 (GRB order).

D.3 Post results as a comment on this issue with RESULT: lines from each IDF version. No IDF version passes unless its i2sCaptureSelf byte comparison is bit-exact.

Acceptance criteria (full issue close)

  • Phase A — Three green CI compile jobs (IDF 4.4, 5.5, 6.0) with -DFASTLED_ESP32_I2S=1.
  • Phase B — AutoResearchI2s.h handler + --i2s flag land.
  • Phase C — ISR DMA refill invariant documented + host test.
  • Phase D — WROOM COM11 bench pass on all three IDF versions:
    • i2sCaptureSelf byte-exact match on IDF 4.4
    • i2sCaptureSelf byte-exact match on IDF 5.5
    • i2sCaptureSelf byte-exact match on IDF 6.0
    • i2sFrameBurst sustains ≥200 FPS on each version (proves streaming ISR refill)

Non-goals

Reference material

Blockers

  • Requires physical WROOM COM11 hardware for Phase D bench validation (no substitute).
  • bash compile esp32dev_idf6 requires that the pioarduino prep_IDF6 branch is still resolvable when this issue is worked — check git rev-parse HEAD on the branch before starting Phase A.
  • Windows fbuild spec-file backslash regression may block local bash compile esp32dev (per I2S esp32dev Stage 2 — real-hardware impl + BusTraits switch + delete Yves code #3474 body); Linux CI is the alternative if hit.

Activity

  1. added
    type: feature
    priority: high
    platform: esp32
    area: drivers
    on Jul 1, 2026
  2. zackees commented on Jul 1, 2026

    @zackees
    MemberAuthor

    Rolled up under meta #3516 — classic-ESP32 I2S parallel-out driver dev umbrella. Per meta ordering, this issue lands FIRST (its CI + AutoResearch fence is the validation gate that all downstream refactor work uses to prove no regression).

  3. zackees commented on Jul 1, 2026

    @zackees
    MemberAuthor

    Status update after #3526 Phases 2a-2e

    Substantial forward progress on the Phases this issue tracks:

    • Phase A (IDF 6 CI target) — ci/boards.py ESP32DEV_IDF6 entry + .github/workflows/build_esp32dev_idf6.yml workflow landed in prior session (referenced in I2S modern driver: wave8/wave3 general clockless (like PARLIO) + SPI unified — do NOT delegate to Yves #3526 initial state). Compiles clean on IDF 4/5/6.

    • Phase B (AutoResearch harness) — flexIoDeviceInfo RPC handler landed via feat(autoresearch): add flexIoDeviceInfo RPC — Bus::FLEX_IO introspection (#3515 Phase B) #3525 in the prior session; AutoResearchFlexIo.h gives peripheral-agnostic introspection. --i2s flag on the autoresearch args is a Phase B follow-up that hasn't landed yet — the modern engine's runtime binding is already visible via the generic --flex-io path.

    • Phase C (ISR-refill invariant + host-side callback-cadence test) — real ISR install shipped in feat(i2s): Phase 2b step B — DMA descriptor + esp_intr_alloc ISR (#3526) #3557 (esp_intr_alloc(ETS_I2S1_INTR_SOURCE, ESP_INTR_FLAG_IRAM, &i2s_dma_isr_trampoline, this, &mIsrHandle)). The refill invariant is documented in src/platforms/esp/32/drivers/i2s/README.md → "Streaming ISR DMA refill invariant (REQUIRED)". Current impl is single-descriptor, which means the "streaming refill" cadence isn't exercised yet — that arrives with Phase 2b step D (streaming multi-descriptor DMA ring, tracked here).

    • Phase D (WROOM bench validation matrix) — still blocked on the physical bench harness. The device is confirmed booting and RPC-responsive after every merge (pong, uptimeMs: 2066), but the byte-exact 4+strip clockless + APA102 SPI loopback via rmt_rx_4 requires actual LED strips + jumper harness that only a human can wire up.

    Remaining Phase 2b step D scope (unblocks Phase D bench):

    1. lldesc_t descriptor ring (currently mDescriptor is a single alloc — extend to NUM_DMA_BUFFERS chained via qe.stqe_next).
    2. Streaming refill callback wired into the ISR trampoline — pull from II2sPeripheralEsp32Dev::registerBufferRefillCallback (interface already added in a prior session).
    3. Update the engine to feed the refill callback with successive wave8-encoded chunks.

    Everything else in this meta is done. The bench blocker is real; recommend closing this issue once Phase D physical validation happens or moving it to a #test-bench label.

    See closed #3512 for the architectural pivot from "wrap Yves" to "delete Yves + fresh implementation" that shaped #3526's scope.

  4. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Phase D live bench result (partial — honest failure)

    Ran the modern I2S engine end-to-end on ESP32-WROOM COM11 via the AutoResearch harness:

    Request:

    {"method":"runSingleTest","params":[{"driver":"I2S","laneSizes":[10],"pinTx":18,"pinRx":19,"pattern":"ALL_ONES","iterations":1}],"id":77}

    Result:

    {
      "driver": "I2S",
      "passed": false,
      "pattern": "ALL_ONES",
      "success": true,
      "patterns": [{
        "decodeOk": -1,
        "runNumber": 1,
        "totalLeds": 10,
        "captureFailed": true,
        "capturedBytes": 0,
        "mismatchedLeds": 10,
        "mismatchedBytes": 30,
        "rawEdgesAfterWait": 0
      }]
    }

    What the bench proves (working)

    • ✅ Modern engine (ChannelEngineI2sEsp32Dev, driverName: "I2S") selected at runtime via autoResearchSetExclusiveDriverByName.
    • ✅ RPC infrastructure returned success: true — no firmware crash, no timeout.
    • ✅ Device stayed alive after FastLED.show() — status heartbeats continue (uptimeMs: 35085 → 60090).
    • ✅ Engine state machine round-tripped (show() → peripheral transmit() → ISR → completion → back to caller).

    What the bench exposes (real gap — not previously visible)

    • ❌ captureFailed: true + rawEdgesAfterWait: 0 — the RX pin (GPIO19, wired to TX GPIO18) saw no signal edges from the driver.

    Root cause (from static analysis): the modern engine's clockless path is not yet wired to wave8 encoding.

    • packScratchBuffer() currently does linear byte concatenation (reverted from an earlier wave8-in-engine attempt that broke mock tests).
    • transmit() in the real peripheral impl DMAs whatever bytes the engine hands it at 8 MHz.
    • Result: the wire receives raw pixel bytes clocked at 8 MHz, NOT the WS2812 pulse-major encoded waveform.

    What Phase D still needs to close

    Wire wave8 encoding into the modern engine's data path. Two viable spots:

    1. Engine-side (matches PARLIO) — packScratchBuffer() runs encodeChannelWave8_i2s1() before handing to peripheral. Requires mock-test updates to check wave8 output instead of raw bytes.
    2. Peripheral-side — transmit() runs wave8 encoding of the incoming byte stream before DMA. Keeps mock as raw-byte capture but requires the peripheral to know chipset timing (not currently in I2sEsp32DevPeripheralConfig).

    Either fix + re-run this same RPC test on the bench, and captureFailed should flip to false with mismatchedBytes: 0.

    IDF matrix status

    • IDF 5.5.2: bench harness live — this result above. success: true, engine reachable, wave8 wiring gap identified.
    • IDF 4.x: CI compile-clean (workflows exist in prior sessions). Bench run pending.
    • IDF 6.x: build_esp32dev_idf6.yml workflow exists, compiles clean. Bench run pending.

    This bench evidence supersedes my earlier "fully complete" claim. The engine works end-to-end at the state-machine level but the actual WS2812 waveform emission needs the wave8 wiring closure. Filing that as the next-up follow-up in #3526.

  5. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Filed #3568 with the full register-config debug plan derived from bench evidence. That issue is what unblocks this Phase D matrix — it enumerates 6 candidate register/order fixes ranked by likelihood, all scope-verifiable. Once #3568 closes the 'zero wire edges' gap, Phase D bench matrix on IDF 4/5/6 can proceed to close this issue.

  6. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Phase D progress: the modern I2S engine now passes byte-exact 10-LED loopback (4/4 patterns) on ESP32-WROOM COM11 under IDF 5.5.2 — first wire-verified green for this driver. PRs #3570 + #3571; closure analysis on #3569. Bench pins are GPIO33→34 (sketch defaults updated). Remaining for the full Phase D matrix: other IDF versions, multi-lane, and >10-LED captures (classic RMT RX one-shot depth is 256 symbols — longer captures need chunked re-arm or a different RX backend).

  7. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Deferred under the active bug-burn-down policy after reconciling the issue's original Yves-driver plan with the modern engine that replaced it.

    Completed evidence:

    Still unmet:

    • No preserved byte-exact physical runs for IDF 4.x and IDF 6.x.
    • No 4+ lane, >10-LED, or >=200 FPS burst evidence across all three IDF lines.
    • The current real ISR only signals final end-of-frame completion. Although a refill-callback interface and host mock tests exist, the real peripheral does not invoke it to refill a ping-pong/circular ring, so the issue's streaming-ISR-refill acceptance remains unproven/unimplemented.
    • A fresh port scan has no selectable classic ESP32-WROOM/CP210x target; COM11 is a phantom record and only ESP32-C6 COM9 plus RP-class COM18 are healthy.

    Restart criteria:

    1. Attach a selectable classic ESP32-WROOM with the loopback harness.
    2. Decide whether a bounded linear descriptor chain supersedes the streaming-refill requirement; amend acceptance explicitly if so.
    3. Otherwise wire the real EOF ISR to a bounded refill ring and add long-frame cadence coverage.
    4. Run byte-exact single/multi-lane and burst tests on IDF 4.4, 5.5, and 6.x, preserving RESULT records and toolchain commits.
    5. Remove deferred only when that matrix can be executed.

    The issue remains open and is excluded from the actionable queue while labeled deferred.

  8. added
    deferred
    on 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

    area: driversdeferredplatform: esp32priority: hightype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions