0

Multiple ST7789 on RPi?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Multiple ST7789 on RPi?

by behanson on Fri Sep 24, 2021 12:03 pm

How to I connect multiple ( 2 or 3) TS7789 displays to a Raspberry Pi

Displays - Adafruit 1.69" 280x240 Round Rectangle Color IPS TFT Display - ST7789
Pi - Raspberry Pi 3 Model B+, I hope to use a Raspberry Pico in the end.

I can get one working using the wiring diagram on Adafruit Python Wiring and Setup

https://learn.adafruit.com/adafruit-1-3-and-1-54-240-x-240-wide-angle-tft-lcd-displays/python-wiring-and-setup#st7789-and-st7735-based-displays-3042525-12

ST7789 and ST7735-based Displays
Vin connects to the Raspberry Pi's 3V pin
GND connects to the Raspberry Pi's ground
CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
CS connects to our SPI Chip Select pin. We'll be using CE0
RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.


But it's not clear how to add more. What do I do with the RST and D/C lines. How is the code configured to send to each individual display separately?

Thanks

Brad Hanson

behanson
 
Posts: 26
Joined: Wed Apr 18, 2018 4:02 pm

Re: Multiple ST7789 on RPi?

by alphanumeric on Sat Sep 25, 2021 7:25 am

Each display has to use a different CE pin. I've run two on SPI0 and three on SPI1
These were Pimoroni SPI LCD breakouts.

SPI0
GPIO 7, Pin 26, CE1
GPIO 8, Pin 24, CE0
GPIO 9, Pin 21, MISO
GPIO 10, Pin 19, MOSI
GPIO 11, Pin 23, SCLK

SPI1
GPIO 16, Pin 36, CE2
GPIO 17, Pin 11, CE1
GPIO 18, Pin 12, CE0
GPIO 19, Pin 35, MISO
GPIO 20, Pin 38, MOSI
GPIO 21, Pin 40, SCLK

In python I do the following.
Two displays on SPI0
Code: Select all | TOGGLE FULL SIZE
disp_left = ST7735.ST7735(
    port=0,
    cs=0,
    dc=9,
    #backlight=19,
    rotation=90,
    spi_speed_hz=10000000
)

disp_left.begin()



# Initialise the right LCD
disp_right = ST7735.ST7735(
    port=0,
    cs=1,
    dc=9,
    #backlight=19,
    rotation=90,
    spi_speed_hz=10000000
)

disp_right.begin()

WIDTH = 160
HEIGHT = 80



Three displays on SPI1
Code: Select all | TOGGLE FULL SIZE
disp0 = ST7735.ST7735(
    port=1,
    cs=0,
    dc=19,
#    backlight=5,
    rotation=90,
    spi_speed_hz=10000000
)

disp0.begin()

disp1 = ST7735.ST7735(
    port=1,
    cs=1,
    dc=19,
 #   backlight=6,
    rotation=90,
    spi_speed_hz=10000000
)

disp1.begin()

disp2 = ST7735.ST7735(
    port=1,
    cs=2,
    dc=19,
  #  backlight=13,
    rotation=90,
    spi_speed_hz=10000000
)

disp2.begin()

WIDTH = 160
HEIGHT = 80


alphanumeric
 
Posts: 596
Joined: Sun Sep 07, 2014 7:06 pm

Re: Multiple ST7789 on RPi?

by behanson on Sat Sep 25, 2021 1:09 pm

Thank you so much for the replay.

It's still unclear to me what I do with these two pins

    RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later.
    D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later as well.

Best I can tell the Pimoroni SPI LCD breakouts do have a D/C pin which you didn't connect. My Adafruit display does not work unless these are connected

Thanks

Brad Hanson

behanson
 
Posts: 26
Joined: Wed Apr 18, 2018 4:02 pm

Re: Multiple ST7789 on RPi?

by alphanumeric on Sat Sep 25, 2021 2:17 pm

For my displays its as follows
3-5V to any 5V or 3V pin
CS to CE0 (or CE1 or CE2)
SCK to SCLK
MOSI to MOSI
DC to MISO
BL to (Pin used for backlight control, can be any pin)
GND to any ground pin

I can leave my backlight pins unconnected and they still work. Grounding that pin turns the backlight off.

In your case "D/C connects to our SPI Chip Select pin" so that's the pin you connect to CE 0 or CE1 etc. Mine don't have a RST pin that is accessible via the header.
Last edited by alphanumeric on Sat Sep 25, 2021 2:51 pm, edited 1 time in total.

alphanumeric
 
Posts: 596
Joined: Sun Sep 07, 2014 7:06 pm

Re: Multiple ST7789 on RPi?

by alphanumeric on Sat Sep 25, 2021 2:22 pm

I find this confusing, its the hookup for your display from the link you posted. I don't get why CS and DC go to "our chip select pin"? I think that might be a typo? I think DC should go to MISO?

Vin connects to the Raspberry Pi's 3V pin
GND connects to the Raspberry Pi's ground
CLK connects to SPI clock. On the Raspberry Pi, thats SLCK
MOSI connects to SPI MOSI. On the Raspberry Pi, thats also MOSI
CS connects to our SPI Chip Select pin. We'll be using CE0
D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later.
RST connects to our Reset pin. We'll be using GPIO 24 but this can be changed later as well.

alphanumeric
 
Posts: 596
Joined: Sun Sep 07, 2014 7:06 pm

Re: Multiple ST7789 on RPi?

by alphanumeric on Sat Sep 25, 2021 2:29 pm

Basically now it works is all the displays use the same MISO, MOSI and SCLK signals. But each one uses a different chip select pin. The CE signal tells that device to communicate over SPI. Only one CE is enabled at a time so only one device at any one time is getting new data.

alphanumeric
 
Posts: 596
Joined: Sun Sep 07, 2014 7:06 pm

Re: Multiple ST7789 on RPi?

by behanson on Sat Sep 25, 2021 8:38 pm

Thanks again for the information. I get the basic operation of SPI and the connections for MISO, MOSI and SCLK which are common to all devices and that each device need a separate Chip Select signal.

Yes my wiring all comes from the Adafruit tutorial page and that is working for one display. The diagram shows that MISO is not connected. I agree the wording is a bit unclear.

Since the SPI interface does not define a Reset or Data/Command pin my basic question is how are these two signals connected with multiple displays (SPI devices) on the bus. Are these pins wired like MISO, MOSA and SCLK were the are all driven by the same pin on the Raspberry Pi. Or are individual pins required for each device like SCLK. It's really a specific Adafruit question as to the interactions between their drives and hardware outside the SPI interface.

I suspect I can get by without the Reset pin since as my one display continues to work if I remove it. But removing the Data/Command line gives strange results. Display goes to a negative image and quits working after a bit.

Just trying to figure out if this is going to work before I invest in a bunch of hardware.

Thanks again

Brad Hanson

behanson
 
Posts: 26
Joined: Wed Apr 18, 2018 4:02 pm

Re: Multiple ST7789 on RPi?

by alphanumeric on Mon Sep 27, 2021 8:08 am

Somebody from Adafruit is going to have to help you with that. I don't have any of those displays to tinker and test with. Or any with those extra pins.

alphanumeric
 
Posts: 596
Joined: Sun Sep 07, 2014 7:06 pm

Re: Multiple ST7789 on RPi?

by adafruit_support_carter on Tue Sep 28, 2021 3:32 pm

D/C connects to our SPI Chip Select pin. We'll be using GPIO 25, but this can be changed later.

Yah, that looks like a copy-paste typo. Ignore the phrase "SPI Chip Select" in that line. D/C is the Data/Command pin. It just needs to be any available GPIO pin, like GPIO 25. It's not really a SPI pin. You could potentially share that pin as well, since you only ever talk to one display at a time. Or just use a different GPIO pin for each display.

MOSI/MISO/SCLK are the main SPI pins that are shared

CS definitely needs to be unique for each display

@behanson Please submit feedback on that guide page calling out that typo and the guide author will get notice to check it out. Thanks!
feedback.jpg
feedback.jpg (121.85 KiB) Viewed 33 times

adafruit_support_carter
 
Posts: 21381
Joined: Tue Nov 29, 2016 2:45 pm

Re: Multiple ST7789 on RPi?

by behanson on Tue Sep 28, 2021 3:50 pm

You only answered half the question. How about the Reset pin? Can that be shared or between the displays?

behanson
 
Posts: 26
Joined: Wed Apr 18, 2018 4:02 pm

Re: Multiple ST7789 on RPi?

by adafruit_support_carter on Tue Sep 28, 2021 5:35 pm

yes, if you want to reset both displays at the same time, which is probably ok

adafruit_support_carter
 
Posts: 21381
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.