mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
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
| Supported Targets | ESP32 | ESP32-P4 | ESP32-S3 |
|---|
SDMMC Protocol Layer Driver
SD Host Side Related Component Architecture
Architecture Graph
┌─────────────────────────────────────────────┐
│ │
│ SD Protocol Layer Driver: components/sdmmc │
│ │
└──────────▲────────────────────▲─────────────┘
│ │
│ │
Implements │ │ Implements
│ │
┌──────────────────────────────────┴─────┐ ┌────┴───────────────────────────────────┐
│ │ │ │
│Host Driver: components/esp_driver_sdmmc│ │Host Driver: components/esp_driver_sdspi│
│ │ │ │
└────────────────────────────────────────┘ └────────────────────────────────────────┘
Components
sdmmc: SD protocol layer driver, it provides SD protocol related definitions and interfaces. With corresponding implementation drivers,sdmmcAPIs can help you:- send commands to slave devices
- send and receive data
- handle error conditions within the bus
esp_driver_sdmmc: SDMMC Host driver for ESP SDMMC hardware, it implements thesdmmcprotocol interfaces.esp_driver_sdspi: SDSPI Host driver for ESP GPSPI hardware, it implements thesdmmcprotocol interfaces.
Dependency
esp_driver_sdmmcis in driver layer (G2), it relies onsdmmcesp_driver_sdspiis in driver layer (G2), it relies onsdmmcsdmmcdoes not and should not rely onesp_driver_sdmmcoresp_driver_sdspi. Thoughsdmmcis independent, it still stays in G2.
Configuration Options
CONFIG_SD_ENABLE_SDIO_SUPPORT
This configuration option allows you to enable/disable SDIO support. By default this option is enabled.
Consider disabling SDIO support (CONFIG_SD_ENABLE_SDIO_SUPPORT=n) when card is Memory-only card and not when Combo cards which provide both I/O functionality and memory storage.