Skip to content

I2S1 modern engine: bench transmit produces no wire edges — register-config mismatch with wave8 output layout #3568

Closed

Description

@zackees

Bug

The modern classic-ESP32 I2S engine (ChannelEngineI2sEsp32Dev) — bound at runtime to Bus::FLEX_IO, 0 per #3526 Phase 2d — dispatches through end-to-end but emits zero wire edges during FastLED.show() on real hardware.

Bench evidence

Live-hardware ESP32-WROOM COM11 (IDF 5.5.2, bash autoresearch esp32dev):

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

Response:

{
  "driver": "I2S",
  "success": true,
  "passed": false,
  "patterns": [{
    "captureFailed": true,
    "capturedBytes": 0,
    "mismatchedLeds": 10,
    "mismatchedBytes": 30,
    "rawEdgesAfterWait": 0
  }]
}
  • Modern engine bound (driverName: "I2S" via flexIoDeviceInfo RPC).
  • FastLED.show() returns without crash; device stays alive.
  • RMT RX capture on GPIO19 sees NO edges from TX GPIO18 across a jumper wire.
  • Every register write in initialize() is bit-identical to Yves's known-working i2s_init() in the deleted i2s_esp32dev.cpp.hpp.

Root-cause hypothesis (needs scope to confirm)

Wave8's encoded output layout does not match the I2S1 FIFO's sample-word format that Yves's register config expects.

Wave8 output (16-lane, 8 pulses/bit)

wave8Transpose_16_bf1 writes 128 bytes per WS2812 input byte:

byte offset | contents
-----------+------------------------
0          | symbol 0, pulse 0, lanes 0-7   (col_lo)
1          | symbol 0, pulse 0, lanes 8-15  (col_hi)
2          | symbol 0, pulse 1, lanes 0-7
3          | symbol 0, pulse 1, lanes 8-15
...
15         | symbol 0, pulse 7, lanes 8-15
16         | symbol 1, pulse 0, lanes 0-7
...
127        | symbol 7, pulse 7, lanes 8-15

So each pulse is a 16-bit-wide parallel sample: [col_lo | col_hi] = 16 lanes.

Current I2S1 register config

src/platforms/esp/32/drivers/i2s/i2s_peripheral_esp32dev_esp.cpp.hpp:246-292:

i2s->sample_rate_conf.tx_bits_mod = 32;
i2s->fifo_conf.tx_fifo_mod = 3;
i2s->conf2.lcd_en = 1;
i2s->conf.tx_msb_right = 1;
i2s->conf.tx_right_first = 1;

With tx_bits_mod = 32, the FIFO emits 4 bytes per output tick — combining [pulse0_lo, pulse0_hi, pulse1_lo, pulse1_hi] into ONE 32-bit sample. That halves the effective wire rate to 4 MHz and mangles pulse ordering.

Bench-tested workaround (also failed)

Setting tx_bits_mod = 16 to match wave8's 16-bit-per-pulse layout also produced zero edges. Currently reverted to = 32 with debug notes — see PR #3567.

Debug plan (needs oscilloscope on the target GPIO)

Candidates ordered by likelihood:

1. tx_bits_mod + tx_fifo_mod inconsistency

The tx_bits_mod = 16 bench attempt kept tx_fifo_mod = 3 (32-bit single-channel). The pair must match. Try:

  • tx_bits_mod = 16 paired with tx_fifo_mod = 1 (16-bit single-channel)
  • Or tx_bits_mod = 8 with tx_fifo_mod set for 8-bit single-channel (see ESP32 TRM chapter 16)

2. Byte order — tx_msb_shift / tx_right_first

Yves used tx_msb_right = 1, tx_right_first = 1 for his 32-lane bit-transpose. With wave8's byte-major output, this may reverse the intended lane order or swap col_lo/col_hi per pulse. Bench-test with tx_msb_right = 0 and/or tx_right_first = 0.

3. Register-write order in transmit()

Delta between current impl and Yves's proven i2s_start():

Current:
  reset -> BURST -> int_clr -> out_link.addr -> out_link.start -> int_ena -> tx_start
Yves:
  reset -> BURST -> out_link.addr -> out_link.start -> int_clr -> int_ena -> tx_start

Yves clears int flags AFTER out_link.start = 1. If setting out_link.start raises int_raw bits (descriptor validation errors?), our pre-clear may miss them. Reorder to match Yves exactly.

4. GPIO matrix signal index

routeLanePin(0, 18) routes I2S1O_DATA_OUT0_IDX + 0 = 166 to GPIO18. Confirm with scope:

  • GPIO18 has actual toggling when the FIFO drains
  • If not, try +1, +2 — the DATA_OUT signal carrying the LSB may not be _OUT0_IDX in 16-bit mode

5. Clock divider correctness

solveI2sClockDivider(8_000_000) returns N=10, A=1, B=0. Verify on scope: LCD clock shows 8 MHz square wave when transmit active. If missing, clka_en may need to be 1 (currently 0, matching Yves).

6. Missing lcd_ws_idx GPIO routing

conf2.lcd_en = 1 puts the peripheral in LCD-parallel mode. LCD outputs sample clock on lcd_ws_idx. If we don't route WS anywhere, the LCD state machine may refuse to advance. (Long shot — Yves also did not route WS explicitly.)

Acceptance

Related

Reference

Activity

  1. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Root cause found and fixed in PR #3570 — full analysis at #3569 (comment). TL;DR: the bench RX pin (GPIO19) is physically disconnected from GPIO18 (proven electrically via esptool GPIO register pokes), so no capture could ever see edges from ANY TX driver; on top of that the RMT RX backend was broken on classic ESP32 (en_partial_rx + use_dma unsupported — the rmt_receive(368): partial receive not supported errors in this issue's logs were the capture dying), and the I2S encoder had the lane-mapping (DATA_OUT(n) = sample bit n+8) and 2-pulses-per-sample bugs this issue hypothesized about — both fixed with byte-exact host tests. Reseat the jumper, merge #3570, and re-run the loopback matrix.

  2. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Resolved by #3570 + #3571 — see the full closure analysis on #3569 (comment). The modern I2S engine now passes byte-exact 10-LED loopback on the WROOM bench (4/4 patterns). Key wire-level facts that supersede this issue's hypotheses: I2S1 in tx_bits_mod=32 mono LCD mode emits only the HIGH half-word (DATA_OUT(n) = memory bit 16+n), and the pixel clock must derive from the chipset timing (6.4 MHz for WS2812, not 8 MHz). Closing.

  3. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    Fixed and wire-verified via #3570/#3571.

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