Commit Graph
188 Commits
Author SHA1 Message Date
Adam Múdry a2b2b36a57 fix(sdmmc): back off between CMD13 polls while waiting for card to be ready
The loops waiting for the card to leave its busy state started their yield
backoff at 100 ms. A card is typically busy for a few milliseconds after a
write, so the backoff never fired and every write was followed by hundreds
of back-to-back CMD13 commands. Occupying the host controller like this
slows down unrelated work on both cores, not just the calling task.

Delay between polls instead, starting at CONFIG_SD_READY_POLL_PERIOD_START_US
(100 us) and doubling. Both the delay and the configured start period are
capped at one FreeRTOS tick period, where vTaskDelay() already yields and one
command per tick is not a storm. A typical wait now costs a handful of
commands instead of hundreds.

Applies to sdmmc_wait_for_idle(), sdmmc_init_sd_wait_data_ready() and
read_tuning_block().

Closes https://github.com/espressif/esp-idf/issues/19034
2026-09-07 19:40:19 +02:00
Adam Múdry 233fa3f948 fix(sdmmc): release aligned DMA buffer on card deinit 2026-08-31 14:14:22 +02:00
Adam Múdry 50b715d93f fix(sdmmc): BDL calculate sectors cast fix
Closes https://github.com/espressif/esp-idf/issues/18875
2026-07-21 15:03:07 +02:00
Adam Múdry d52b12fe11 fix(sdmmc): Add a better handling of devices accessing PSRAM through DMA
Closes https://github.com/espressif/esp-idf/issues/18412
2026-07-21 15:03:07 +02:00
Jiang Jiang Jian f298dd2110 Merge branch 'bugfix/sdmmc-ddr-response-buffer-leak_v6.0' into 'release/v6.0'
fix(sdmmc): free DMA response buffer on DDR mode switch failure (v6.0)

See merge request espressif/esp-idf!50886
2026-07-20 10:45:54 +08:00
sonika.rathi 849a342fe0 fix(sdmmc): free DMA response buffer on DDR mode switch failure 2026-07-17 10:47:47 +02:00
Adam Múdry 322f9d5c34 fix(sdmmc): sdmmc_cmd.c fixed error handling in certain if and switch statements 2026-07-13 11:46:18 +02:00
Adam Múdry 28e22036f6 fix(sdmmc): Handle nonsensical max freq correctly
Closes https://github.com/espressif/esp-idf/issues/15250
2026-07-01 12:38:45 +02:00
sonika.rathi 4f8408dca1 fix(storage): mark storage pytest apps flaky in CI 2026-05-21 15:41:09 +02:00
Martin Vychodil dddc72dae2 Merge branch 'contrib/github_pr_17642_v6.0' into 'release/v6.0'
feat(sdmmc): support multi-block read/writes (GitHub PR) (v6.0)

See merge request espressif/esp-idf!46776
2026-03-24 19:10:58 +08:00
igor.udot e2a8bbe639 ci: update build-test-rules to use common_components 2026-03-20 15:53:26 +08:00
Jiang Jiang Jian 9bf6972f2b Merge branch 'fix/sdmmc_sdspi_retry_crc_check_v6.0' into 'release/v6.0'
fix(sdspi): 0x106 error during SD card init via SPI related fixes (v6.0)

See merge request espressif/esp-idf!45691
2026-03-20 10:51:38 +08:00
Adam Múdry 5c17a125ad feat(sdmmc): Try to reallocate smaller DMA buffer if larger one failed 2026-03-19 13:48:57 +01:00
Adam Múdry 61034416bb fix(sdmmc): Multi-block read/writes support refactor + tests and documentation added 2026-03-19 13:48:57 +01:00
jofrevandAdam Múdry d9f8209588 feat(sdmmc): Add support for multi-block read/writes
This has the potential of speeding up SD card access significantly.

Reusing the DMA aligned buffer gives the additional option of having to
allocate the transaction buffer only once instead of for every
transaction, while still keeping the improved transaction time.

To give users the maximum amount of control, the Kconfig option for the
transaction buffer size applies only to the temporary buffer, which is
only allocated if the DMA aligned buffer has not been pre-allocated.

Closes https://github.com/espressif/esp-idf/pull/17642

Co-authored-by: Adam Múdry <adam.mudry@espressif.com>
2026-03-19 13:48:57 +01:00
Adam Múdry a4cec4355a fix(sdspi): 0x106 error during SD card init via SPI related fixes
Try to turn on CRC16 again if first failed, allow disabling of CRC check altogether

Releated https://github.com/espressif/esp-idf/issues/15450
2026-03-09 19:10:55 +01:00
armando fe5b8358f3 feat(hal):graudate the sdmmc/sdio_slave hal driver into a new component 2026-02-04 19:00:57 +08:00
morris db750dc1a0 feat(dma): graduate the dma driver from esp_hw_support to esp_driver_dma 2026-01-29 14:41:14 +08:00
Adam Múdry 6ab125fa16 fix(sdmmc): sdmmc_get_blockdev fix potential overflow before widen 2025-12-16 15:42:23 +01:00
Adam Múdry 3ba496c6b9 feat(storage): Add support for SDMMC BDL 2025-12-16 15:42:23 +01:00
C.S.M ed64e7bf78 ci(header_check): Add check for public header should not include freertos 2025-12-10 15:10:43 +08:00
Alexey Lapshin ad7f4b9670 feat(esp_libc): make picolibc default libc 2025-12-06 00:08:35 +07:00
Marius Vikhammer 484d2c5c2f fix(system): fixed issues with unused variable warnings when compiling with NDEBUG 2025-09-19 15:42:07 +08:00
Armando (Dou Yiwen) 4a383012b3 Merge branch 'feature/p4_rev3_sdmmc' into 'master'
sdmmc: supported sdmmc on p4 ECO5 real chip, and UHS-I SDR104 (200MHz)

