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.8k stars 1.09k forks source link

library not working with espressif32 esp32-s3 Arduino core > 2.0.14 #3329

Open Jason2866 opened 6 months ago

Jason2866 commented 6 months ago

Device crashes at boot. Open issue in Arduino repo https://github.com/espressif/arduino-esp32/issues/9618#issuecomment-2113344119 and https://github.com/Xinyuan-LilyGO/T-Dongle-S3/issues/26

thelastoutpostworkshop commented 6 months ago

I confirm, esp32-s3 reset under 2.0.16 (when init is called), when installing espressif arduino core 2.0.14 works fine

jfseaman commented 5 months ago

I confirm, under 2.0.14 it works for ESP32-C3, ESP32-S3. I did not test ESP32 but same code.

Under 2.0.15 and 2.0.16. Software reset breaks. Actual code from TFT_eSPI_ESP32.h TFT_eSPI_ESP32_xx.h is:

define SET_BUS_WRITE_MODE *_spi_user = SPI_USR_MOSI

and

define SET_BUS_WRITE_MODE *_spi_user = SPI_USR_MOSI | SPI_CK_OUT_EDGE

"Guru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled."

jfseaman commented 5 months ago

The issue persists under 2.0.17.

ats3788 commented 5 months ago

I use PlatformIO [env:my-esp32] platform = espressif32 @ 6.7.0 For further exploration of configuration options for the espressif32 development platform, refer to the documentation.

Supported Frameworks Arduino - v2.0.16 (based on IDF v4.4.7) ESP-IDF - v5.1.2 I don't even connect the ILI9341 to the board and it reboots

Rebooting... ␀�ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0xb (SPI_FAST_FLASH_BOOT) Saved PC:0x4202934a SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x4bc load:0x403c9700,len:0xbd8 load:0x403cc700,len:0x2a0c entry 0x403c98d0 [ 112][V][esp32-hal-uart.c:330] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(44) txPin(43) [ 121][V][esp32-hal-uart.c:416] uartBegin(): UART0 not installed. Starting installation [ 129][V][esp32-hal-uart.c:463] uartBegin(): UART0 initialization done. Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.

ats3788 commented 5 months ago

define TFT_ESPI_VERSION "2.5.43"

define ILI9341_DRIVER // Generic driver for common displays

define USER_SETUP_ID 70

// See SetupX_Template.h for all options available

define ILI9341_DRIVER

                // Typical board default pins - change to match your board

define TFT_CS 10 // 10 or 34 (FSPI CS0)

define TFT_MOSI 35 // 11 or 35 (FSPI D)

define TFT_SCLK 36 // 12 or 36 (FSPI CLK)

define TFT_MISO 37 // 13 or 37 (FSPI Q)

// Use pins in range 0-31

define TFT_DC 7

define TFT_RST 6

cmachsocket commented 5 months ago

i met the problem too. I use 2.0.17 and esp32s3,and the program will reboot when it run tft.init()

StuartsProjects commented 5 months ago

Same here too;

https://github.com/Bodmer/TFT_eSPI/issues/3346#issuecomment-2143324416

A program to transmer images over LoRa and display on a TFT was working on core 2.0.11, but stopped when I updgraded the core.

By going backwards with the cores I found the last one that worked was 2.0.14. For later core versions the program would crash on start.

ESP32S3, Arduino IDE 1.8.19.

youngsu999 commented 5 months ago

Hi there,

I'm suffering for same issue.

I found a clue on espressif32 Arduino fimeware.

the system reboots when call TFT_WRITE_BITS and i found out the macro uses the below defines

image

  #define _spi_cmd       (volatile uint32_t*)(SPI_CMD_REG(SPI_PORT))
  #define _spi_user      (volatile uint32_t*)(SPI_USER_REG(SPI_PORT))
  #define _spi_mosi_dlen (volatile uint32_t*)(SPI_MOSI_DLEN_REG(SPI_PORT))
  #define _spi_w         (volatile uint32_t*)(SPI_W0_REG(SPI_PORT))

the macros such as SPI_CMD_REG uses REG_SPI_BASE and the SPI ports are define as 0/1 (HSPI/VSPI)

#define SPI_CMD_REG(i)          (REG_SPI_BASE(i) + 0x0)

however, in the defintion on REG_SPI_BASE, it always returns Null address (because of (i) >=2 )

#define REG_SPI_BASE(i) (((i) >= 2) ? (DR_REG_SPI2_BASE + (i - 2) * 0x1000) : (0)) // GPSPI2 and GPSPI3

And i fix it as ->

#define REG_SPI_BASE(i) (((i) <= 2) ? (DR_REG_SPI2_BASE + (i - 2) * 0x1000) : (0)) // GPSPI2 and GPSPI3

Then it stops to reboot.

However, the macro was stuck in following lines.

image

Anyone can figure out why?


  1. espressif arduino firmware seems to have bugs.
  2. I have no idea why the macro stuck on while in the macro.

Thanks.

gitboysimon commented 5 months ago

I also have this issue, device re-starts continuously on tft.init() Was previously using platform espressif32 6.5.0 and framework 2.0.14 on new pc I now have 6.7.0 and 2.0.16, I reverted to platform = espessif32@6.5.0 and and it's ok with 2.0.16

Kolodieiev commented 5 months ago

Temporary solution.

#define USE_HSPI_PORT

#define TFT_DC 15
#define TFT_CS 7
#define TFT_MOSI 17 // sda
#define TFT_SCLK 18 // dcl
#define TFT_RST -1 // TFT reset pin connect to RST

// Позбутися помилки: піни не визначенні для HSPI_PORT
#define TFT_MISO 8 
SergePD commented 5 months ago

define USE_HSPI_PORT

Yes, It works for me (esp32S3)

thelastoutpostworkshop commented 5 months ago

define USE_HSPI_PORT

Works for me also in the device setup header file. thanks

PhilG1300 commented 5 months ago

For my ESP32S3 adding #define USE_HSPI_PORT in the variants/esp32s3/pins_arduino.h file in ESP32 version 3.0.1 works too. Had to make other changes for the backlight control as ledc... functions have changed in version 3. Thanks for the suggestion as I thought I was stuck on version 2.0.14

jfseaman commented 5 months ago

define USE_HSPI_PORT Yes, It works for me (esp32S3)

I am working from a Volos Projects GC9A01 example. I just like his clock face. His code uses a GFXglyph.

I tried defining HSPI and using the latest 3.01 from Espressif. The number of defines lost/forgotten renders code uncompilable. Basically every TFT_xxx define is lost. The GFXglyph typdef is lost.

I have common code that is running on ESP32S3DevKit1, Adafruit QT Py S3 and XAIO ESP32C3.

Board definitions after 2.0.14 just don't work. Compiler is broken so bad it is unusable.

bolkedebruin commented 5 months ago

Seeing the issue here as well, but defining USE_HSPI_PORT is not working.

jack-changyan commented 5 months ago

I also see this problem here. I also define USE_HSPI_PORT and it doesn't work.

JooJooBee666 commented 4 months ago

I have the same problem. The #define USE_HSPI_PORT seems to work for me, or rolling espressif back to 6.6.0.

I'm using IL9341 with Touch Screen in latest TFT_eSPI on a ESP32-S3 N16R8 (enabling or disabling the PSRAM has no effect). The screen has an SDCard reader but I'm not using it. This happens on a base scetch with nothing else in it except for the TFT_eSPI import, the SPI.h import and tft.begin() in the setup so it's clearly some issue with a change made in the espressif framework. Here's my backtrace:

/home/deadlink/Arduino/projects/PlatformIO/SHTC3Testing/.pio/libdeps/esp32-s3-n16r8/TFT_eSPI/TFT_eSPI.cpp:81
/home/deadlink/Arduino/projects/PlatformIO/SHTC3Testing/.pio/libdeps/esp32-s3-n16r8/TFT_eSPI/TFT_eSPI.cpp:692
/home/deadlink/Arduino/projects/PlatformIO/SHTC3Testing/.pio/libdeps/esp32-s3-n16r8/TFT_eSPI/TFT_eSPI.cpp:603
/home/deadlink/Arduino/projects/PlatformIO/SHTC3Testing/src/main.cpp:35 (discriminator 1)
/home/deadlink/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42

Basically pointing back to the writecommand method that @youngsu999 mentioned earlier.

jfseaman commented 4 months ago

I managed to adapt code to the esp32 3.0.x Arduino IDE board definitions. Many things have changed.

Setting USE_HSPI_PORT works for all ESP32S3.

Does not work for ESP32C3.

jfseaman commented 4 months ago

I replaced all my ESP32C3 with ESP32S3.

Now able to use ESP32 board definitions 3.0.2 in Arduino-IDE with USE_HSPI_PORT.

A few dollars and hours and hours of diag for no gain other than current IDE.

xhy2008 commented 3 months ago

The #define USE_HSPI_PORT worked for me,but I'm worried that it will slow down the display.

confusedMech commented 3 months ago

Same here, When I use #define USE_HSPI_PORT the ESP32-S3 stops crashing but then im unable to use an external SD card. Going back to platformio Espressif version 6.6.0 allows everything to function properly.

oet-oet commented 2 months ago

define USE_HSPI_PORT

当前时间20240818,所有库都用当前最新版,使用这个宏定义,就好使了

Rollmops67 commented 2 months ago

Hello from France ! I was becoming crazy after updating the arduino core for ESP32 from 2.0.14 to 3.0.4 on the Arduino IDE (1.8.19) After that one of my projects (using Bodmer's last TFT_eSPI library) booted without end at restart, after compiling without errors. The ESP32S3 is a LilyGo T7-S3. I reverted than back the Arduino Core for Arduino version after version ( 3.0.4 > 3.0.3 ...... > 2.0.17 > 2.0.16 > 2.0.15 > 2.0.14) and it worked again with 2.0.14. So after doing a search on google I found this tread (and others)... At least I now know where the problem is. For me too Kolodieiev's temporary solution works (thank you !), albeit it's just a workaround... And of course a big thank you to Jason2866 !

Programing is a neverending story...

Roland

khvolk commented 2 months ago

I run into the same problem: Guru Meditation Error (What does this mean. Are the people kidding?):

XIAO ESP32-C3 st7789 240x240 Arduino IDE 2.3.2 ESP32 Core 3.0.4

Setting USE_HSPI_PORT was no solution for me.

Downgrading to 2.0.14 worked for me. Does somebody working on solving this issue?

florinbaciuu commented 2 months ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

jfseaman commented 2 months ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

You have made it work for ESP32-C3 under core 3.0.4 Arduino IDE?

What config?

ChassaB commented 1 month ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

That is great. I would love the User_Config flies for the Lily-T_Display - S3 and the ESP32S3dev-n16r8 with an ili9341 2.8 display

Mehdow commented 1 month ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

Same here, I would love to have your platformio.ini and user_config files for T-Display S3, as 'm stuck in a "StoreProhibited" never-ending error regarding heap (funniest part is that the same code works perfectly with an arduino nano esp32....). Not sure if it's the same issue that everyone here has but I'm desperate to know how to proceed

florinbaciuu commented 1 month ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

You have made it work for ESP32-C3 under core 3.0.4 Arduino IDE?

What config?

Tonight I will try to attach a display or two to the c3 boards have and do some tests. I will come back with information later about the C3.

florinbaciuu commented 1 month ago

Hello everyone. I tested this library (V2.5.43) on the following boards

Lilygo-T-Display-S3 ( parallel ) Lilygo-T-HMI (S3) ( parallel ) Lilygo-T-QTPro-S3 ( USE_FSPI_PORT) Lilygo-T-Dongle-S3 ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32S3dev-n16r8 with an ili9341 2.8 display ( USE_FSPI_PORTand USE_HSPI_PORT) ESP32dev-n4 with an ili9341 2.8 display ( without SPI define and with USE_HSPI_PORT)

with Arduino Core 3.0.4 and 3.0.3 in platformio and Arduino IDE and even in ESPIDF with arduino-as-component. The library works perfectly, I even used it together with the GUISlice library and everything was perfect except for the fact that I had to rewrite the code for touch(it has nothing to do with the problem), some having XPT2046(spi) (shared bus and separate bus) and others having cst816 (i2c) controller )... On some I had to put USE_HSPI_PORT(ESP32S3dev-n16r8 with ili9341), on others I had to put USE_FSPI_PORT(Lilygo-T-QTPro-S3) and on others it worked with every setup i tried. I can provide you the User_Config files for each board and I can even test on many esp32 variants. I own esp32, s2, s3, c3, c6 in various flavors and models.

That is great. I would love the User_Config flies for the Lily-T_Display - S3 and the ESP32S3dev-n16r8 with an ili9341 2.8 display

Sure: -THIS IS THE CODE FOR LILYGOTDISPLAYS3:

#define USER_SETUP_ID 4000 // just put what you want 

#define ST7789_DRIVER // lilygo-t-display-s3
////#define ST7789_2_DRIVER
#define INIT_SEQUENCE_3 // Using this initialisation sequence improves the display image

