Skip to content

fix(i2s): retain active clockless frame after DMA timeout - #5482

Merged
zackees merged 1 commit into
masterfrom
fix/i2s-clockless-retain-active-frame
Nov 25, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/i2s-clockless-retain-active-frame

Conversation

@zackees

@zackees zackees commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #5356.

The classic ESP32 I2S clockless engine used to proceed after a failed DMA wait. A larger queued frame could release and reallocate the scratch buffer still used by DMA. Drop the queued frame if the wait times out and leave the active payload and driver state alone until normal completion.

The host regression reproduces the active-frame release and scratch-buffer allocation before the fix. It passes under ASan/UBSan after the fix and verifies that a later frame transmits successfully. Changed-file lint passed. Full host C++ and hosted classic ESP32 coverage are pending. The attached ESP32-C6 and LPC devices cannot exercise this peripheral.

Summary by CodeRabbit

  • Bug Fixes
    • Improved ESP32 I2S handling when a previous transmission is still active. If it does not finish within 500 ms, the new frame is not dispatched, preventing overlapping transmissions.
    • The pending channel remains available to be transmitted after the active frame completes.

@zackees zackees added the ci-full Run the complete release-equivalent CI matrix on this PR SHA label Nov 25, 2026
@github-actions github-actions Bot removed the ci-full Run the complete release-equivalent CI matrix on this PR SHA label Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review.

Walkthrough

When the 500 ms wait for an active DMA transmit fails, show() clears queued channels and returns without dispatching the queued frame. A regression test checks that the active frame remains in use and that the queued frame can transmit after completion.

Changes: ESP32 I2S timeout handling

Layer / File(s) Summary
Timeout handling and recovery
src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp.hpp, tests/unit/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp
show() now returns after clearing queued channels when the transmit wait fails. The test checks that the active frame remains in use, no buffer is allocated for the queued frame, and the queued frame transmits after completion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 64af2

On a DMA transmit timeout, the I2S engine now drops the queued frame instead of releasing the buffer the active transfer is still using. The change is small and has a regression test. No merge-blocking risk was identified, and the pending hardware and full host coverage runs should still complete.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(i2s): retain active clockless frame after DMA timeout" matches the main change. The summary and objectives describe the ESP32 I2S clockless engine dropping the queued frame when the DMA…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(i2s): retain active clockless frame after DMA timeout" matches the main change. The summary and objectives describe the ESP32 I2S clockless engine dropping the queued frame when the DMA wait times out, while leaving the active frame and buffer unchanged. The title names the fix, the component, and the timeout condition, so it describes the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 23d99f7 and 64af292.

Files selected for processing: 2

  • src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp.hpp
  • tests/unit/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Memory usage (this PR vs. its merge base)

Change in examples/Blink per target. The left number is this PR's image flash / attributed RAM in bytes; the colored delta is the change from the merge base (red ↑ is larger, green ↓ is smaller, Same is unchanged).

Target FLASH [bytes] RAM [bytes]
attiny85 2,460 (Same) 136 (Same)
esp32c3 322,844 (Same) 13,814 (Same)
esp32c6 351,430 (Same) 17,905 (Same)
esp32dev 285,591 ($\color{red}\uparrow$ 4) 18,767 (Same)
esp32s3 318,715 (Same) 22,519 (Same)
esp8266 264,603 (Same) 6,808 (Same)
nrf52840_dk 66,976 (Same) 19,468 (Same)
rp2040 102,004 (Same) 8,624 (Same)
stm32f103c8 21,676 (Same) 1,789 (Same)
teensy41 46,080 (Same) 21,738 (Same)
uno 3,644 (Same) 134 (Same)

@zackees
zackees added this pull request to the merge queue Nov 25, 2026
Merged via the queue into master with commit 6bf5d3b Nov 25, 2026
347 of 486 checks passed
@zackees
zackees deleted the fix/i2s-clockless-retain-active-frame branch November 25, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant