Repository navigation
Description
Problem
I'm working on a project that requires tight timing and takes advantage of the ESP32-S3 dual core setup to ensure servicing the timing-critical components is not impacted by LED rendering and communication. In the current ChannelDriverLcdClockless::ensureWorkerTask() code, fl_lcd_clk starts with xTaskCreate() at priority configMAX_PRIORITIES - 2. This results in priority 23 based on the default priority 25, which is the same level as the Wi-Fi driver. The scheduler can then run it on either core, and it preempts everything below 23 on that core.
My app currently splits the cores as follows:
-loop() on Core 1 renders and calls FastLED.show();
-a network task on Core 0 (priority 5) handles an Ethernet controller and a latency-sensitive input path that needs each pass to finish within 5 ms.
With six WS2812B strips (170 LEDs each) on LCD_CLOCKLESS, FastLED 3.10.8, Arduino-ESP32 3.3.12 / ESP-IDF 5.5.5, our worst network-task pass went from 4.8 ms to 39 ms. With the worker pinned to Core 1 (one-line change below) it's back to 4.7 ms, and the LEDs still update cleanly (show() ≈ 8 ms for the frame).
ESP-IDF can't move a task to another core after it's created, and the task is created without a Core argument inside the driver, so an application has no way to fix this from outside without patching the library.
Proposed solution
Allow the user to specify core and priority, and potentially default to the same core as show():
- provide a build-time option, e.g.
FASTLED_ESP32_LCD_WORKER_CORE(and maybeFASTLED_ESP32_LCD_WORKER_PRIORITY), passed toxTaskCreatePinnedToCore()inensureWorkerTask().tskNO_AFFINITYkeeps today's behavior. - default the core for the worker to the core that calls
show(), since that's the core the application has chosen for LED work.
I've currently patched the driver as follows:
BaseType_t ok = xTaskCreatePinnedToCore(workerTaskEntry, "fl_lcd_clk",
4096, this, priority, &handle, 1);
The same request may apply to other drivers that start worker tasks (e.g., the I2S/LCD_CAM and PARLIO engines), if they create them the same way.
Alternatives considered
- Lowering the task's priority after FastLED creates it (
vTaskPrioritySet): it stays unpinned, and a low priority risks DMA ring underruns, which show as glitches. - Patching the source at build time: what's implemented now (a PlatformIO pre-build script that swaps the one call and stops the build if the code changes), but it's fragile across releases.
- The RMT driver instead: on the S3 it can't drive six strips in parallel (four TX channels), and 3.10.8's RMT5 engine leaks on channel reconfiguration (see the existing memory-leak issue #4993).
Platform relevance
ESP32
Additional context
Time data is from an ESP32-S3 (N16R8) with a W5500 Ethernet controller on Core 0 and six WS2812B strips on GPIO 1–6.
Happy to test or provide other details that might be helpful. Also willing to attempt a pull request, though it would be my first time.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
perf(channels): keep default worker policy lightweight
fix(channels): clear failed-start worker chunk diagnostics
fix(esp32): configurable LCD worker affinity and sustained streaming (#…
zackees commentedon Nov 3, 2026
still need a priority argument
zackees commentedon Nov 21, 2026
Both parts of this are on master:
xTaskCreatePinnedToCore. The core comes fromChannelConfig::options.mWorker.core(fl::Core::Core0/Core1/CallingCore/Any). The default (Auto) keeps the old unpinned behavior.options.mWorker.prioritywith named policies (fl::Priority::High, the default, at networking priority;Mediumbelow networking;Low). feat(channels): add generic engine worker core and priority macros #5054 adds build-wide defaults:-DFL_ENGINE_WORKER_CORE=fl::Core::Core1and-DFL_ENGINE_WORKER_PRIORITY=fl::Priority::Medium.So your pre-build patch can become
-DFL_ENGINE_WORKER_CORE=fl::Core::Core1(orfl::Core::CallingCoreto followshow()). Seesrc/fl/channels/README.mdfor the per-channel form.Scope note: these settings currently apply only to the LCD/I2S clockless engine. PARLIO and the other engines still use their own task setup. If you need the same control there, please open a new issue.