Hi, I tried to use a ST7789 SPI 320*240 lcd screen on ESP32-P4 with Arduino TFT_eSPI and Adafruit ST7735 and ST7789 Library, and found they both don't work on ESP32-P4.
After some testing, I found the software SPI mode in Adafruit T7789 Library works good on ESP32-P4 but with very slow speed,
and it also works good with ESP32-IDF framwork's esp_lcd component with hardware SPI.
It just doesn't work with the Arduino's hardware SPI on ESP32-P4.
The Arduino core that I used is lastest 3.2.0.
Finally I found that, the same simple code below lights up the ST7789 LCD with messy colors on ESP32-S3/ESP32-C3, but not work on ESP32-P4 with only a black backlighted screen.
// Works on ESP32 S3/C3 with hardware SPI
pinMode(TFT_CS, OUTPUT);
pinMode(TFT_DC, OUTPUT);
pinMode(TFT_RST, OUTPUT);
digitalWrite(TFT_CS, HIGH); // Chip select high (Inactive)
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
digitalWrite(TFT_RST, HIGH);// NO Reset
SPI.begin(TFT_SCLK, TFT_MISO, TFT_MOSI, -1);
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
digitalWrite(TFT_RST, HIGH);
delay(200);
digitalWrite(TFT_RST, LOW);
delay(20);
digitalWrite(TFT_RST, HIGH);
delay(200);
// Sleep out
GPIO.out_w1tc.val = (1 << TFT_CS);
GPIO.out1_w1tc.val = (1 << (TFT_DC - 32));
*_spi_mosi_dlen = 7;
*_spi_w = ST7789_SLPOUT;
*_spi_cmd = SPI_UPDATE;
while(*_spi_cmd & SPI_UPDATE);
*_spi_cmd = SPI_USR;
while(*_spi_cmd & SPI_USR);
GPIO.out1_w1ts.val = (1 << (TFT_DC - 32));
GPIO.out_w1ts.val = (1 << TFT_CS);
delay(120);
// Display on
GPIO.out_w1tc.val = (1 << TFT_CS);
GPIO.out1_w1tc.val = (1 << (TFT_DC - 32));
*_spi_mosi_dlen = 7;
*_spi_w = ST7789_DISPON;
*_spi_cmd = SPI_UPDATE;
while(*_spi_cmd & SPI_UPDATE);
*_spi_cmd = SPI_USR;
while(*_spi_cmd & SPI_USR);
GPIO.out1_w1ts.val = (1 << (TFT_DC - 32));
GPIO.out_w1ts.val = (1 << TFT_CS);
delay(120);
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
My pin Settings on ESP32-P4
It works good with esp_lcd component in IDF framework but not work with Arduino framework.
#define TFT_MOSI 29
#define TFT_SCLK 30
#define TFT_CS 28
#define TFT_DC 49
#define TFT_BL 23
#define TFT_RST 50
#define TFT_MISO -1
#define ST7789_DRIVER
#define TFT_RGB_ORDER TFT_BGR
#define TFT_WIDTH 240
#define TFT_HEIGHT 320
Any suggestions will be appreciated. I just want to use TFT_eSPI library for all
my LCDs on ESP32 C3/S3/C6/P4 with the same code.