#define CGRAM_OFFSET // lilygo-t-display-s3

/* Colour order Red-Green-Blue */
#define TFT_RGB_ORDER TFT_RGB // lilygo-t-display-s3
/* Colour order Blue-Green-Red */
////#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red

#define TFT_INVERSION_ON // lilygo-t-display-s3
////#define TFT_INVERSION_OFF

#define TFT_PARALLEL_8_BIT // lilygo-t-display-s3

#define TFT_WIDTH 170
#define TFT_HEIGHT 320

#define TFT_RST 5
#define TFT_CS 6 // Not connected
#define TFT_DC 7
#define TFT_WR 8
#define TFT_RD 9

#define TFT_D0 39
#define TFT_D1 40
#define TFT_D2 41
#define TFT_D3 42
#define TFT_D4 45
#define TFT_D5 46
#define TFT_D6 47
#define TFT_D7 48

#define TFT_BL 38
#define TFT_BACKLIGHT_ON HIGH // lilygo-t-display-s3

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

Also for this board i use a init function for ST7789 display. Just call this function from setup after the tft.init(); This is the code :

typedef struct
{
   uint8_t cmd;
   uint8_t data[14];
   uint8_t len;
} lcd_cmd_t;

lcd_cmd_t lcd_st7789v[] = {
    {0x11, {0}, 0 | 0x80},
    {0x3A, {0X05}, 1},
    {0xB2, {0X0B, 0X0B, 0X00, 0X33, 0X33}, 5},
    {0xB7, {0X75}, 1},
    {0xBB, {0X28}, 1},
    {0xC0, {0X2C}, 1},
    {0xC2, {0X01}, 1},
    {0xC3, {0X1F}, 1},
    {0xC6, {0X13}, 1},
    {0xD0, {0XA7}, 1},
    {0xD0, {0XA4, 0XA1}, 2},
    {0xD6, {0XA1}, 1},
    {0xE0, {0XF0, 0X05, 0X0A, 0X06, 0X06, 0X03, 0X2B, 0X32, 0X43, 0X36, 0X11, 0X10, 0X2B, 0X32}, 14},
    {0xE1, {0XF0, 0X08, 0X0C, 0X0B, 0X09, 0X24, 0X2B, 0X22, 0X43, 0X38, 0X15, 0X16, 0X2F, 0X37}, 14},
};

// put this function after tft.init() in setup() function.
void lcd_st7789v_init()
{
   for (uint8_t i = 0; i < (sizeof(lcd_st7789v) / sizeof(lcd_cmd_t)); i++)
   {
      tft.writecommand(lcd_st7789v[i].cmd);
      for (int j = 0; j < (lcd_st7789v[i].len & 0x7f); j++)
      {
         tft.writedata(lcd_st7789v[i].data[j]);
      }

      if (lcd_st7789v[i].len & 0x80)
      {
         delay(120);
      }
   }
}

Also, for this bord is ok to declare the backlight pin and board ON pin and set on in setup.

pinMode(15, OUTPUT); // power ON display
digitalWrite(15, HIGH);
pinMode(38, OUTPUT); // backlight
digitalWrite(38, HIGH);

For the ESP32S3dev-n16r8 (16MB Flash, 8MB PSRAM) i have the next configs: ESP32S3dev-n16r8 + 1.3" 240x240 Color IPS TFT Display Waveshare

// Support for 1.3" 240x240  Color IPS TFT Display Waveshare
#define USER_SETUP_ID 50000

#define ST7789_DRIVER  // Full configuration option, define additional parameters below for this display

//#define TFT_RGB_ORDER TFT_RGB  // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR  // Colour order Blue-Green-Red

#define TFT_WIDTH 240
#define TFT_HEIGHT 240

//#define TFT_INVERSION_ON
//#define TFT_INVERSION_OFF

#define CGRAM_OFFSET     

#define TFT_BL           10    // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)

#define TFT_CS   -1   // Chip select control pin
#define TFT_MOSI 11   //SDA
#define TFT_SCLK 12
#define TFT_MISO -1 //     13 or 37   //no needed all the time
#define TFT_DC   3  // Data Command control pin
#define TFT_RST  10  // Reset pin (could connect to RST pin)
//#define TOUCH_CS 16 // Optional for touch screen

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

// FSPI port will be used unless the following is defined
#define USE_HSPI_PORT

