Skip to content

fix(esp32): honor chipset reset timing in RMT4 and I2S channel drivers #3932

Closed

Description

@zackees

Problem

The current ESP32 alternate clockless channel drivers do not consistently honor each chipset's configured reset/latch interval (ChipsetTimingConfig::reset_us). That can make consecutive frames invalid for chipsets whose required low interval exceeds the driver's fixed or implicit tail.

This was found while reviewing #1049's claim that every backend enforces its chipset latch time. I searched open FastLED issues and PRs for reset_us RMT4 I2S; no existing tracker covers this gap.

Current source evidence

ESP-IDF 4 RMT backend

  • ClocklessIdf4<..., WAIT_TIME> accepts the legacy reset-time template argument, but only constructs ChannelData from makeTimingConfig<TIMING>(); WAIT_TIME is otherwise unused (src/platforms/esp/32/drivers/rmt/rmt_4/idf4_clockless_rmt_esp32.h).
  • ChannelEngineRMT4Impl::ChannelState retains only the zero/one bit symbols, not timing.reset_us (channel_driver_rmt4.h).
  • Once pixel bytes are exhausted, fillNextBuffer() writes rmt_item32_t::val = 0, which is an end marker rather than a duration derived from the chipset reset interval (channel_driver_rmt4.h, around the refill loop).
  • The TX-done ISR sets transmissionComplete; poll() then clears ChannelData::inUse, releases the channel, and can return READY immediately (channel_driver_rmt4.cpp.hpp).

ESP32-S3 LCD_CAM/I2S backend

  • ChipsetGroup retains mTiming, including reset_us, but Wave8 buffer sizing uses a fixed reset_words = 64 with the comment ~50us reset at typical clock (src/platforms/esp/32/drivers/i2s/channel_driver_i2s.cpp.hpp).
  • The default pixel clock is 2.4 MHz, so the encoded low tail is fixed by clock/buffer math rather than by mTiming.reset_us (channel_driver_i2s.h).
  • The buffer tail is zero-filled, and poll() reports READY when DMA completes. Chipsets in the timing traits currently include reset intervals up to 300 us, so a fixed approximately-50-us tail is not a general implementation of the timing contract.

Impact

Back-to-back FastLED.show() calls can begin before the chipset's required low reset/latch interval has elapsed on these selectable backends. Symptoms can include ignored frames, partial updates, wrong pixels, or a user-observed need for an arbitrary FastLED.delay() between frames. The behavior depends on backend and chipset despite the common channel timing API.

Proposed fix

  1. Preserve the effective reset interval in each active transmission/channel state.
  2. For RMT4, emit or otherwise enforce a continuous LOW interval of at least reset_us after the final data bit before the channel becomes reusable/READY.
  3. For LCD_CAM/I2S, calculate the zero-tail word count from reset_us and the actual peripheral clock, including rounding up, instead of using a fixed 64 words.
  4. Define how the legacy WAIT_TIME template parameter combines with timing traits (for example, use the larger effective value) so compatibility arguments are not silently ignored.

Acceptance criteria

  • RMT4 does not report READY or permit the next frame until the effective chipset reset interval has elapsed LOW.
  • ESP32-S3 LCD_CAM/I2S derives its LOW tail from ChipsetTimingConfig::reset_us and the configured pixel clock.
  • Focused tests cover at least two reset intervals, including one greater than 50 us, and verify rounding never shortens the requested interval.
  • Tests cover the legacy WAIT_TIME interaction or document/remove it explicitly without an API break.
  • Relevant ESP32 RMT4 and ESP32-S3 I2S configurations compile.

Decisions made while filing

  • Treat this as one issue because both failures violate the same channel timing contract and the shared regression coverage should specify identical READY semantics.
  • Treat exact timing as a driver responsibility rather than recommending an application-level fixed delay.

Activity

  1. added
    status: in-progress
    type: bug
    priority: high
    platform: esp32
    area: drivers
    on Aug 20, 2026
  2. moved this from Triage to Done in FastLED Trackeron Aug 20, 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

    area: driversplatform: esp32priority: highstatus: in-progresstype: bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions