ST7789 LCD SPI1 2nd Screen problem

Active today
Viewed 24 times

I’ve been trying to get this ST7789 library working with the 240×240 1.3″ display on the rpi0w

Python lib


So far I’ve set all the screen pins to the bcm spi1 pins on the pi and updated them in my script to match. I’ve also tried setting the spi device / port to 1 and in various combinations of 1,0 0,1 1,1 and so on.

Please see his clock_EN.py in examples for parameters example.

So far I have not been able to display anything on the screen when connected to spi1. But connected to spi0 everything works as expected.

I’ve contacted the author but haven’t received a reply.

Is it as simple as changing the script parameters and connecting the screen to the spi1 pins or is the spi device hard coded into his library?

My goal is to have 1 screen running on spi0 and another on spi1.

Thanks in advance.

 New contributor
  • I once looked at the WaveShare SPI driver thing and found that they hard coded for SPI0 only (They did NOT develope the touch LCD for two mon situation). Another touch TFT LCD for ILI9341 based kernel also has a fixed channel SPI0 – you CANNOT build a kernel using SPI1. Many users want to use two mons at the same time. Me too. But my quick and dirty conclusion is that it is mission impossible. – tlfong01 19 hours ago   
  • Hi tlfong01 I think you might be referencing a different display altogether. This is the display in question displaymodule.com/products/… – nosuchintel 19 hours ago
  • My apologies for my careless mistake of the wrong conclusion on your ST7789 LCD. Yes, as you said, ST7789 LCD is completely different from what I have been studying. Your LCD’s driver is a python program, NO need to build any newbie scary driver/kernel. There is some hope (20%, I think) of setting up dual mon or triple mon. So I quickly skimmed the docs and draft a brainstorming answer. – tlfong01 14 hours ago   

2 Answers



How to talk to an ST7789 LCD connected to SPI #1?


Update 2019oct23hkt0928

For those with little experience of rewiring delicate ribbon cables, perhaps the follow 12 pin breakout version (Ref 8)is worth trying:

12 pin lcd

I think we need to do two things:

(1) Change ST7789 LCD’s CS connection from Ground to CS1 (Note 1),

(2) Change Python_ST7789/examples/clock_EN.py‘s statement form SPI_PORT = 0 to SPI_PORT = 1

Note 1 – I used to cheat the SPI device by connecting its CS pin NOT to CS0 or CS1. Instead, I connect to other Rpi GPIO pins (as CS0, CS1, CS2, … CSn pins), or even to MCP23017 I/O expander’s GPIO pins. So if my trick here works, I can use a MCP23017 and have 16 time multiplexed LCDs! 🙂

st7789 1

st7789 1


(1) Display Module DM-TFT13-377 1.3″ 240 X 240 IPS TFT Display Module-SPI -$10

(2) AliExpress IPS 1.3 inch 3.3V 12 PIN SPI TFT LCD ST7789 240 * 240 US$3

(4) Display Module 1.3 SPI TFT LCD User Guide

(5) ST7789VW Datasheet – Sitronix

(6) Python ST7789 GitHub – solinnovay

(7) ST7789 GitHub Example Program (Python_ST7789/examples/clock_EN.py)

(8) AliExpress IPS 1.3″ 240×240 12 pin SPI TFT LCD ST7789 – US$2


Appendix – How to change clock_EN.py for SPI CS #1

Raspberry Pi pin configuration:

RST = 27 DC  = 25

LED = 24

SPI_PORT = 0 >>>>>> change to SPI_PORT = 1


SPI_MODE = 0b11 SPI_SPEED_HZ = 40000000

End of answer

  • 1
    Thanks for your answer. Although this display module supports chip select, it is not included in the breakout board. I’m not confident breaking out the ribbon cable by hand. Please let me know if I’m misunderstanding something. Thanks for mentioning about the multiplexer too, I might look in to it in future. – nosuchintel 11 hours ago
  • @nosuchintel, (1) Ah yes, you need some skills to extract the CS wire from the breakout. Perhaps I will show my steps, in case other newbies would like to take the risk. (2) The CS multiplexing thing is a bit complicated. Perhaps I can search my old answers in other forums and explain in a bit more details. This is a general trick for ALL SPI devices. I usually use it for multiple sensors. (1) Yes, you understand what I said perfectly. Actually I hesitate to give this answer and risky hardware get around to newbies. But since you already dug deep into the python driver part, .. Cheers! – tlfong01 4 hours ago   
  • @nosuchintel, Or you might like to consider the 12 pin breakout version. See the update to my answer. – tlfong01 3 hours ago   


clock_EN.py has the line:

disp = TFT.ST7789(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=SPI_SPEED_HZ),
       mode=SPI_MODE, rst=RST, dc=DC, led=LED)

The intention appears to be that the bus is defined by SPI_PORT and the chip select by SPI_DEVICE.

So set SPI_PORT and SPI_DEVICE and connect the device as follows

                                     DEVICE 0    DEVICE 1    DEVICE 2
                   MISO  MOSI  SCLK  CE0         CE1         CE2
PORT 0 | Main SPI    9    10    11    8           7           -
PORT 1 | Aux SPI    19    20    21   18          17          16

Of course if the display doesn’t have a chip select line you will have to use different buses and can ignore the chip selects.

  • Thanks for your reply Joan. This is the display displaymodule.com/products/… it has no chip select but I don’t see that being an issue if I’m using spi0 and spi1. I did try connecting a single display to the spi1 bcm pins and tried various combinations of port / device 1/0. Is there something I’m missing? – nosuchintel 19 hours ago
  • Could you add a photo of the connections when connected to SPI bus 1 (the auxiliary SPI device)? – joan 19 hours ago
  • Thanks Joan, here are the images imgur.com/a/xPBa166 I used the base pin numbers specified in the clock Python script but tried changing the port and device numbers unfortunately with no luck. – nosuchintel 8 hours ago

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: