Skip to content

fix(i2s-spi): retain active frame after DMA timeout - #5481

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

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

Conversation

@zackees

@zackees zackees commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #5356.

When a second I2S SPI show times out waiting for the previous DMA transfer, drop the queued frame and preserve the active transfer. This prevents buffer growth in the next frame from deinitializing the peripheral while it is still moving data. Normal completion releases the active frame and the following show can transmit.

The host regression fails before the fix when a larger frame displaces the active frame. It passes after the fix and verifies recovery on the next show. The focused ASan/UBSan test and changed-file C++ lint passed. Full host C++ validation is running. The attached ESP32-C6 and LPC devices do not provide the classic ESP32 I2S SPI path.

Summary by CodeRabbit

  • Bug Fixes
    • When a display update reaches its wait limit while a transfer is still active, the ongoing transfer and active frame remain intact. Further updates do not replace or interrupt the active frame, and a later update can transmit the next frame after the transfer completes.
  • Tests
    • Added coverage for active transfers, queued frames, and sending the next frame after completion.

@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 DMA remains active after show() reaches its wait limit, the driver now drops queued channels and returns without releasing the active transmission. A unit test checks frame ownership during this state and verifies that a later frame transmits after completion.

Changes: I2S SPI transmission handling

Layer / File(s) Summary
Timeout handling and frame ownership
src/platforms/esp/32/drivers/i2s_spi/channel_driver_i2s_spi.cpp.hpp, tests/unit/platforms/esp/32/drivers/i2s_spi/channel_driver_i2s_spi.cpp
If DMA remains active after the wait limit, show() drops queued channels and returns without clearing the busy state or releasing the transmitting channels. The test checks that the active frame remains in use, the queued frame is not acquired, and a later show() transmits a frame after polling observes completion.

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

Change: Bug fix

Merge Risk: Minimal · up to ec8c0

When a second show() times out while DMA is still transmitting, the driver now keeps the active frame and drops the queued one, so a larger next frame can no longer displace the active frame mid-transmission. The unit test covers retention, release on completion, and transmission of the next frame. No merge-blocking risk is identified.

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 names the main change: when a second show() times out waiting on an active DMA transfer, the active frame is retained and the queued frame is dropped. The raw summary confirms the driver cha…
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 names the main change: when a second show() times out waiting on an active DMA transfer, the active frame is retained and the queued frame is dropped. The raw summary confirms the driver change in show() and the added unit test for retaining the active frame. The title is specific and matches the changeset, so it passes.

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 ec8c0d0.

Files selected for processing: 2

  • src/platforms/esp/32/drivers/i2s_spi/channel_driver_i2s_spi.cpp.hpp
  • tests/unit/platforms/esp/32/drivers/i2s_spi/channel_driver_i2s_spi.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,587 (Same) 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 dd644d6 Nov 25, 2026
346 of 484 checks passed
@zackees
zackees deleted the fix/i2s-spi-retain-active-frame branch November 25, 2026 15:36
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Nov 25, 2026
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.

1 participant