Page 2 of 2

Re: 1.8'' TFT Display

Posted: Wed Mar 18, 2015 10:47 am
by Jerry Messina
Is there a way to use Hardware SPI with this (without modifying code too much)?
I suppose so, but both Coccoliso and bitfogav have a lot more experience with the graphics stuff than I do, so they might know better than I.
Sometimes these chips don't like faster speeds, and running SPI down a long wire isn't the best of arrangements.


Anyway, code-wise it looks like you would replace the routines in the driver with:

Code: Select all

    Public Sub WriteCommand (pData As Byte)
        _rw=0
        _cs=0 
        SPI.WriteByte(pData)
        '_cs=1
    End Sub

    Public Sub WriteData (pData As Byte)
        _rw=1
        _cs=0
        SPI.WriteByte(pData)
        _cs=1
    End Sub

    Public Sub WriteWordData (pData As Word)
        _rw=1
        _cs=0
        SPI.WriteByte(pData.byte1)
        SPI.WriteByte(pData.byte0)
        _cs=1
    End Sub
It seems the chip supports writes up to 10MHz, and if so you should be fine with the default SPI.SetAsMaster() setting which would be 32MHz/4=8MHz. If not, you could slow it down to 2MHz using SPI.SetAsMaster(spiOscDiv16)

You'd have to change the connections to use the SPI RC3 (SCK) and RC5 (SDO) pins. Add code to init the SPI driver, and make sure the new pins are in digital mode.

Not sure if there's anything else needed... maybe somebody else has tried this already.

Re: 1.8'' TFT Display

Posted: Wed Mar 18, 2015 4:57 pm
by Coccoliso
Hello everyone,
There are other modules that mount ST7735 controllable with SPI ( as AdaFruit ST7735 ) but what you have, Overclocked,
is wired with I2C only.. to drive it in SPI must lead to the connector other pin of the graphic chip.
Is pretty much what happens with all chip TFT that have multiple interfaces.. is the interconnect board that makes it parallel / serial or SPI.

Re: 1.8'' TFT Display

Posted: Wed Mar 18, 2015 7:55 pm
by Jerry Messina
but what you have, Overclocked, is wired with I2C only
Are you sure about that?

This thread has me a bit confused. When I look at the datasheets for the S6D02A1A01 and/or ST7735 IC's the only serial interface I see in those datasheets is SPI... neither of them use I2C. You have your choice of "3-wire" or "4-wire" SPI, but the "3-wire" version makes you transmit 9-bit serial data, so that one's pretty useless unless you're bit-banging it.

BOTH datasheets I looked at are confusing because they use the "I2C" signal names SDA and SCL for the data and clock lines, but if you ignore the names those logic diagrams are SPI.

I have no idea what's actually on any of these displays, and it's probably some other chip that has multiple modes...

Re: 1.8'' TFT Display

Posted: Wed Mar 18, 2015 8:03 pm
by bitfogav
Ok so today I decided to run the 1.8 tft display with a 5v pic using basically the same code that I had with my 3.3v pic.. The display is almost white now but you can see a faint outline of the text on the display :roll:
I have also come across this webpage secret hack now they recommend putting 1k resistors on the data lines, basically to run the I/O at 3.3v. Don't know if it's worth a try or not?
1_8_TFT.jpg
1_8_TFT.jpg (135.89 KiB) Viewed 12218 times

Re: 1.8'' TFT Display

Posted: Thu Mar 19, 2015 11:55 am
by Jerry Messina
If you're using a pic @ 5V to drive the display, that could definitely be a problem.

I'm not a fan of using series resistors to interface 5V -> 3V3 devices since you're relying on that to just limit the current into the pins and (hopefully) still have the 3V3 device function correctly. If I did, I'd use something larger than 1K... perhaps 10K.

Trouble is, that puts a low-pass (R-C) filter on the the pins and slows down the edges. If you're bit-banging it @ 800KHz that's probably not too much of an issue, but if you want to use the SPI peripheral that could be a problem at a few MHz.

