374 lines
8.3 KiB
Markdown
374 lines
8.3 KiB
Markdown
# ESP32-S3-LCD-1.3 Troubleshooting Guide
|
|
|
|
## Issue: No Serial Output
|
|
|
|
### Solution: USB CDC Timing
|
|
|
|
The ESP32-S3 uses **USB CDC (native USB)** for serial communication. The code now includes proper USB CDC initialization:
|
|
|
|
```cpp
|
|
// Wait for USB CDC to be ready
|
|
while (!Serial && (millis() - start_wait < 3000)) {
|
|
delay(100);
|
|
}
|
|
```
|
|
|
|
### Quick Upload and Monitor
|
|
|
|
Use the helper script:
|
|
```bash
|
|
./upload_and_monitor.sh
|
|
```
|
|
|
|
Or manually:
|
|
```bash
|
|
pio run --target upload && sleep 2 && pio device monitor
|
|
```
|
|
|
|
**Important**: The 2-second delay after upload allows the ESP32-S3 to reset before monitoring starts.
|
|
|
|
### Verify Baud Rate Matches
|
|
|
|
Both are set to **115200 baud**:
|
|
- `platformio.ini`: `monitor_speed = 115200`
|
|
- `main.cpp`: `Serial.begin(115200)`
|
|
|
|
If you still see no output, try:
|
|
```bash
|
|
# Monitor with explicit baud rate
|
|
pio device monitor --baud 115200
|
|
|
|
# Or use screen/minicom
|
|
screen /dev/ttyACM0 115200
|
|
```
|
|
|
|
---
|
|
|
|
## Issue: Blank/Black Display - No Output
|
|
|
|
### Most Common Cause: Incorrect Backlight Pin
|
|
|
|
**Problem**: The display backlight is likely on GPIO **2**, not GPIO 15.
|
|
|
|
**Solution**: The code has been updated in `src/display_init.cpp` (line 64) to use:
|
|
```cpp
|
|
cfg.pin_bl = 2; // GPIO2 for Waveshare ESP32-S3-LCD boards
|
|
```
|
|
|
|
### Current Pin Configuration (Updated)
|
|
|
|
Based on similar Waveshare ESP32-S3-LCD boards (ESP32-S3-LCD-1.28):
|
|
|
|
```cpp
|
|
SCLK: GPIO 10 // SPI Clock
|
|
MOSI: GPIO 11 // SPI Data Out
|
|
MISO: GPIO 12 // SPI Data In (not used by display)
|
|
DC: GPIO 8 // Data/Command
|
|
CS: GPIO 9 // Chip Select
|
|
RST: GPIO 14 // Reset
|
|
BL: GPIO 2 // ⭐ BACKLIGHT (most critical for visibility!)
|
|
```
|
|
|
|
---
|
|
|
|
## Diagnostic Steps
|
|
|
|
### Step 1: Check Serial Output
|
|
|
|
Upload the firmware and monitor the serial port:
|
|
|
|
```bash
|
|
pio run --target upload && pio device monitor
|
|
```
|
|
|
|
**Expected output:**
|
|
```
|
|
=================================
|
|
ESP32-S3-LCD-1.3 - Controller B
|
|
Phase 1: Display Initialization
|
|
=================================
|
|
|
|
CPU Frequency: 240 MHz
|
|
Free Heap: 327680 bytes
|
|
[DisplayInit] Initializing display...
|
|
[DisplayInit] Display initialized: 240x240
|
|
[DisplayInit] LVGL initialized
|
|
[UI] Initializing SquareLine Studio UI...
|
|
[UI] SquareLine Studio UI initialized
|
|
[LVGL Task] Started on Core 1
|
|
|
|
[UI Debug] Checking SquareLine UI components:
|
|
ui_Home_Screen: 0x3fcXXXXX
|
|
ui_Main_Container: 0x3fcXXXXX
|
|
ui_Home_LBL: 0x3fcXXXXX
|
|
uic_Home_LBL: 0x3fcXXXXX
|
|
✓ uic_Home_LBL exists!
|
|
```
|
|
|
|
### Step 2: Check Physical Display
|
|
|
|
**What to look for:**
|
|
|
|
1. **Completely black screen** = Likely backlight issue (GPIO 2)
|
|
- Check backlight pin configuration
|
|
- Try toggling `cfg.invert` in backlight config
|
|
|
|
2. **Faint image visible when shining light on it** = Backlight is definitely off
|
|
- Backlight pin is wrong
|
|
- Try GPIO 2, GPIO 15, or GPIO 21
|
|
|
|
3. **White/colored static or noise** = Communication issue
|
|
- Check SCLK, MOSI, DC pins
|
|
- Reduce SPI frequency from 80MHz to 40MHz
|
|
|
|
4. **Partial display or corruption** = Timing/frequency issue
|
|
- Reduce SPI frequency
|
|
- Check power supply stability
|
|
|
|
### Step 3: Verify Backlight
|
|
|
|
Add this test code in `setup()` after `DisplayInit::init()`:
|
|
|
|
```cpp
|
|
// Test backlight directly
|
|
pinMode(2, OUTPUT);
|
|
digitalWrite(2, HIGH); // Turn on backlight
|
|
Serial.println("[Test] Backlight should be ON");
|
|
```
|
|
|
|
If the display lights up, GPIO 2 is correct!
|
|
|
|
### Step 4: Check LVGL Warnings
|
|
|
|
Monitor for these common LVGL issues:
|
|
|
|
```
|
|
[Warn] lv_tick_inc() is not called ✓ FIXED - tick handler implemented
|
|
[Error] lv_disp_flush_ready not called = Display flush callback issue
|
|
[Error] Out of memory = Reduce LVGL_MEM_SIZE in lv_conf.h
|
|
```
|
|
|
|
---
|
|
|
|
## Common Fixes
|
|
|
|
### Fix 1: Wrong Backlight Pin
|
|
|
|
**File**: `src/display_init.cpp` (line 64)
|
|
|
|
Try these pins in order:
|
|
```cpp
|
|
cfg.pin_bl = 2; // ⭐ Most likely
|
|
cfg.pin_bl = 15; // Alternative 1
|
|
cfg.pin_bl = 21; // Alternative 2
|
|
cfg.pin_bl = 45; // Alternative 3
|
|
```
|
|
|
|
### Fix 2: Inverted Backlight
|
|
|
|
**File**: `src/display_init.cpp` (line 65)
|
|
|
|
```cpp
|
|
cfg.invert = true; // Change from false to true
|
|
```
|
|
|
|
Some boards use inverted backlight control.
|
|
|
|
### Fix 3: Lower SPI Frequency
|
|
|
|
**File**: `src/display_init.cpp` (line 18)
|
|
|
|
```cpp
|
|
cfg.freq_write = 40000000; // Try 40MHz instead of 80MHz
|
|
```
|
|
|
|
### Fix 4: Display Color Inversion
|
|
|
|
**File**: `src/display_init.cpp` (line 52)
|
|
|
|
```cpp
|
|
cfg.invert = false; // Try toggling between true/false
|
|
```
|
|
|
|
### Fix 5: Display Rotation
|
|
|
|
**File**: `src/display_init.cpp` (line 102)
|
|
|
|
```cpp
|
|
display.setRotation(0); // Try 0, 1, 2, or 3
|
|
```
|
|
|
|
---
|
|
|
|
## Verification Tests
|
|
|
|
### Test 1: LovyanGFX Direct Draw (Before LVGL)
|
|
|
|
Add this in `DisplayInit::init()` after `display.init()`:
|
|
|
|
```cpp
|
|
// Test pattern - should show immediately
|
|
display.fillScreen(TFT_RED);
|
|
delay(1000);
|
|
display.fillScreen(TFT_GREEN);
|
|
delay(1000);
|
|
display.fillScreen(TFT_BLUE);
|
|
delay(1000);
|
|
display.fillScreen(TFT_WHITE);
|
|
delay(1000);
|
|
```
|
|
|
|
**If you see colors**: Display hardware works, issue is in LVGL integration.
|
|
**If still blank**: Display pin configuration is wrong.
|
|
|
|
### Test 2: Backlight PWM Test
|
|
|
|
```cpp
|
|
// Test backlight brightness control
|
|
for (int brightness = 0; brightness <= 255; brightness += 5) {
|
|
display.setBrightness(brightness);
|
|
delay(50);
|
|
}
|
|
```
|
|
|
|
**If brightness changes**: Backlight works!
|
|
**If no change**: Wrong backlight pin.
|
|
|
|
### Test 3: SPI Communication Test
|
|
|
|
Check if SPI is working:
|
|
|
|
```cpp
|
|
// In setup(), after display.init()
|
|
uint16_t id = display.readCommand16(0x04); // Read display ID
|
|
Serial.printf("[Test] Display ID: 0x%04X\n", id);
|
|
```
|
|
|
|
**Expected**: Should return ST7789 ID (0x7C89 or similar)
|
|
**If 0x0000 or 0xFFFF**: SPI communication failed (check SCLK, MOSI, CS pins)
|
|
|
|
---
|
|
|
|
## Pin Configuration Matrix
|
|
|
|
Try these configurations if the default doesn't work:
|
|
|
|
### Configuration A (Current - Waveshare Standard)
|
|
```cpp
|
|
SCLK=10, MOSI=11, DC=8, CS=9, RST=14, BL=2
|
|
```
|
|
|
|
### Configuration B (Alternative Backlight)
|
|
```cpp
|
|
SCLK=10, MOSI=11, DC=8, CS=9, RST=14, BL=15
|
|
```
|
|
|
|
### Configuration C (Different SPI Pins)
|
|
```cpp
|
|
SCLK=18, MOSI=23, DC=27, CS=5, RST=33, BL=2
|
|
```
|
|
|
|
### Configuration D (ESP32-S3-DevKit Standard)
|
|
```cpp
|
|
SCLK=12, MOSI=11, DC=13, CS=10, RST=9, BL=2
|
|
```
|
|
|
|
---
|
|
|
|
## Serial Debug Commands
|
|
|
|
Add these to your code for runtime diagnostics:
|
|
|
|
```cpp
|
|
// In loop(), check for serial commands
|
|
if (Serial.available()) {
|
|
char cmd = Serial.read();
|
|
|
|
switch (cmd) {
|
|
case '1':
|
|
display.fillScreen(TFT_RED);
|
|
Serial.println("Red screen");
|
|
break;
|
|
case '2':
|
|
display.fillScreen(TFT_GREEN);
|
|
Serial.println("Green screen");
|
|
break;
|
|
case '3':
|
|
display.fillScreen(TFT_BLUE);
|
|
Serial.println("Blue screen");
|
|
break;
|
|
case 'b':
|
|
display.setBrightness(255);
|
|
Serial.println("Backlight MAX");
|
|
break;
|
|
case 'd':
|
|
display.setBrightness(0);
|
|
Serial.println("Backlight OFF");
|
|
break;
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Hardware Checks
|
|
|
|
### 1. Power Supply
|
|
- Verify 5V USB power is stable
|
|
- Check if board LED is lit
|
|
- Measure voltage on 3.3V pin (should be 3.2-3.4V)
|
|
|
|
### 2. Display Connection
|
|
- Ensure display is seated properly (if removable)
|
|
- Check for physical damage
|
|
- Look for broken solder joints
|
|
|
|
### 3. ESP32-S3 Status
|
|
- Verify boot messages on serial (if using USB CDC)
|
|
- Check if board boots normally
|
|
- Confirm PSRAM is detected
|
|
|
|
---
|
|
|
|
## If Nothing Works
|
|
|
|
### Last Resort: Factory Test Mode
|
|
|
|
1. Download Waveshare official demo code:
|
|
```bash
|
|
wget https://files.waveshare.com/wiki/ESP32-S3-LCD-1.3/ESP32-S3-LCD-1.3-Demo.zip
|
|
unzip ESP32-S3-LCD-1.3-Demo.zip
|
|
```
|
|
|
|
2. Check their pin configuration in the demo code
|
|
|
|
3. Test with their demo to confirm hardware works
|
|
|
|
4. Compare their pins to our configuration
|
|
|
|
### Get Help
|
|
|
|
If the display still doesn't work:
|
|
|
|
1. **Schematic**: Download from https://files.waveshare.com/wiki/ESP32-S3-LCD-1.3/ESP32S3_1.3inch.pdf
|
|
2. **Datasheet**: https://files.waveshare.com/wiki/ESP32-S3-LCD-1.3/1.3inch_LCD_Module_ESP32S3.pdf
|
|
3. **Waveshare Support**: support@waveshare.com
|
|
4. **Community**: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.3#Resources
|
|
|
|
---
|
|
|
|
## Success Checklist
|
|
|
|
Once display is working, you should see:
|
|
|
|
- ✅ SquareLine Studio UI appears
|
|
- ✅ `uic_Home_LBL` label is visible
|
|
- ✅ Text updates every second
|
|
- ✅ No LVGL warnings in serial monitor
|
|
- ✅ Smooth rendering (30+ FPS)
|
|
|
|
---
|
|
|
|
**Last Updated**: 2025-11-08
|
|
**Status**: Backlight pin updated to GPIO 2 (most likely correct)
|