ESP32 + Waveshare 1.28" Touch LCD not working with LC-Relay-ESP32-2R-D5

Hi everyone,

I have been reading the forum for a while but this is my first post. I'm currently working on a project where I repurpose parts from a Senseo coffee machine and control them via an ESP32. The system is already fully functional using a web interface, but I also want to add an control option via a touch panel.

For this, I chose the Waveshare 1.28" Touch LCD (Wiki link). However, I am unable to get it working when using the LC-Relay-ESP32-2R-D5 module as my ESP32 board (Wiki-Link).

My wiring setup:

Module Pin  |	ESP32 Pin
VCC	5V
GND	GND
MISO	GPIO19 (VSPIQ)
MOSI	GPIO23 (VSPID)
SCLK	GPIO18 (VSPICLK)
LCS_CS	GPIO5 (VSPICS0)
LCS_DC	GPIO21
LCS_RST	GPIO17
LCS_BL	GPIO16
TP_SDA	GPIO21 (I2C SDA)
TP_SCL	GPIO22 (I2C SCL)
TP_INT	GPIO4
TP_RST	GPIO2

My test code:


#include <SPI.h>
#include <TFT_eSPI.h>

TFT_eSPI tft = TFT_eSPI();

void setup() {
    Serial.begin(115200);
    delay(1000);
    
    Serial.println("SPI-Test...");
    
    // Standard VSPI-Pins for ESP32
    SPI.begin(30, 31, 37, 28);  // SCLK, MISO, MOSI, CS
    delay(100);
    Serial.println("SPI started!");

    // Backlight activation
    pinMode(27, OUTPUT);
    digitalWrite(27, HIGH);

    // Initialize display
    tft.init();
    tft.setRotation(1);
    tft.fillScreen(TFT_RED);
    delay(1000);
    tft.fillScreen(TFT_GREEN);
    delay(1000);
    tft.fillScreen(TFT_BLUE);
    delay(1000);
}

void loop() {}

My User_Setups/Setup200_GC9A01.h configuration:

#define USER_SETUP_ID 200
#define GC9A01_DRIVER

#define TFT_MOSI 37
#define TFT_MISO 31
#define TFT_SCLK 30
#define TFT_CS    29
#define TFT_DC   33
#define TFT_RST  38

#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF
#define SMOOTH_FONT

#define SPI_FREQUENCY  27000000
#define SPI_READ_FREQUENCY  5000000

Issue:

Despite this setup, I cannot get the display to work. The screen remains blank, and I don’t see any output from the test code.
Questions:

  1. Is there an issue with the pin mapping when using the LC-Relay-ESP32-2R-D5 module?
  2. Could the SPI configuration in my code be incorrect?
  3. Where do I define the pins for the touch functions?
  4. Has anyone successfully used this display with an ESP32-based relay module like mine?

Any help would be greatly appreciated!

Is there a reason that gpios don't match?

One thing is the GPIOs, and the other is the corresponding number on the board.

Only gpio numbering matters here.

Also, If your board is like this, it only prints Gpio numbers...

thank you !
i fixed that in the setup200 and my testcode:

    SPI.begin(18, 19, 23, 5);  // SCLK, MISO, MOSI, CS

but when i upload it i got following error:

Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00063fff...
Compressed 24976 bytes to 15952...
Writing at 0x00001000... (100 %)

A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption.
Fehlgeschlagenes Hochladen: Hochladefehler: exit status 2

when i disconnect the lcd while uploading it works but then i got this error in a loop:

19:25:59.772 -> SPI-Test...
19:25:59.900 -> SPI gestartet!
19:26:00.774 -> ets Jul 29 2019 12:21:46
19:26:00.819 -> 
19:26:00.819 -> rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
19:26:00.819 -> configsip: 0, SPIWP:0xee
19:26:00.819 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:26:00.819 -> mode:DIO, clock div:1
19:26:00.819 -> load:0x3fff0030,len:4916


is this error maybe becaus i got the onboard-relais and led on gpio 16 ,gpio17 and a led on gpio 23? Wouldn't that be fatal since the GPIOs are designated for specific functions (e.g., MOSI, SCLK)?

At least don't use those relay pins on your display configuration.

26 and 27 would be better option.

Also, Gpio 2 connected might prevent upload.

1 Like

Thank you so much!
Its working

Nice!
It's not the easiest display to setup.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.