//#define SPI_FREQUENCY 27000000 // 20Mhz
#define SPI_FREQUENCY 40000000 //40 Mhz
//#define SPI_FREQUENCY 80000000 //80 Mhz

#define SPI_READ_FREQUENCY  20000000 //20 Mhz
//#define SPI_READ_FREQUENCY  6000000 // 6 MHz is the maximum SPI read speed for the ST7789V

//#define SPI_TOUCH_FREQUENCY  2500000

#define SUPPORT_TRANSACTIONS

ESP32S3dev-n16r8 + ili9341 2.8 display

// See SetupX_Template.h for all options available
#define USER_SETUP_ID 40002

#define ILI9341_DRIVER

#define TFT_WIDTH 320
#define TFT_HEIGHT 240

#define TFT_MISO 13 // (leave TFT SDO disconnected if other SPI devices share MISO)
#define TFT_MOSI 11
#define TFT_SCLK 12
#define TFT_CS   9// Chip select control pin
#define TFT_DC   3  // Data Command control pin
#define TFT_RST  8  // Reset pin (could connect to RST pin)

// touch screen not select bcs Touch use another bus.
//#define TOUCH_CS 5 // Chip select pin (T_CS) of touch screen

#define LOAD_GLCD    // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2   // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4   // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6   // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7   // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8   // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF   // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

// TFT SPI clock frequency
 //#define SPI_FREQUENCY  20000000
// #define SPI_FREQUENCY  27000000
#define SPI_FREQUENCY  40000000
// #define SPI_FREQUENCY  80000000

// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default.
// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam)
// then uncomment the following line:
//#define USE_HSPI_PORT
//#define USE_FSPI_PORT

// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY  16000000

// SPI clock frequency for touch controller
//#define SPI_TOUCH_FREQUENCY  2500000

//#define SUPPORT_TRANSACTIONS

ESP32S3dev-n16r8 + 3.5 TFT LCD UNO Shield ILI9488 8 bit parallel display 480x320

// This setup is for the ESP32 S3 processor only when used with 3.5 TFT LCD UNO Shield 8 bit parallel displays
// See SetupX_Template.h for all options available
// Created by Florin Baciu @ 20:59_06-11-2023

#define USER_SETUP_ID 40005

// Interface
#define TFT_PARALLEL_8_BIT

// Display driver type
#define ILI9488_DRIVER

#define TFT_WIDTH 480
#define TFT_HEIGHT 320

#define TFT_CS   5  // Do not define, chip select control pin permanently connected to 0V

// These pins can be moved and are controlled directly by the library software
#define TFT_DC   4    // Data Command control pin
#define TFT_RST  46    // Reset pin

#define TFT_RD   8  // Do not define, read pin permanently connected to 3V3

// Note: All the following pins are PIO hardware configured and driven
// The pins are hard-coded at the moment and must not be changed here
// Connections MUST use the pins below
  #define TFT_WR   3

  // PIO requires these to be sequentially increasing - do not change
  #define TFT_D0    13
  #define TFT_D1    12
  #define TFT_D2    7
  #define TFT_D3    6
  #define TFT_D4   18
  #define TFT_D5   17
  #define TFT_D6   16
  #define TFT_D7   15
//*/
// Fonts to be available

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

Also for esp32 simple: esp32devKit v4 (ESP32) + ili9341 2.8 display esp32wrover 8MB PSRAM (ESP32) + ili9341 2.8 display

#define USER_SETUP_ID (0002)
#define DISABLE_WARNINGS

/*DRIVER SETTINGS*/
#define ILI9341_DRIVER

#define TFT_RGB_ORDER TFT_BGR  // Colour order Blue-Green-Red

#define TFT_WIDTH 320
#define TFT_HEIGHT 240

/*PINOUT*/
//#define TFT_SPI_PORT (1)
#define TFT_MISO (12)
#define TFT_MOSI (13)
#define TFT_SCLK (14)
#define TFT_CS   (15)

#define TFT_RST (27)
#define TFT_DC  (26)
#define TFT_BL  (25)    // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)

#define TOUCH_CLK   (18)
#define TOUCH_MISO (19)
#define TOUCH_MOSI (23)
//#define TOUCH_CS    (5)
#define TOUCH_IRQ   (4)

//#define TFT_SDA_READ

/*COLOR ORDER*/
#define TFT_RGB_ORDER (TFT_BGR)

/*TFT INVERSION*/
//#define TFT_INVERSION_ON

/*FONT DEFINE*/
#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
// #define LOAD_FONT8
#define LOAD_GFXFF
#define SMOOTH_FONT

/*SPI SETTINGS*/
#define SPI_FREQUENCY (40000000)
#define SPI_READ_FREQUENCY (6000000)
#define SPI_TOUCH_FREQUENCY (2500000)

For another boards i will test them in next days and i will post here the working setups.

florinbaciuu commented 1 month ago

Same here, I would love to have your platformio.ini and user_config files for T-Display S3, as 'm stuck in a "StoreProhibited" never-ending error regarding heap (funniest part is that the same code works perfectly with an arduino nano esp32....). Not sure if it's the same issue that everyone here has but I'm desperate to know how to proceed

My platformio.ini file is :

; PlatformIO Project Configuration File for ....lilygo-t-displays3

######################################################################################################

[platformio]
##-------------------------
workspace_dir = ./
core_dir = ${PROJECT_DIR}/core
platforms_dir = ${platformio.core_dir}/platforms
packages_dir = ${platformio.core_dir}/pkg
##-------------------------
src_dir = ${PROJECT_DIR}/src
libdeps_dir = ${PROJECT_DIR}/libdeps
lib_dir = ${PROJECT_DIR}/lib
data_dir = ${PROJECT_DIR}/data
include_dir = ${PROJECT_DIR}/include
boards_dir = ${PROJECT_DIR}/board
build_dir = ${PROJECT_DIR}/build
build_cache_dir = ${platformio.build_dir}/build_cache
test_dir = ${PROJECT_DIR}/test
monitor_dir = ${PROJECT_DIR}/monitor

default_envs = pioarduino_3_0_5
extra_configs = 

######################################################################################################

[env]
lib_ldf_mode = deep ;options : off, chain, deep, chain+, deep+
lib_archive = yes
lib_compat_mode = off
lib_extra_dirs = libraries 
                 components

######################################################################################################

[DEBUGx]
build_flags = 
    -DCORE_DEBUG_LEVEL=5
    -DCONFIG_ARDUHAL_LOG_COLORS=1

######################################################################################################

##      OPTIONS:  test - debug - release  ##
[BUILDx]
build_type = debug

######################################################################################################

[lilygotdisplays3] 
extends = env 
build_type = ${BUILDx.build_type}
board = lilygo-t-displays3
board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
board_build.flash_size = 16MB
board_build.boot = qio         ;options: qio , dio
board_build.boot_freq= 80000000L
board_build.partitions = partition.csv
board_build.flash_mode = qio
board_build.f_flash = 80000000L
board_build.psram_type = opi
board_build.arduino.memory_type = qio_opi
board_build.filesystem = spiffs ;options: ffat , spiffs, littlefs

build.variants_dir = ${PROJECT_DIR}/variant
board_build.variant = lilygo_t_display_s3
;--------------------------------------------;
upload_speed = 921600
upload_protocol = esptool
;--------------------------------------------;
monitor_speed = 115200
monitor_filters =  colorize , esp32_exception_decoder , time
;--------------------------------------------;
; Custom linker script
;board_build.ldscript = /path/to/ldscript.ld
;--------------------------------------------;
build_flags =
        -D ESP32
        -D ESP32S3
        -D ARDUINO_ARCH_ESP32
        -D ARDUINO_ESP32S3_DEV
        -D ESP_PLATFORM
        -D CONFIG_IDF_TARGET_ESP32_S3
        -D BOARD_HAS_PSRAM
        -D CONFIG_SPIRAM
        -D CONFIG_SPIRAM_SUPPORT
        -D CONFIG_SPIRAM_CACHE_WORKAROUND
        -D ARDUINO_USB_MODE=1
        -D ARDUINO_USB_CDC_ON_BOOT=1
        -D ARDUINO_RUNNING_CORE=1
        -D ARDUINO_EVENT_RUNNING_CORE=1

        -mfix-esp32-psram-cache-issue
        -mfix-esp32-psram-cache-strategy=memw
        -mlongcalls
        -Wno-dev
        -Wno-error
        -w
        -fpermissive
        -MMD
        -c
        -g
        -Os
        -fexceptions
lib_deps = 
        ;arduino_gfx = symlink://components/Arduino_GFX

[env:pioarduino_3_0_5]
extends = lilygotdisplays3
framework = arduino
extra_scripts = 
        post:extra_script.py
build_type = ${BUILDx.build_type}
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
platform_packages =
build_flags = ${lilygotdisplays3.build_flags}
            ${DEBUGx.build_flags}
            #${TFT_eSPI.build_flags}

targets = 

and the UserSetup.h is :

#define USER_SETUP_ID 4000 // just put what you want 

/************************************************** */

#define ST7789_DRIVER // lilygo-t-display-s3
////#define ST7789_2_DRIVER
#define INIT_SEQUENCE_3 // Using this initialisation sequence improves the display image

/************************************************** */

#define CGRAM_OFFSET // lilygo-t-display-s3

/************************************************** */

/* Colour order Red-Green-Blue */
#define TFT_RGB_ORDER TFT_RGB // lilygo-t-display-s3
/* Colour order Blue-Green-Red */
////#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red

/************************************************** */

#define TFT_INVERSION_ON // lilygo-t-display-s3
////#define TFT_INVERSION_OFF

/************************************************** */

#define TFT_PARALLEL_8_BIT // lilygo-t-display-s3

/************************************************** */

#define TFT_WIDTH 170
#define TFT_HEIGHT 320

/************************************************** */

#define TFT_RST 5
#define TFT_CS 6 // Not connected
#define TFT_DC 7
#define TFT_WR 8
#define TFT_RD 9

#define TFT_D0 39
#define TFT_D1 40
#define TFT_D2 41
#define TFT_D3 42
#define TFT_D4 45
#define TFT_D5 46
#define TFT_D6 47
#define TFT_D7 48

#define TFT_BL 38
#define TFT_BACKLIGHT_ON HIGH // lilygo-t-display-s3

/************************************************** */

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

/************************************************** */

Optional my partition test:

partition.csv is:

# ESP-IDF Partition Table,,,,,,
# Total 16384K (16 MB),,,,,,
#       Name, Type,  SubType, Offset,  Size, Flags,
# bootloader,     ,         , 0x1000,   32K,      , # located at the address 0x1000; Offset default 0x1000(4K);      
# partitions,     ,         , 0x8000,    4K,      , # Offset default 0x8000(32K);
         nvs, data,      nvs,       ,   16K,      , # Type:(0x02);
     otadata, data,      ota,       ,    8K,      , # Type:(0x00); Default: 8K(0x2000);
    phy_init, data,      phy,       ,    4K,      , # Type:(0x01);
     factory,  app,  factory,0x10000, 4096K,      , # Type:(0x00); offset default 0x10000(64K);  APP standard partition;
       ota_0,  app,    ota_0,       , 4096K,      , # Type:(0x10);
       ota_1,  app,    ota_1,       , 4096K,      , # Type:(0x11);
        ffat, data,      fat,       , 1024K,      , # Type:(0x81);
      spiffs, data,   spiffs,       , 1024K,      , # Type:(0x82);
#   littlefs, data, littlefs,       , 1024K,      , # Type:(0x83);
     eeproom, data,      nvs,       ,  892K,      , ### EEPROOM PARTITION
     nvs_key, data, nvs_keys,       ,    4k,      , # Type:(0x04); Default: 4kB(0x1000);
    coredump, data, coredump,       ,   64K,      , # Type:(0x03); Default: 64kB(0x10000);
ChassaB commented 1 month ago

Thanks. That's great. I'll try it out in a few days

lapinos03 commented 1 month ago

On Arduino IDE 2.3.3, I succeeded to compile and run on a ESP32S3+ST7789 (https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2.8) the demo provided for this boad with the latest versions of espressif (3.0.5) and TFT_eSPI (2.5.43) by putting these lines:

// FSPI port (SPI2) used unless following defined
#define USE_HSPI_PORT
#define ESP32 1
#define CONFIG_IDF_TARGET_ESP32S3 1

For this board, the complete tft_setup.h :

//#define USER_SETUP_ID 305
//#define USER_SETUP_INFO "WAVESHARE_ESP32-S3-TOUCH-LCD-2.8"

#define USER_SETUP_LOADED

#define ST7789_DRIVER

#define TFT_WIDTH  240
#define TFT_HEIGHT 320

#define TFT_MISO -1
#define TFT_MOSI 45
#define TFT_SCLK 40
#define TFT_CS   42
#define TFT_DC   41
#define TFT_RST  39
#define TFT_BL   5
#define TFT_BACKLIGHT_ON HIGH

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

#define SMOOTH_FONT

