From 4db4402bed9a7d382e789abf48239613a066d4a4 Mon Sep 17 00:00:00 2001 From: Kirill Chalov Date: Mon, 24 Jun 2019 21:46:11 +0800 Subject: [PATCH] Review the file api-reference/peripherals/sdmmc_host.rst --- .../api-reference/peripherals/sdmmc_host.rst | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/docs/en/api-reference/peripherals/sdmmc_host.rst b/docs/en/api-reference/peripherals/sdmmc_host.rst index 59bc75d69..f2a866a2b 100644 --- a/docs/en/api-reference/peripherals/sdmmc_host.rst +++ b/docs/en/api-reference/peripherals/sdmmc_host.rst @@ -4,12 +4,12 @@ SDMMC Host Driver Overview -------- -On the ESP32, SDMMC host peripheral has two slots: +ESP32's SDMMC host peripheral has two slots: - Slot 0 (:c:macro:`SDMMC_HOST_SLOT_0`) is an 8-bit slot. It uses ``HS1_*`` signals in the PIN MUX. - Slot 1 (:c:macro:`SDMMC_HOST_SLOT_1`) is a 4-bit slot. It uses ``HS2_*`` signals in the PIN MUX. -Pin mappings of these slots are given in the following table: +Pin mappings of these slots are given in the table below. +--------+-------------+-------------+ | Signal | Slot 0 | Slot 1 | @@ -39,44 +39,55 @@ Pin mappings of these slots are given in the following table: | WP | any input via GPIO matrix | +--------+---------------------------+ -Card Detect and Write Protect signals can be routed to arbitrary pins using GPIO matrix. To use these pins, set ``gpio_cd`` and ``gpio_wp`` members of :cpp:class:`sdmmc_slot_config_t` structure before calling :cpp:func:`sdmmc_host_init_slot`. Note that it is not advised to specify Card Detect pin when working with SDIO cards, because in ESP32 card detect signal can also trigger SDIO slave interrupt. +The Card Detect and Write Protect signals can be routed to arbitrary pins using the GPIO matrix. To reserve the pins, set the ``gpio_cd`` and ``gpio_wp`` members of the :cpp:class:`sdmmc_slot_config_t` structure before calling :cpp:func:`sdmmc_host_init_slot`. Please note that it is not advised to specify a Card Detect pin when working with SDIO cards, because the card detect signal in ESP32 can also trigger SDIO slave interrupt. .. warning:: - Pins used by slot 0 (``HS1_*``) are also used to connect SPI flash chip in ESP-WROOM32 and ESP32-WROVER modules. These pins can not be shared between SD card and SPI flash. If you need to use Slot 0, connect SPI flash to different pins and set Efuses accordingly. + 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 shared between an SD card and SPI flash. If you need to use Slot 0, connect SPI flash to different pins and set eFuses accordingly. -Supported speed modes + +Supported Speed Modes --------------------- SDMMC Host driver supports the following speed modes: -- Default Speed (20MHz), 4-line/1-line (with SD cards), and 8-line (with 3.3V eMMC). -- High Speed (40MHz), 4-line/1-line (with SD cards), and 8-line (with 3.3V eMMC) -- High Speed DDR (40MHz), 4-line (with 3.3V eMMC) +- Default Speed (20 MHz), 4-line/1-line (with SD cards), and 8-line (with 3.3 V eMMC) +- High Speed (40 MHz), 4-line/1-line (with SD cards), and 8-line (with 3.3 V eMMC) +- High Speed DDR (40 MHz), 4-line (with 3.3 V eMMC) -Not supported at present are: +Speed modes not supported at present: - High Speed DDR mode, 8-line eMMC -- UHS-I 1.8V modes, 4-line SD cards +- UHS-I 1.8 V modes, 4-line SD cards -Using the SDMMC Host driver + +Using the SDMMC Host Driver --------------------------- -Of all the funtions listed below, only :cpp:func:`sdmmc_host_init`, :cpp:func:`sdmmc_host_init_slot`, and :cpp:func:`sdmmc_host_deinit` will be used directly by most applications. +Of all the functions listed below, only the following ones will be used directly by most applications: -Other functions, such as :cpp:func:`sdmmc_host_set_bus_width`, :cpp:func:`sdmmc_host_set_card_clk`, and :cpp:func:`sdmmc_host_do_transaction` will be called by the SD/MMC protocol layer via function pointers in :cpp:class:`sdmmc_host_t` structure. +- :cpp:func:`sdmmc_host_init` +- :cpp:func:`sdmmc_host_init_slot` +- :cpp:func:`sdmmc_host_deinit` -Configuring bus width and frequency +Other functions, such as the ones given below, will be called by the SD/MMC protocol layer via function pointers in the :cpp:class:`sdmmc_host_t` structure: + +- :cpp:func:`sdmmc_host_set_bus_width` +- :cpp:func:`sdmmc_host_set_card_clk` +- :cpp:func:`sdmmc_host_do_transaction` + + +Configuring Bus Width and Frequency ----------------------------------- -With the default initializers for :cpp:class:`sdmmc_host_t` and :cpp:class:`sdmmc_slot_config_t` (:c:macro:`SDMMC_HOST_DEFAULT` and :c:macro:`SDMMC_SLOT_CONFIG_DEFAULT`), SDMMC Host driver will attempt to use widest bus supported by the card (4 lines for SD, 8 lines for eMMC) and 20MHz frequency. +With the default initializers for :cpp:class:`sdmmc_host_t` and :cpp:class:`sdmmc_slot_config_t` (:c:macro:`SDMMC_HOST_DEFAULT` and :c:macro:`SDMMC_SLOT_CONFIG_DEFAULT`), SDMMC Host driver will attempt to use the widest bus supported by the card (4 lines for SD, 8 lines for eMMC) and the frequency of 20 MHz. -In designs where communication at 40MHz frequency can be achieved, it is possible to increase the bus frequency to by changing ``max_freq_khz`` field of :cpp:class:`sdmmc_host_t`:: +In the designs where communication at 40 MHz frequency can be achieved, it is possible to increase the bus frequency by changing the ``max_freq_khz`` field of :cpp:class:`sdmmc_host_t`:: sdmmc_host_t host = SDMMC_HOST_DEFAULT(); host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; -To configure bus width, set ``width`` field of :cpp:class:`sdmmc_slot_config_t`. For example, to set 1-line mode:: +To configure the bus width, set the ``width`` field of :cpp:class:`sdmmc_slot_config_t`. For example, to set 1-line mode:: sdmmc_slot_config_t slot = SDMMC_SLOT_CONFIG_DEFAULT(); slot.width = 1; @@ -87,9 +98,10 @@ See also See :doc:`SD/SDIO/MMC Driver <../storage/sdmmc>` for the higher level driver which implements the protocol layer. -See :doc:`SD SPI Host Driver ` for a similar driver which uses SPI controller and is limited to SPI mode of SD protocol. +See :doc:`SD SPI Host Driver ` for a similar driver which uses the SPI controller and is limited to SD protocol's SPI mode. + +See :doc:`sd_pullup_requirements` for pullup support and compatibilities of modules and development kits. -See :doc:`sd_pullup_requirements` for pullup support and compatiblities about modules and devkits. API Reference -------------