Merge branch 'doc/review_api-ref_periph-sd_pullup' into 'master'

Review the file api-reference/peripherals/sd_pullup_requirements.rst

See merge request espressif/esp-idf!5793
This commit is contained in:
Angus Gratton 2019-10-30 12:01:42 +08:00
commit 3bddf269ab
3 changed files with 188 additions and 171 deletions

View file

@ -6,6 +6,7 @@ Peripherals API
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
ADC <adc> ADC <adc>
CAN <can> CAN <can>
DAC <dac> DAC <dac>
@ -16,9 +17,10 @@ Peripherals API
MCPWM <mcpwm> MCPWM <mcpwm>
Pulse Counter <pcnt> Pulse Counter <pcnt>
Remote Control <rmt> Remote Control <rmt>
SD Pull-up Requirements <sd_pullup_requirements>
SDMMC Host <sdmmc_host>
SD SPI Host <sdspi_host> SD SPI Host <sdspi_host>
SDIO Slave <sdio_slave> SDIO Slave <sdio_slave>
SDMMC Host <sdmmc_host>
Sigma-delta Modulation <sigmadelta> Sigma-delta Modulation <sigmadelta>
SPI Master <spi_master> SPI Master <spi_master>
SPI Slave <spi_slave> SPI Slave <spi_slave>
@ -27,4 +29,5 @@ Peripherals API
Touch Sensor <touch_pad> Touch Sensor <touch_pad>
UART <uart> UART <uart>
Code examples for this API section are provided in the :example:`peripherals` directory of ESP-IDF examples. Code examples for this API section are provided in the :example:`peripherals` directory of ESP-IDF examples.

View file