Closes IDF-12222, IDF-13731, and IDF-14050

See merge request espressif/esp-idf!41563
2025-09-17 09:09:24 +00:00
sonika.rathi 4d91eac13f fix(sdmmc): Allow disabling SDIO specific steps in sdmmc card init 2025-09-16 22:24:10 +08:00
armando 28786d0732 feat(sdmmc): supported UHS-I SDR104 (200 MHz) on ESP32-P4 rev3 2025-09-16 12:03:03 +08:00
sonika.rathi c4a3c1fc5b fix(sdmmc): fix sdmmc initialization issue in caused by CMD52 CRC error 2025-06-24 13:48:38 +02:00
morris fb4b590941 refactor(dma)!: remove deprecated functions 2025-06-12 12:24:58 +08:00
armando c2b8ea07d0 feat(sd): supported UHS-I SDR104 200MHz speed 2025-05-15 10:57:45 +08:00
armando 402bf0ce58 feat(sd): sd host driver layer driver NG 2025-05-15 10:57:33 +08:00
Armando e8ad9b05aa refactor(sd): replace esp_dma_ with heap_caps_ 2025-01-20 10:54:59 +08:00
Armando (Dou Yiwen) ed8ec9de0b Merge branch 'feat/sdmmc_uhs_tuning' into 'master'
sdmmc: UHS-I support for SDR50 (100MHz, 50MB/s), DDR50 (50MHz, 50MB/s)

Closes IDF-10294, IDF-11447, and IDF-8886

See merge request espressif/esp-idf!34441
2024-11-13 11:05:10 +08:00
Armando 9e3b7e4558 feat(sdmmc): supported UHS-I SDR50 (100Mhz) and DDR50 mode 2024-11-13 09:47:45 +08:00
Adam Múdry b0ffe15514 fix(sdmmc): Fix ACMD22 DMA buffer problem for ESP32-P4 2024-11-12 14:55:19 +01:00
Ivan Grokhotkov c9bf5d9698 feat(sdmmc): support for voltage switching in protocol layer 2024-11-12 15:39:42 +08:00
Adam Múdry 6bf2d91c4d test(sdmmc): Add test_apps test for sdmmc component 2024-11-05 02:36:43 +01:00
Adam Múdry 9386b58e17 fix(sdmmc): Generalize waiting for card idle to a function 2024-11-05 02:36:42 +01:00
Adam Múdry 2c1bec2c70 fix(sdmmc): Send ACMD22 if CMD25 fails
Send the number of the written write blocks (ACMD22) after
write multiple blocks fails (CMD25)
2024-10-31 14:30:51 +01:00
Martin Vychodil 12398c0f25 Merge branch 'fix/sdmmc_write_sectors_dma_always_send_cmd13' into 'master'
fix(sdmmc): sdmmc_write_sectors_dma always check card status after write

Closes IDF-9632

See merge request espressif/esp-idf!34132
2024-10-21 20:35:33 +08:00
Adam Múdry 9c7609a0e7 fix(sdmmc): Send status (CMD13) even if write/read command fails 2024-10-17 00:58:48 +08:00
Adam Múdry 3f838d7843 fix(sdmmc): Improve SD card state checking after write/read command 2024-10-17 00:58:48 +08:00
Adam Múdry 72bbb8c857 fix(sdmmc): Retry to get another RCA if the previous response was 0 2024-10-14 03:25:55 +02:00
Ivan GrokhotkovandZhang Shu Xian 71fe7543f1 docs(sdmmc): update information about eMMC support
Related to https://esp32.com/viewtopic.php?f=13&t=41088

Co-authored-by: Zhang Shu Xian <zhangshuxian@espressif.com>
2024-09-10 09:14:54 +02:00
Steffen Beyer 93c67f16ab fix(sdmmc): typo in docs
Closes https://github.com/espressif/esp-idf/pull/14341
2024-08-09 13:45:27 +02:00
Adam Múdry cbf59b4c76 fix(sdmmc): Fix logically dead code in sdmmc_io_rw_extended 2024-07-18 17:28:01 +02:00
Michael (XIAO Xufeng) fded5b0ce3 fix(sdmmc_io): fixed fixed_addr mode will still increase addr when splitting 2024-06-29 02:30:20 +08:00
Alexey Lapshin 0815f6ab8c fix(sdmmc): fix warnings found by GNU static analyzer 2024-06-18 14:25:37 +08:00
Martin Vychodil c4ffee4b81 Merge branch 'feat/sdio_validate_hs_mode' into 'master'
feat(sdmmc): add high speed mode switch validation check for SDIO

See merge request espressif/esp-idf!30743
2024-06-12 15:38:44 +08:00
Ivan Grokhotkov 6ed7e93676 fix(sdmmc): fix invalid data when reading/writing PSRAM buffers
Previous commit has enabled buffers in PSRAM for ESP32-P4. But this
also caused a regression for ESP32-S3, where PSRAM is not DMA capable.
This commit re-introduces the check for esp_ptr_external_ram in case
SOC_SDMMC_PSRAM_DMA_CAPABLE is not set.
2024-06-05 13:12:03 +02:00
sonika.rathi 1af74c8a4a feat(sdmmc): add high speed mode switch validation check for SDIO 2024-05-31 09:14:36 +02:00