|
| 1 | + |
| 2 | + |
| 3 | +# Pinouts & GPIO Pins # |
| 4 | + |
| 5 | +| ESP32 Pin | Analog | DAC/T | Serial | Function | Note | |
| 6 | +| --- | --- | --- | --- | --- | --- | --- | |
| 7 | +| GPIO0 | ADC2-1 | Touch-1 | | **NOT available**, used by Bootloader and PHY | Default **Pull-Up**. Bootloader Mode=0, Run Mode=1 | |
| 8 | +| GPIO1 | | | TX0 | **Available** if USB comm not used. USB TX.| On the ESP32-NodeMCU, this pin is used for the USB to Serial converter TX pin | |
| 9 | +| GPIO2 | ADC2-2 | Touch-2 | | **Available** if SD not used. SD Card. 47k PU| Default **Pull-Down**. Must be 0 to enter Bootloader Mode (when GPIO0=0). | |
| 10 | +| GPIO3 | | | RX0 | **Available** if USB comm not used. USB RX via jumper. | On the ESP32-NodeMCU, this pin is used for the USB to Serial converter RX pin | |
| 11 | +| GPIO4 | ADC2-0 | Touch-0 | | **Available** to user. | | |
| 12 | +| GPIO5 | | | VSPI-SS | **Available** by default, LED via Jumper | Default **Pull-up**, use to determine timing of SDIO Slave. | |
| 13 | +| GPIO12 | ADC2-5 | Touch-5 | MISO | **Available** to user. | **JTAG** TDI - Default **Pull-down**. If 1 at PU, sets flash = 1.8V, else standard 3.3V. **MUST be 0** at PU for 3.3V board! | |
| 14 | +| GPIO13 | ADC2-4 | Touch-4 | MOSI | **Available** to user. | **JTAG** TCK | |
| 15 | +| GPIO14 | ADC2-6 | Touch-6 | CLK | **Available** if SD not used.<br>SD Card.| **JTAG** TMS | |
| 16 | +| GPIO15 | ADC2-3 | Touch-3 | SS | **Available** if SD not used.<br>SD Card.| **JTAG** TDO - Default **Pull-up**. If 0 at PU, silences boot messages printed by the ROM bootloader.| |
| 17 | +| GPIO16 | | | RX2 | **Available** to user. | **NOT AVAILABLE** on Wrover, used for PSRAM CS ! | |
| 18 | +| GPIO17 | | | TX2 | **Available** to user. | **NOT AVAILABLE** on Wrover, used for PSRAM CLK ! | |
| 19 | +| GPIO18 | | | VSPI-CLK | **NOT available**, used by PHY | | |
| 20 | +| GPIO19 | | | VSPI-MISO | **NOT available**, used by PHY | | |
| 21 | +| GPIO21 | | | I2C-SDA | **NOT available**, used by PHY | | |
| 22 | +| GPIO22 | | | I2C-SCL | **NOT available**, used by PHY | | |
| 23 | +| GPIO23 | | | VSPI-MOSI | **NOT available**, used by PHY | | |
| 24 | +| GPIO25 | ADC2-8 | DAC 1 | | **NOT available**, used by PHY | | |
| 25 | +| GPIO26 | ADC2-9 | DAC 2 | | **NOT available**, used by PHY | | |
| 26 | +| GPIO27 | ADC2-7 | Touch-7 | | **NOT available**, used by PHY | | |
| 27 | +| GPIO32 | ADC1-4 | Touch-9 | | I2C SCL, can also be\\ **used for user I2C** | XTAL32 | |
| 28 | +| GPIO33 | ADC1-5 | Touch-8 | | I2C SCL, can also be\\ **used for user I2C** | XTAL32 | |
| 29 | +| GPIO34 | ADC1-6 | | | **Available** by default,\\ User Button via Jumper | **Input Only!** No PU or PW! | |
| 30 | +| GPIO35 | ADC1-7 | | | **Available** to user.\\ Input only | **Input Only!** No PU or PW! | |
| 31 | +| GPIO36 | ADC1-0 | | | **Available** to user.\\ Input only | **Input Only!** No PU or PW! | |
| 32 | +| GPIO39 | ADC1-3 | | | **Available** to user.\\ Input only | **Input Only!** No PU or PW! | |
| 33 | + |
| 34 | +## Other Pins that are not available ## |
| 35 | +| ESP32 Pin | Analog | DAC/T | Serial | NodeMCU | Wrover | Note | |
| 36 | +| --- | --- | --- | --- | --- | --- | --- | |
| 37 | +| GPIO6 | | | | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 38 | +| GPIO7 | | | | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 39 | +| GPIO8 | | | | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 40 | +| GPIO9 | | | RX1 | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 41 | +| GPIO10 | | | TX1 | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 42 | +| GPIO11 | | | | | N/A | **NOT AVAILABLE** used for SPI Flash Wrover/Wroom Modules | |
| 43 | +| GPIO16 | | | RX2 | | | **NOT AVAILABLE** on Wrover, used for PSRAM CS ! | |
| 44 | +| GPIO17 | | | TX2 | | | **NOT AVAILABLE** on Wrover, used for PSRAM CLK ! | |
| 45 | +| GPIO37 | | | | N/A | N/A | Pin is NOT available on NodeMCU and Wrover boards! | |
| 46 | +| GPIO38 | | | | N/A | N/A | Pin is NOT available on NodeMCU and Wrover boards! | |
| 47 | + |
| 48 | + |
| 49 | +## Input Only Pins: 34-39 ## |
| 50 | +Pins 34, 35, 36, 37, 38 and 39 cannot be configured as outputs, but they can be used as either digital inputs, analog inputs, or for other unique purposes. Also note that they do not have internal pull-up or pull-down resistors, like the other I/O pins. |
| 51 | + |
| 52 | +GPIO pins 36-39 are an integral part of the ultra low noise pre-amplifier for the ADC – they are wired up to 270pF capacitors, which help to configure the sampling time and noise of the pre-amp. |
| 53 | + |
| 54 | +## Pin Matrix ## |
| 55 | +The ESP32 has a pin matrix allowing any of the I/O pins to be assigned following peripherals: |
| 56 | + * 3 x SPI interfaces |
| 57 | + * 3 x UART interfaces |
| 58 | + * 2 x I2C interfaces |
| 59 | + * 2 x I2S interfaces |
| 60 | + * 16 x PWM outputs |
| 61 | + |
| 62 | +## ADC ## |
| 63 | +See ADC pins in table above. |
| 64 | + |
| 65 | +## UART ## |
| 66 | +The ESP32 has 3 UART interfaces (0,1 and 2), which provide asynchronous communication (RS232 and RS485) and IrDA support. |
| 67 | +Communication speed is up to 5 Mbps. All UARTs provides hardware management of the CTS and RTS signals and software flow |
| 68 | +control (XON and XOFF). All of the interfaces can be accessed by the DMA controller or directly by the CPU. |
| 69 | + |
| 70 | +## SPI, HSPI and VSPI ## |
| 71 | +The ESP32 has 4 SPI peripherals(SPI0, SPI1, HSPI and VSPI), of which 2(HSPI and VSPI) are available to the user. |
| 72 | + |
| 73 | +SPI Peripherals can be configured for slave and master modes in 1-line full-duplex and 1/2/4-line half-duplex communication modes. |
| 74 | +They support the following general-purpose SPI features: |
| 75 | + * Four timing modes of the SPI format transfer, which depend on the polarity (POL) and the phase (PHA) |
| 76 | + * up to 40 MHz and the divided clocks of 80 MHz |
| 77 | + * up to 64-byte FIFO |
| 78 | + * Each SPI can be served by DMA |
| 79 | + |
| 80 | +SPI0 and SPI1 are used for the external Flash, and are not available to the user! |
| 81 | +This leaves two SPI peripherals for general use, HSPI and VSPI. They have default pins(IOMUX pins), but can also be assigned to any other |
| 82 | +I/O pin using the Pin Matrix. When using the default pins, speeds up to 80MBits/sec is possible, where 40MBits/sec is the limit when |
| 83 | +using the pin matrix. For details, see [[https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/spi_master.html#gpio-matrix-and-iomux|this page]]. |
| 84 | + |
| 85 | +The default pins for HSPI are: |
| 86 | + * SS = GPIO 15 |
| 87 | + * CLK = GPIO 14 |
| 88 | + * MISO = GPIO 12 |
| 89 | + * MOSI = GPIO 13 |
| 90 | + |
| 91 | +The default pins for VSPI are: |
| 92 | + * SS = GPIO 5 |
| 93 | + * CLK = GPIO 18 |
| 94 | + * MISO = GPIO 19 |
| 95 | + * MOSI = GPIO 23 |
| 96 | + |
| 97 | +## I2C ## |
| 98 | +The ESP32 has two I2C bus interfaces which can serve as I2C master or slave, depending on the user’s configuration. |
| 99 | +The I2C interfaces support: |
| 100 | + * Standard mode (100 kbit/s) |
| 101 | + * Fast mode (400 kbit/s) |
| 102 | + * Up to 5 MHz, yet constrained by SDA pull-up strength |
| 103 | + * 7-bit/10-bit addressing mode |
| 104 | + * Dual addressing mode |
| 105 | +Users can program command registers to control I2C interfaces, so that they have more flexibility. |
| 106 | + |
| 107 | +## I2S ## |
| 108 | +Two standard I2S interfaces are available in ESP32. They can be operated in the master or slave mode, in full |
| 109 | +duplex and half-duplex communication modes, and can be configured to operate with an 8-/16-/32-/40-/48-bit |
| 110 | +resolution as input or output channels. BCK clock frequency, from 10 kHz up to 40 MHz, is supported. When one |
| 111 | +or both of the I2S interfaces are configured in the master mode, the master clock can be output to the external |
| 112 | +DAC/CODEC. |
| 113 | +Both of the I2S interfaces have dedicated DMA controllers. PDM and BT PCM interfaces are supported. |
| 114 | + |
| 115 | +## PWM ## |
| 116 | +The Pulse Width Modulation (PWM) controller can be used for driving digital motors and smart lights. The controller |
| 117 | +consists of PWM timers, the PWM operator and a dedicated capture sub-module. Each timer provides timing in |
| 118 | +synchronous or independent form, and each PWM operator generates a waveform for one PWM channel. The |
| 119 | +dedicated capture sub-module can accurately capture events with external timing. |
| 120 | + |
| 121 | +## LED PWM ## |
| 122 | +The LED PWM controller can generate 16 independent channels of digital waveforms with configurable periods |
| 123 | +and duties. The 16 channels of digital waveforms operate at 80 MHz APB clock, eight of which have the option of using the 8 |
| 124 | +MHz oscillator clock. Each channel can select a 20-bit timer with configurable counting range, while its accuracy |
| 125 | +of duty can be up to 16 bits within a 1 ms period. |
| 126 | +The software can change the duty immediately. Moreover, each channel supports step-by-step duty increasing or |
| 127 | +decreasing automatically, which makes it useful for the LED RGB color-gradient generator. |
| 128 | + |
| 129 | +## Touch Sensor ## |
| 130 | +The ESP32 has 10 capacitive sensing GPIOs. |
| 131 | + |
| 132 | +## Buttons and LEDs ## |
| 133 | +The following pins are used for Buttons and LEDs on common ESP32 based boards: |
| 134 | + |
| 135 | +## JTAG Pins ## |
| 136 | +Pins 12 to 15 are also used for JTAG functions. If JTAG debugging is required, these pins should be used in such a way that they will be |
| 137 | +available for the JTAG programmer/debugger. |
| 138 | + |
| 139 | +## ESP32 Strapping Pins ## |
| 140 | +**GPIO0**, **GPIO5** and **GPIO15** have pull-**up** resistors enabled during power up.\\ |
| 141 | +**GPIO2** and **GPIO12** have pull-**down** resistors enabled during power up.\\ |
| 142 | +These pull-up and pull-down resistors can be disabled via software once the device is running. |
| 143 | + |
| 144 | +The ESP32 will enter the serial bootloader when GPIO0 is held low on reset. Otherwise it will run the program in flash. |
| 145 | + |
| 146 | +GPIO0 has an internal pullup resistor, so if it is left unconnected then it will pull high. |
| 147 | + |
| 148 | +Many boards use a button marked "Flash" (or "BOOT" on some Espressif development boards) that pulls GPIO0 low when pressed. |
| 149 | + |
| 150 | +GPIO2 must also be either left unconnected/floating, or driven Low, in order to enter the serial bootloader. |
| 151 | + |
| 152 | +## EN(RST) Pin ## |
| 153 | +The EN pin is the 3.3V regulator’s enable pin. It’s pulled up, so connect to ground to disable the 3.3V regulator. This means that you can use |
| 154 | +this pin connected to a push button to restart your ESP32, for example. This pin does NOT go low during a software reset of the ESP32. |
0 commit comments