esp32.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. .. This file gets included from other .rst files in this folder.
  2. .. It contains target-specific snippets.
  3. .. Comments and '---' lines act as delimiters.
  4. ..
  5. .. This is necessary mainly because RST doesn't support substitutions
  6. .. (defined in RST, not in Python) inside code blocks. If that is ever implemented,
  7. .. These code blocks can be moved back to the main .rst files, with target-specific
  8. .. file names being replaced by substitutions.
  9. .. gpio-summary
  10. The {IDF_TARGET_NAME} chip features 34 physical GPIO pins (GPIO0 ~ GPIO19, GPIO21 ~ GPIO23, GPIO25 ~ GPIO27, and GPIO32 ~ GPIO39). Each pin can be used as a general-purpose I/O, or be connected to an internal peripheral signal. Through IO MUX, RTC IO MUX and the GPIO matrix, peripheral input signals can be from any IO pins, and peripheral output signals can be routed to any IO pins. Together these modules provide highly configurable I/O. For more details, see *{IDF_TARGET_NAME} Technical Reference Manual* > *IO MUX and GPIO Matrix (GPIO, IO_MUX)* [`PDF <{IDF_TARGET_TRM_EN_URL}#iomuxgpio>`__].
  11. The table below provides more information on pin usage, and please note the comments in the table for GPIOs with restrictions.
  12. .. list-table::
  13. :header-rows: 1
  14. :widths: 8 12 12 20
  15. * - GPIO
  16. - Analog Function
  17. - RTC GPIO
  18. - Comments
  19. * - GPIO0
  20. - ADC2_CH1
  21. - RTC_GPIO11
  22. - Strapping pin
  23. * - GPIO1
  24. -
  25. -
  26. - TXD
  27. * - GPIO2
  28. - ADC2_CH2
  29. - RTC_GPIO12
  30. - Strapping pin
  31. * - GPIO3
  32. -
  33. -
  34. - RXD
  35. * - GPIO4
  36. - ADC2_CH0
  37. - RTC_GPIO10
  38. -
  39. * - GPIO5
  40. -
  41. -
  42. - Strapping pin
  43. * - GPIO6
  44. -
  45. -
  46. - SPI0/1
  47. * - GPIO7
  48. -
  49. -
  50. - SPI0/1
  51. * - GPIO8
  52. -
  53. -
  54. - SPI0/1
  55. * - GPIO9
  56. -
  57. -
  58. - SPI0/1
  59. * - GPIO10
  60. -
  61. -
  62. - SPI0/1
  63. * - GPIO11
  64. -
  65. -
  66. - SPI0/1
  67. * - GPIO12
  68. - ADC2_CH5
  69. - RTC_GPIO15
  70. - Strapping pin; JTAG
  71. * - GPIO13
  72. - ADC2_CH4
  73. - RTC_GPIO14
  74. - JTAG
  75. * - GPIO14
  76. - ADC2_CH6
  77. - RTC_GPIO16
  78. - JTAG
  79. * - GPIO15
  80. - ADC2_CH3
  81. - RTC_GPIO13
  82. - Strapping pin; JTAG
  83. * - GPIO16
  84. -
  85. -
  86. - SPI0/1
  87. * - GPIO17
  88. -
  89. -
  90. - SPI0/1
  91. * - GPIO18
  92. -
  93. -
  94. -
  95. * - GPIO19
  96. -
  97. -
  98. -
  99. * - GPIO21
  100. -
  101. -
  102. -
  103. * - GPIO22
  104. -
  105. -
  106. -
  107. * - GPIO23
  108. -
  109. -
  110. -
  111. * - GPIO25
  112. - ADC2_CH8
  113. - RTC_GPIO6
  114. -
  115. * - GPIO26
  116. - ADC2_CH9
  117. - RTC_GPIO7
  118. -
  119. * - GPIO27
  120. - ADC2_CH7
  121. - RTC_GPIO17
  122. -
  123. * - GPIO32
  124. - ADC1_CH4
  125. - RTC_GPIO9
  126. -
  127. * - GPIO33
  128. - ADC1_CH5
  129. - RTC_GPIO8
  130. -
  131. * - GPIO34
  132. - ADC1_CH6
  133. - RTC_GPIO4
  134. - GPI
  135. * - GPIO35
  136. - ADC1_CH7
  137. - RTC_GPIO5
  138. - GPI
  139. * - GPIO36
  140. - ADC1_CH0
  141. - RTC_GPIO0
  142. - GPI
  143. * - GPIO37
  144. - ADC1_CH1
  145. - RTC_GPIO1
  146. - GPI
  147. * - GPIO38
  148. - ADC1_CH2
  149. - RTC_GPIO2
  150. - GPI
  151. * - GPIO39
  152. - ADC1_CH3
  153. - RTC_GPIO3
  154. - GPI
  155. .. note::
  156. - Strapping pin: GPIO0, GPIO2, GPIO5, GPIO12 (MTDI), and GPIO15 (MTDO) are strapping pins. For more infomation, please refer to `ESP32 datasheet <{IDF_TARGET_DATASHEET_EN_URL}>`_.
  157. - SPI0/1: GPIO6-11 and GPIO16-17 are usually connected to the SPI flash and PSRAM integrated on the module and therefore should not be used for other purposes.
  158. - JTAG: GPIO12-15 are usually used for inline debug.
  159. - GPI: GPIO34-39 can only be set as input mode and do not have software-enabled pullup or pulldown functions.
  160. - TXD & RXD are usually used for flashing and debugging.
  161. - ADC2: ADC2 pins cannot be used when Wi-Fi is used. So, if you are having trouble getting the value from an ADC2 GPIO while using Wi-Fi, you may consider using an ADC1 GPIO instead, which should solve your problem. For more details, please refer to :ref:`Hardware Limitations of ADC Continuous Mode <hardware_limitations_adc_continuous>` and :ref:`Hardware Limitations of ADC Oneshot Mode <hardware_limitations_adc_oneshot>`.
  162. - Please do not use the interrupt of GPIO36 and GPIO39 when using ADC or Wi-Fi and Bluetooth with sleep mode enabled. Please refer to `ESP32 ECO and Workarounds for Bugs <https://espressif.com/sites/default/files/documentation/eco_and_workarounds_for_bugs_in_esp32_en.pdf>`_ > Section 3.11 for the detailed description of the issue.
  163. ---