Repository navigation
Fix garbled I2S audio on the ESP32-P4 - #11875
Open
mikeysklar wants to merge 1 commit into
Open
mikeysklar wants to merge 1 commit into
mikeysklar wants to merge 1 commit into
Conversation
On the ESP32-P4 internal RAM is reached through the L1 cache. IDF writes the DMA buffer back right after the on_sent callback, but audiobusio fills the buffer later from a background callback, so the new samples can sit in the cache while the DMA plays the buffer's old contents. MP3 playback through I2SOut came out garbled. Write the buffer back after each fill. Only chips that cache internal RAM (SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE) compile it in. Measured on a Metro ESP32-P4 with an on-chip loopback (I2S1 RX reading the TX pins), slow.mp3, three runs: 0, 392, 0 stale blocks with the write-back on, off, on. Fixes adafruit#11873 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix garbled I2S audio on ESP32-P4 boards.
Why
The P4 caches internal RAM, so the DMA sometimes played old samples.
Fixes #11873
Tested
Pin loopback
I2S1 RX reading the TX pins while playing
slow.mp3, on a debug build with the write-back switchable.Not tested: other P4 boards.
AI assistance: Claude helped find and write this. I checked the fix by ear and with the loopback captures.
🤖 Generated with Claude Code