// FSPI port (SPI2) used unless following defined
#define USE_HSPI_PORT
#define ESP32 1
#define CONFIG_IDF_TARGET_ESP32S3 1

#define SPI_FREQUENCY  80000000
//#define SPI_FREQUENCY  40000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000

For LVGL, use version 8.4.0.

florinbaciuu commented 1 month ago

On Arduino IDE 2.3.3, I succeeded to compile and run on a ESP32S3+ST7789 (https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2.8) the demo provided for this boad with the latest versions of espressif (3.0.5) and TFT_eSPI (2.5.43) by putting these lines:


// FSPI port (SPI2) used unless following defined

#define USE_HSPI_PORT

#define ESP32 1

#define CONFIG_IDF_TARGET_ESP32S3 1

indeed these 2 lines :

#define ESP32
#define CONFIG_IDF_TARGET_ESP32S3

correctly select SPI. Unlike you, I put them in platformio.ini.

-DESP32
-DESP32S3
-DCONFIG_IDF_TARGET_ESP32S

probably that's why I had no problem with this library. it compiles and runs without problems for me on any esp32 (s2, S3)

happychickencxk commented 3 weeks ago

thank u very much! I downgraded my board core version to 2.0.14,and find it useless for me. but #define USE_HSPI_PORT (at the same time) in User_Setup.h save my life! 呦西,here we goooooooooo!

cyberreefguru commented 1 week ago

I just spend about 6 hours bashing my head into the wall until I found this thread. I'm using a Waveshare ESP32-S3 Zero, which has a ESP32-S3FH4R2 on board. I added:

-DESP32 -DESP32S3 -DUSE_HSPI_PORT -DCONFIG_IDF_TARGET_ESP32S

to my platform.ini and everything started working. Prior to that, got an access fault:

19:35:06.980 > bootedGuru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
19:35:06.981 > 
19:35:06.981 > Core  1 register dump:
19:35:06.981 > PC      : 0x420426ce  PS      : 0x00060c30  A0      : 0x820427d4  A1      : 0x3fcebdd0  
19:35:06.992 > A2      : 0x00000010  A3      : 0x00000000  A4      : 0x60004000  A5      : 0x00000004  
19:35:06.997 > A6      : 0x000000ff  A7      : 0x3fc99e20  A8      : 0x08000000  A9      : 0x3fcebda0  
19:35:07.003 > A10     : 0x3fc9b2dc  A11     : 0x00000001  A12     : 0xffffffff  A13     : 0x00000004  
19:35:07.014 > A14     : 0x00000000  A15     : 0x3fc94670  SAR     : 0x00000010  EXCCAUSE: 0x0000001d  
19:35:07.019 > EXCVADDR: 0x00000010  LBEG    : 0x4204691c  LEND    : 0x42046980  LCOUNT  : 0x00000003  
19:35:07.030 > 
19:35:07.030 > 
19:35:07.030 > Backtrace: 0x420426cb:0x3fcebdd0 0x420427d1:0x3fcebe00 0x420427dc:0x3fcebe20 0x4200ccca:0x3fcebe40 0x42002b3f:0x3fcebe80 0x42030b9a:0x3fcebef0
19:35:07.149 >   #0  0x420426cb in TFT_eSPI::begin_tft_write() at .pio/libdeps/seeed_xiao_esp32s3/TFT_eSPI/TFT_eSPI.cpp:81
19:35:07.149 >       (inlined by) TFT_eSPI::writecommand(unsigned char) at .pio/libdeps/seeed_xiao_esp32s3/TFT_eSPI/TFT_eSPI.cpp:989
19:35:07.149 >   #1  0x420427d1 in TFT_eSPI::init(unsigned char) at .pio/libdeps/seeed_xiao_esp32s3/TFT_eSPI/TFT_eSPI.cpp:699
19:35:07.149 >   #2  0x420427dc in TFT_eSPI::begin(unsigned char) at .pio/libdeps/seeed_xiao_esp32s3/TFT_eSPI/TFT_eSPI.cpp:603
19:35:07.149 >   #3  0x4200ccca in lv_tft_espi_create at .pio/libdeps/seeed_xiao_esp32s3/lvgl/src/drivers/display/tft_espi/lv_tft_espi.cpp:63 (discriminator 2)
19:35:07.149 >   #4  0x42002b3f in setup() at src/main.cpp:424
19:35:07.149 >   #5  0x42030b9a in loopTask(void*) at /Users/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42

Hope this helps others.

-Tom