1

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?

enter image description here

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?

1

OK I'm sorry, it works now! I guess was so tired I thought I had rebooted the Rpi when I did not. After a reboot, it works :)

Sorry! And I hope this helps the next person who purchased this cheap Chinese knockoff to get it working on their Rpi!

| improve this answer | |
  • Hi @that-ben, This thread might also help other ST7789 LCD newbies:(1) raspberrypi.stackexchange.com/questions/104846/…. Cheers. – tlfong01 Feb 9 at 0:47
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Feb 12 at 19:24
  • Yes, I could not accept my own answer before, because it was too recent... go figure. – that-ben Feb 13 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.