This commit is contained in:
2026-09-21 10:28:35 +02:00
commit b6fb01ba73
54 changed files with 33982 additions and 0 deletions
+218
View File
@@ -0,0 +1,218 @@
# Pin Configuration Guide
**⚠️ IMPORTANT**: The pin assignments in `src/display_init.cpp` are educated guesses based on common ESP32-S3-LCD-1.3 configurations. You **MUST** verify these against your actual board schematic before uploading firmware.
## Current Pin Assignments
These pins are configured in `src/display_init.cpp` in the `LGFX` class constructor:
### SPI Display Pins (ST7789VW)
```cpp
cfg.pin_sclk = 10; // SPI Clock
cfg.pin_mosi = 11; // SPI MOSI (Master Out Slave In)
cfg.pin_dc = 8; // Data/Command select
cfg.pin_cs = 9; // Chip Select
cfg.pin_rst = 14; // Reset
cfg.pin_bl = 15; // Backlight PWM control
```
### Future UART Pins (Phase 2)
Defined in `platformio.ini` build flags:
```ini
-DUART_RX_PIN=44 // UART receive from Controller A
-DUART_TX_PIN=43 // UART transmit (unused in RX-only mode)
```
## How to Verify Pin Assignments
### Method 1: Check Waveshare Wiki
1. Visit: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.3
2. Look for "Pin Mapping" or "Schematic" section
3. Find ST7789 display connections
4. Update `src/display_init.cpp` with correct pins
### Method 2: Check Board Schematic
If you have the schematic PDF:
1. Look for ST7789 or display controller section
2. Trace ESP32-S3 GPIO connections to:
- SPI SCLK (Serial Clock)
- SPI MOSI (Data)
- DC (Data/Command)
- CS (Chip Select)
- RST (Reset)
- BL (Backlight)
3. Update pins in code
### Method 3: Try Example Code
1. Download Waveshare's Arduino examples
2. Find display initialization code
3. Extract pin numbers from their configuration
4. Apply to this project
## Common ESP32-S3-LCD Variants
Different vendors may use different pinouts. Here are some known configurations:
### ✅ VERIFIED - Waveshare ESP32-S3-LCD-1.3 (Official from Demo Code)
```cpp
SCLK: GPIO 40 ✅ VERIFIED
MOSI: GPIO 41 ✅ VERIFIED
MISO: GPIO -1 (not connected)
DC: GPIO 38 ✅ VERIFIED
CS: GPIO 39 ✅ VERIFIED
RST: GPIO 42 ✅ VERIFIED
BL: GPIO 20 ✅ VERIFIED - From official demo code!
```
**Source**: ESP32-S3-LCD-1.3-Demo/Arduino/libraries/TFT_eSPI/User_Setup.h
**Status**: This configuration has been applied to the code and uploaded.
### Alternative Configuration B (if above doesn't work)
```cpp
SCLK: GPIO 12
MOSI: GPIO 11
DC: GPIO 8
CS: GPIO 9
RST: GPIO 14
BL: GPIO 2
```
### Alternative Configuration C
```cpp
SCLK: GPIO 18
MOSI: GPIO 23
DC: GPIO 27
CS: GPIO 5
RST: GPIO 33
BL: GPIO 32
```
## Testing Pin Configuration
### Quick Test Procedure
1. **Upload firmware with current pins**
2. **Check serial monitor for**:
```
[DisplayInit] Initializing display...
[DisplayInit] Display initialized: 240x240
```
3. **Visual check**:
- Display should show black circle outline
- Text should read "ESP32-S3", "LCD 1.3", "Phase 1"
- If blank/corrupted, pins are likely wrong
### Debugging Display Issues
#### Symptom: Completely Blank Display
**Possible causes**:
- Wrong CS (Chip Select) pin
- Wrong RST (Reset) pin
- Wrong BL (Backlight) pin
- Power supply issue
**Try**:
1. Verify backlight pin (should see faint glow if correct)
2. Check reset pin (incorrect reset = no init)
3. Verify chip select (incorrect CS = no communication)
#### Symptom: Garbled/Random Pixels
**Possible causes**:
- Wrong SCLK or MOSI pins
- Wrong DC (Data/Command) pin
- SPI frequency too high
**Try**:
1. Reduce SPI frequency in `display_init.cpp`:
```cpp
cfg.freq_write = 40000000; // Try 40MHz instead of 80MHz
```
2. Verify SCLK and MOSI pins
3. Check DC pin assignment
#### Symptom: Display Works but Backlight Off
**Possible causes**:
- Wrong BL pin
- Backlight polarity inverted
**Try**:
1. Change backlight pin
2. Toggle invert flag:
```cpp
cfg.invert = true; // Try opposite value
```
## Updating Pin Configuration
To change pins, edit `src/display_init.cpp`:
```cpp
// Around line 20-30, in LGFX constructor
// SPI bus pins
cfg.pin_sclk = YOUR_SCLK_PIN;
cfg.pin_mosi = YOUR_MOSI_PIN;
cfg.pin_dc = YOUR_DC_PIN;
// Panel control pins
cfg.pin_cs = YOUR_CS_PIN;
cfg.pin_rst = YOUR_RST_PIN;
// Backlight pin
cfg.pin_bl = YOUR_BL_PIN;
```
Save, rebuild, and upload:
```bash
pio run --target upload
```
## GPIO Constraints on ESP32-S3
### Safe GPIOs for General Use
These are generally safe for SPI/display:
- GPIO 1-21 (most are OK)
- GPIO 33-48 (some restrictions)
### GPIOs to AVOID
- **GPIO 0**: Boot mode select (use with caution)
- **GPIO 3**: JTAG (conflicts if debugging enabled)
- **GPIO 19-20**: USB D-/D+ (if using USB)
- **GPIO 26-32**: Used for PSRAM on some modules
- **GPIO 45-46**: Boot strapping pins
## References
- **ESP32-S3 Datasheet**: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf (Table: GPIO Matrix and IO MUX)
- **Waveshare Wiki**: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.3
- **LovyanGFX Examples**: https://github.com/lovyan03/LovyanGFX/tree/master/examples
## Help Needed?
If you successfully identify the correct pins for your board, please consider:
1. Updating this file with confirmed working configuration
2. Adding your board variant to "Common ESP32-S3-LCD Variants" section
3. Documenting any special notes or gotchas
---
**Last Updated**: 2025-11-08
**Status**: Pins need verification against actual hardware