Page 1 of 1

Sainsmart ST7735 LCD display

Posted: Sun Oct 26, 2014 5:00 am
by gcarver
I'm attempting to write a driver for this display but it does not work at the moment. I was hoping I could get some help on what the SPI settings for this hardware should be.
My code is here: ... /

The datasheet for the hardware is here: ... R_V0.2.pdf

I've looked at some code for RPi implementation and the baud rate is set to 20mhz.
I also looked at for cross reference. This sets the baud rate to around 16mhz and the phase to 0. This phase is not legitimate and actually gets set to 2.
However I cannot read the timing charts to know what to set the SPI values to.

I'm going to keep plugging away and even try software SPI to see if I can find where I'm going wrong.

Thanks in advance for any help.

Re: Sainsmart ST7735 LCD display

Posted: Sun Oct 26, 2014 12:14 pm
by nelfata
I just modified the stock LCD driver in MP (but the C code) and I thought to share with you some notes to get you going:
- make sure you have the pins connected appropriately
- make sure the SPI bus is not shared with other devices (if it is you need to make sure the CS lines are connected and in use)
- check if you are configuring the CS line as a digital output
- double check your SPI configuration
- use a slow SPI clock speed setting to start with (try 1MHz or even 500KHz), sometimes your wires might be too long and higher speeds would generate noisy data lines
- check the signals on a scope (make sure the clock speed is what you expect)
- the phase is being set correctly but the print is showing 2 instead of 1 on the MP console (I will file a bug against it)
- a good way of testing the proper configuration is to write a series of registers and read them afterwards (not all displays allow you to read), make sure you write a block and you read the same block and verify, if you have the clock/phase badly configured this method will allow you to detect that

I hope this helps.

Re: Sainsmart ST7735 LCD display

Posted: Wed Oct 29, 2014 4:15 am
by gcarver
Thanks for the help. It was invaluable. I now have everything working!
I was not controlling CS as I thought the SPI module was doing that. However the documentation states that the NSS pin is not used and I'm pretty sure that is synonymous with CS.
The phase also needed to be 1 and I finally figured that out from the timing charts.

I've updated GitHub and currently have lines, circles and boxes implemented. Will be adding text soon.
I'd like to implement in C but I'm on windows and don't have a cross compiler successfully installed.

Re: Sainsmart ST7735 LCD display

Posted: Mon Nov 03, 2014 3:34 pm
by nelfata
My pleasure, I am glad it worked for you.

Re: Sainsmart ST7735 LCD display

Posted: Mon Nov 10, 2014 4:54 pm
by gcarver
I've finished implementing the ST7735 driver in c and it is much, much faster than the python version.
I still have to implement the TFT tests and there is no documentation other than source code at the moment.
In case anyone is interested my branch is at
It is implemented as pyb.TFT. I used pyb.LCD pretty much as a template.
It supports multiple fonts (not provided in this branch) but by default uses the same font as pyb.LCD.
I am still supporting the python version of the driver because that does not require a new uPython image. Th python implementation cannot use the pyb.LCD font however.

Re: Sainsmart ST7735 LCD display

Posted: Tue Aug 25, 2015 7:30 pm
by josie87

after I fryed my displaymodule, I thought I 'd go for a shiny colored one. My choice fell on a ST7735. I tryed to hook it up using your lib, but all I get is a black screen.

To verify the screen itself,I ran the arduino examples with my uno and nano, both work fine. Of course I also used the same cables.

I would guess that I wired smth. wrong:

d/c -> x2
rst -> x1
cs -> x5
clk -> x6
din -> x8
bl -> 3.3V

I attached a picture with the pinout.

Hope anyone can help me

Re: Sainsmart ST7735 LCD display

Posted: Sat Aug 29, 2015 4:34 pm
by josie87