Help with ST7789 240x240 TFT display with Seeed Studio XIAO ESP32C3 #2174
-
For Quite a while I have been trying to interface the Seeed Studio XIAO ESP32C3 with the ST7789 240x240 TFT display. But whenever I run the Colour_test nothing appears. I have tried so many things but none of it works. I believe the microcontroller and display work fine. I have done the pinout as such: I have done the user define as such: `// USER DEFINED SETTINGS // User defined information reported by "Read_User_Setup" test & diagnostics example // Define to disable all #warnings in library (can be put in User_Setup_Select.h) // ################################################################################## // Define STM32 to invoke optimised processor support (only for STM32) // Defining the STM32 board allows the library to optimise the performance // STM32 8 bit parallel only: // Tell the library to use parallel mode (otherwise SPI is assumed) // Display type - only define if RPi display // Only define one driver, the other ones must be commented out // Some displays support SPI reads via the MISO pin, other displays have a single // #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 and GC9A01 display only // For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue // For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below // #define M5STACK // For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation // For ST7735 ONLY, define the type of display, originally this was based on the // #define ST7735_INITB // If colours are inverted (white shows as black) then uncomment one of the next // #define TFT_INVERSION_ON // ################################################################################## // If a backlight control signal is available then define the TFT_BL pin in Section 2 // #define TFT_BL 32 // LED back-light control pin // We must use hardware SPI, a minimum of 3 GPIO pins is needed. // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ###### // For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation //#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin) //#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen //#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only // ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ###### // Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact //#define TFT_SPI_OVERLAP // In ESP8266 overlap mode the TFT chip select MUST connect to pin D3 // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###### // For ESP32 Dev board (only tested with ILI9341 display) #define TFT_MISO 9 // RX PIN - Not Connected // For ESP32 Dev board (only tested with GC9A01 display) //#define TFT_MOSI 15 // In some display driver board, it might be written as "SDA" and so on. //#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen //#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only // For the M5Stack module use these #define lines // ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ###### // The library supports 8 bit parallel TFTs with the ESP32, the pin // Parallel bus is only supported for the STM32 and ESP32 // Tell the library to use 8 bit parallel mode (otherwise SPI is assumed) // The ESP32 and TFT the pins used for testing are: //#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31 //#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus // ###### EDIT THE PINs BELOW TO SUIT YOUR STM32 SPI TFT SETUP ###### // The TFT can be connected to SPI port 1 or 2 //#define TFT_SPI_PORT 2 // SPI port 2 maximum clock rate is 27MHz // Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select //#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to processor reset // ################################################################################## // Comment out the #defines below with // to stop that font being loaded #define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH // Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded // ################################################################################## // For RP2040 processor and SPI displays, uncomment the following line to use the PIO interface. // For RP2040 processor and 8 or 16 bit parallel displays: // For the RP2040 processor define the SPI port channel used (default 0 if undefined) // For the STM32 processor define the SPI port channel used (default 1 if undefined) // Define the SPI clock frequency, this affects the graphics rendering speed. Too // #define SPI_FREQUENCY 1000000 // Optional reduced SPI frequency for reading TFT // The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here: // The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default. // Comment out the following #define if "SPI Transactions" do not need to be // Transaction support is needed to work with SD library but not needed with TFT_SdFat // Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex) // #define SUPPORT_TRANSACTIONS Btw I am extremely sorry if this is not the correct way of starting a discussion in github as it's my first time using it. I am an amateur, so I am totally puzzled. Thank you for any help provided. I am going insane trying to solve this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I suspect you are not using the GPIO numbers to specify the pins because this board (I am guessing this is the board!) does not have a GPIO 1 for the TFT_RST signal: |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for the quick reply! |
Beta Was this translation helpful? Give feedback.
-
Okay for anyone who was facing the same issue. Note: click the restart button after you have uploaded the code, this makes it work for some reason. // User defined information reported by "Read_User_Setup" test & diagnostics example // Define to disable all #warnings in library (can be put in User_Setup_Select.h) // ################################################################################## // Define STM32 to invoke optimised processor support (only for STM32) // Defining the STM32 board allows the library to optimise the performance // STM32 8 bit parallel only: // Tell the library to use parallel mode (otherwise SPI is assumed) // Display type - only define if RPi display // Only define one driver, the other ones must be commented out // Some displays support SPI reads via the MISO pin, other displays have a single // #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 and GC9A01 display only // For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue // For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below // #define M5STACK // For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation // For ST7735 ONLY, define the type of display, originally this was based on the // #define ST7735_INITB // If colours are inverted (white shows as black) then uncomment one of the next // #define TFT_INVERSION_ON // ################################################################################## // If a backlight control signal is available then define the TFT_BL pin in Section 2 // #define TFT_BL 32 // LED back-light control pin // We must use hardware SPI, a minimum of 3 GPIO pins is needed. // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ###### // For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation //#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin) //#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen //#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only // ###### FOR ESP8266 OVERLAP MODE EDIT THE PIN NUMBERS IN THE FOLLOWING LINES ###### // Overlap mode shares the ESP8266 FLASH SPI bus with the TFT so has a performance impact //#define TFT_SPI_OVERLAP // In ESP8266 overlap mode the TFT chip select MUST connect to pin D3 // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###### // For ESP32 Dev board (only tested with ILI9341 display) #define TFT_MISO MISO // RX PIN - Not Connected // For ESP32 Dev board (only tested with GC9A01 display) //#define TFT_MOSI 15 // In some display driver board, it might be written as "SDA" and so on. //#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen //#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only // For the M5Stack module use these #define lines // ###### EDIT THE PINs BELOW TO SUIT YOUR ESP32 PARALLEL TFT SETUP ###### // The library supports 8 bit parallel TFTs with the ESP32, the pin // Parallel bus is only supported for the STM32 and ESP32 // Tell the library to use 8 bit parallel mode (otherwise SPI is assumed) // The ESP32 and TFT the pins used for testing are: //#define TFT_WR 4 // Write strobe control pin - must use a pin in the range 0-31 //#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus // ###### EDIT THE PINs BELOW TO SUIT YOUR STM32 SPI TFT SETUP ###### // The TFT can be connected to SPI port 1 or 2 //#define TFT_SPI_PORT 2 // SPI port 2 maximum clock rate is 27MHz // Can use Ardiuno pin references, arbitrary allocation, TFT_eSPI controls chip select //#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to processor reset // ################################################################################## // Comment out the #defines below with // to stop that font being loaded #define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH // Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded // ################################################################################## // For RP2040 processor and SPI displays, uncomment the following line to use the PIO interface. // For RP2040 processor and 8 or 16 bit parallel displays: // For the RP2040 processor define the SPI port channel used (default 0 if undefined) // For the STM32 processor define the SPI port channel used (default 1 if undefined) // Define the SPI clock frequency, this affects the graphics rendering speed. Too // #define SPI_FREQUENCY 1000000 // Optional reduced SPI frequency for reading TFT // The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here: // The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default. // Comment out the following #define if "SPI Transactions" do not need to be // Transaction support is needed to work with SD library but not needed with TFT_SdFat // Transactions are automatically enabled by the library for an ESP32 (to use HAL mutex) // #define SUPPORT_TRANSACTIONS ` |
Beta Was this translation helpful? Give feedback.
Okay for anyone who was facing the same issue.
Note: click the restart button after you have uploaded the code, this makes it work for some reason.
This is the setup file I used:
`
// USER DEFINED SETTINGS
// Set driver type, fonts to be loaded, pins used and SPI control method etc
//
// See the User_Setup_Select.h file if you wish to be able to define multiple
// setups and then easily select which setup file is used by the compiler.
//
// If this file is edited correctly then all the library example sketches should
// run without the need to make any more changes for a particular hardware setup!
// Note that some sketches are designed for a particular TFT pixel width/height
// User defi…