Skip to content

ESP32-S3 RMT5: first strip always gets a 4 KB DMA buffer (~7.7 KB more heap than 3.10.3), no opt-out #5161

Closed

Description

@bolkedebruin

Board / MCU

ESP32-S3 (ESP32-S3-DevKitC-1-N8 class module, 8 MB flash, no PSRAM)

LED Chipset

WS2812B, one strip of 12 LEDs on one pin

FastLED Version

3.10.9 (PlatformIO registry). The relevant code is unchanged on current master (channel_driver_rmt.cpp.hpp, see below).

Arduino / PlatformIO version

PlatformIO, pioarduino platform-espressif32 55.03.39: Arduino core 3.3.9 + ESP-IDF 5.5.4 (framework = arduino, espidf)

Operating System

macOS (build host)

Description

Upgrading from 3.10.3 to 3.10.9 costs our firmware about 7.7 KB of internal heap for a 12-LED strip (36 bytes of pixel data). On a board without PSRAM that is significant: the lowest free heap during our boot fell from about 60.7 KB to 51.4 KB, with no other change.

Measured with heap_caps_get_free_size(MALLOC_CAP_8BIT) around the FastLED calls:

Step Free heap change Allocated blocks
FastLED.addLeds<WS2812B, PIN, RGB>(leds, 12) -2.4 KB +7
first FastLED.show() -5.3 KB +25

No extra FreeRTOS task is created.

Most of the show() cost is the RMT DMA buffer. In ChannelDriverRmt (src/platforms/esp/32/drivers/rmt/rmt_5/channel_driver_rmt.cpp.hpp, about lines 774-836 in 3.10.9 and master), the first TX channel on the S3 always tries DMA when memMgr.isDMAAvailable() is true, with a fixed dma_mem_block_symbols = 1024. That is a 4 KB DMA-capable internal-RAM buffer whatever the strip length. For a short strip the non-DMA path (on-chip RMT memory, double buffer) would be enough and needs no heap.

There is no way to opt out:

Request: a way to keep the RMT5 driver off DMA, for example:

  • a build flag such as FASTLED_RMT5_USE_DMA=0, or a CFastLED setting; or
  • use DMA only when the encoded strip doesn't fit the on-chip RMT memory; or
  • size the DMA block to the data instead of always 1024 symbols.

The remaining ~3.7 KB (driver registry / channel manager / buffer pool) would also be worth a look for memory-constrained boards, but the DMA buffer is the main part.

Steps to reproduce

  1. ESP32-S3 without PSRAM, ESP-IDF 5.x, FastLED 3.10.9.
  2. FastLED.addLeds<WS2812B, PIN, RGB>(leds, 12); then FastLED.show();
  3. Log heap_caps_get_free_size(MALLOC_CAP_8BIT) before addLeds, after addLeds, and after the first show(). Compare with 3.10.3.

Minimal sketch

#include <FastLED.h>
#include <esp_heap_caps.h>

#define PIN 5
CRGB leds[12];

static void probe(const char* where) {
  Serial.printf("%s: free %u\n", where, (unsigned)heap_caps_get_free_size(MALLOC_CAP_8BIT));
}

void setup() {
  Serial.begin(115200);
  delay(1000);
  probe("before addLeds");
  FastLED.addLeds<WS2812B, PIN, RGB>(leds, 12);
  probe("after addLeds");
  fill_solid(leds, 12, CRGB::Red);
  FastLED.show();
  probe("after first show");
}

void loop() {}

(The numbers above come from our firmware, which makes the same calls; I haven't run this standalone sketch.)

Serial / debug output

From our firmware's heap probes (free / lowest since boot / largest free block / allocated blocks):

TEMP fastled: before begin   free 234104  min 229576  largest 172032  blk 91
TEMP fastled: after begin    free 231652  min 227124  largest 172032  blk 98
TEMP fastled: after flash    free 226328  min 221800  largest 172032  blk 123

("begin" = addLeds, "flash" = fill + show() + clear + show().)

Checklist

  • I have searched existing issues for duplicates
  • I have tested with the latest FastLED release or git master
  • I can reproduce this with a minimal sketch

Activity

  1. added
    sanitized
    on Nov 8, 2026
  2. zackees commented on Nov 8, 2026

    @zackees
    Member

    PR #5166 adds a build flag, -DFL_RMT5_USE_DMA=0. With it, every RMT TX channel stays on on-chip RMT memory and never allocates the 1024-symbol DMA block. The default is unchanged. Still open here:

    • The heap saving has not been measured on a device.
    • With DMA on, the DMA block is still a fixed 1024 symbols, not sized to the strip.
    • The other ~3.7 KB (driver registry, channel manager, buffer pool) is not addressed.
  3. zackees commented on Nov 9, 2026

    @zackees
    Member

    Second follow-up on this one: #5227 / #5228. The driver no longer takes the DMA channel automatically for short strips — if the encoded frame fits inside the DMA block (about 42 WS2812 RGB LEDs) it stays on the double-buffered on-chip RMT path, so a 12-LED strip no longer pays the 4 KB DMA block by default. FL_RMT5_USE_DMA=0 from #5166 still works as a firmware-wide override, and FL_RMT5_DMA_AUTO=0 restores the old always-DMA behaviour.

    Still open from the original report: the DMA block is a fixed 1024 symbols when DMA is used, and the ~3.7 KB driver registry / channel manager / buffer pool is untouched.

  4. zackees commented on Nov 9, 2026

    @zackees
    Member

    Verified resolved on master: PR #5228 / commit 453fee5 skips DMA automatically for short strips, and FL_RMT5_USE_DMA=0 provides an explicit opt-out. The current channel driver has the short-strip on-chip-memory selection path. Re-ran bash test rmt_5/channel_driver_rmt successfully (1/1 test target, including the short-strip regression). This is host regression evidence, not a new on-device heap measurement; no claim is made that all remaining channel-manager overhead disappeared.

  5. 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