ESP32 Deep Dive · #14 of 20
ESP32 Pins: Strapping Pins, Input-Only, Boot Traps
Pin Configuration Gotchas
Why it matters
ESP32 pins have special functions. Using the wrong pin can prevent booting, cause unreliable behavior, or damage the chip.
The idea
Strapping Pins
Some pins are sampled at boot to configure the ESP32:- GPIO0: Boot mode (LOW = download mode, HIGH = normal boot)
- GPIO2: Boot configuration
- GPIO12: Flash voltage (LOW = 3.3V, HIGH = 1.8V)
- GPIO15: Boot configuration
<h3>Input-Only Pins</h3>
GPIO34–39 are <strong>input-only</strong>:
<ul>
<li>Cannot be configured as outputs</li>
<li>No internal pull-ups/pull-downs</li>
<li>Must use <strong>external</strong> pull-up/down resistors</li>
<li>Good for: ADC inputs, sensor inputs</li>
</ul>
<h3>Safe GPIO Pins</h3>
These pins are generally safe for general-purpose use:
<ul>
<li><strong>GPIO4, 5, 16, 17, 18, 19</strong>: Safe for I/O</li>
<li><strong>GPIO21, 22</strong>: Default I²C (but can be remapped)</li>
<li><strong>GPIO25, 26</strong>: Safe for I/O</li>
</ul>
<h3>Boot Traps</h3>
Common mistakes:
<ul>
<li>Button on GPIO0 → ESP32 won't boot normally</li>
<li>Output on input-only pin → doesn't work, no error</li>
<li>Pull-up on GPIO12 → wrong flash voltage → boot failure</li>
</ul>
Demo
Pin configuration is critical but not visual. Review this before designing your circuit.
Key takeaways
- Strapping pins (GPIO0, 2, 12, 15) affect boot — use carefully
- GPIO34–39 are input-only — no outputs, no internal pull-ups
- Always check pin functions before using them
- Use safe GPIO pins (4, 5, 16–19, 21, 22, 25, 26) for general I/O
Going deeper
ESP32 pin functions are documented in the datasheet. For production designs, create a pin assignment table that documents each pin’s function and any constraints. Use GPIO0 for boot mode selection only if you need to enter download mode frequently. For most projects, avoid strapping pins entirely.
Math details
Pin current limits:
GPIO source: ~40mA max
GPIO sink: ~28mA max
Total chip current: ~600mA (check datasheet for your variant)
Pin voltage levels:
Input HIGH: > 2.4V (0.7 × VDD)
Input LOW: < 0.8V (0.3 × VDD)
Output HIGH: ~3.0V (VDD - 0.3V)
Output LOW: < 0.1V