SPI on Sparkfun SerLCD

OhioJim

Well-known member
Does anyone know of an example on how to do this?

All the examples I see are for I2C. I am finding that it is a bit slow in my application. I am getting an annoying flicker of the display as it is updating.

I see in the SerLCD library that it has SPI capability, but but there are so many "#ifdef" that I can't figure out how to use it.
 
Sorry I am not sure which display you have, but assuming it is one like:
https://www.sparkfun.com/products/16396

I would assume you would hook up PWR/GND and then signals to the SPI pins (SCK, SDI, SDO, /CS) Sometimes can be confusing on mixing markings...
if the SDI connects to MOSI (or MISO) and SDO to the other.... If all else fails try both ways...

Looks like maybe with their library you would use the begin method: void begin(SPIClass &spiPort, byte csPin, SPISettings spiSettings);

Again I have not looked at their specs but it might be something like:

Code:
#define TFT_CS 10 // some pin number
SerLCD tft = SerLCD();
...
void setup() {
    tft.begin(SPI, TFT_CS, SPISettings(2000000, MSBFIRST, SPI_MODE0));
...
But again only guessing as I don't know what speeds it can handle or mode or...
 
Thanks, KurtE. That is the problem I am having. The capability certainly looks like it was there, but there are no examples showing what is needed to make it work.

I will have to look into it some more.

The LCD I have is this one.

Edit: I looked at the online documentation the SerLCD. It has example code for using SPI. However it seems to not use the "utility functions" like the I2C interface. For example, with I2C you use lcd.clear() to clear the display but their SPI example requires that you use 2 SPI.transfer commands and bit-bang the CS pin.
 
Last edited:
Yes, that was what I was looking at. What you linked to.

I am currently using the "LCD library for SparkFun RGB3.3v SerialOpen LCD display with attached Qwiic adapter", by Gaston R. Williams. It does say that any command can be used on any interface (I2C, serial, SPI). So I will have to study it some more and give it a try.

What i am getting is not actually a flicker, but it just seems to take a while to update the display. I can see it clear a line and write the new one. It would be nice for this to be not visible. My concern is that the display firmware itself is slow and going to a faster interface won't make any difference.

One other problem is that when updating the display with the GPS clock time, every so often it skips a second or two. But the calculated Sidereal Time does not do this. During debugging, I sent the GPS time to the Serial port and it looks fine there. That is what makes me think it is a display update problem.

I did read in the specs that the display is supposed to have an 80 character buffer. Since I have the 20x4 version, it should never overflow the display since I am updating only once per second.
 
Back
Top