- Notifications
You must be signed in to change notification settings - Fork7.8k
feat(sd_mmc) Make UHS-I SDR the default for ESP-P4 SD_MMC#12038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
github-actionsbot commentedNov 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
👋Hello lbernstone, we appreciate your contribution to this project! 📘 Please review the project'sContributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
github-actionsbot commentedNov 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
github-actionsbot commentedNov 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Test Results 83 files 83 suites 26m 19s ⏱️ For more details on these failures, seethis check. Results for commit4716fc0. ♻️ This comment has been updated with latest results. |
lucasssvaz commentedNov 17, 2025
Please add a check for IDF versions greater than 5.3: https://github.com/espressif/arduino-esp32/actions/runs/19442524813/job/55629051409?pr=12038 |
Uh oh!
There was an error while loading.Please reload this page.
P-R-O-C-H-Y commentedNov 18, 2025
On P4 EV Board card is no longer mounting with the changes in PR. |
P-R-O-C-H-Y commentedNov 18, 2025
@lbernstone If I comment out the UHS-1 flag, the sdmmc starts working again and the speed is improved with the DDR flag only. |
TD-er commentedNov 18, 2025
@P-R-O-C-H-Y What kind of SD card do you have? |
P-R-O-C-H-Y commentedNov 18, 2025
Its a Kingston 16GB with USH-1 marking on it. |
P-R-O-C-H-Y commentedNov 18, 2025
Weird is, that the SD card is not working on the P4-EYE board I got. Even with/without the changes in this PR. |
TD-er commentedNov 18, 2025
Can you try to format it using some SD-format tool? |
P-R-O-C-H-Y commentedNov 18, 2025
The P4-eye have identical SD card schema as the P4-EV board. Will try with formatted card and also with different one. |
TD-er commentedNov 18, 2025
Maybe also try some SDHC/SDXC card? |
me-no-dev commentedNov 18, 2025
in all cases, we want to support more cards, not less. If these options make cards not work, we need to make them optional |
TD-er commentedNov 18, 2025
I'm not sure if SDHC uses DDR signalling. Looking here:https://www.sdcard.org/developers/sd-standard-overview/bus-speed-default-speed-high-speed-uhs-sd-express/ |
lbernstone commentedNov 18, 2025
I'll see if I can find some old cards around here and test an array of them. Not sure if I have really small & slow ones around any more. |
lbernstone commentedNov 18, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
P4-eye (waveshare) has BOARD_SDMMC_POWER_PIN on 46 |
TD-er commentedNov 18, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm I took another look at the source code of this PR and host.flags &= ~SDMMC_HOST_FLAG_DDR; looks like it is disabling DDR? If it is indeed increasing the transfer speed, then it sounds like a timing issue, or maybe some signal is inverted? |
TD-er commentedNov 18, 2025
Hmm these defines for sure would be a lot more clear with quite a bit more comments... #defineSDMMC_FREQ_DEFAULT20000/*!< SD/MMC Default speed (limited by clock divider)*/#defineSDMMC_FREQ_HIGHSPEED40000/*!< SD High speed (limited by clock divider)*/#defineSDMMC_FREQ_PROBING400/*!< SD/MMC probing speed*/#defineSDMMC_FREQ_52M52000/*!< MMC 52MHz speed*/#defineSDMMC_FREQ_26M26000/*!< MMC 26MHz speed*/#defineSDMMC_FREQ_DDR5050000/*!< MMC 50MHz speed*/#defineSDMMC_FREQ_SDR50100000/*!< MMC 100MHz speed*/#defineSDMMC_FREQ_SDR104200000/*!< MMC 200MHz speed*/ The names of those defines don't appear to match the frequency numbers. Then the most important change of this PR is setting the clock? |
lbernstone commentedNov 19, 2025
Yes, you should be able to force to lower rates by setting a lower frequency, and the PR as written sets SDR (by turning DDR off). But, I do think the process should be backwards compatible, such that if the fastest speed fails, it drops down to try to init at a rate that the card understands, like happens transparently on your PC. I just don't have the hardware available to code & test that. |
lbernstone commentedDec 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Ok, the dev board I got doesn't break out the SDIO pins, so I still have no way to test the old (standard SD) cards I have. Does anybody have old microsd cards and a working P4 that can test if the code as written fails back to lower rates automatically? Ideally, it needs to be tested on a non-UHS SDHC (eg 4GB), and then an old 64MB capacity card. |
TD-er commentedDec 5, 2025
That would be extremely hard to find, as I have never seen non-SDHC cards in the micro-SD ("TF") format. |
lbernstone commentedDec 6, 2025
The thing that really needs to be tested is if this works on a device that is not capable of 1V8 operation. |
Description of Change
SD_MMC driver had been updated to support UHS-I on ESP-P4, but didn't have the flags quite right. This updates the driver to use UHS SDR by default.
Test Scenarios
ESP32-P4-EYE reading a file off SD card. Speed is improved about 300%.
Related links
Shouldclose#12027