Skip to content

ESP32-P4 PARLIO: per-frame TX reinstall can fail during HTTP uploads; PSRAM DMA capability check excludes PSRAM #5491

Done

Description

@MariusVB

Thanks for maintaining FastLED! We reproduced this on 3.10.8 and inspected the corresponding paths in 3.10.10. We have not run 3.10.10 on hardware.

Environment and reproduction

  • ESP32-P4 rev 3.1, Arduino-ESP32 3.3.9 / ESP-IDF 5.5.4.
  • 16 WS2815 lanes, 384 LEDs/lane, 25 fps; configured timing 250/625/375 ns with a 280 µs reset, selecting Wave3.
  • Both PARLIO ring-cap flags set to 196,608 bytes; maximum LEDs/channel set to 496.
  • An HTTP server receives a roughly 12 MB upload while FastLED.show() continues running with unchanged pins and timing.

Observed on 3.10.8:

gdma-link: gdma_new_link_list(97): no mem for link list items
parlio: parlio_tx_unit_init_dma(193): create DMA link list failed
parlio: parlio_new_tx_unit(326): install tx DMA failed

Afterward, calls to show() return without updating the LEDs, which remain frozen until reboot.

Source findings

FastLED filenames below are under src/platforms/esp/32/drivers/parlio/; line numbers refer to 3.10.10 unless stated otherwise.

  1. TX teardown/reinstall on every frame. channel_driver_parlio.cpp.hpp:394 calls initialize() for each transmission. Even when config_matches is true, parlio_engine.cpp.hpp:1442-1477 deinitializes and recreates the TX unit. The wrapper calls IDF's parlio_del_tx_unit() and parlio_new_tx_unit() at parlio_peripheral_esp.cpp.hpp:257,206. This repeatedly reallocates internal DMA descriptors while HTTP/network allocations compete for that memory. The corresponding 3.10.8 engine branch is at lines 1394-1428.

  2. The PSRAM probe/allocation cannot match a P4 heap with these caps. parlio_engine.cpp.hpp:74 and parlio_peripheral_esp.cpp.hpp:429-441 request MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA. In IDF 5.5.4, components/heap/port/esp32p4/memory_layout.c:45-68, the PSRAM type lacks MALLOC_CAP_DMA. Consequently, FastLED selects internal DMA memory instead. This is also present in 3.10.8.

    P4 PARLIO supports external-memory DMA: IDF components/esp_driver_parlio/src/parlio_tx.c:175-180. Its transmit path checks alignment and already calls esp_cache_msync(C2M | UNALIGNED) at lines 685-698.

  3. Failed-reinstall recovery can retain the old ring while allocating another. At parlio_engine.cpp.hpp:1463-1466, a failed reinstall clears mInitialized without releasing mRingBuffer. The next attempt skips the initialized-only cleanup at lines 1481-1488 and reaches another allocation at lines 1633-1646. This can prevent recovery when there is insufficient room for both rings. The reset at line 1420 is for a length increase, not a failed TX reinstall. The same ownership problem exists in 3.10.8 at lines 1414-1417,1432-1439,1591-1604. The persistent freeze was observed on 3.10.8; recovery behavior on 3.10.10 is source analysis only.

Measurements and existing improvement

With our settings, 3.10.8 allocated 3 × 55,616 = 166,848 bytes, although this frame uses only one buffer. 3.10.10 already fixes that waste through sizeRingBuffers() / ringBufferCount() and allocation of only the required slots (parlio_engine.cpp.hpp:1158-1166,1218-1221; parlio_buffer_calc.h:247-268).

On locally patched 3.10.8, moving the original waveform allocations to PSRAM increased internal DMA free immediately after the first show from 50,376 to 217,280 bytes. With one waveform buffer and an additional application-only change moving 74,400 bytes of non-DMA UDP buffers to PSRAM, it reached 291,652 bytes. The latter number includes that separate application change.

Suggested fix

  • Retain the TX unit for unchanged configuration, preserving the existing drain/disable/enable sequence. Account for actual pin values, reset timing and any shared-pin rerouting requirements.
  • On P4, probe/allocate PSRAM without MALLOC_CAP_DMA, retaining cache-line alignment and IDF's alignment/cache-sync requirements.
  • Reuse or safely release a stale ring before allocating its replacement during recovery.

We patch these paths locally. The patch has run on hardware through three 11,980,816-byte uploads during playback, another upload with different source dimensions, and a flash-default switch: no PARLIO/GDMA errors or reboot, with playback counters advancing at approximately 25 fps. Upload-time show() latency still has spikes, so this is not a claim of constant frame-call latency.

Activity

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

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions