Skip to content

feat(i2s): I2S0 second clockless bank — 32 parallel lanes on classic ESP32 (#3576 Phase 1) - #3577

Merged
zackees merged 1 commit into
masterfrom
feat/i2s0-second-bank-32-lanes-3576
Jul 2, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/i2s0-second-bank-32-lanes-3576

Conversation

@zackees

@zackees zackees commented Jul 2, 2026

Copy link
Copy Markdown
Member

Phase 1 of the #3576 program. Classic ESP32's second I2S block (I2S0) now hosts a second 16-lane wave8 clockless bank — 32 parallel clockless lanes total.

Design

  • Per-port engines: createI2sEsp32DevEngine(port) with per-port peripheral singletons; the second bank registers as Bus::FLEX_IO instance 1 with the distinct name "I2S0" (targetable via affinity / AutoResearch's exclusive-driver selector).
  • Overflow: the primary bank's canHandle() enforces a 16-lane clockless capacity, so the 17th+ channel of a frame overflows to the second bank (registered one priority below), then RMT. SPI batches are uncapped (delegated).
  • Hardware arbitration: I2S0 is contended between this bank and the clocked-SPI driver. New cross-driver port-claim registry (i2s_port_claim.{h,cpp.hpp}) — both peripherals claim at initialize() and release at deinitialize()/failure; first mode wins, the loser fails cleanly.
  • Silicon quirk found on the bench: in the identical 32-bit mono LCD config, I2S0 presents the emitted half-word on DATA_OUT8..23 (I2S1 uses DATA_OUT0..15). Register dumps via peekMem showed a perfect config + completed DMA with a silent pin; the +8 signal-offset in routeLanePin fixed it.
  • Per review direction, default_bus_priority(bus, which) now takes which explicitly (no default) and is instance-aware — secondary FLEX_IO instances sit one below the primary (matches P4 LCD_RGB's slot). All call sites updated.
  • fl/channels/README.md updated (engine table + 32-lane operation section).

Verification

  • Host: 345/345 (new tests: port plumb-through to the mock config, "I2S0" naming, 16-lane capacity + SPI exemption + re-accept of enqueued channels); lint clean.
  • Bench (WROOM COM11, GPIO33→34): I2S0 bank passed: true, 4/4 patterns byte-exact — first wire-verified I2S0 clockless frame. Regression: I2S (bank 1), RMT, UART, SPI all 4/4.

Refs #3576.

🤖 Generated with Claude Code

…ESP32 (#3576 Phase 1)

Classic ESP32 has two identical I2S blocks; only I2S1 carried the
modern wave8 clockless engine. This adds a second 16-lane bank on I2S0
("I2S0", Bus::FLEX_IO instance 1) for 32 parallel clockless lanes.

- createI2sEsp32DevEngine(port): per-port peripheral singletons
  (Singleton<T, N> tag = port); engine carries mI2sPort and passes it
  through init/routing; getName() is port-distinct ("I2S"/"I2S0") so
  affinity binding and AutoResearch's exclusive-driver selector can
  target each bank.
- 16-lane capacity in canHandle(): the primary bank refuses the 17th
  distinct clockless channel of a frame, overflowing it to the second
  bank (priority one below), then RMT. SPI batches are uncapped (they
  delegate).
- Cross-driver I2S port-claim registry (i2s_port_claim.{h,cpp.hpp}):
  I2S0 is contended between this bank and the clocked-SPI driver
  (I2sSpiPeripheralEsp). Both peripherals claim in initialize() and
  release in deinitialize()/failure paths; first mode wins, the loser
  fails cleanly and its channels fall through the priority list.
- Registration: BusTraits<Bus::FLEX_IO, 1> on esp32dev;
  BusInstanceCount<FLEX_IO/SPI/UART> specializations for FL_IS_ESP_32DEV;
  enableAllDrivers() enrolls instance 1; default_bus_priority() is now
  instance-aware (secondary FLEX_IO = primary - 1, matching P4 LCD_RGB)
  and its `which` parameter is EXPLICIT (no default) so silent
  default-priority call sites can't creep in — all call sites updated.
- I2S0 silicon quirk (bench-derived): in the same 32-bit mono LCD
  config, I2S0 presents the emitted half-word on DATA_OUT8..23 — one
  byte higher than I2S1's DATA_OUT0..15. routeLanePin applies the +8
  signal offset on port 0.
- fl/channels/README.md: engine table + 32-lane operation section.

Bench (WROOM COM11, GPIO33→34): I2S0 second bank passed: true 4/4
patterns byte-exact (first wire-verified I2S0 clockless frame);
regression I2S/RMT/UART/SPI 4/4 each. Host: 345/345, lint clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 2, 2026
@zackees
zackees merged commit 7af3470 into master Jul 2, 2026
12 checks passed
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i2s0-second-bank-32-lanes-3576

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant