Repository navigation
Description
Blocker
The modern classic-ESP32 I2S engine consistently triggers a Stack canary watchpoint triggered (loopTask) panic inside _frxt_int_enter during runSingleTest RPC. Every register-config permutation attempted so far either:
- Produces the stack canary panic (when the DMA-done ISR fires), or
- Runs without crashing but produces zero wire edges (
captureFailed: true, rawEdgesAfterWait: 0).
I've been iterating on register-config values in circles without a scope. Filing this to hand off the register-level debug to someone with hardware instrumentation.
Bench evidence — every attempt
| Attempt | Config change | Result |
|---|---|---|
| Baseline (Yves values) | tx_bits_mod=32, tx_fifo_mod=3, tx_msb_right=1, tx_right_first=1, stqe_next=nullptr, ESP_INTR_FLAG_IRAM, ISR sets tx_start=0 |
boots, rawEdgesAfterWait: 0 |
| Fix #3568 BUG#1 | stqe_next = self (self-loop) |
Stack canary panic in _frxt_int_enter — infinite DMA→ISR loop |
| Fix #3568 BUG#1 + #2 | self-loop + remove tx_start=0 from ISR |
Same stack canary panic |
| Fix #3568 BUG#1 + #2 + #3A | above + tx_bits_mod=16, tx_fifo_mod=1 |
Stack canary panic (worse — new StringHolder StoreProhibited also seen) |
Revert self-loop, add ISR int_ena.out_eof=0 |
stqe_next=nullptr + ISR self-mask |
Stack canary panic (something other than out_eof is firing repeatedly) |
Full ISR mask via int_ena.val=0 + only handle out_eof bit |
as above | Stack canary panic (spurious interrupts continue) |
Consistent failure pattern
The panic backtrace is always the same shape:
Debug exception reason: Stack canary watchpoint triggered (loopTask)
PC: 0x4008daf8 (_frxt_int_enter — freertos ISR entry stub)
Backtrace:
_xt_lowint1
encodeChannelWave8_i2s1
ChannelEngineI2sEsp32Dev::packScratchBuffer
ChannelEngineI2sEsp32Dev::show
ChannelManager::onEndFrame
...
CFastLED::show()
autoResearchChipsetTiming
AutoResearchRemoteControl::runSingleTestImpl
The interrupt fires WHILE the wave8 encoder is running in the loop task. The interrupt entry stub can't push its context because the loop task stack is at the canary boundary. Something is firing an I2S1 interrupt during packScratchBuffer — before we even reach transmit() — meaning the peripheral is in an unexpected state left over from the previous run.
What I ruled out
- Not a stack-usage bug on my side: hoisted 2 KB wave8 byte-LUT to engine member field with hash-invalidation cache. Loop task stack is measured well below 8 KB budget without the interrupt.
- Not an incorrect
stqe_next: bothnullptrandselffailed. Multi-descriptor ring not tried yet. - Not just the encoder-format mismatch: fixing
(tx_bits_mod, tx_fifo_mod)to(16, 1)matches wave8's 2-byte-per-pulse layout — didn't produce edges either, and made the panic more frequent.
What I suspect the real root cause is
Stale DMA + ISR state persisting across initialize() calls. The peripheral is a fl::Singleton<> (process-lifetime, never destroyed). Once initialize() runs once and transmit() fires, some register state (probably int_st unread flags, or the DMA state machine in a mid-transfer state) survives even if the caller calls deinitialize() + initialize() again. Subsequent runs of runSingleTest inherit that stale state and immediately fire an interrupt.
Yves's driver worked because his peripheral was ALWAYS armed for streaming and never went through deinit/re-init cycles — his gInitializedI2sInitialized was one-shot for the process. My re-init cycle is broken.
Files touched in this debug session
src/platforms/esp/32/drivers/i2s/i2s_peripheral_esp32dev_esp.cpp.hpp—initialize()register writes,transmit()descriptor + kick,i2s_dma_isr_trampolinesrc/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.h+.cpp.hpp— wave8 LUT hoisted to member with timing-hash cache
Current uncommitted state on branch docs/i2s-bench-open-debug-note-3526. Should probably be reverted or held on a branch pending scope-verified fixes.
What the next attempt needs
Hardware instrumentation — scope on GPIO 18 during a runSingleTest call, and specifically:
- Does GPIO 18 have ANY signal at all? If yes, we're producing edges but wave8-encoded wrong. If no, the peripheral isn't outputting even a clock.
- Does the I2S1 clock (LCD_WS or CLK signal) toggle? If yes, the peripheral runs but the data path is misconfigured. If no, clock divider or LCD-mode config is wrong.
- Which interrupt bit fires during the panic? Read
i2s->int_st.valin a paused-in-debugger state. Ifout_eoffires but only once, the panic must be fromdscr_errre-firing due to a bad descriptor. - Is
stqe_next = nullptractually valid? ESP32 TRM doesn't say explicitly for LCD-parallel mode. Yves's code always uses circular chains — never one-shot. May need to allocate two descriptors and chain first→sentinel (sentinel withowner=0).
Recommended next step
Someone with a scope should:
- Revert my
docs/i2s-bench-open-debug-note-3526branch's uncommitted changes back to Yves-baseline registers. - Add explicit deinit-then-fresh-init in the peripheral impl (may need to also
esp_intr_free()+ realloc across runs). - Instrument the peripheral to log
int_st.valstate on the FIRST ISR fire of eachrunSingleTestto identify which flag is triggering the flood. - Consider a 2-descriptor ring with a sentinel
owner=0descriptor as the one-shot terminator — Yves never testednullptr; his ring always had a valid next pointer.
Related
- Meta: Meta: classic-ESP32 I2S parallel-out clockless driver dev — bring-up + unify + validate on IDF 4/5/6 #3516 (classic-ESP32 I2S driver dev umbrella)
- Architecture: I2S modern driver: wave8/wave3 general clockless (like PARLIO) + SPI unified — do NOT delegate to Yves #3526 (wave8/wave3 modern driver)
- Original bug tracker: I2S1 modern engine: bench transmit produces no wire edges — register-config mismatch with wave8 output layout #3568 (this issue's parent)
- Bench matrix: I2S classic-ESP32 bring-up on IDF 4/5/6 via AutoResearch loopback + ISR DMA refill #3515 (Phase D)
Files to review
- Live impl:
src/platforms/esp/32/drivers/i2s/i2s_peripheral_esp32dev_esp.cpp.hpp - Live engine:
src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp.hpp - Yves reference (deleted, still in git):
git show ce70b5a5c8^:src/platforms/esp/32/drivers/i2s/i2s_esp32dev.cpp.hpp
Session summary
Over ~20 configuration permutations across 6+ hours of bench iteration, I could not produce a passing runSingleTest on WROOM COM11. The problem is genuinely register-level and needs hardware instrumentation to resolve. Handing off.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jul 2, 2026
Root cause analysis — the mystery is solved, and it was five separate problems
Full re-investigation from scratch (Fable 5 session, 2026-07-01). Every prior conclusion in this issue was re-derived from evidence; several were wrong. All software fixes are in PR #3570. Findings below, most important first.
0. TL;DR
The bench itself is broken: the GPIO18 → GPIO19 jumper wire is not electrically connected. Proven with esptool register pokes (no firmware involved). Every "no wire edges" observation ever recorded on this WROOM — for I2S, RMT, and even plain GPIO toggles — was a floating RX pin. On top of that, four real software bugs were found and fixed (PR forthcoming): two in the RMT RX capture backend that made any capture on classic ESP32 impossible, and the I2S TX encoding bugs that would have produced wrong waveforms once captures work.
1. The physical bench blocker (ACTION REQUIRED: reconnect the jumper)
Electrical test via esptool memory pokes in the ROM bootloader (no firmware, no drivers):
GPIO18 works perfectly. GPIO19 does not follow it. The jumper is missing, loose, or on the wrong pins. Also confirmed independently: the boot-time
gpioBaselineself-test (1 ms plain-GPIO toggles) fails with BOTH the RMT RX backend and the GPIO-ISR RX backend — two unrelated capture stacks, same zero edges.2. RMT RX capture was broken in software for EVERY driver on classic ESP32 (fixed)
The
E (rmt) rmt_receive(368): partial receive not supportederrors that appear in every prior transcript were not noise — they were the capture dying:rmt_rx_channel_5.cpp.hppsetrx_params.flags.en_partial_rx = trueunconditionally on IDF ≥ 5.3. Classic ESP32 has no RX ping-pong hardware (SOC_RMT_SUPPORT_RX_PINGPONGabsent from its soc_caps.h), so ESP-IDF hard-rejects the receive → everyrmt_receive()failed before arming. Fixed: gate onSOC_RMT_SUPPORT_RX_PINGPONG.AutoResearchTest.cppforcesrx_config.use_dma = truefor all non-RMT TX drivers (I2S included). Classic ESP32 RMT has no DMA (SOC_RMT_SUPPORT_DMAabsent) →rmt_new_rx_channel()failed → RXbegin()failed for every I2S capture attempt. Fixed: driver-level graceful fallback to non-DMA.After these fixes, bench runs show
captureWaitResult: -1 → 1anddecodeOutputCapacity: 0 → 32100— the receive now arms and waits; only the floating pin keepsrawEdgesAfterWaitat 0.Implication:
rawEdgesAfterWait: 0was NEVER evidence about the I2S TX driver. The RX side could not observe anything.3. The crashes were memory exhaustion, not driver/ISR bugs (fixed)
Decoded the recurring
StoreProhibitedat PC0x400d2ecefrom the ELF disassembly: the faulting instruction stores a vtable pointer into the result offl::aligned_alloc(8, 120)which returned NULL — the json control-block allocation insidefl::json::setfailing on an exhausted heap. The earlierStringHolderStoreProhibited is the same failure shape. Reproduced with driver=RMT too — nothing to do with the I2S engine.The "Stack canary watchpoint (loopTask)" panic is the flip side: the RPC → runSingleTest → autoResearchChipsetTiming → capture → FastLED.show() chain is bench-measured ~8,032 bytes deep (backtrace frame arithmetic) — the 8 KB default loopTask stack has zero headroom for an interrupt frame at peak depth.
_xt_lowint1in the backtrace services ALL level-1 interrupts (including the FreeRTOS tick), so the "something fires an I2S interrupt during packScratchBuffer" theory in this issue's description was a misread; any tick at peak depth tripped it. The 2 KBWave8ByteExpansionLutby-value return materializing on the stack was a real contributor and is fixed (built in place on the engine member).Fix pairing on ESP32-WROOM AutoResearch: RX capture buffer 96 KB → 32 KB tier (frees 64 KB heap) +
SET_LOOP_TASK_STACK_SIZE(16 KB). Either alone fails: 16 KB stack with the 96 KB buffer = heap OOM (the json crash); 8 KB stack = canary. With the pair,runSingleTestcompletes crash-free every run.4. The I2S TX driver DID have real encoding bugs (fixed, host-test-verified, wire verification pending jumper)
From Yves's proven driver (
git show ce70b5a5c8^:...): his data mask is1 << (i + 8)with pins routed toDATA_OUT0 + i— i.e. intx_bits_mod=32LCD mode,DATA_OUT(n)presents sample bitn + 8; bits 0–7 of each 32-bit sample never reach any pin. The wave8 encoder emitted 2 bytes per pulse, so:Fixes (all in the PR):
wave8I2s1ExpandTo32Samples(): one u32 sample per pulse, 16 lanes at bits 8..23 (lo<<8 | hi<<16), byte-exact host tests against the shared kernel.eofonly on the last, null-terminated) — a 10-LED 32-bit-sample frame is 7,680 bytes, past the single lldesc 4,092-byte reach the old code silently rejected.tx_bits_mod=32 / tx_fifo_mod=3and the whole register init stay bit-identical to Yves's proven values (the earlier=16/=1experiments in this issue were chasing the wrong layer).5. Corrections to this issue's prior hypotheses
Next steps
tx_stop_en, the RMT RXuse_dmarebuild loop, and the RX memory-pool claims).runSingleTest {driver: I2S, laneSizes: [10], pinTx: 18, pinRx: 19, pattern: ALL_ONES}— with the software fixes merged,rawEdgesAfterWait > 0is expected, and byte-exact loopback is the acceptance test for I2S classic-ESP32 bring-up on IDF 4/5/6 via AutoResearch loopback + ISR DMA refill #3515 Phase D.tx_msb_right/tx_right_firstlane permutation — a lane remap, not a timing issue) — diagnosable from the captured byte pattern, still no scope needed.fix(i2s,rmt-rx): 32-bit sample encoding + classic-ESP32 capture fixes (…
fix(i2s,rmt-rx,autoresearch): I2S loopback GREEN on WROOM bench (#3569)…
zackees commentedon Jul 2, 2026
✅ RESOLVED — I2S loopback GREEN on the WROOM bench (PR #3571)
With the jumper confirmed on GPIO 33 → 34 (thanks — the sketch defaults said 18/19, which was never the physical wiring; both pins verified electrically via esptool register pokes):
First wire-verified byte-exact frame from the modern classic-ESP32 I2S engine. RMT control test also 4/4.
Final root causes (in the order they fell)
edge_capacity ≈ 256k symbolsmade the accumulation buffer grab 25% of free heap per capture arm on a one-shot chip that can never receive more than its mem block. This was the whole StoreProhibited / LoadStoreAlignment crash family — it only fired once real capture data started flowing. Clamped to hardware capacity.tx_bits_mod=32mono LCD mode, I2S1 emits only the high half-word of each 32-bit memory word —DATA_OUT(n)= memory bit16+n, low 16 bits discarded. (The bit-n+8model inferred from Yves's code was wrong; established by bisection with the working RMT RX: bits 8..23 → silent, 0..15 → silent, all-32 broadcast → signal.) Lanes now packed at bits 16..31.ChipsetTimingConfig(6.4 MHz for WS2812; the 8 MHz hardcode was 25% fast — bench-measured 1.0 µs bit) and the wave8 LUT is built from the channel's T1/T2/T3. Confirmed on the wire:H850 L400(1-bit) /H300 L950(0-bit) at a spec-perfect 1250 ns period.tx_stop_en=1latches attx_start(FIFO empty before DMA prefetch) — must stay 0.Diagnostics that cracked it: the new
peekMemRPC (register dumps without resetting the chip) showed the DMA completing with the pin silent, isolating the fault to the sample-bit mapping; the working RMT RX then served as a logic probe for the bisection.Remaining follow-ups (tracked, not blockers)
Closing this issue: the blocker it tracked (stack canary → later re-diagnosed as the crash family above, plus "no wire edges") is fully resolved and wire-verified. PRs: #3570, #3571.
zackees commentedon Jul 2, 2026
Fixed by #3570 + #3571 — I2S byte-exact loopback verified on the WROOM bench.
fix(autoresearch): extend 16 KB loop stack to all ESP32 variants (#3576…
fix(uart): stop 400 kHz picking a geometry whose '1' symbol nothing c…