NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » GLCD SPI problems

September 27, 2013
by andyi
andyi's Avatar

Hi, I have looked over the forums and internet in general but I cannot find the answers i need (or I'm too stupid to understand them). I have a small 1.8 inch tft screen from ebay. It has an spi interface with the following pins:-

RESET, A0, SDA, SCK, CS,

It is a ST7735 controller and looking in the datasheet it mentions 2 versions of spi: 3 wire and 4 wire. The difference is that the 4 wire version uses CS, SDA, SCK and D/C (data or command switch) and the 3 wire uses CS, SDA and SCK whereby the D/C instruction is sent as a single bit immediately before the serial byte. i.e. 9 bits of info sent instead of 8.

What I need to know first is which one is this? I think it all revolves around the A0 pin. I assumed this was the serial out pin and therefore I should use the 3 wire SPI protocol but could this pin be the D/C pin instead?

Does any of this make sense ?

Andy.

September 27, 2013
by JimFrederickson
JimFrederickson's Avatar

Hello Andy,

It may be that you have multiple interfaces on that 1.8" display?

Are those the ONLY pins for the Interface that are available, or just the pins that you
think are necessary?

Usually...

SDA SCK, and A0 are associated with and an I2C Interface.

MOSI, MOSO, SCK or CLK, CS are associated with an SPI Interface.

I have seen some 1.8" Displays that have multiple Interfaces as well as some that have
a Display and an SD Card Interface as well.

The place you purchased it from did not have a Datasheet?

Do you have more details as to the Display? (Manufacturer for instance?)

September 28, 2013
by andyi
andyi's Avatar

Hi Jim, Thanks for getting back to me. I think I made the mistake of assuming SPI and serial are the same and could be used interchangeably. I have been sent a number of diagrams that appear to show SD card connections too but mine doesn't have an SD card. All I know is that there are 14 pins and the controller is ST7735. The pinout i was sent is:-

1 NC

2 VSS

3 LED-

4 LED+

5 VSS

6 /RET

7 A0

8 SDA

9 SCK

10 VDDA

11 VDDIC

12 /CS

13 VSS

14 NC

where VSS and LED- are connected to Ground, LED+, VDDA, VDDIC are connected to 3.3V and the rest to the MCU (via 10K resistors to bring the voltage down to ~3.3v)

September 28, 2013
by JimFrederickson
JimFrederickson's Avatar

Hello Andy,

On the "drawing/datasheet" where you got your pinout do you see these numbers:

TFT177T027-V4

Or maybe the actual filename is:

SPE_IM120905001_FPC.pdf

That one, that I found, shows the same Pinout as you posted.

I looked it up initially, because I thought maybe you had an error in your Post.

It is unusual NOT to have a GND pin referenced somewhere, however I did find one that doesn't...
(Just as you entered.)

It seems that it is very likely, that most of your confusion
has more to do with a manufacturer using incorrect terms. (Or I guess it could just be considered a "translation issue", but the result is the same.)

September 29, 2013
by andyi
andyi's Avatar

The drawing has the heading TFT177F028 but further down there is also the designation TFT177M028-V4 . It is surrounded by chinese characters so I don't know what it refers to.

September 29, 2013
by JimFrederickson
JimFrederickson's Avatar

Very similar to the one that I found...

The names of the pins on the 14-pin connector do not follow what the ST7735 Datasheets shows.

I am pretty sure that the following are correct:

SDA - Serial Data (it looks like both in and out)
SCK - Serial Clock

There are 2 more Interface Pins to account for on the ST7735 Interface:
D/CX and CSX

A0 - Probably is for “Address Line 0”, this is common for selecting devices and also
for registers.
Since there is a Command Register and a Data Register, or at least the controller
must be able to distinguish between goth, this most likely used for that purpose.
High - Display Data
Low - Display Command
This probably the “D/CX” pin on the ST7735.
Unfortunately, I am not clear as to whether this “has to be used” or “can be
used”? I think it depends how the ST7734 is wired up on the board you have.
Using it to determine whether you are sending a Data or Command should always
work.

/RET - Is probably trying to saying “active low” with the “/” and “RET” is probably
meant to be “RES”.
This is necessary to “Reset the Display” to a known state.
According to the DataSheet this is “Active Low” so probably tie this to “+”
through a 10k resistor.

/CS - Is again probably trying to represent an “active low” condition, for the “Chip
Select”.

So you Interface Pins are:
SDA
SCK
A0
/CS

This is a fairly complex Controller.

Just “talking to it” is only part of the problem.

You have to “talk to it with the data and formats it expects” as well!

Hopefully you have some code already designed, and known working, for this display?

There is ALWAYS the allure of "cheap parts from China", but there is also the "reality of figuring them out".

Often the documentation is not what it used to be when everything was made here, or at
least by US Companies. (Long gone are the days of boards having a "Top Left Orientation" with the "Chip Numbers" oriented horizontal or turned 90 clockwise". Now,
as is often the case, even the Pin Names are not correct!)

That is, probably, the most help I can give. (Which I believe, and hope, is accurate.)

I don't have one of these Displays.

I found lot's of software designed in the Arduino Environment for this Display, but
you need that environment for that! (Which can be done...)

This Interface while "called SPI" is not the "Serial Peripheral Interface"/"SPI"
Standard.

This is more a form of I2C...

(you can look at good descriptions of both Standards on Wikipedia.)

September 29, 2013
by andyi
andyi's Avatar

Thanks so much for that explanation. I do have some code for ST7735 controller - originally for another MCU but I think I've modified correctly it for the AVR. I'll get to the code bit when I'm fairly sure that the thing is wired up properly.
I will look up I2C and see if converting the code I have to that standard helps.

September 29, 2013
by JimFrederickson
JimFrederickson's Avatar

If yo have code that "you believe works", I would use that first.

I don't think that it is "I2C Compliant/compatible" it is just that the protocol they
use is closer to i2c than SPI. (Even though SPI is claimed in the Datasheet.) Maybe
after you get the code you have working, then you can look into the I2C part.

I would suggest getting the LCD to work with what you have and then separately getting
I2C to work...

Then you can look into seeing if i2c it will work with your LCD...

There is a Thread in the Forums for a 24LC256 EEPROM. This part is relatively cheap,
the thread has the code, and it runs from i2c. (I think that would be good for you to get for you to get i2c working separately.)

But read-up and be careful in your testing...

Good Luck!

September 30, 2013
by Ralphxyz
Ralphxyz's Avatar

And then there is Rick's I2C LED thread!!

Since you will have a I2C buss going.

Ralph

September 30, 2013
by JimFrederickson
JimFrederickson's Avatar

I was only using the 24LC256 EEPROM because that is a cheap part, simple to wire with
just power and the i2c interface.

That way he can, fairly easily, have an AVR that Communicates VIA i2c to start with.

So it is a "known good i2c implementation" and then "software on the AVR"...

The "i2c LCD THREAD", :), is great but there it is more involved.

I am always a fan of "smaller bites"! :)

November 08, 2013
by andyi
andyi's Avatar

Hi, Thanks for all your suggestions. I managed to get this working by not using SPI but setting clock and SDA explicity in code. The A0 pin that I mentioned above is indeed the D/C (aka RS) input. Now I will try and make it work using SPI just for completeness sake.

btw, Ralph, I asked you before about the best way of connecting FPC or FFC cables. I found these adapter boards that you can solder various pitch cables directly to.

link to ebay

the code is just the same UTFT code I used for the sainsmart 3.2 glcd in my other thread. Andy.

November 08, 2013
by andyi
andyi's Avatar

also I should mention that I got this working by running the mcu and glcd at 3.3v

November 08, 2013
by Ralphxyz
Ralphxyz's Avatar

Hey andyi, those pcbs look interesting. What is the ic in the upper right?

Do you have a schematic?

Ralph

November 10, 2013
by andyi
andyi's Avatar

Hi Ralph, I'm not sure what that space is designed for, possibly a level shifter ic? I only use these boards to solder FPC cable to as it is the only way I've found to do this reliably without buying expensive connectors for every ribbon I come across. As you can see from the link they have 4 different pitches and in the pictures below, you can see how easy they are to solder up (my soldering skills are basic at best!).

view from top

view underneath

Post a Reply

Please log in to post a reply.

Did you know that you can make a capacitive proximity sensor with some aluminum foil and paperclips? Learn more...