doc(sdmmc): doc(sdmmc): updated sdmmc programming guide for esp32p4

This commit is contained in:
Armando 2023-11-21 12:11:45 +08:00
parent 77299842ed
commit f893750bb6
5 changed files with 35 additions and 38 deletions

13
docs/_static/diagrams/sd/sd_arch.diag vendored Normal file
View File

@ -0,0 +1,13 @@
blockdiag sd_arch {
default_fontsize = 16;
node_width = 300;
node_height = 100;
span_width = 150;
A [label = "SD Protocol Layer Driver Component:\nsdmmc"]
B [label = "Host Driver Component:\nesp_driver_sdmmc"]
C [label = "Host Driver Component:\nesp_driver_sdspi"]
A -> B [dir = back, label = "Implements", style = dashed, hstyle = generalization, fontsize=14]
A -> C [dir = back, label = "Implements", style = dashed, hstyle = generalization, fontsize=14]
}

BIN
docs/_static/diagrams/sd/sd_arch.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -73,7 +73,6 @@ api-reference/storage/fatfs.rst
api-reference/storage/nvs_partition_gen.rst
api-reference/storage/nvs_flash.rst
api-reference/storage/partition.rst
api-reference/storage/sdmmc.rst
api-reference/storage/mass_mfg.rst
api-reference/storage/fatfsgen.rst
api-reference/storage/index.rst
@ -111,7 +110,6 @@ api-reference/peripherals/i2c.rst
api-reference/peripherals/dedic_gpio.rst
api-reference/peripherals/sd_pullup_requirements.rst
api-reference/peripherals/index.rst
api-reference/peripherals/sdmmc_host.rst
api-reference/peripherals/uart.rst
api-reference/kconfig.rst
api-reference/network/esp_openthread.rst

View File

@ -67,10 +67,15 @@ Overview
Pins used by Slot 0 (``HS1_*``) are also used to connect the SPI flash chip in ESP32-WROOM and ESP32-WROVER modules. These pins cannot be concurrently shared between an SD card and an SPI flash. If you need to use Slot 0, establish an alternative connection for the SPI flash using different pins and configure the necessary eFuses accordingly.
.. only:: SOC_SDMMC_USE_GPIO_MATRIX
.. only:: esp32s3
Both slots :c:macro:`SDMMC_HOST_SLOT_0` and :c:macro:`SDMMC_HOST_SLOT_1` support 1-, 4- and 8-line SD interfaces. The slots are connected to {IDF_TARGET_NAME} GPIOs using the GPIO matrix. This means that any GPIO may be used for each of the SD card signals.
.. only:: esp32p4
- :c:macro:`SDMMC_HOST_SLOT_1` is routed via GPIO Matrix. This means that any GPIO may be used for each of the SD card signals. It is for non UHS-I usage.
- :c:macro:`SDMMC_HOST_SLOT_0` is dedicated to UHS-I mode, which is not yet supported in the driver.
Supported Speed Modes
---------------------

View File

@ -6,47 +6,28 @@ SD/SDIO/MMC Driver
Overview
--------
The SD/SDIO/MMC driver currently supports SD memory, SDIO cards, and eMMC chips. This is a protocol level driver built on top of SDMMC and SD SPI host drivers.
The SD/SDIO/MMC driver currently supports SD memory, SDIO cards, and eMMC chips. This is a protocol layer driver (:component_file:`sdmmc/include/sdmmc_cmd.h`) which can be implemented by:
SDMMC and SD SPI host drivers (:component_file:`esp_driver_sdmmc/include/driver/sdmmc_host.h` and :component_file:`esp_driver_sdspi/include/driver/sdspi_host.h`) provide API functions for:
.. list::
:SOC_SDMMC_HOST_SUPPORTED: - SDMMC host driver (:component_file:`esp_driver_sdmmc/include/driver/sdmmc_host.h`), see :doc:`SDMMC Host API <../peripherals/sdmmc_host>` for more details.
- SDSPI host driver (:component_file:`esp_driver_sdspi/include/driver/sdspi_host.h`), see :doc:`SD SPI Host API <../peripherals/sdspi_host>` for more details.
Protocol Layer vs Host Layer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SDMMC protocol layer described in this document handles the specifics of the SD protocol, such as the card initialization flow and variours data transfer command flows. The protocol layer works with the host via the :cpp:class:`sdmmc_host_t` structure. This structure contains pointers to various functions of the host.
Host layer driver(s) implement the protocol layer driver by supporting these functions:
- Sending commands to slave devices
- Sending and receiving data
- Handling error conditions within the bus
For functions used to initialize and configure:
.. blockdiag:: /../_static/diagrams/sd/sd_arch.diag
:scale: 100%
:caption: SD Host Side Component Architecture
:align: center
.. list::
:SOC_SDMMC_HOST_SUPPORTED: - SDMMC host, see :doc:`SDMMC Host API <../peripherals/sdmmc_host>`
- SD SPI host, see :doc:`SD SPI Host API <../peripherals/sdspi_host>`
.. only:: SOC_SDMMC_HOST_SUPPORTED
The SDMMC protocol layer described in this document handles the specifics of the SD protocol, such as the card initialization and data transfer commands.
The protocol layer works with the host via the :cpp:class:`sdmmc_host_t` structure. This structure contains pointers to various functions of the host.
Pin Configurations
------------------
..only:: SOC_SDMMC_USE_IOMUX and not SOC_SDMMC_USE_GPIO_MATRIX
SDMMC pins are dedicated, you don't have to configure the pins.
..only:: SOC_SDMMC_USE_GPIO_MATRIX and not SOC_SDMMC_USE_IOMUX
SDMMC pin signals are routed via GPIO Matrix, so you will need to configure the pins in :cpp:type:`sdmmc_slot_config_t`.
..only:: esp32p4
SDMMC have two slots:
.. list::
- Slot 0 pins are dedicated for UHS-I mode. This is not yet supported in the driver.
- Slot 1 pins are routed via GPIO Matrix, and it's for non UHS-I usage. You will need to configure the pins in :cpp:type:`sdmmc_slot_config_t` to use the slot 1.
Application Example
-------------------
@ -58,7 +39,7 @@ An example which combines the SDMMC driver with the FATFS library is provided in
Protocol Layer API
------------------
The protocol layer is given the :cpp:class:`sdmmc_host_t` structure. This structure describes the SD/MMC host driver, lists its capabilities, and provides pointers to functions of the driver. The protocol layer stores card-specific information in the :cpp:class:`sdmmc_card_t` structure. When sending commands to the SD/MMC host driver, the protocol layer uses the :cpp:class:`sdmmc_command_t` structure to describe the command, arguments, expected return values, and data to transfer if there is any.
The protocol layer is given the :cpp:class:`sdmmc_host_t` structure. This structure describes the SD/MMC host driver, lists its capabilities, and provides pointers to functions for the implementation driver. The protocol layer stores card-specific information in the :cpp:class:`sdmmc_card_t` structure. When sending commands to the SD/MMC host driver, the protocol layer uses the :cpp:class:`sdmmc_command_t` structure to describe the command, arguments, expected return values, and data to transfer if there is any.
Using API with SD Memory Cards