Skip to content

feat(spi): convert ESP32 SPI driver from block-DMA to ISR-chunked wave8 streaming (refs #3177) #3179

Closed

Description

@zackees

Goal

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.
  • Signal channel_poll_signal (per feat: add ISR-backed channel poll wakeups #2992) on done.
  • Engine dispatch advertises streaming mode only when the transport-hint API selects it (or auto chooses it based on memory pressure).

Acceptance

Cross-references

Activity

  1. zackees commented on Jul 2, 2026

    @zackees
    MemberAuthor

    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.

  2. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    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:

    Restart criteria:

    1. 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.
    2. 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.
    3. Implement bounded DMA chunk buffers with queue/refill completion signaling; make poll() genuinely async and ensure the source lifetime is retained until final completion.
    4. 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.
    5. 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.

  3. added
    deferred
    on Aug 20, 2026
  4. moved this from Triage to Done in FastLED Trackeron Nov 3, 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

    deferred

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions