You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(spi): convert ESP32 SPI driver from block-DMA to ISR-chunked wave8 streaming (refs #3177) #3179
Convert ESP32 Bus::SPI driver from one-shot block DMA to ISR-chunked wave8 streaming, mirroring the PARLIO reference implementation.
Why
Today's SPI driver for ESP32 allocates the full SPI transaction buffer (bytes per LED × LED count) up front per show() call. For clocked chipsets like APA102/SK9822 with thousands of LEDs, the buffer is several KB. ISR-chunked streaming keeps a small ring buffer of wave8 chunks; the half/done transfer ISRs refill the buffer mid-frame.
Scope
Wire the existing SPI encoder into a ring-buffer feeder.
Hook the SPI peripheral's half-empty + done DMA interrupts.
Status check during the classic-ESP32 WROOM bench sweep (PR #3573): the SPI channel engine is already async at the frame level — show() queues the first DMA via spi_device_queue_trans (ISR-driven) and returns; poll()/advancePipeline() drive chunk encode/queue overlap and completion, non-blocking (C6 uses split polling per its errata). Wire-verified byte-exact on WROOM COM11: {driver: SPI, passed: true, 4/4 patterns, 10 LEDs}. What remains for this issue is exactly its stated scope — the ISR-chunked ring-buffer streaming conversion to cut peak buffer memory on 1000+-LED clocked strips — which needs the S3 bench + memory profiling per the acceptance list. No change to that scope from #3573.
Burn-down disposition: DEFER ? the requested true-SPI memory conversion is not implemented and requires an architecture change plus unavailable S3 hardware.
The current SPISingleESP32 true-SPI backend (spi_hw_1_esp32.cpp.hpp) still allocates a DMABuffer(total_size) for the full APA102/SK9822 frame, sets queue_size = 1, queues one transaction, and releases the buffer only after completion.
SpiChannelEngineAdapter::transmitBatch() acquires/copies the whole encoded channel and then synchronously calls waitComplete(1000). It has no chunk feeder, ISR refill state, or channel_poll_signal completion path.
The current bench has no attached ESP32-S3 and no documented 1000-LED APA102/SK9822 memory-profile setup; recorded S3 ports are phantom.
Restart criteria:
Decide whether the generic SpiHw1 interface grows streaming primitives or whether ESP32 gets a dedicated true-SPI channel driver; preserve the existing adapters on other platforms.
Add a deterministic host state-machine test for chunk order, start/end-frame framing, error recovery, final drain, and byte equality against the current block encoder.
Implement bounded DMA chunk buffers with queue/refill completion signaling; make poll() genuinely async and ensure the source lifetime is retained until final completion.
Attach an S3 and 1000+ pixel APA102/SK9822-equivalent setup. Record peak internal/DMA heap before/after, wire bytes, frame time, and sustained back-to-back frames.
Meet the issue's 3?5? peak-buffer reduction without throughput loss, then land a resolving PR and close the issue.
The existing clockless ping-pong and LCD_SPI implementations are useful references, but they do not satisfy this true-SPI issue.
Activity
fix(uart): enforce minimum wave10 symbol separation — UART + SPI loop…
zackees commentedon Jul 2, 2026
Status check during the classic-ESP32 WROOM bench sweep (PR #3573): the SPI channel engine is already async at the frame level — show() queues the first DMA via spi_device_queue_trans (ISR-driven) and returns; poll()/advancePipeline() drive chunk encode/queue overlap and completion, non-blocking (C6 uses split polling per its errata). Wire-verified byte-exact on WROOM COM11: {driver: SPI, passed: true, 4/4 patterns, 10 LEDs}. What remains for this issue is exactly its stated scope — the ISR-chunked ring-buffer streaming conversion to cut peak buffer memory on 1000+-LED clocked strips — which needs the S3 bench + memory profiling per the acceptance list. No change to that scope from #3573.
zackees commentedon Aug 20, 2026
Burn-down disposition: DEFER ? the requested true-SPI memory conversion is not implemented and requires an architecture change plus unavailable S3 hardware.
Current-state evidence:
SPISingleESP32true-SPI backend (spi_hw_1_esp32.cpp.hpp) still allocates aDMABuffer(total_size)for the full APA102/SK9822 frame, setsqueue_size = 1, queues one transaction, and releases the buffer only after completion.SpiChannelEngineAdapter::transmitBatch()acquires/copies the whole encoded channel and then synchronously callswaitComplete(1000). It has no chunk feeder, ISR refill state, orchannel_poll_signalcompletion path.ChannelEngineSpiand PR feat(spi,esp32): pre-queue alternate-buffer SPI chunk for >680-LED strips (refs #2304) #2810 are for clockless WS281x-over-SPI, explicitly not true SPI. They cannot be used as proof for this issue's 1000-LED APA102 acceptance.Restart criteria:
SpiHw1interface grows streaming primitives or whether ESP32 gets a dedicated true-SPI channel driver; preserve the existing adapters on other platforms.poll()genuinely async and ensure the source lifetime is retained until final completion.The existing clockless ping-pong and LCD_SPI implementations are useful references, but they do not satisfy this true-SPI issue.