| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833 |
- GPIO & RTC GPIO
- ===============
- Overview
- --------
- .. only:: esp32
- 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. The table below provides more information on pin usage, and please note the comments in the table for GPIOs with restrictions.
- .. list-table::
- :header-rows: 1
- :widths: 8 12 12 20
- * - GPIO
- - Analog Function
- - RTC GPIO
- - Comments
- * - GPIO0
- - ADC2_CH1
- - RTC_GPIO11
- - Strapping pin
- * - GPIO1
- -
- -
- - TXD
-
- * - GPIO2
- - ADC2_CH2
- - RTC_GPIO12
- - Strapping pin
-
- * - GPIO3
- -
- -
- - RXD
-
- * - GPIO4
- - ADC2_CH0
- - RTC_GPIO10
- -
-
- * - GPIO5
- -
- -
- - Strapping pin
-
- * - GPIO6
- -
- -
- - SPI0/1
-
- * - GPIO7
- -
- -
- - SPI0/1
-
- * - GPIO8
- -
- -
- - SPI0/1
-
- * - GPIO9
- -
- -
- - SPI0/1
-
- * - GPIO10
- -
- -
- - SPI0/1
-
- * - GPIO11
- -
- -
- - SPI0/1
-
- * - GPIO12
- - ADC2_CH5
- - RTC_GPIO15
- - Strapping pin; JTAG
-
- * - GPIO13
- - ADC2_CH4
- - RTC_GPIO14
- - JTAG
-
- * - GPIO14
- - ADC2_CH6
- - RTC_GPIO16
- - JTAG
-
- * - GPIO15
- - ADC2_CH3
- - RTC_GPIO13
- - Strapping pin; JTAG
-
- * - GPIO16
- -
- -
- - SPI0/1
-
- * - GPIO17
- -
- -
- - SPI0/1
-
- * - GPIO18
- -
- -
- -
-
- * - GPIO19
- -
- -
- -
- * - GPIO20
- -
- -
- - This pin is only available on ESP32-PICO-V3 chip package
-
- * - GPIO21
- -
- -
- -
-
- * - GPIO22
- -
- -
- -
-
- * - GPIO23
- -
- -
- -
-
- * - GPIO25
- - ADC2_CH8
- - RTC_GPIO6
- -
-
- * - GPIO26
- - ADC2_CH9
- - RTC_GPIO7
- -
-
- * - GPIO27
- - ADC2_CH7
- - RTC_GPIO17
- -
-
- * - GPIO32
- - ADC1_CH4
- - RTC_GPIO9
- -
-
- * - GPIO33
- - ADC1_CH5
- - RTC_GPIO8
- -
-
- * - GPIO34
- - ADC1_CH6
- - RTC_GPIO4
- - GPI
-
- * - GPIO35
- - ADC1_CH7
- - RTC_GPIO5
- - GPI
-
- * - GPIO36
- - ADC1_CH0
- - RTC_GPIO0
- - GPI
-
- * - GPIO37
- - ADC1_CH1
- - RTC_GPIO1
- - GPI
-
- * - GPIO38
- - ADC1_CH2
- - RTC_GPIO2
- - GPI
-
- * - GPIO39
- - ADC1_CH3
- - RTC_GPIO3
- - GPI
- .. note::
- - Strapping pin: GPIO0, GPIO2, GPIO5, GPIO12 (MTDI), and GPIO15 (MTDO) are strapping pins. For more infomation, please refer to `ESP32 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_.
- - 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.
- - JTAG: GPIO12-15 are usually used for inline debug.
- - GPI: GPIO34-39 can only be set as input mode and do not have software-enabled pullup or pulldown functions.
- - TXD & RXD are usually used for flashing and debugging.
- - ADC2: ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead, that should solve your problem. For more details, please refer to `ADC limitations <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html#adc-limitations>`_.
- .. only:: esp32s2
- 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.
- The table below provides more information on pin usage, and please note the comments in the table for GPIOs with restrictions.
- .. list-table::
- :header-rows: 1
- :widths: 8 12 12 20
- * - GPIO
- - Analog Function
- - RTC GPIO
- - Comment
-
- * - GPIO0
- -
- - RTC_GPIO0
- - Strapping pin
-
- * - GPIO1
- - ADC1_CH0
- - RTC_GPIO1
- -
-
- * - GPIO2
- - ADC1_CH1
- - RTC_GPIO2
- -
-
- * - GPIO3
- - ADC1_CH2
- - RTC_GPIO3
- -
-
- * - GPIO4
- - ADC1_CH3
- - RTC_GPIO4
- -
-
- * - GPIO5
- - ADC1_CH4
- - RTC_GPIO5
- -
-
- * - GPIO6
- - ADC1_CH5
- - RTC_GPIO6
- -
-
- * - GPIO7
- - ADC1_CH6
- - RTC_GPIO7
- -
-
- * - GPIO8
- - ADC1_CH7
- - RTC_GPIO8
- -
-
- * - GPIO9
- - ADC1_CH8
- - RTC_GPIO9
- -
-
- * - GPIO10
- - ADC1_CH9
- - RTC_GPIO10
- -
-
- * - GPIO11
- - ADC2_CH0
- - RTC_GPIO11
- -
-
- * - GPIO12
- - ADC2_CH1
- - RTC_GPIO12
- -
-
- * - GPIO13
- - ADC2_CH2
- - RTC_GPIO13
- -
-
- * - GPIO14
- - ADC2_CH3
- - RTC_GPIO14
- -
-
- * - GPIO15
- - ADC2_CH4
- - RTC_GPIO15
- -
-
- * - GPIO16
- - ADC2_CH5
- - RTC_GPIO16
- -
-
- * - GPIO17
- - ADC2_CH6
- - RTC_GPIO17
- -
-
- * - GPIO18
- - ADC2_CH7
- - RTC_GPIO18
- -
-
- * - GPIO19
- - ADC2_CH8
- - RTC_GPIO19
- -
-
- * - GPIO20
- - ADC2_CH9
- - RTC_GPIO20
- -
-
- * - GPIO21
- -
- - RTC_GPIO21
- -
-
- * - GPIO26
- -
- -
- - SPI0/1
-
- * - GPIO27
- -
- -
- - SPI0/1
-
- * - GPIO28
- -
- -
- - SPI0/1
-
- * - GPIO29
- -
- -
- - SPI0/1
-
- * - GPIO30
- -
- -
- - SPI0/1
-
- * - GPIO31
- -
- -
- - SPI0/1
-
- * - GPIO32
- -
- -
- - SPI0/1
-
- * - GPIO33
- -
- -
- -
-
- * - GPIO34
- -
- -
- -
-
- * - GPIO35
- -
- -
- -
-
- * - GPIO36
- -
- -
- -
-
- * - GPIO37
- -
- -
- -
-
- * - GPIO38
- -
- -
- -
-
- * - GPIO39
- -
- -
- - JTAG
-
- * - GPIO40
- -
- -
- - JTAG
-
- * - GPIO41
- -
- -
- - JTAG
-
- * - GPIO42
- -
- -
- - JTAG
-
- * - GPIO43
- -
- -
- -
-
- * - GPIO44
- -
- -
- -
-
- * - GPIO45
- -
- -
- - Strapping pin
-
- * - GPIO46
- -
- -
- - GPI;Strapping pin
- .. note::
- - Strapping pin: GPIO0, GPIO45 and GPIO46 are strapping pins. For more infomation, please refer to `ESP32-S2 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf>`_
- - SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses.
- - JTAG: GPIO39-42 are usually used for inline debug.
- - GPI: GPIO46 is fixed to pull-down and is input only.
- .. only:: esp32c3
- 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.
- The table below provides more information on pin usage, and please note the comments in the table for GPIOs with restrictions.
- .. list-table::
- :header-rows: 1
- :widths: 12 12 22
-
- * - GPIO
- - Analog Function
- - Comment
-
- * - GPIO0
- - ADC1_CH0
- - RTC
-
- * - GPIO1
- - ADC1_CH1
- - RTC
-
- * - GPIO2
- - ADC1_CH2
- - Strapping pin;RTC
-
- * - GPIO3
- - ADC1_CH3
- - RTC
-
- * - GPIO4
- - ADC1_CH4
- - RTC
-
- * - GPIO5
- - ADC2_CH0
- - RTC
-
- * - GPIO6
- -
- -
-
- * - GPIO7
- -
- -
-
- * - GPIO8
- -
- - Strapping pin
-
- * - GPIO9
- -
- - Strapping pin
-
- * - GPIO10
- -
- -
-
- * - GPIO11
- -
- -
-
- * - GPIO12
- -
- - SPI0/1
-
- * - GPIO13
- -
- - SPI0/1
-
- * - GPIO14
- -
- - SPI0/1
-
- * - GPIO15
- -
- - SPI0/1
-
- * - GPIO16
- -
- - SPI0/1
-
- * - GPIO17
- -
- - SPI0/1
-
- * - GPIO18
- -
- - USB-JTAG
-
- * - GPIO19
- -
- - USB-JTAG
-
- * - GPIO20
- -
- -
-
- * - GPIO21
- -
- -
- .. note::
- - Strapping pin: GPIO2, GPIO8 and GPIO9 are strapping pins. For more infomation, please refer to `ESP32-C3 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf>`_.
- - SPI0/1: GPIO12-17 are usually used for SPI flash and PSRAM and not recommended for other uses.
- - USB-JTAG: 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.
- - RTC: GPIO0-5 can be used when in deep sleep.
- .. only:: esp32s3
- 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.
- The table below provides more information on pin usage, and please note the comments in the table for GPIOs with restrictions.
- .. list-table::
- :header-rows: 1
- :widths: 8 12 12 20
- * - GPIO
- - Analog Function
- - RTC GPIO
- - Comment
-
- * - GPIO0
- -
- - RTC_GPIO0
- - Strapping pin
-
- * - GPIO1
- - ADC1_CH0
- - RTC_GPIO1
- -
-
- * - GPIO2
- - ADC1_CH1
- - RTC_GPIO2
- -
-
- * - GPIO3
- - ADC1_CH2
- - RTC_GPIO3
- - Strapping pin
-
- * - GPIO4
- - ADC1_CH3
- - RTC_GPIO4
- -
-
- * - GPIO5
- - ADC1_CH4
- - RTC_GPIO5
- -
-
- * - GPIO6
- - ADC1_CH5
- - RTC_GPIO6
- -
-
- * - GPIO7
- - ADC1_CH6
- - RTC_GPIO7
- -
-
- * - GPIO8
- - ADC1_CH7
- - RTC_GPIO8
- -
-
- * - GPIO9
- - ADC1_CH8
- - RTC_GPIO9
- -
-
- * - GPIO10
- - ADC1_CH9
- - RTC_GPIO10
- -
-
- * - GPIO11
- - ADC2_CH0
- - RTC_GPIO11
- -
-
- * - GPIO12
- - ADC2_CH1
- - RTC_GPIO12
- -
-
- * - GPIO13
- - ADC2_CH2
- - RTC_GPIO13
- -
-
- * - GPIO14
- - ADC2_CH3
- - RTC_GPIO14
- -
-
- * - GPIO15
- - ADC2_CH4
- - RTC_GPIO15
- -
-
- * - GPIO16
- - ADC2_CH5
- - RTC_GPIO16
- -
-
- * - GPIO17
- - ADC2_CH6
- - RTC_GPIO17
- -
-
- * - GPIO18
- - ADC2_CH7
- - RTC_GPIO18
- -
-
- * - GPIO19
- - ADC2_CH8
- - RTC_GPIO19
- - USB-JTAG
-
- * - GPIO20
- - ADC2_CH9
- - RTC_GPIO20
- - USB-JTAG
-
- * - GPIO21
- -
- - RTC_GPIO21
- -
-
- * - GPIO26
- -
- -
- - SPI0/1
-
- * - GPIO27
- -
- -
- - SPI0/1
-
- * - GPIO28
- -
- -
- - SPI0/1
-
- * - GPIO29
- -
- -
- - SPI0/1
-
- * - GPIO30
- -
- -
- - SPI0/1
-
- * - GPIO31
- -
- -
- - SPI0/1
-
- * - GPIO32
- -
- -
- - SPI0/1
-
- * - GPIO33
- -
- -
- - SPI0/1
-
- * - GPIO34
- -
- -
- - SPI0/1
-
- * - GPIO35
- -
- -
- - SPI0/1
-
- * - GPIO36
- -
- -
- - SPI0/1
-
- * - GPIO37
- -
- -
- - SPI0/1
-
- * - GPIO38
- -
- -
- -
-
- * - GPIO39
- -
- -
- -
-
- * - GPIO40
- -
- -
- -
-
- * - GPIO41
- -
- -
- -
-
- * - GPIO42
- -
- -
- -
-
- * - GPIO43
- -
- -
- -
-
- * - GPIO44
- -
- -
- -
-
- * - GPIO45
- -
- -
- - Strapping pin
-
- * - GPIO46
- -
- -
- - Strapping pin
-
- * - GPIO47
- -
- -
- -
-
- * - GPIO48
- -
- -
- -
- .. Note::
- - Strapping pin: GPIO0, GPIO3, GPIO45 and GPIO46 are strapping pins.
- - SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses. When using Octal Flash or Octal PSRAM or both, GPIO33~37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore on ESP32-S3R8 / ESP32-S3R8V board GPIO33~37 are also not recommended for other uses.
- - USB-JTAG: 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.
- .. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
- 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:
- .. list::
- - In deep sleep
- :SOC_ULP_SUPPORTED: - The :doc:`Ultra Low Power co-processor <../../api-guides/ulp>` is running
- - Analog functions such as ADC/DAC/etc are in use.
- Application Example
- -------------------
- GPIO output and input interrupt example: :example:`peripherals/gpio/generic_gpio`.
- API Reference - Normal GPIO
- ---------------------------
- .. include-build-file:: inc/gpio.inc
- .. include-build-file:: inc/gpio_types.inc
- .. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
- API Reference - RTC GPIO
- ------------------------
- .. include-build-file:: inc/rtc_io.inc
- .. include-build-file:: inc/rtc_io_types.inc
|