Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.79k stars 1.09k forks source link

can not run TFT009-81AINN using ST7735S driver #1695

Closed smarq8 closed 2 years ago

smarq8 commented 2 years ago

Hello I prototype some board with TFT009-81AINN display, it use ST7735 controller, pin1 tied to VCC for 4 wire spi, I already fixed missing connection at pin12 (backlight). I tried any tc parameter for tft.ini(tc) without succes. I also check signals by osciloscope and it seems fine. My MCU - ESP32-WROOM-32D. Any solution what I'm missing or does this library support it? Also does it metter if TFT_RES is connected to IO5 (pwm at boot)? Its reasaon why I put delay(1000).

main.cpp

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

TFT_eSPI tft;
void setup(){
    Serial.begin(2000000);
    delay(1000);
    tft.init();
    tft.setRotation(1); // not yet sure
    tft.fillCircle(15,15,10,tft.color24to16(0xff0000));
}

void loop(){
    Serial.printf("%u\n",millis());
    tft.fillCircle(15,15,10,tft.color24to16(0xff0000));
    delay(200);
}

config:

#define ST7735_DRIVER  // Generic driver for common displays
#define TFT_WIDTH  160 // before rotation
#define TFT_HEIGHT 80
// #define ST7735_INITB
// #define ST7735_GREENTAB
// #define ST7735_GREENTAB2
// #define ST7735_GREENTAB3
// #define ST7735_GREENTAB128    // For 128 x 128 display
// #define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
// #define ST7735_REDTAB
// #define ST7735_BLACKTAB
// #define ST7735_REDTAB160x80   // For 160 x 80 display with 24 pixel offset

const int VMOSI_PIN = 23;
const int VMISO_PIN = 19;
const int VSCLK_PIN = 18;

#define TFT_BL   22            // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO VMISO_PIN
#define TFT_MOSI VMOSI_PIN
#define TFT_SCLK VSCLK_PIN
#define TFT_CS   16  // Chip select control pin
#define TFT_DC   4   // Data Command control pin
#define TFT_RST  5  // Reset pin (could connect to RST pin)

screenshot 1646930184 screenshot 1646930196 screenshot 1646931075

smarq8 commented 2 years ago

I think I found issue. It was cold solder joint on a connector between MCU and display on SCLK line. Also I provide here working setup:

main.cpp

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

TFT_eSPI tft;
void setup(){
    Serial.begin(2000000);
    tft.init();
    tft.setRotation(1);
    tft.fillScreen(tft.color24to16(0x000000));

}

void loop(){
    tft.setCursor(10,10);
    tft.setTextSize(2);
    tft.printf("hello world\n%u",millis());
    tft.fillCircle(10,50,10,tft.color24to16(0xff0000));
    tft.drawRect(1,1,160-2,80-2,tft.color24to16(0x0000ff));
    Serial.printf("%u\n",millis());
    delay(1000);
}
#define ST7735_DRIVER
#define TFT_WIDTH  80
#define TFT_HEIGHT 160
#define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 offset)
#define TFT_INVERSION_ON
#define TFT_RGB_ORDER TFT_BGR

#define TFT_BL   22            // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO VMISO_PIN
#define TFT_MOSI VMOSI_PIN
#define TFT_SCLK VSCLK_PIN
#define TFT_CS   16  // Chip select control pin
#define TFT_DC   4   // Data Command control pin
#define TFT_RST  5  // Reset pin (could connect to RST pin)
#define SPI_FREQUENCY       27000000 // 40MHz begin to glitch