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.69k stars 1.07k forks source link

It is unclear how to set SPI mode if the default does not work. #3296

Open JuneTheMistborn opened 5 months ago

JuneTheMistborn commented 5 months ago
  1. While using a ST7789 board that does not support SPI mode 3 (ie; Waveshare 2.8" Pico Restouch), the TFT will not display.
  2. Using PlatformIO
  3. TFT_eSPI version 2.5.43
  4. Board package version 3.7.2 (earlephilhower)
  5. RP2040
  6. ST7789 Product
  7. SPI

With the Pico Restouch, Waveshare distributes a special version of TFT_eSPI.h, the only change they make is to line 133 to change the declaration of TFT_SPI_MODE to SPI_MODE0 instead of SPI_MODE3. Running a program without this change leads to the backlight turning on, but nothing being displayed. TFT_eSPI.h has an else statement defining the mode as 0, but the statement appears to be unreachable.

The user can define TFT_SPI_MODE in a user setup file, but there is no indication of this. It would be very helpful to add a line in the user setup template indicating that the SPI mode can be defined, and to try setting it to SPI_MODE0 if the backlight turns on but nothing is displayed while using an ST7789 board.

klspstck commented 4 months ago

I was just re-trying the TFT_eSPI library with the Pimoroni Display 2.0". It is working with the Adafruit library but not with the standard user setup files. Your hint saved may day, now it is working by just adding the "#define TFT_SPI_MODE SPI_MODE0". Thank you.