75 lines
2.6 KiB
Markdown
75 lines
2.6 KiB
Markdown
# Programming Header Pinout
|
|
|
|
## Header J2 - 2x4 Programming Header (8 Pins)
|
|
|
|
Use this header to connect an external USB-to-Serial adapter (CP2102, CH340, FT232, etc.) for flashing the ESP32.
|
|
|
|
### Pinout (Top View)
|
|
|
|
```
|
|
┌─────────────┐
|
|
│ 1 2 3 4 │ ← Top row
|
|
│ 5 6 7 8 │ ← Bottom row
|
|
└─────────────┘
|
|
```
|
|
|
|
| Pin | Signal | ESP32 Connection | Description |
|
|
|-----|--------|------------------|-------------|
|
|
| 1 | +3V3 | +3V3 Power Rail | Optional - Power ESP32 from programmer |
|
|
| 2 | GND | GND | Ground reference |
|
|
| 3 | UART_TX | GPIO1 (UART TX) | ESP32 transmits to programmer |
|
|
| 4 | UART_RX | GPIO3 (UART RX) | ESP32 receives from programmer |
|
|
| 5 | DTR | GPIO0 | Data Terminal Ready (auto-reset for flashing) |
|
|
| 6 | RTS | EN | Request To Send (auto-reset for flashing) |
|
|
| 7 | NC | - | Not connected (spare) |
|
|
| 8 | NC | - | Not connected (spare) |
|
|
|
|
### Connection to USB-to-Serial Adapter
|
|
|
|
When connecting your USB-to-Serial adapter:
|
|
|
|
| Adapter Pin | J2 Pin | Signal |
|
|
|-------------|--------|--------|
|
|
| VCC | Pin 1 | +3V3 (optional - only if powering ESP32 from adapter) |
|
|
| GND | Pin 2 | GND |
|
|
| RX | Pin 3 | UART_TX (receives TX from ESP32) |
|
|
| TX | Pin 4 | UART_RX (sends to RX of ESP32) |
|
|
| DTR | Pin 5 | DTR (auto-reset) |
|
|
| RTS | Pin 6 | RTS (auto-reset) |
|
|
| - | Pin 7 | NC (spare) |
|
|
| - | Pin 8 | NC (spare) |
|
|
|
|
**Important Notes:**
|
|
- **Do NOT connect VCC** if your ESP32 is already powered from J1 (JST connector power input)
|
|
- **Always connect GND** - this is critical for proper operation
|
|
- **RX/TX are swapped** - Adapter RX goes to ESP32 TX, and vice versa
|
|
- **DTR and RTS** enable automatic reset during flashing (no need to press buttons)
|
|
|
|
### Optional Pull-up Resistors
|
|
|
|
For maximum reliability, add pull-up resistors:
|
|
- **R5**: 10kΩ between J2 Pin 5 (DTR) and +3V3
|
|
- **R6**: 10kΩ between J2 Pin 6 (RTS) and +3V3
|
|
|
|
Most USB-to-Serial adapters have built-in pull-ups, but adding them on the board ensures reliable operation.
|
|
|
|
### Flashing Process
|
|
|
|
1. Connect USB-to-Serial adapter to J2 header
|
|
2. Power the board (via J1 JST connector or J2 Pin 1)
|
|
3. Use `esptool` or ESPHome to flash:
|
|
```bash
|
|
esptool.py --port /dev/ttyUSB0 write_flash 0x0 firmware.bin
|
|
```
|
|
4. The DTR/RTS signals will automatically put ESP32 into boot mode
|
|
|
|
### Common USB-to-Serial Adapters
|
|
|
|
- **CP2102**: Common, reliable, good driver support
|
|
- **CH340**: Very common, cheap, good for Linux
|
|
- **FT232**: Premium option, excellent driver support
|
|
- **PL2303**: Older, less reliable
|
|
|
|
All of these will work with this header configuration.
|
|
|