sd_pullup_requirements.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. SD Pullup Requirements
  2. ======================
  3. CMD and DATA lines D0-D3 of the slave should be pulled up by 10 kOhm resistor
  4. even in 1-bit mode or SPI mode. The pullups of the slave cards should be
  5. connected even if they're not connected to the host.
  6. The MTDI strapping pin by default is incompatible with DAT2 line pullup when
  7. the flash is 3.3 V. See :ref:`technical_detail_sdio` below.
  8. .. _existing_issues_official_modules_sdio:
  9. Possible Issues
  10. ---------------
  11. Here is a list of Espressif chips, official modules and development kits and
  12. the issues they may have during SDIO development. Since the requirements are
  13. for the pullups on the SD bus, the issues should be resolved no matter if it
  14. is a host or slave. Each issue is linked to its solution. The solution for a
  15. specific issue may be different for host and slave.
  16. Official modules are usually without the sufficient pullups on all 6 pins, it
  17. is suggested to select one of the development kits for either host or slave
  18. to provide such pullups.
  19. Chips
  20. ^^^^^
  21. - ESP32 (except D2WD, see `ESP32 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_):
  22. :ref:`sd_pullup_no_pullups`, whether the strapping conflicts with DAT2 is determined
  23. by the flash you are using. Please see :ref:`strapping_conflicts_dat2` if
  24. your flash chip is 3.3 V.
  25. - ESP32-D2WD:
  26. :ref:`sd_pullup_no_pullups`, :ref:`no_pullup_on_gpio12`
  27. - ESP32-PICO-D4:
  28. :ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`
  29. Modules
  30. ^^^^^^^
  31. - ESP32-WROOM-32 Series:
  32. Including ESP32-WROOM-32, ESP32-WROOM-32D, ESP32-WROOM-32U and
  33. ESP32-SOLO-1.
  34. :ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`.
  35. - ESP32-WROVER Series:
  36. Including ESP32-WROVER and ESP32-WROVER-I.
  37. :ref:`sd_pullup_no_pullups`.
  38. - ESP32-WROVER-B Series:
  39. Including ESP32-WROVER-B and ESP32-WROVER-IB.
  40. :ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`.
  41. .. _sdio_dev_kits:
  42. Development Boards
  43. ^^^^^^^^^^^^^^^^^^
  44. - ESP32-PICO-KIT:
  45. Including PICO-KIT v4.1, v4.0 and v3.
  46. :ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`,
  47. :ref:`gpio2_strapping_pin`.
  48. - ESP32-DevKitC:
  49. Including ESP32-DevKitC v4 and v2.
  50. :ref:`sd_pullup_no_pullups`, :ref:`strapping_conflicts_dat2`,
  51. :ref:`gpio2_strapping_pin`.
  52. - ESP-WROVER-KIT:
  53. v4.1: Have pullups, but :ref:`pullup_conflicts_on_gpio13` ,
  54. :ref:`strapping_conflicts_dat2`.
  55. v3: Have pullups, but :ref:`pullup_conflicts_on_gpio13`.
  56. v2 and v1: Have pullups, but :ref:`pullup_conflicts_on_gpio13`,
  57. :ref:`strapping_conflicts_dat2`, :ref:`gpio2_strapping_pin`.
  58. You can tell the version of your ESP23-WROVER-KIT version from the module
  59. on it: v4.1 are with ESP32-WROVER-B modules, v3 are with ESP32-WROVER
  60. modules, while v2 and v1 are with ESP32-WROOM-32 modules.
  61. - ESP32-LyraTD-MSC:
  62. :ref:`strapping_conflicts_dat2`. Have pullups.
  63. - ESP32-LyraT:
  64. Have pullups, but :ref:`pullup_conflicts_on_gpio13`
  65. Non-Espressif Hosts
  66. ^^^^^^^^^^^^^^^^^^^
  67. Please make sure that your 3rd party SDIO host has correct pullups for all
  68. the signals.
  69. Solutions
  70. ---------
  71. .. _sd_pullup_no_pullups:
  72. No Pullups
  73. ^^^^^^^^^^
  74. When developing on boards without pullups, you can either:
  75. 1. If your host and slave are on seperated boards, you can change one of them
  76. to a board with pullups. Please see :ref:`sdio_dev_kits` to find Espressif
  77. official boards with pullups.
  78. 2. Connect external pullups to VDD by yourself. Connect these pins without
  79. pullups to the VDD through a 10 kOhm resistor.
  80. .. _pullup_conflicts_on_gpio13:
  81. Pullup Conflicts on GPIO13
  82. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  83. The DAT3 of slave may not be properly pulled up. You can either:
  84. 1. Use 1-bit mode, and tie DAT3 of slave to VDD.
  85. 2. Use SPI mode.
  86. 3. Remove the pulldown resistors on GPIO13; or pull it up by resistor less
  87. than 5 kOhm (2 kOhm suggested); or pull it up or drive it high by host or
  88. VDD3.3V in 1-bit mode.
  89. .. _strapping_conflicts_dat2:
  90. Conflicts Between Bootstrap and SDIO on DAT2
  91. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  92. The strapping requirements conflict with SDIO protocol. See
  93. :ref:`mtdi_strapping_pin` for the details of this issue. You can either:
  94. 1. (Recomended) Burn the flash voltage selection eFuses. This will
  95. permanently select 3.3 V output voltage for the internal regulator, and GPIO12
  96. will not be used as a bootstrapping pin. Then connect a pullup resistor
  97. to GPIO12.
  98. .. warning:: Burning eFuse is irreversible. The issue list above may be
  99. out of date. Do make sure the module you are burning is using a 3.3 V flash
  100. according to the information on http://www.espressif.com/. If you burn the
  101. 3.3 V eFuses on an 1.8 V module, the module will get broken.
  102. Run the command below under your IDF folder:
  103. ::
  104. components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V
  105. This command will burn the `XPD_SDIO_TIEH`, `XPD_SDIO_FORCE`, and
  106. `XPD_SDIO_REG` eFuses. With all three burned to value 1, the internal
  107. VDD_SDIO flash voltage regulator is permanently set to 3.3 V. You will
  108. see the following log if the burning succeeds:
  109. ::
  110. espefuse.py v2.6
  111. Connecting....
  112. Enable internal flash voltage regulator (VDD_SDIO) to 3.3 V.
  113. The following eFuses are burned: XPD_SDIO_FORCE, XPD_SDIO_REG, XPD_SDIO_TIEH.
  114. This is an irreversible operation.
  115. Type 'BURN' (all capitals) to continue.
  116. BURN
  117. VDD_SDIO setting complete.
  118. You can also run ``components/esptool_py/esptool/espefuse.py summary`` to
  119. check the status of the eFuses above.
  120. `espefuse.py` has a ``--do-not-confirm`` option if running from an
  121. automated flashing script.
  122. See the ESP32 Technical Reference Manual for more details.
  123. 2. **When using 1-bit mode or SPI mode**, DAT2 signal is not needed (though it
  124. still has to be pulled up). If the device works as the host, you can leave
  125. the DAT2 of host floating, and directly connect DAT2 of slave to VDD; or if
  126. the device works as the slave, specify ``SDIO_SLAVE_FLAG_DAT2_DISABLED`` in
  127. the slave app to avoid slave detecting on DAT2 line. Note the host will
  128. not know that 4-bit mode is not supported any more by the standard CCCR
  129. register. You have to forbid the host from using 4-bit mode.
  130. .. _no_pullup_on_gpio12:
  131. No Pullup on GPIO12
  132. ^^^^^^^^^^^^^^^^^^^
  133. Your module is compatible with the SDIO protocol. Just connect GPIO12 to the
  134. VDD through a 10 kOhm resistor.
  135. .. _gpio2_strapping_pin:
  136. Auto-program Not Working (minor issue)
  137. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  138. GPIO2 pin is used as a bootstrapping pin, and should be low to enter UART
  139. download mode. You may find it unable to enter the UART download mode if you
  140. correctly connect the pullup of SD on GPIO2.
  141. Some official kits pull down GPIO2 when downloading. For other boards, you
  142. may try to connect GPIO0 and GPIO2 using a jumper, and then the auto-reset
  143. circuit on most development boards will pull GPIO2 low along with GPIO0, when
  144. entering download mode. (Some boards have pulldown and/or LED on GPIO2. LED
  145. is usually ok, but the pulldown resistor will interfere with D0 signals and
  146. must be removed. Check the schematic of your development board for anything
  147. connected to GPIO2.)
  148. If the above way is not working, please just turn off the other device and
  149. remove the pullups on GPIO2 when you are programming the slave.
  150. .. _technical_detail_sdio:
  151. Technical Details
  152. -----------------
  153. .. _mtdi_strapping_pin:
  154. MTDI Strapping Pin
  155. ^^^^^^^^^^^^^^^^^^
  156. MTDI (GPIO12) is used as a bootstrapping pin to select output voltage of an
  157. internal regulator which powers the flash chip (VDD_SDIO). This pin has an
  158. internal pulldown so if left unconnected it will read low at startup
  159. (selecting default 3.3 V operation).
  160. For ESP32-WROVER modules, excluding ESP32-WROVER-B, they use 1.8 V flash, and
  161. have pullup on GPIO12 inside. For other modules, which use 3.3 V flash, have
  162. no pullups on GPIO12, and GPIO12 is weakly pulled down internally.
  163. When adding a pullup to this pin for SD card operation, consider the
  164. following:
  165. - For boards which don't use the internal regulator (VDD_SDIO) to power the
  166. flash, GPIO12 can be pulled high.
  167. - For boards which use 1.8 V flash chip, GPIO12 needs to be pulled high at
  168. reset. This is fully compatible with SD card operation.
  169. - On boards which use the internal regulator and a 3.3 V flash chip, GPIO12
  170. must be low at reset. This is incompatible with SD card operation. Please
  171. check :ref:`existing_issues_official_modules_sdio` to see whether your board
  172. has this issue, and how to solve it.
  173. Internal Pullups and Strapping Requirements
  174. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  175. It is never recommended to rely on internal weak pullups for SDIO
  176. communications, since internal weak pullups are insufficient. But information
  177. of the strapping requirements and internal pullups may be useful. For
  178. Espressif official modules, different weak pullups / pulldowns are connected
  179. to CMD, and DATA pins as below.
  180. +-----------------------+-----+--------------------------+------+-----------------------+------+
  181. | GPIO | 15 | 2 | 4 | 12 | 13 |
  182. +=======================+=====+==========================+======+=======================+======+
  183. | Name | CMD | DAT0 | DAT1 | DAT2 | DAT3 |
  184. +-----------------------+-----+--------------------------+------+-----------------------+------+
  185. | At startup | WPU | WPD | WPD | PU for 1.8 V flash; | WPU |
  186. | | | | | WPD for 3.3 V flash | |
  187. +-----------------------+-----+--------------------------+------+-----------------------+------+
  188. | Strapping requirement | | Low to download to flash | | High for 1.8 V flash; | |
  189. | | | | | Low for 3.3 V flash | |
  190. +-----------------------+-----+--------------------------+------+-----------------------+------+
  191. - WPU: Weak pullup
  192. - WPD: Weak pulldown
  193. - PU: Pullup inside the module