I purchased a cheap Chinese ST7789 TFT (1.3in, 240x240) that is clearly identified as SPI compatible, tough it does NOT have a CS pin and also some of the pins seem weirdly named to me. I have been struggling all morning to get it working until I found a post on raspberrypi.org (not sure if I'm allowed to include a reference to this page URL here?) mentioning the same exact Chinese ST7789 TFT board and the same issue. Apparently that guy got it working after hours of fiddling, but I have yet to reproduce his solution. Can anybody help me figure it out?
I first tried with this pimoroni library and nothing happened, the backlight is on but the screen remains black: https://github.com/pimoroni/st7789-python
The guy who got it working mentioned that he failed with that exact same pimoroni library and instead got it working only using that one from solinnovay: https://github.com/solinnovay/Python_ST7789
So I'm now trying to get it working with the latter (solinnovay).
Here's the relevant Python3 code I have right now (BTW, I'm using a Raspberry Pi 2B under Python 3.7 and yes, the SPI interface is enabled in raspi-config, the image path does exist and there are no Python error):
RST = 22 # Set GPIO pin# 15 (BCM 22) as reset control
DC = 17 # Set GPIO pin# 11 (BCM 17) as DATA/command (NOT MOSI!)
LED = 27 # Set GPIO pin# 13 (BCM 27) as backlight control
SPI_PORT = 0
SPI_DEVICE = 0
SPI_MODE = 0b11
SPI_SPEED_HZ = 40000000
disp = ST7789(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=SPI_SPEED_HZ), mode=SPI_MODE, rst=RST, dc=DC, led=LED)
disp.begin()
disp.clear()
image = Image.open(image_file)
image = image.resize((240, 240))
disp.display(image)
Here is the TFT's pinout to the Rpi :
TFT Display <-> Raspberry Pi (PIN# as BOARD, not BCM)
GND <----------> PIN# 6
VCC <----------> PIN# 1
SCL <----------> PIN# 23
SDA <----------> PIN# 19
RES <----------> PIN# 15
DC <----------> PIN# 11
BLK <----------> PIN# 13
I see the TFT's backlight, so I know it is powered on and I guessed "SCL" is the SPI clock, but I tried all sorts of stuff concerning "SDA" and "DC" and could not get it to work yet. Thanks to the guy's post, now I know "SDA" goes to the Rpi's "MOSI" pin and that "DC" can go to any GPIO we want. The screen still remains black tough. Anybody has any suggestions I can try to get this TFT board working?