Re: 1.8'' TFT Display

Posted: Thu Mar 19, 2015 12:18 pm
by Coccoliso
I confirm Jerry,
every time I put the divider I only had problems when we have to pass the clock must put a CMOS buffer to ensure the correct data sampling.

Re: 1.8'' TFT Display

Posted: Thu Mar 26, 2015 11:23 pm
by Overclocked
Hi everyone. For some reason the forum didnt tell me there were responses.

Now I suspected the 5v thing would be trouble, so I just ran it at 3.3v. Still nothing. Got my new one in the mail.

Which is this one
http://www.ebay.com/itm/381139173995?_t ... EBIDX%3AIT

I got a little further than I did last time. But this time, instead of white, it display junk (like static on your TV.) I am confused about the nomenclature as well. They Use I2C designations, but the datasheets say they run in SPI.

Also I ohm checked the other connections, they are both shared.

Re: 1.8'' TFT Display

Posted: Fri Mar 27, 2015 10:05 am
by bitfogav
The new TFT display in your last post uses the driver ST7735S, it needs a different initialisation routine than the ST7735, so I doubt you will get it to work with the ST7735 driver module..

I got my 1.8 TFT displays from these ebay users, and both of these work with the ST7735 module at 3.3v
http://www.ebay.co.uk/itm/111480735262? ... EBIDX%3AIT
http://www.ebay.co.uk/itm/350945597957? ... EBIDX%3AIT

Edit*
I have put together a ST7735S driver and updated the tft module, please note this is an untested module because I don't have a ST7735S to test it on.
but if you replace the existing tft.bas with this one and add this ST7735S.bas to the swordfish user library folder and give it a try with your new ST7735S display?. You will also need change the data line I/O pins again in the ST7735S.bas to suit.
Tft.zip
(4.18 KiB) Downloaded 372 times
ST7735S.zip
(2.83 KiB) Downloaded 344 times

Re: 1.8'' TFT Display

Posted: Fri Mar 27, 2015 4:32 pm
by Coccoliso
Great job Bitfogav!
Try it and let us know..

Re: 1.8'' TFT Display

Posted: Fri Apr 03, 2015 12:27 am
by Overclocked
Gave it a shot, still nothing. Mine has a "AO" pin. Im assuming its a r/w pin. I might just buy the legit TFT from adafruit Just to make sure its nothing on my end. Im willing to mail the displays I have at this point to anyone who wants to get them working.

I do thank you for all the help!

Re: 1.8'' TFT Display

Posted: Fri Apr 03, 2015 6:26 pm
by Coccoliso
Hello Overclocked,
I thank you for the purpose but not accept it ..
I already have here a pseudo KS0108 that made me mad :x

Re: 1.8'' TFT Display

Posted: Fri Apr 03, 2015 8:34 pm
by bitfogav
Have you tried connecting up a led to a port pin and running a simple led flash prog on your mcu? to make sure the mcu is working correctly?.
Have you tried connecting the tft displays to PORTB?.

Re: 1.8'' TFT Display

Posted: Tue Oct 25, 2022 12:51 pm
by agent007
Hello. Checked and corrected files for the ST7735S controller are posted here:https://www.sfcompiler.co.uk/phpBB3/vie ... 198#p12198

Re: 1.8'' TFT Display

Posted: Tue Oct 25, 2022 5:42 pm
by bitfogav
Hi agent007, I'm glad that it all worked, and thank you for the PM.

What model/type of display did you get for the ST7735S driver, does it have A0 pin on it?.. :D

Re: 1.8'' TFT Display

Posted: Tue Oct 25, 2022 6:11 pm
by agent007
bitfogav wrote:
Tue Oct 25, 2022 5:42 pm
What model/type of display did you get for the ST7735S driver, does it have A0 pin on it?.. :D
I got a 1.44 inch 128x128 pixel display. Mine has contact A0, I attached it to TFT_RW