fix(sdio): bounce SDRAM-targeted reads through internal SRAM on H750#7318
Open
raphaelcoeffic wants to merge 1 commit intomainfrom
Open
fix(sdio): bounce SDRAM-targeted reads through internal SRAM on H750#7318raphaelcoeffic wants to merge 1 commit intomainfrom
raphaelcoeffic wants to merge 1 commit intomainfrom
Conversation
On STM32H750, DMA from SDMMC into SDRAM can cause FIFO overruns when the SDRAM controller can't keep up with the SDMMC receive rate. The disk cache fills go into internal SRAM so they're safe, but three paths bypass the cache and hand the caller's buffer (often an SDRAM heap allocation) directly to the DMA: - reads larger than DISK_CACHE_BLOCK_SECTORS (disk_cache.cpp:149) - reads near the end of the disk (disk_cache.cpp:156) - FatFs f_read multi-sector reads that exceed the block size Drop the SDRAM heap clause from _IS_DMA_BUFFER on STM32H7 so SDRAM buffers take the bounce path, and grow the bounce buffer to 8 KB (DISK_CACHE_BLOCK_SECTORS) on H7 to keep throughput reasonable for large reads. H7RS keeps the original behaviour — its SDRAM is fast enough not to trigger this.
Member
Author
|
@sneone can you please test with this if that improves anything? |
Contributor
Ok, I tested it and it works fine. I even changed the SD card clock to 50M and it still reads and writes to the SD card correctly (I only did a few dozen simple tests). I think it would be better to change the variable scratch to 32-byte alignment. |
Member
|
This should be able to merge in 2.11 branch, right? |
Member
|
I'll try to cherry-pick it in, will see how that goes. @raphaelcoeffic Don't forget to consider this from above
|
Member
|
I tried to cherry pick to 2.11, no conflicts |
Member
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.
On STM32H750, DMA from SDMMC into SDRAM can cause FIFO overruns when the SDRAM controller can't keep up with the SDMMC receive rate. The disk cache fills go into internal SRAM so they're safe, but three paths bypass the cache and hand the caller's buffer (often an SDRAM heap allocation) directly to the DMA:
Drop the SDRAM heap clause from _IS_DMA_BUFFER on STM32H7 so SDRAM buffers take the bounce path, and grow the bounce buffer to 8 KB (DISK_CACHE_BLOCK_SECTORS) on H7 to keep throughput reasonable for large reads. H7RS keeps the original behaviour — its SDRAM is fast enough not to trigger this.