gpio.rst 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. GPIO & RTC GPIO
  2. ===============
  3. Overview
  4. --------
  5. .. only:: esp32
  6. The {IDF_TARGET_NAME} chip features 34 physical GPIO pads. Some GPIO pads cannot be used or do not have the corresponding pin on the chip package. 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>`__]. Each pad can be used as a general purpose I/O or can be connected to an internal peripheral signal.
  7. - Note that GPIO6-11 are usually used for SPI flash.
  8. - GPIO34-39 can only be set as input mode and do not have software pullup or pulldown functions.
  9. .. only:: esp32s2
  10. The {IDF_TARGET_NAME} chip features 43 physical GPIO pads. Some GPIO pads cannot be used or do not have the corresponding pin on the chip package. 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>`__]. Each pad can be used as a general purpose I/O or can be connected to an internal peripheral signal.
  11. - Note that GPIO26-32 are usually used for SPI flash.
  12. - GPIO46 is fixed to pull-down and is input only
  13. .. only:: esp32c3
  14. The {IDF_TARGET_NAME} chip features 22 physical GPIO pads. Some GPIO pads cannot be used or do not have the corresponding pin on the chip package. 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>`__]. Each pad can be used as a general purpose I/O or can be connected to an internal peripheral signal.
  15. - Note that GPIO12-17 are usually used for SPI flash.
  16. - Note that GPIO 18 and 19 are used by USB-JTAG by default. In order to use them as GPIOs, USB-JTAG will be disabled by the drivers.
  17. - {IDF_TARGET_NAME} doesn't have separate "RTC GPIO" support. However, GPIO0-5 keep the rtc feature, which can be used for power-management and analog subsystem.
  18. .. only:: esp32s3
  19. The {IDF_TARGET_NAME} chip features 45 physical GPIO pads. Some GPIO pads cannot be used or do not have the corresponding pin on the chip package. 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>`__]. Each pad can be used as a general purpose I/O or can be connected to an internal peripheral signal.
  20. - Note that GPIO26-32 are usually used for SPI flash.
  21. - Note that GPIO 19 and 20 are used by USB-JTAG by default. In order to use them as GPIOs, USB-JTAG will be disabled by the drivers.
  22. - Note that when using SPI eight-line mode, GPIO33~37 are connected to IO4~IO7 and DQS. On ESP32-S3R8 / ESP32-S3R8V board GPIO33~37 are not recommended for other uses.
  23. .. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
  24. There is also separate "RTC GPIO" support, which functions when GPIOs are routed to the "RTC" low-power and analog subsystem. These pin functions can be used when:
  25. .. list::
  26. - In deep sleep
  27. :SOC_ULP_SUPPORTED: - The :doc:`Ultra Low Power co-processor <../../api-guides/ulp>` is running
  28. - Analog functions such as ADC/DAC/etc are in use.
  29. Application Example
  30. -------------------
  31. GPIO output and input interrupt example: :example:`peripherals/gpio/generic_gpio`.
  32. API Reference - Normal GPIO
  33. ---------------------------
  34. .. include-build-file:: inc/gpio.inc
  35. .. include-build-file:: inc/gpio_types.inc
  36. .. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
  37. API Reference - RTC GPIO
  38. ------------------------
  39. .. include-build-file:: inc/rtc_io.inc
  40. .. include-build-file:: inc/rtc_io_types.inc