Repository navigation
feat(rx): I2S-RX 1-bit oversampling capture backend — breaks the classic-ESP32 10-LED capture ceiling (#3576 Phase 3) - #3581
Conversation
…#3576 Phase 3) Classic ESP32's RMT receiver has no ping-pong and no DMA — captures are one-shot into channel RAM, ~256 symbols ≈ 10 WS2812 LEDs (#3571). This adds an I2S0-based oversampling backend that removes the ceiling: bench-verified byte-exact at 100 and 160 LEDs (16x the RMT limit). Backend (RxBackend::I2S_RX / RxDeviceType::I2S_RX, classic only): - I2S0 standard master-RX serial mode samples the RX pin (via the I2S0I_DATA_IN15 matrix signal — the classic SD-in quirk) at 16 MHz into a 16 KB circular DMA ring; CLZ-based run-length extraction on the draining task; 4-phase pair decode matching RMT semantics. - Packed level runs (4 bytes each) capped at 8000 (~165 LEDs, 32 KB) — sized against classic's free heap; unbounded storage OOM'd at 500. - Claims I2S0 through the cross-driver port-claim registry; begin() fails cleanly (fall back to RMT) when the second clockless bank or clocked-SPI owns the block. Bench-derived silicon findings (all encoded as comments): - The RX serial sampler clocks SD at the CLKM rate directly (80/clkm_div_num); rx_bck_div only shapes the unused BCK output. - Rates above ~16 MHz (clkm_div_num < 5) capture only zeros from real pads; the matrix-constant source still samples — input path ceiling. - rx_msb_shift=1 (Philips) required; PDM block forced off. - Bit order: bit31 of each 32-bit FIFO word is the earliest sample. - Per-bit extraction cannot keep up at 16 Msps (mid-frame gaps past ~50 LEDs) — CLZ word-run scanning fixes it. Plumbing: - RxChannel::begin() recreates the device when config.backend differs; a fresh default config silently reverted explicit backends to PLATFORM_DEFAULT/RMT. New RxChannel::backend() accessor; the AutoResearch capture path now carries it (root-cause fix). - runSingleTest gains an optional rxBackend param (RMT/ISR/I2S_RX). - g_i2s_rx_debug[] bench counters (peekMem-able, 32 bytes) kept for future bring-up. - fl/channels/README.md: RX capture backends section. Bench (WROOM COM11, GPIO33->34): I2S_RX byte-exact 4/4 at 10, 100 and 160 LEDs; regression I2S/I2S0/RMT/UART/SPI (RMT backend) 4/4 each. Host: 345/345, lint clean. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR adds an I2S_RX capture backend for classic ESP32 devices. It extends the RxBackend/RxDeviceType enums, factory dispatch, and RxChannel with a backend() accessor, implements the ESP32 I2S sampler, updates AutoResearch examples/RPC handling, adds documentation, and includes generated build_info JSON files. ChangesI2S RX Backend Feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant RemoteRunner as AutoResearchRemoteRunSingleTest
participant FastLED
participant RxChannel
participant RxDevice as RxDevice::create<I2S_RX>
participant I2sRxSampler
RemoteRunner->>RemoteRunner: parse rxBackend from RPC config
alt rxBackend override provided
RemoteRunner->>FastLED: addRx(RxChannelConfig(pin_rx, backend))
FastLED->>RxChannel: begin(config)
RxChannel->>RxDevice: create<I2S_RX>(pin)
RxDevice->>I2sRxSampler: createI2sRxSampler(pin)
I2sRxSampler-->>RxDevice: sampler instance
RxDevice-->>RxChannel: device
RxChannel-->>RemoteRunner: rx_channel_to_use
else no override
RemoteRunner->>RemoteRunner: reuse mState->rx_channel or rx_factory
end
RemoteRunner->>RxChannel: backend()
RxChannel-->>RemoteRunner: configured backend
Possibly related issues
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Phase 3 of #3576. Classic ESP32's RMT receiver is one-shot (no ping-pong, no DMA): ~256 symbols ≈ 10 WS2812 LEDs per capture (#3571). This PR adds
RxBackend::I2S_RX— an I2S0-based 1-bit oversampler — bench-verified byte-exact at 100 and 160 LEDs (16× the ceiling).How it works
begin()fails cleanly to the RMT fallback when the second clockless bank or clocked-SPI owns the block.Bench-derived silicon findings (encoded as code comments)
rx_bck_divonly shapes the unused BCK output. Measured pulse durations pinned this: 12 samples for a 735 ns UART pulse.rx_msb_shift=1(Philips) required; PDM block must be forced off; SD-in rides theI2S0I_DATA_IN15matrix signal; bit31 of each FIFO word is the earliest sample.Root-cause fix included
RxChannel::begin()recreates its device wheneverconfig.backenddiffers — so any consumer that re-armed with a fresh default config silently reverted an explicitly-selected backend to PLATFORM_DEFAULT/RMT. AddedRxChannel::backend()and made the AutoResearch capture path carry it.runSingleTestgains an optionalrxBackendparam (RMT/ISR/I2S_RX).Verification
Refs #3576, #3571.
🤖 Generated with Claude Code
Summary by CodeRabbit