Commit Graph

9 Commits

Author SHA1 Message Date
Adam Múdry
381d0fe032 sdmmc: add vTaskDelay to loops to prevent potential WDT trigger
Also change timeout to 120 seconds in fatfs sdcard pytest to prevent failing during formatting.
2023-04-11 11:06:56 +00:00
Chip Weinberger
74d6215b7f [SDMMC] add reasonable timeouts to all while loops
Closes: https://github.com/espressif/esp-idf/pull/10532
2023-04-11 11:06:56 +00:00
Martin Vychodil
56f2001317 sdmmc/sdspi: allow custom setup of SD card frequency
In order to allow flexible setup of SD card frequency, sdmmc_host_t.max_freq_khz is used as a limit

Closes https://github.com/espressif/arduino-esp32/issues/6225
2022-09-12 17:08:36 +02:00
Ivan Grokhotkov
79659e3096
sdmmc: better calculation of erase timeout
Previous version of the code used a fixed constant (500 ms) for the
erase timeout and added 1 ms for each sector erased.
This commit improves timeouts calculation:
- For SD cards, check if erase timeout information is present in the
  SSR register. If yes, use it for erase timeout calculation.
  Otherwise assume 250ms per erase block, same as Linux does.
- For eMMC assume 250ms per erase block (but no less than 1 second).
  This has to be improved later to use the erase timeout info in the
  extended CSD register.
2022-05-30 15:39:02 +02:00
Ivan Grokhotkov
da47bebdd8
sdmmc: sdmmc_init_sd_ssr: use correct command name
Numerical value of MMC_SEND_STATUS is the same as SD_APP_SD_STATUS,
so there is no functional change. Just making this consistent with the
sdmmc_send_app_cmd call later on.
2022-05-30 15:39:01 +02:00
Vamshi Gajjela
ffdbeee9f6 sdmmc: Add erase command-38. Support erase/trim/discard/sanitize
options.

Erase command (38) for SD cards allows option for erase/dicard/fule
operation at block level and for MMC cards supports option for
discard/trim at block level. When Sanitize is executed only the
portion of data that was unmapped by a Discard command shall be
removed by the Sanitize command.

Unit test cases added to verify ERASE feature in SD/SDSPI mode.
TRIM/DISCARD/SANITIZE tests for eMMC devices.

Closes https://github.com/espressif/esp-idf/pull/7635
Closes https://github.com/espressif/esp-idf/issues/7623
2022-03-05 16:02:01 +05:30
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Michael (XIAO Xufeng)
279ee85305 sdmmc: fix the probe issue that forbid sdspi working in highspeed mode
SD cards don't support CMD7 (select_card) in SPI mode. Highspeed probe
of sdspi will fail in this step and stop working in highspeed mode.
Remove the CMD7 in enable_hs_mode_and_check to fix this issue.

Please note that, on ESP32, you have to use the IOMUX pins to use sdspi
in 40MHz, otherwise the initialization process will report reading issue
and fail.
2020-06-30 17:34:13 +08:00
Ivan Grokhotkov
de42d99b1d sdmmc: command layer refactoring 2018-08-30 13:11:54 +08:00