-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
my SD/MMC no longer works from version 5.0 (IDFGH-11818) #12912
Comments
Hi, thank you for the report. DRESULT ff_sdmmc_ioctl (BYTE pdrv, BYTE cmd, void* buff)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
switch(cmd) {
case CTRL_SYNC:
return RES_OK;
case GET_SECTOR_COUNT:
*((DWORD*) buff) = card->csd.capacity;
return RES_OK;
case GET_SECTOR_SIZE:
*((WORD*) buff) = card->csd.sector_size;
return RES_OK;
case GET_BLOCK_SIZE:
return RES_ERROR;
#if FF_USE_TRIM
case CTRL_TRIM:
if (sdmmc_can_trim(card) != ESP_OK) {
return RES_PARERR;
}
return ff_sdmmc_trim (pdrv, *((DWORD*)buff), //start_sector
(*((DWORD*)buff + 1) - *((DWORD*)buff) + 1)); //sector_count
#endif //FF_USE_TRIM
}
return RES_ERROR;
} |
I've now tested it with two SDs that didn't work before and both work now. |
I've now tested with a second ESP32-CAM and a third SD that didn't work before and now it works as expected ^^ |
Thank you! |
@SybexX - closing the task. Feel free to reopen if the issue appears again. Thank you |
Reopening, there is a code fix ready for merging so this task cannot yet be closed. My bad, sorry |
Answers checklist.
IDF version.
[email protected]
Espressif SoC revision.
ESP32-S
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
AI Thinker ESP32-CAM
Power Supply used.
USB
What is the expected behavior?
older SDs without ATA-TRIM support do not work
What is the actual behavior?
SD initialization is aborted
Steps to reproduce.
Using an older SD card
Debug Logs.
No response
More Information.
As of version 5.0, FF_USE_TRIM was set from 0 to 1 and since then my card has not been recognized.
This is because it does not support ATA-TRIM^^
You have added a function esp_err_t sdmmc_can_trim(sdmmc_card_t* card) for this, but it has no effect.
I searched for the error overnight and found a solution for it.
After I modified the files as follows, everything works as it should again:
fatfs/diskio/diskio_sdmmc.c
DRESULT ff_sdmmc_ioctl (BYTE pdrv, BYTE cmd, void* buff), at lines 106 to 110 changed from:
to:
fatfs/src/ff.c
added:
static FRESULT remove_chain(FFOBJID* obj, DWORD clst, DWORD pclst), at lines 1437 to 1454 changed from:
to:
FRESULT f_mkfs(const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len), at lines 5946 to 5949 changed from:
to:
FRESULT f_mkfs(const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len), at lines 6175 to 6178 changed from:
to:
sdmmc/sdmmc_cmd.c
added:
esp_err_t sdmmc_can_trim(sdmmc_card_t* card), at lines 630 to 636 changed from:
to:
sdmmc/include/sdmmc_cmd.h
added:
The text was updated successfully, but these errors were encountered: