Skip to content

[codex] fix(esp32): honor chipset reset timing - #3937

Merged
zackees merged 1 commit into
masterfrom
fix/3932-esp32-reset-timing
Aug 20, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/3932-esp32-reset-timing

Conversation

@zackees

@zackees zackees commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • derive the ESP32-S3 LCD_CAM/I2S LOW reset tail from each chipset's reset_us and the actual pixel clock
  • keep ESP-IDF 4 RMT output connected idle-LOW until a synchronized, rollover-safe reset interval has elapsed
  • treat legacy WAIT_TIME as a lower bound, add overflow-safe DMA sizing, and verify the encoded tail is LOW

Root cause and impact

The alternate ESP32 channel drivers used fixed or implicit reset tails instead of the timing carried by ChipsetTimingConfig. Back-to-back frames could therefore start before slower chipsets had latched, causing ignored or corrupted updates. RMT completion was also shared between ISR and task code through volatile rather than an atomic.

Validation

  • PYTEST_ADDOPTS='-k esp32_rmt4_reset_timing' bash test --py
  • bash test channel_driver_i2s
  • bash lint
  • bash compile esp32dev_idf44 --examples Blink (linked firmware.elf/.bin; metadata query warned after the successful build)
  • ESP32-S3 forced LCD_CAM/I2S build produced fresh linked firmware artifacts
  • current IDF5 forced-RMT4 API incompatibilities are separately tracked and deferred in fix(esp32): repair or reject legacy RMT4 selection on IDF 5 #3936

Closes #3932

Summary by CodeRabbit

  • Bug Fixes

    • Improved ESP32 RMT4 timing so channels remain safely idle until the configured chipset reset interval elapses.
    • Preserved the RMT signal connection through transmission completion for more reliable output.
    • Improved legacy wait-time handling without shortening required reset timing.
    • Added safer I2S buffer sizing, including reset-tail data and overflow detection.
  • Tests

    • Added coverage for ESP32 RMT4 reset and latch timing.
    • Added I2S tests for buffer sizing, reset timing, overflow handling, and completion behavior.

@zackees
zackees merged commit 8da3c66 into master Aug 20, 2026
10 of 18 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 40fb9e01-e854-4df0-a71a-15cb344b8a5f

📥 Commits

Reviewing files that changed from the base of the PR and between ed2d80d and 912cedf.

📒 Files selected for processing (7)
  • ci/tests/test_esp32_rmt4_reset_timing.py
  • src/platforms/esp/32/drivers/i2s/channel_driver_i2s.cpp.hpp
  • src/platforms/esp/32/drivers/i2s/channel_driver_i2s.h
  • src/platforms/esp/32/drivers/rmt/rmt_4/channel_driver_rmt4.cpp.hpp
  • src/platforms/esp/32/drivers/rmt/rmt_4/channel_driver_rmt4.h
  • src/platforms/esp/32/drivers/rmt/rmt_4/idf4_clockless_rmt_esp32.h
  • tests/platforms/esp/32/drivers/i2s/channel_driver_i2s.cpp

📝 Walkthrough

Walkthrough

The ESP32 RMT4 driver now enforces chipset reset timing after transmission. The ESP32 I2S driver derives DMA reset tails from chipset timing and clock frequency. Tests cover rounding, overflow, completion state, and legacy WAIT_TIME behavior.

Changes

ESP32 reset timing

Layer / File(s) Summary
I2S reset-tail sizing and validation
src/platforms/esp/32/drivers/i2s/*, tests/platforms/esp/32/drivers/i2s/*
I2S buffer sizes now include reset-tail words calculated from reset_us and the pixel clock. Overflow checks reject invalid sizes. Tests cover rounding, zero tails, overflow, zero-filled tails, and completion.
RMT4 completion and reset wait
src/platforms/esp/32/drivers/rmt/rmt_4/*, ci/tests/test_esp32_rmt4_reset_timing.py
RMT4 uses atomic completion state, keeps the signal connected after TX completion, and holds the channel until the configured reset interval elapses. The legacy WAIT_TIME value can extend the trait reset duration. Regression tests verify these behaviors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ClocklessIdf4
  participant ChannelEngineRMT4Impl
  participant RMT4TxDoneHandler
  ClocklessIdf4->>ChannelEngineRMT4Impl: Start transmission with reset duration
  RMT4TxDoneHandler->>ChannelEngineRMT4Impl: Mark transmission complete
  ChannelEngineRMT4Impl->>ChannelEngineRMT4Impl: Poll until reset interval elapses
  ChannelEngineRMT4Impl->>ClocklessIdf4: Release channel and report ready
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3932-esp32-reset-timing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Aug 20, 2026
@zackees
zackees deleted the fix/3932-esp32-reset-timing branch August 21, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

1 participant