In the previous post, we looked in detail at the different pins of the ESP32, as well as their specific functions and utilities.
However, as with the ESP8266, not all of the ESP32 pins are equally safe to use in our projects.
This is because some pins perform specific roles or participate in the device boot process. Incorrectly using these pins can cause conflicts that may prevent your project from working, or even break something.
If you are using an ESP32-S3, you have a similar summary in this post Which pins can I use on an ESP32-S3
Summary of pins
Therefore, it is very useful to have a reference table that provides clear and precise information about which pins are safe to use and which have specific functions.
I advise you to have this table on hand and consult it before starting a project with an ESP32, to avoid surprises from using a pin that should not be used.
GPIO | NAME | FUNCTIONS | YOU CAN USE IT |
---|---|---|---|
0 | IO0 | GPIO0, ADC2_CH1, TOUCH_CH1, Boot | ⚠️Pulled-UP. Must be HIGH at boot. Must be LOW for flashing. Generates PWM at boot |
1 | TX | GPIO1, U0TXD | ❌Pin TX. Debug output at boot |
2 | IO2 | GPIO2, ADC2_CH2, TOUCH_CH2 | ⚠️Must be floating or LOW for flashing. Connected to LED |
3 | RX | GPIO3, U0RXD | ❌Pin RX. HIGH at boot |
4 | IO4 | GPIO4, ADC2_CH0, TOUCH_CH0 | ✔️ |
5 | IO5 | GPIO5 | ⚠️Must be HIGH at boot. Generates PWM signal at boot |
6 | CLK | GPIO6 | ❌FLASH SPI |
7 | D0 | GPIO7 | ❌FLASH SPI |
8 | D1 | GPIO8 | ❌FLASH SPI |
9 | D2 | GPIO9 | ❌FLASH SPI |
10 | D3 | GPIO10 | ❌FLASH SPI |
11 | CMD | GPIO11 | ❌FLASH SPI |
12 | IO12 | GPIO12, ADC2_CH5, TOUCH_CH5, MTDI | ⚠️Must be LOW at boot Debug JTAG |
13 | IO13 | GPIO13, ADC2_CH4, TOUCH_CH4, MTCK | 🟢Debug JTAG |
14 | IO14 | GPIO14, ADC2_CH6, TOUCH_CH6, MTMS | ⚠️Generates PWM signal at boot Debug JTAG |
15 | IO15 | GPIO15, ADC2_CH3, TOUCH_CH3, MTDO | ⚠️Must be HIGH at boot Debug JTAG |
16 | IO16 | GPIO16 | ✔️ |
17 | IO17 | GPIO17 | ✔️ |
18 | IO18 | GPIO18 | ✔️ |
19 | IO19 | GPIO19 | ✔️ |
21 | IO21 | GPIO21 | ✔️ |
22 | IO22 | GPIO22 | ✔️ |
23 | IO23 | GPIO23 | ✔️ |
25 | IO25 | GPIO25, ADC1_CH8, DAC_1 | ✔️ |
26 | IO26 | GPIO26, ADC2_CH9, DAC_2 | ✔️ |
27 | IO27 | GPIO27, ADC2_CH7, TOUCH_CH7 | ✔️ |
32 | IO32 | GPIO32, ADC1_CH4, TOUCH_CH9, XTAL_32K_P | ✔️ |
33 | IO33 | GPIO33, ADC1_CH5, TOUCH_CH8, XTAL_32K_N | ✔️ |
34 | IO34 | GPIO34, ADC1_CH6, VDET_1 | ⚠️Input only |
35 | IO35 | GPIO35, ADC1_CH7, VDET_2 | ⚠️Input only |
36 | VP | GPIO36, ADC1_CH0, S_VP | ⚠️Input only |
37 | VP | GPIO37 | ⚠️Input only |
38 | VP | GPIO38 | ⚠️Input only |
39 | VN | GPIO39, ADC1_CH3, S_VN | ⚠️Input only |
EN | EN | CHIP_PU, Reset | ❌ |