esp-idf/components/sdmmc
Ivan Grokhotkov 47ba4d639a
fix(sdmmc): use correct argument for ACMD41 in SPI mode
ACMD41 argument is different between SD mode and SPI mode.
In SPI mode, the only non-zero bit may be the HCS bit. Unlike the SD
mode, the bits reflecting the host's OCR should be zero.
Previously, we used to set these bits the same way as for the SD mode.
This has caused certain cards to fail initializing, apparently their
controllers have checked the ACMD41 argument more strictly and refused
to finish initialization, resulting in an error such as

    sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107

(Note that this error may have other causes than the one fixed in
this commit. For example, if the card doesn't have a sufficient and
stable power supply, it may also fail to complete the internal
initialization process, and will never clear the busy flag in R1
response.)

Closes https://github.com/espressif/esp-idf/issues/6686
Closes https://github.com/espressif/esp-idf/issues/10542
2024-02-28 09:33:23 +01:00
..
include feat(sdio): add sdio over sdmmc support for esp32p4 2024-01-14 01:05:00 +08:00
CMakeLists.txt feat(sdmmc): use ldo as power supply on esp32p4 2024-01-04 15:34:59 +08:00
README.md feat(sd): added readme for dependency among SD host related components 2023-11-20 12:30:03 +08:00
sdmmc_cmd.c refactor: Remove -Wno-format from storage related components 2023-10-22 17:56:41 +00:00
sdmmc_common.c fix(sdmmc): use correct argument for ACMD41 in SPI mode 2024-02-28 09:33:23 +01:00
sdmmc_common.h feat(sdio): add sdio over sdmmc support for esp32p4 2024-01-14 01:05:00 +08:00
sdmmc_init.c feat(sdio): add sdio over sdmmc support for esp32p4 2024-01-14 01:05:00 +08:00
sdmmc_io.c feat(sdio): add sdio over sdmmc support for esp32p4 2024-01-14 01:05:00 +08:00
sdmmc_mmc.c refactor: Remove -Wno-format from storage related components 2023-10-22 17:56:41 +00:00
sdmmc_sd.c feat(sdmmc): use ldo as power supply on esp32p4 2024-01-04 15:34:59 +08:00

SDMMC Protocol Layer Driver

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, sdmmc APIs 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 the sdmmc protocol interfaces.
  • esp_driver_sdspi: SDSPI Host driver for ESP GPSPI hardware, it implements the sdmmc protocol interfaces.

Dependency

  • esp_driver_sdmmc is in driver layer (G2), it relies on sdmmc
  • esp_driver_sdspi is in driver layer (G2), it relies on sdmmc
  • sdmmc does not and should not rely on esp_driver_sdmmc or esp_driver_sdspi. Though sdmmc is independent, it still stays in G2.