Skip to content

RMT5: DMA should be switched off automatically for short strips (#5161 follow-up) #5227

Closed

Description

@zackees

Follow-up to #5161. That issue reported that on an ESP32-S3 without PSRAM a 12-LED
strip costs ~7.7 KB more internal heap on 3.10.9 than on 3.10.3, because the first
RMT5 TX channel always takes the single DMA slot and with it a fixed 4 KB
DMA-capable internal-RAM block.

#5166 added a build-wide opt-out (-DFL_RMT5_USE_DMA=0). That helps, but it is a
compile-time decision for the whole firmware: an application with one 12-LED status
strip and one 300-LED main strip cannot keep DMA for the long strip and drop it for
the short one. The default is still "always DMA", so nothing changes for anyone who
does not know the flag exists.

Request

Turn DMA off automatically when the strip is short, so the default is the good
behaviour and the flag becomes an override rather than a requirement.

Proposed rule

The DMA channel only earns its 4 KB when the encoded frame is long enough to stream.
ESP-IDF's own documentation says rmt_tx_channel_config_t::mem_block_symbols
"controls the size of the internal DMA buffer ... you can set a larger value, e.g.,
1024" when DMA is enabled, and "the size of the dedicated memory block owned by the
channel" when it is not. So the natural cutoff is the block size itself: if the whole
frame fits in ~1024 symbols (one RMT symbol per encoded bit, so ~42 WS2812 RGB LEDs),
DMA cannot beat the double-buffered on-chip path, and taking it only spends heap and
ties up the one DMA channel the S3 has.

Resulting behaviour on ESP32-S3:

Strip Encoded symbols Backend
12 RGB LEDs 288 on-chip RMT memory (no 4 KB block)
42 RGB LEDs 1008 on-chip RMT memory
300 RGB LEDs 7200 DMA

Implemented in #5228

FL_RMT5_DMA_AUTO (default 1) applies the size rule; FL_RMT5_DMA_MIN_SYMBOLS
(default 1024) sets the cutoff; FL_RMT5_DMA_AUTO=0 restores "always DMA when the
hardware supports it", and FL_RMT5_USE_DMA=0 still forces non-DMA everywhere.
Host tests cover short strip, long strip and no-DMA-hardware.

Remaining gap from #5161 that this does not address: with DMA still enabled for long
strips the block stays a fixed 1024 symbols rather than being sized to the frame, and
the ~3.7 KB of driver registry / channel manager / buffer pool is untouched.

Activity

  1. added
    sanitized
    on Nov 9, 2026
  2. moved this from Triage to Done in FastLED Trackeron Nov 9, 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

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions