Xinyuan-LilyGO / LilyGO-T-ETH-Series

165 stars 64 forks source link

Use Display with T-ETH-Lite-ESP32S3 #84

Open Queequack opened 1 week ago

Queequack commented 1 week ago

Hi,

I use the T-ETH-Lite-ESP32S3. Later I would like to equip it with the PoE Shiled. I use VSCode and I adapted the platformio.ini as describet here. I also found some User-Setups for the used Library TFT_eSPI for the ETH_Lite_ESP32 and the ETH_Pro_ESP32.

Before I implement LVGL, I want to get the display running with TFT-eSPI.

I wonder if there is a user setup for the ETH-Lite-ESP32S3 or if there are any restrictions.

I have successfully tested the ETH-Lite-ESP32S3 with an ILI9488 in 8Bit parallel mode. I am currently trying in vain to get it to work in 4-line SPI mode with this ST7796. The background LEDs work. The display lights up white. When I upload code, it flickers a little during runtime. The code is not executed, the RGB LED does not flash as expected (it flashes when I do not connect the display).

My test application uses a SK6812 RGB LED on GPIO 38 to test my code. Other than that, the code contains nothing other than a simple test with TFT_eSPI.

Regards

Setup is (FPC left, controller right): 1 (GND) --> GND 2 (A) --> +3.3V 3 (K) --> GND (later dimmable via transistor) 4 (VCC) --> +3.3V 5 (IM0) --> +3.3V (for 4-line SPI) 6 (IM1) --> +3.3V (for 4-line SPI) 7 (IM2) --> +3.3V (for 4-line SPI) 8 (RESET) --> +3.3V via 10k resistor 9 to 31 --> not connected 32 (SDA) --> GPIO6 (MOSI, bus write data signal) 33 (RD) --> +3.3V 34 (WR) --> GPIO7 (SCL/SCK, bus clock signal) 35 (RS) --> GPIO4 (DC, data or command) 36 (CS) --> GPIO5 (Chip Select) 37 to 40 --> not connected

(#define TFT_RST -1 the used User_Setup.h)

#include <Arduino.h>
#include <TFT_eSPI.h>
#include <FastLED.h>

// ################## Display ##################
TFT_eSPI tft = TFT_eSPI();
// #############################################

// ############### LED ###############
CRGB rgbLed[1];
bool ledState = true;
unsigned long lastTime = 0;
unsigned long blinkTime = 1000;
// #############################################

bool timerExpired(unsigned long, unsigned long);

TFT_eSPI tft = TFT_eSPI();
void setup()
{
  // ################## Display ##################
  tft.init();
  tft.setRotation(1);
  tft.fillScreen(TFT_BLACK);
  tft.setCursor(0,0,4);
  tft.setTextColor(TFT_WHITE);
  tft.println ("Hello World!");
  // #############################################

  // ############### LED ###############
  FastLED.addLeds<SK6812, 38, GRB>(rgbLed, 1);
  FastLED.setBrightness(50);
  rgbLed[0] = CRGB::Green; FastLED.show();
  ledState = true;
  // #############################################
}

void loop() 
{
  // ############### LED ###############
  if (timerExpired(lastTime, blinkTime))
  {
    lastTime = millis();
    if(ledState) { rgbLed[0] = CRGB::Black; FastLED.show(); ledState = false; }
    else         { rgbLed[0] = CRGB::Green; FastLED.show(); ledState = true;  }
  }
  // #############################################
}

bool timerExpired(unsigned long last, unsigned long del)
{
  if (millis() - last >= del) return true;
  return false;
}
lewisxhe commented 1 week ago

I can only say that there is no limit to the GPIO you use, but I can't answer you why the screen doesn't light up, because I don't have it and can't test it.