@ -1,160 +1,172 @@
SD Pullup Requirements SD Pull-up Requirements
====================== =======================
CMD and DATA lines D0-D3 of the slave should be pulled up by 10 kOhm resistor Espressif hardware products are designed for multiple use cases which may require different pull states on pins. For this reason, the pull state of particular pins on certain products will need to be adjusted to provide the pull-ups required in the SD bus.
even in 1-bit mode or SPI mode. The pullups of the slave cards should be
connected even if they're not connected to the host.
The MTDI strapping pin by default is incompatible with DAT2 line pullup when SD pull-up requirements apply to cases where ESP32 uses the SPI controller to communicate with SD cards. When an SD card is operating in SPI mode or 1-bit SD mode, the CMD and DATA (DAT0 - DAT3) lines of the SD bus must be pulled up by 10 kOhm resistors. Slaves should also have pull-ups on all above-mentioned lines (regardless of whether these lines are connected to the host) in order to prevent SD cards from entering a wrong state.
the flash is 3.3 V. See :ref:`technical_detail_sdio` below.
.. _existing_issues_official_modules_sdio: By default, the MTDI bootstrapping pin is incompatible with the DAT2 line pull-up if the flash voltage is 3.3 V. For more information, see :ref:`mtdi_strapping_pin` below.
Possible Issues .. todo::
---------------
Here is a list of Espressif chips, official modules and development kits and Add a diagram of the Bus lines and pullups
the issues they may have during SDIO development. Since the requirements are
for the pullups on the SD bus, the issues should be resolved no matter if it
is a host or slave. Each issue is linked to its solution. The solution for a
specific issue may be different for host and slave.
Official modules are usually without the sufficient pullups on all 6 pins, it This document has the following structure:
is suggested to select one of the development kits for either host or slave
to provide such pullups.
Chips - `Overview of compatibility`_ between the default pull states on pins of Espressif's products and the states required by the SD bus
^^^^^ - `Solutions`_ - ideas on how to resolve compatibility issues
- `Related information`_ - other relevant information
- ESP32 (except D2WD, see `ESP32 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_):
:ref:`sd_pullup_no_pullups`, whether the strapping conflicts with DAT2 is determined
by the flash you are using. Please see :ref:`strapping_conflicts_dat2` if
your flash chip is 3.3 V.
- ESP32-D2WD: .. _compatibility_overview_espressif_hw_sdio:
:ref:`sd_pullup_no_pullups`, :ref:`no_pullup_on_gpio12`
Overview of Compatibility
-------------------------
This section provides an overview of compatibility issues that might occur when using SDIO (secure digital input output). Since the SD bus needs to be connected to pull-ups, these issues should be resolved regardless of whether they are related to master (host) or slave (device). Each issue has links to its respective solution. A solution for a host and device may differ.
Systems on a Chip (SoCs)
^^^^^^^^^^^^^^^^^^^^^^^^
- ESP32 (except for D2WD versions, see `ESP32 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_):
- :ref:`sd_pull-up_no_pull-ups`
- :ref:`strapping_conflicts_dat2` for models with 3.3 V flash chip
- ESP32-D2WD:
- :ref:`sd_pull-up_no_pull-ups`
- :ref:`no_pull-up_on_gpio12`
Systems in Packages (SIP)
^^^^^^^^^^^^^^^^^^^^^^^^^
- ESP32-PICO-D4:
- :ref:`sd_pull-up_no_pull-ups`
- :ref:`strapping_conflicts_dat2`
- ESP32-PICO-D4:
:ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`
Modules Modules
^^^^^^^ ^^^^^^^
- ESP32-WROOM-32 Series: - ESP32-WROOM-32 Series, including ESP32-WROOM-32, ESP32-WROOM-32D, ESP32-WROOM-32U, and ESP32-SOLO-1
Including ESP32-WROOM-32, ESP32-WROOM-32D, ESP32-WROOM-32U and
ESP32-SOLO-1.
:ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`. - :ref:`sd_pull-up_no_pull-ups`
- :ref:`strapping_conflicts_dat2`
- ESP32-WROVER Series: - ESP32-WROVER Series, including ESP32-WROVER and ESP32-WROVER-I
Including ESP32-WROVER and ESP32-WROVER-I.
:ref:`sd_pullup_no_pullups`. - :ref:`sd_pull-up_no_pull-ups`
- ESP32-WROVER-B Series: - ESP32-WROVER-B Series, including ESP32-WROVER-B and ESP32-WROVER-IB
Including ESP32-WROVER-B and ESP32-WROVER-IB.
- :ref:`sd_pull-up_no_pull-ups`
- :ref:`strapping_conflicts_dat2`
:ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`.
.. _sdio_dev_kits: .. _sdio_dev_kits:
Development Boards Development Boards
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
- ESP32-PICO-KIT: - ESP32-PICO-KIT, including PICO-KIT v4.1, v4.0, and v3
Including PICO-KIT v4.1, v4.0 and v3.
:ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`, - :ref:`sd_pull-up_no_pull-ups`
:ref:`gpio2_strapping_pin`. - :ref:`strapping_conflicts_dat2`
- :ref:`gpio2_strapping_pin`
- ESP32-DevKitC: - ESP32-DevKitC, including ESP32-DevKitC v4 and v2
Including ESP32-DevKitC v4 and v2.
:ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`, - :ref:`sd_pull-up_no_pull-ups`
:ref:`gpio2_strapping_pin`. - :ref:`strapping_conflicts_dat2`
- :ref:`gpio2_strapping_pin`
- ESP-WROVER-KIT: - ESP-WROVER-KIT
v4.1: Have pullups, but :ref:`pullup_conflicts_on_gpio13` ,
:ref:`strapping_conflicts_dat2`.
v3: Have pullups, but :ref:`pullup_conflicts_on_gpio13`. - Required pull-ups are provided
- :ref:`pull-up_conflicts_on_gpio13` (v4.1, v3, v2, and v1)
- :ref:`strapping_conflicts_dat2` (v4.1, v2, and v1)
- :ref:`gpio2_strapping_pin` (v2, v1)
v2 and v1: Have pullups, but :ref:`pullup_conflicts_on_gpio13`, You can determine the version of your ESP23-WROVER-KIT by checking which module is mounted on it:
:ref:`strapping_conflicts_dat2`, :ref:`gpio2_strapping_pin`.
You can tell the version of your ESP23-WROVER-KIT version from the module - ESP32-WROVER-B on v4.1
on it: v4.1 are with ESP32-WROVER-B modules, v3 are with ESP32-WROVER - ESP32-WROVER on v3
modules, while v2 and v1 are with ESP32-WROOM-32 modules. - ESP32-WROOM-32 on v1 and v2
- ESP32-LyraTD-MSC: - ESP32-LyraTD-MSC
:ref:`strapping_conflicts_dat2`. Have pullups.
- Required pull-ups are provided
- :ref:`strapping_conflicts_dat2`
- ESP32-LyraT
- Required pull-ups are provided
- :ref:`pull-up_conflicts_on_gpio13`
- ESP32-LyraT:
Have pullups, but :ref:`pullup_conflicts_on_gpio13`
Non-Espressif Hosts Non-Espressif Hosts
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
Please make sure that your 3rd party SDIO host has correct pullups for all Please make sure that your SDIO host provides necessary pull-ups for all SD bus signals.
the signals.
Solutions Solutions
--------- ---------
.. _sd_pullup_no_pullups: .. _sd_pull-up_no_pull-ups:
No Pullups No Pull-ups
^^^^^^^^^^ ^^^^^^^^^^^
When developing on boards without pullups, you can either: If you use a development board without pull-ups, you can do the following:
1. If your host and slave are on seperated boards, you can change one of them - If your host and slave device are on seperate boards, replace one of them with a board that has pull-ups. For the list of Espressif's development boards with pull-ups, go to :ref:`sdio_dev_kits`.
to a board with pullups. Please see :ref:`sdio_dev_kits` to find Espressif - Attach external pull-ups by connecting each pin which requires a pull-up to VDD via a 10 kOhm resistor.
official boards with pullups.
2. Connect external pullups to VDD by yourself. Connect these pins without
pullups to the VDD through a 10 kOhm resistor.
.. _pullup_conflicts_on_gpio13:
Pullup Conflicts on GPIO13 .. _pull-up_conflicts_on_gpio13:
^^^^^^^^^^^^^^^^^^^^^^^^^^
The DAT3 of slave may not be properly pulled up. You can either: Pull-up Conflicts on GPIO13
^^^^^^^^^^^^^^^^^^^^^^^^^^^
If DAT3 of your device is not properly pulled up, you have the following options:
- Use 1-bit SD mode and tie the device's DAT3 to VDD
- Use SPI mode
- Perform one of the following actions on the GPIO13 pin:
- Remove the pull-down resistors
- Attach a pull-up resistor of less than 5 kOhm (2 kOhm suggested)
- Pull it up or drive it high either by using the host or with 3.3 V on VDD in 1-bit SD mode
1. Use 1-bit mode, and tie DAT3 of slave to VDD.
2. Use SPI mode.
3. Remove the pulldown resistors on GPIO13; or pull it up by resistor less
than 5 kOhm (2 kOhm suggested); or pull it up or drive it high by host or
VDD3.3V in 1-bit mode.
.. _strapping_conflicts_dat2: .. _strapping_conflicts_dat2:
Conflicts Between Bootstrap and SDIO on DAT2 Conflicts Between Bootstrap and SDIO on DAT2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The strapping requirements conflict with SDIO protocol. See There is a conflict between the boot strapping requirements of the ESP32 and the SDIO protocol. For details, see :ref:`mtdi_strapping_pin`.
:ref:`mtdi_strapping_pin` for the details of this issue. You can either:
1. (Recomended) Burn the flash voltage selection eFuses. This will To resolve the conflict, you have the following options:
permanently select 3.3 V output voltage for the internal regulator, and GPIO12
will not be used as a bootstrapping pin. Then connect a pullup resistor
to GPIO12.
.. warning:: Burning eFuse is irreversible. The issue list above may be 1. (Recommended) Burn the flash voltage selection eFuses. This will permanently configure the internal regulator's output voltage to 3.3 V, and GPIO12 will not be used as a bootstrapping pin. After that, connect a pull-up resistor to GPIO12.
out of date. Do make sure the module you are burning is using a 3.3 V flash
according to the information on http://www.espressif.com/. If you burn the
3.3 V eFuses on an 1.8 V module, the module will get broken.
Run the command below under your IDF folder: .. warning::
::
Burning eFuses is irreversible! The issue list above might be out of date, so please make sure that the module you are burning has a 3.3 V flash chip by checking the information on http://www.espressif.com/. If you burn the 3.3 V eFuses on a module with a 1.8 V flash chip, the module will stop functioning.
If you are sure that you need to irreversibly burn eFuses, go to your ESP-IDF directory and run the following command:
.. code-block:: bash
components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V
This command will burn the `XPD_SDIO_TIEH`, `XPD_SDIO_FORCE`, and This command will burn the `XPD_SDIO_TIEH`, `XPD_SDIO_FORCE`, and `XPD_SDIO_REG` eFuses. After all the three eFuses are burned to value 1, the internal VDD_SDIO flash voltage regulator will be permanently set to 3.3 V. You will see the following log if the burning succeeds:
`XPD_SDIO_REG` eFuses. With all three burned to value 1, the internal
VDD_SDIO flash voltage regulator is permanently set to 3.3 V. You will .. code-block:: bash
see the following log if the burning succeeds:
::
espefuse.py v2.6 espefuse.py v2.6
Connecting.... Connecting....
@ -166,103 +178,105 @@ The strapping requirements conflict with SDIO protocol. See
BURN BURN
VDD_SDIO setting complete. VDD_SDIO setting complete.
You can also run ``components/esptool_py/esptool/espefuse.py summary`` to To check the status of the eFuses, run::
check the status of the eFuses above.
`espefuse.py` has a ``--do-not-confirm`` option if running from an ``components/esptool_py/esptool/espefuse.py summary``
automated flashing script.
See the ESP32 Technical Reference Manual for more details. If running from an automated flashing script, ``espefuse.py`` has an option ``--do-not-confirm``.
2. **When using 1-bit mode or SPI mode**, DAT2 signal is not needed (though it For more details, see the `ESP32 Technical Reference Manual <https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf>`_ (PDF).
still has to be pulled up). If the device works as the host, you can leave
the DAT2 of host floating, and directly connect DAT2 of slave to VDD; or if
the device works as the slave, specify ``SDIO_SLAVE_FLAG_DAT2_DISABLED`` in
the slave app to avoid slave detecting on DAT2 line. Note the host will
not know that 4-bit mode is not supported any more by the standard CCCR
register. You have to forbid the host from using 4-bit mode.
.. _no_pullup_on_gpio12: 2. **If using 1-bit SD mode or SPI mode**, disconnect the DAT2 pin and make sure it is pulled high. For this, do one the following:
No Pullup on GPIO12 - Leave the host's DAT2 floating and directly connect the slave's DAT2 to VDD.
^^^^^^^^^^^^^^^^^^^ - For a slave device, build a firmware with the option ``SDIO_SLAVE_FLAG_DAT2_DISABLED`` and re-flash your device. This option will help avoid slave detecting on the DAT2 line. Note that 4-bit SD mode will no longer be supported by the standard Card Common Control Register (CCCR); however, the host will not be aware of that. The use of 4-bit SD mode will have to be disabled on the host's side.
.. _no_pull-up_on_gpio12:
No Pull-up on GPIO12
^^^^^^^^^^^^^^^^^^^^
Your module is compatible with the SDIO protocol. Just connect GPIO12 to VDD via a 10 kOhm resistor.
Your module is compatible with the SDIO protocol. Just connect GPIO12 to the
VDD through a 10 kOhm resistor.
.. _gpio2_strapping_pin: .. _gpio2_strapping_pin:
Auto-program Not Working (minor issue) Download Mode Not Working (minor issue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GPIO2 pin is used as a bootstrapping pin, and should be low to enter UART When the GPIO2 pin is pulled high in accordance with the SD pull-up requirements, you cannot enter Download mode because GPIO2 is a bootstrapping pin which in this case must be pulled low.
download mode. You may find it unable to enter the UART download mode if you
correctly connect the pullup of SD on GPIO2.
Some official kits pull down GPIO2 when downloading. For other boards, you There are the following solutions:
may try to connect GPIO0 and GPIO2 using a jumper, and then the auto-reset
circuit on most development boards will pull GPIO2 low along with GPIO0, when
entering download mode. (Some boards have pulldown and/or LED on GPIO2. LED
is usually ok, but the pulldown resistor will interfere with D0 signals and
must be removed. Check the schematic of your development board for anything
connected to GPIO2.)
If the above way is not working, please just turn off the other device and - For boards that require shorting the GPIO0 and GPIO2 pins with a jumper, put the jumper in place, and the auto-reset circuit will pull GPIO2 low along with GPIO0 before entering Download mode.
remove the pullups on GPIO2 when you are programming the slave. - For boards with components attached to their GPIO2 pin (such as pull-down resistors and/or LEDs), check the schematic of your development board for anything connected to GPIO2.
- **LEDs** would not affect operation in most cases.
- **Pull-down resistors** can interfere with DAT0 signals and must be removed.
If the above solutions do not work for you, please determine if it is the host or slave device that has pull-ups affecting their GPIO2, then locate these pull-ups and remove them.
.. _technical_detail_sdio: .. _related_info_sdio:
Technical Details Related Information
----------------- -------------------
.. _mtdi_strapping_pin: .. _mtdi_strapping_pin:
MTDI Strapping Pin MTDI Strapping Pin
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
MTDI (GPIO12) is used as a bootstrapping pin to select output voltage of an MTDI (GPIO12) is used as a bootstrapping pin to select the output voltage of an internal regulator (VDD_SDIO) which powers the flash chip. This pin has an internal pull-down, so, if left unconnected, it will read low at startup, which will lead to selecting the default 3.3 V operation.
internal regulator which powers the flash chip (VDD_SDIO). This pin has an
internal pulldown so if left unconnected it will read low at startup
(selecting default 3.3 V operation).
For ESP32-WROVER modules, excluding ESP32-WROVER-B, they use 1.8 V flash, and All ESP32-WROVER modules, excluding ESP32-WROVER-B, use 1.8 V flash and have internal pull-ups on GPIO12. Other modules that use 3.3 V flash have no pull-ups on the GPIO12 pin, and this pin is slightly pulled down internally.
have pullup on GPIO12 inside. For other modules, which use 3.3 V flash, have
no pullups on GPIO12, and GPIO12 is weakly pulled down internally.
When adding a pullup to this pin for SD card operation, consider the When adding a pull-up to this pin for SD card operation, consider the following:
following:
- For boards which don't use the internal regulator (VDD_SDIO) to power the - For boards that do not use the internal regulator (VDD_SDIO) to power flash, GPIO12 can be pulled high.
flash, GPIO12 can be pulled high. - For boards using 1.8 V flash chips, GPIO12 needs to be pulled high at reset. This is fully compatible with the SD card operation.
- For boards which use 1.8 V flash chip, GPIO12 needs to be pulled high at - On boards using the internal regulator and a 3.3 V flash chip, GPIO12 must be pulled low at reset. This is incompatible with the SD card operation. For reference information on compatibility of Espressif's boards with the SD card operation, see :ref:`compatibility_overview_espressif_hw_sdio`.
reset. This is fully compatible with SD card operation.
- On boards which use the internal regulator and a 3.3 V flash chip, GPIO12
must be low at reset. This is incompatible with SD card operation. Please
check :ref:`existing_issues_official_modules_sdio` to see whether your board
has this issue, and how to solve it.
Internal Pullups and Strapping Requirements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It is never recommended to rely on internal weak pullups for SDIO Internal Pull-ups and Strapping Requirements
communications, since internal weak pullups are insufficient. But information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
of the strapping requirements and internal pullups may be useful. For
Espressif official modules, different weak pullups / pulldowns are connected
to CMD, and DATA pins as below.
+-----------------------+-----+--------------------------+------+-----------------------+------+ Using external resistors is always preferable. However, Espressif's products have internal weak pull-up and pull-down resistors which can be enabled and used instead of external ones. Please keep in mind that this solution cannot guarantee reliable SDIO communication.
| GPIO | 15 | 2 | 4 | 12 | 13 |
+=======================+=====+==========================+======+=======================+======+
| Name | CMD | DAT0 | DAT1 | DAT2 | DAT3 |
+-----------------------+-----+--------------------------+------+-----------------------+------+
| At startup | WPU | WPD | WPD | PU for 1.8 V flash; | WPU |
| | | | | WPD for 3.3 V flash | |
+-----------------------+-----+--------------------------+------+-----------------------+------+
| Strapping requirement | | Low to download to flash | | High for 1.8 V flash; | |
| | | | | Low for 3.3 V flash | |
+-----------------------+-----+--------------------------+------+-----------------------+------+
- WPU: Weak pullup With that said, the information about these internal pull-ups and strapping requirements can still be useful. Espressif hardware products have different weak internal pull-ups / pull-downs connected to CMD and DATA pins. The table below shows the default pull-up and pull-down states of the CMD and DATA pins.
- WPD: Weak pulldown
- PU: Pullup inside the module The following abbreviations are used in the table:
- **WPU**: Weak pull-up inside the SoC
- **WPD**: Weak pull-down inside the SoC
- **PU**: Pull-up inside Espressif modules but outside the SoC
.. list-table:: Default pull-up and pull-down states of the CMD and DATA pins
:widths: 25 25 25 25
:header-rows: 1
* - GPIO number
- Pin Name
- Startup State
- Strapping Requirement
* - **15**
- CMD
- WPU
-
* - **2**
- DAT0
- WPD
- Low for Download mode
* - **4**
- DAT1
- WPD
-
* - **12**
- DAT2
- PU for 1.8 V flash; WPD for 3.3 V flash
- High for 1.8 V flash; Low for 3.3 V flash
* - **13**
- DAT3
- WPU
-

View file

@ -42,13 +42,13 @@ Connections
pulled up by 10 KOhm resistors. This should be ensured even in 1-bit mode pulled up by 10 KOhm resistors. This should be ensured even in 1-bit mode
or SPI mode. Most official modules don't offer these pullups internally. or SPI mode. Most official modules don't offer these pullups internally.
If you are using official development boards, check If you are using official development boards, check
:ref:`existing_issues_official_modules_sdio` to see whether your :ref:`compatibility_overview_espressif_hw_sdio` to see whether your
development boards have such pullups. development boards have such pullups.
.. note:: Most official modules have conflicts on strapping pins with the .. note:: Most official modules have conflicts on strapping pins with the
SDIO slave function. If you are using a ESP32 module with 3.3 V flash SDIO slave function. If you are using a ESP32 module with 3.3 V flash
inside, you have to burn the EFUSE when you are developing on the module inside, you have to burn the EFUSE when you are developing on the module
for the first time. See :ref:`existing_issues_official_modules_sdio` to for the first time. See :ref:`compatibility_overview_espressif_hw_sdio` to
see how to make your modules compatible with the SDIO. see how to make your modules compatible with the SDIO.
Here is a list for modules/kits with 3.3 V flash: Here is a list for modules/kits with 3.3 V flash: