TFT_eSPI
TFT_eSPI copied to clipboard
It seems that IO19 of the ESP32 will be deinitialized after tft.init() ,even when TFT_MISO is defined as -1
Problem: When I use tft.init() after define TFT_MISO as -1, The pin 19 I have inited before can not be write normally IDE:PlatformIO TFT_eSPI library version: 2.5.43 Board package version: 6.5.0 Procesor: ESP-WROOM-u32 TFT driver: ST7789 Interface type: SPI
my User_Setup.h(unchanged part is not contained):
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
#define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_BL 33 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO -1 // Automatically assigned with ESP8266 if not defined
#define TFT_MOSI 23 // Automatically assigned with ESP8266 if not defined
#define TFT_SCLK 22 // Automatically assigned with ESP8266 if not defined
#define TFT_MISO -1
#define TFT_MOSI 23
#define TFT_SCLK 22
#define TFT_CS 21 // Chip select control pin
#define TFT_DC 13 // Data Command control pin
#define TFT_RST 32 // Reset pin (could connect to RST pin)
my code:
TFT_eSPI tft1 = TFT_eSPI();
void setup() {
pinMode(19, OUTPUT);
digitalWrite(19, LOW);
// tft1.init();
}
void loop() {
digitalWrite(19, HIGH);
delay(1000);
digitalWrite(19, LOW);
delay(1000);
}
if I define MISO as IO5, the IO5 which connect to my led also can not be writed. if i uncomment “tft1.init();”,the output of IO9 will always 3.3V, but if it is commented, then the output voltage will oscillate normally between 3.3V and 0V. I speculate this is because the ST7789 configuration test was not performed on the ESP32 (as mentioned in the comment, this setting was only tested on ILI9341), or is because define as -1 is not the right to ignore MISO pin.
Now I have a temporary solution, which is to move the initialization of IO19 to after tft.init() is executed. Then everything runs perfectly