Repository navigation
Description
Goal
Follow-up to #3509 Phase 3 (merged as #3511 — IDF 6 enable via i2s_ll_* compat shim). Consolidates the remaining architectural work from #3509 into one issue so the two paths for the classic-ESP32 I2S peripheral collapse into a single production surface with WROOM bench validation.
Scope
Phase 2 — Move DMA + ISR machinery into modern peripheral impl
Rewrite I2sPeripheralEsp32DevEsp::transmit() from a synchronous-callback stub into a real DMA descriptor chain kick + esp_intr_alloc ISR handler. Reference: i2s_esp32dev.cpp.hpp:444-491 for the working register sequence, interruptHandler() for the ISR pattern.
Key architectural question the refactor must resolve: streaming refill callback vs. done-only callback. The classic driver's ISR fires per-buffer during transmit and calls ClocklessI2S::fillBuffer() to encode the next 8-pixel row into the just-emptied DMA buffer. The modern peripheral interface (ii2s_peripheral_esp32dev.h) documents registerTransmitCallback as a done-only ISR hook. Options:
- Extend the peripheral interface to support a streaming callback (breaks the mock semantics — 66 host tests would need updating).
- Have the peripheral own the ping-pong buffer internally and only fire the completion callback when the whole stream drains (requires the whole encoded stream to fit in one continuous buffer — not viable for 24-strip parallel).
- Split the surface:
registerTransmitCallbackstays for done, addregisterBufferRefillCallbackfor streaming. Both concrete impls (real + mock) implement both hooks.
Recommend option 3 — preserves existing tests, cleanly extends the interface, matches how ObjectFLED's LPUART path handles the same problem.
Phase 4 — Wire ClocklessI2S<> template through the peripheral interface
Legacy addLeds<WS2812, PIN, GRB>() currently instantiates ClocklessI2S<> which pokes Path A globals directly. Rewrite so ClocklessI2S::init() obtains a fl::Singleton<I2sPeripheralEsp32DevEsp>::instance() and uses the peripheral interface for initialize/allocateBuffer/transmit/waitTransmitDone. Result: one hardware access surface, two user-facing entry points.
Ping-pong buffer refill in the ISR lives in the peripheral impl (unchanged behavior), but the fillBuffer callback goes through registerBufferRefillCallback() (new — see Phase 2 option 3) instead of a raw file-scope function-pointer global.
Phase 5 — Re-include modern peripheral impl in unity build
Once Phase 2 lands and the real DMA/ISR machinery is in I2sPeripheralEsp32DevEsp, remove the UNITY_BUILD_EXCLUDE(...) marker from i2s_peripheral_esp32dev_esp.cpp.hpp and add the include to _build.cpp.hpp. The ADC: CONFLICT! collision documented in Phase 1 was specifically about driver/i2s.h in the Stage 2 (#3476) impl, NOT driver/gpio.h in the current Stage 4 file — the exclude is over-conservative and can lift.
Phase 6 — Global state → Singleton migration
Once the peripheral owns the DMA state, the 10+ file-scope globals in i2s_esp32dev.cpp.hpp become peripheral-instance state. Migrating storage into Singleton<I2sPeripheralEsp32DevEsp>::instance() handles storage-elision naturally per FastLED's convention. Removes the FL_LINT_ALLOW_GLOBAL_FILE(...) marker. Closes #3489.
Phase 7 — WROOM autoresearch loopback
- Add/verify
bash autoresearch --i2sflag onAutoResearch.ino. - WROOM COM11 loopback: TX 4+ parallel WS2812B strips → capture on RX pin via
rmt_rx_4(landed in feat(rmt_rx): backport RmtRxChannel to IDF 4.x (#3465) #3467) → decode → byte-level comparison against sent stream. Success = every strip's decoded byte stream matches the pattern. - Repeat on ESP-IDF 4.x, 5.x, AND 6.x when 6.x becomes available (external blocker — see I2S classic-ESP32: unify Yves + modern paths and add IDF 6+ (LL API) support #3509 comment thread).
Phase 8 — README
src/platforms/esp/32/drivers/i2s/README.md documenting the unified path, the peripheral interface, the LL-API version-gate (in i2s_periph_compat.h), and the loopback test.
Acceptance criteria
-
I2sPeripheralEsp32DevEsp::transmit()does real DMA+ISR — no more synchronous-callback stub (Phase 2) -
ClocklessI2S<>uses the peripheral interface — no direct globals (Phase 4) -
i2s_peripheral_esp32dev_esp.cpp.hppback in unity build, noUNITY_BUILD_EXCLUDEmarker (Phase 5) -
i2s_esp32dev.cpp.hpphas no file-scope statics — closes singleton: migrate i2s_esp32dev driver state — 19 hits, ISR pattern (Tier 2a) #3489, removesFL_LINT_ALLOW_GLOBAL_FILEmarker (Phase 6) -
bash autoresearch --i2sdecodes a 4+ strip WS2812B loopback on WROOM against IDF 4.x and 5.x (Phase 7) - Modern
FastLED.add<Channel::create<Bus::FLEX_IO, 0>()>path also drives real WS2812 output (proves both entry points hit the same peripheral) -
bash test --cpp— all host tests green - README updated (Phase 8)
Reference material
- Preceding work: I2S classic-ESP32: unify Yves + modern paths and add IDF 6+ (LL API) support #3509 (this issue's parent), feat(i2s-esp32dev): enable IDF 6+ via i2s_ll_* compat shim (#3509 Phase 3) #3511 (Phase 3 merged, IDF 6 enable)
- Working DMA/ISR reference:
i2s_esp32dev.cpp.hpp:145(ISR),:444(esp_intr_alloc),:477(out_link.addrkick) - Modern engine state machine:
channel_engine_i2s_esp32dev.cpp.hpp:200,281 - Peripheral interface:
ii2s_peripheral_esp32dev.h - Singleton migration follow-up: singleton: migrate i2s_esp32dev driver state — 19 hits, ISR pattern (Tier 2a) #3489
- Parallel-IO unified-engine rule:
agents/docs/cpp-standards.md— "Parallel-IO Driver: Unified Clockless + SPI Engine"
Blockers
- Windows fbuild spec-file backslash regression blocks local
bash compile esp32dev(per I2S esp32dev Stage 2 — real-hardware impl + BusTraits switch + delete Yves code #3474 body); on-device validation rides on Linux CI or fbuild fix. - IDF 6 confirmation (Phase 7 third-target) depends on Espressif shipping ESP-IDF v6.0 stable + pioarduino publishing a matching platform binding. Externally blocked.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(i2s-esp32dev): wrap IDF 6 LL calls in PERIPH_RCC_ATOMIC critical …
zackees commentedon Jul 1, 2026
Rolled up under meta #3516 — classic-ESP32 I2S parallel-out driver dev umbrella. See the meta for landing order (this issue's Phase 2 runs AFTER #3515 Phases A-D confirm the current Yves driver works on all three IDF versions).
feat(i2s): remove FASTLED_ESP32_I2S selector, add IDF6 CI target (#3515…
docs+fix: Bus::FLEX_IO runtime-selection guardrail + restore Yves opt…
feat(i2s): re-include peripheral impl in unity build (#3512 Phase 5) (#…
docs(i2s): add classic-ESP32 I2S driver README (#3512 Phase 8) (#3521)
feat(autoresearch): add flexIoDeviceInfo RPC — Bus::FLEX_IO introspec…
docs(i2s): rewrite README for modern engine (#3526 Phase 8 / #3512 Ph…
zackees commentedon Jul 1, 2026
Closed by #3526 series — architectural approach superseded
This issue planned to unify the two coexisting I2S paths (Yves
ClocklessI2S<>+ modern channel-manager) by moving Yves's DMA/ISR machinery INTO the modern peripheral impl, then rewiringClocklessI2S<>to consume the modern interface.That plan was explicitly rejected during a user architectural review that led to #3526. Rationale: Yves's per-chipset bit-pattern encoder (
i2s_define_bit_patterns+ variable pulses per bit) is fundamentally different from the wave8/wave3 general-clockless pattern PARLIO established — the two shouldn't share machinery.#3526 was filed to build the modern I2S engine as a fresh implementation in the shape of PARLIO (fixed pixel clock, per-channel wave8 byte-LUT). All the acceptance criteria of this issue were addressed there, via a different route:
lldesc_t+esp_intr_alloc()ISR +routeLanePinClocklessI2S<>through peripheral)BusTraits<Bus::FLEX_IO, 0>→ modern engine;ClocklessI2S<>DELETED entirely at Phase 2e_build.cpp.hppcleanupI2sPeripheralEsp32DevEspisfl::Singleton<>; Yves globals deleted with the files. Closes #3489.Phase 4's original goal was to keep
ClocklessI2S<>working. #3526 chose the harder path: delete the Yves files and force users to migrate to the modern API. The-DFASTLED_ESP32_I2S=1opt-in is gone; users get the modern engine viaFastLED.setExclusiveDriver<fl::Bus::FLEX_IO, 0>().Every line of Yves code that this issue depended on (
i2s_esp32dev.{h,cpp.hpp},clockless_i2s_esp32.{h,cpp.hpp}, ~1287 LOC total) was deleted at Phase 2e (2026-07-01) with proper Yves Bazin attribution preserved in the modern engine's docstrings. Bench verified boots + RPC after every merge.Remaining scope not addressed by #3526 (tracked separately):
feat(i2s): wire wave8 encoding into engine + routeLanePin call (#3526) (
docs(i2s): document open bench debug on tx_bits_mod (#3526 / #3515) (#…
fix(i2s,rmt-rx): 32-bit sample encoding + classic-ESP32 capture fixes (…