I’ve been trying to get this ST7789 library working with the 240×240 1.3″ display on the rpi0w
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.
How to talk to an ST7789 LCD connected to SPI #1?
For those with little experience of rewiring delicate ribbon cables, perhaps the follow 12 pin breakout version (Ref 8)is worth trying:
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! 🙂
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_DEVICE = 0
SPI_MODE = 0b11 SPI_SPEED_HZ = 40000000
End of answer
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.