SPI and st7789 LCD notes

Viewed 8 times

I’ve done some research, but not probably not enough, as I’m still confused some.

First of all, I’ve got a Pi rev 1 Model B (with the 26 pin connector) and two devices: The Waveshare AD/DA board and e-ink display HAT form factors. They share the MOSI and SCLK pins, but the AD/DA board appears to use gpio pins 15 and 16 for CS0 and CS1, whereas the display uses spi pin 24. If I understand correctly, should I be able to get both devices to work as long as I get the timing on the chip selects right? I saw one post that specifically mentioned not using pin 24 (CEO) when trying to get more than 2 devices working together. Is there a reason for that???

Lastly, the devices also share pin 11, but I have a free gpio, pin 7. The next question is, via wiringPi (or something else?), can I reassign that pin for the display while not confusing the AD/DA board? I can easily physically wire that (pin 7) to the pin position that the HAT expects it, but I’m not sure if assigning a different pin via software is universal or can be done for a particular instance (ie display and not the ad/da board).

I know I’ve got to read up more on this, but it’d be nice to know if I’m trying something impossible.


 New contributor
  • Hi @klatk, Welcome. Let me see. Yes, the standard method is to use CE0, CE1, and CE2 to enable/select chips and devices. But you can also forget the standard CE0~2 and have your own CE3, 4, 5, … using GPIO pins. Actually you can also use GPIO expanders such a MCP23017 GPIO pins as CE pins to select SPI devices. (Yes, I did it since my Arduino Decimilla days.). Coming back to SPI LCDs, there are some problems: (1) If the LCD driver is hard coded to use SPI0, then you need to modify the driver or write your own driver. (2) / to continue, … – tlfong01 27 mins ago   
  • (2) The LCD module’s hardware CS0 signal wire might be hardwired to ground (ie, chip always selected), and it is difficult to disconnect the CE line and extract it out to your CS0, … CSn lines. Some small LCDs, eg ST7789 based, are not that difficult, and some actually have the CS line in the input connector for hackers to use: (3) raspberrypi.stackexchange.com/questions/104846/…, (4) raspberrypi.org/forums/viewtopic.php?f=91&t=233311#p1429189. – tlfong01 21 mins ago   
  • And messing around the SPI LCD driver/kernel is for sure not for the faint of heart newbies. For the over ambitious ninjas, I would recommend to start with the very popular ILI9341 based LCD modules: (1) raspberrypi.stackexchange.com/questions/98549/… (2) raspberrypi.stackexchange.com/questions/104600/… (3) raspberrypi.stackexchange.com/questions/99134/…. Good luck and cheers! 🙂 – tlfong01 12 mins ago    
  • For newbies wanting to learn how to write a LCD driver the easiest way, I would recommend the Piromoni’s ST7789 LCD module, for which you can use their Python library to control the LCD. Actually the python functions used in their library are not that difficult, I mean by ninja standards: (1) “How to connect ST7789 LCD to Raspberry Pi: raspberrypi.stackexchange.com/questions/105364/…. Note: there is no answer in the post, but read my comments in the CHAT record. – tlfong01 3 mins ago    Edit   

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: