5.2 KiB
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)
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:
-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
- Visit: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.3
- Look for "Pin Mapping" or "Schematic" section
- Find ST7789 display connections
- Update
src/display_init.cppwith correct pins
Method 2: Check Board Schematic
If you have the schematic PDF:
- Look for ST7789 or display controller section
- Trace ESP32-S3 GPIO connections to:
- SPI SCLK (Serial Clock)
- SPI MOSI (Data)
- DC (Data/Command)
- CS (Chip Select)
- RST (Reset)
- BL (Backlight)
- Update pins in code
Method 3: Try Example Code
- Download Waveshare's Arduino examples
- Find display initialization code
- Extract pin numbers from their configuration
- 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)
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)
SCLK: GPIO 12
MOSI: GPIO 11
DC: GPIO 8
CS: GPIO 9
RST: GPIO 14
BL: GPIO 2
Alternative Configuration C
SCLK: GPIO 18
MOSI: GPIO 23
DC: GPIO 27
CS: GPIO 5
RST: GPIO 33
BL: GPIO 32
Testing Pin Configuration
Quick Test Procedure
-
Upload firmware with current pins
-
Check serial monitor for:
[DisplayInit] Initializing display... [DisplayInit] Display initialized: 240x240 -
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:
- Verify backlight pin (should see faint glow if correct)
- Check reset pin (incorrect reset = no init)
- 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:
- Reduce SPI frequency in
display_init.cpp:cfg.freq_write = 40000000; // Try 40MHz instead of 80MHz - Verify SCLK and MOSI pins
- Check DC pin assignment
Symptom: Display Works but Backlight Off
Possible causes:
- Wrong BL pin
- Backlight polarity inverted
Try:
- Change backlight pin
- Toggle invert flag:
cfg.invert = true; // Try opposite value
Updating Pin Configuration
To change pins, edit src/display_init.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:
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:
- Updating this file with confirmed working configuration
- Adding your board variant to "Common ESP32-S3-LCD Variants" section
- Documenting any special notes or gotchas
Last Updated: 2025-11-08 Status: Pins need verification against actual hardware