Arduino Forum

Using Arduino => Displays => Topic started by: guix on Dec 05, 2012, 11:51 pm

Title: SSD1289 : question about the RD pin
Post by: guix on Dec 05, 2012, 11:51 pm
Hello, I have Sainsmart's 3.2" TFT display and adapter shield for Arduino Mega

I need to read data from GDDRAM, (to retrieve pixel color), in order to do that, I need to use the RD (Data Read) pin..which unfortunately isn't useable, look this picture:

(http://i.solidfiles.net/0a29d62173.png)


The white line is the RD pin, and it's connected to Arduino's 3.3V through a 10k ohm resistor (I think it's a resistor)...

1) Any reason for it being connected to 3.3V? My guess is that it's connected here so the pin is always HIGH..am I right? (but then, why it's not connected to 5V?)

2) Can I use this RD pin if I solder a wire from it to an unused Arduino pin (such as D42 for example) ?


I hope someone can answer this!

Thanks in advance :)
Title: Re: SSD1289 : question about the RD pin
Post by: dhenry on Dec 06, 2012, 12:30 am
Quote
2) Can I use this RD pin if I solder a wire from it to an unused Arduino pin (such as #44 for example) ?


Yes.
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 06, 2012, 02:02 am
Ok I ask this because if they haven't connected it to a useable pin when designing that shield, that's probably for a good reason no?
Title: Re: SSD1289 : question about the RD pin
Post by: dhenry on Dec 06, 2012, 02:33 am
Very rarely you read it back from a serial lcd; Most serial lcds don't allow you to read data back.
Title: Re: SSD1289 : question about the RD pin
Post by: Docedison on Dec 06, 2012, 04:44 am
There is also the thought that the 'pixel' data being 'recovered' didn't get there by accident. What of the command to write the pixel and the data structure that held the information?.
It would appear to me that you are trying to use the display for additional storage, I wouldn't but that is more a matter of programming style and personal choice than some 'programming' guide or rule.
Where is the 'Tipping Point"?, where storing the data in the program or in processor ram is more difficult that re-reading the graphics device ram?.
Whatever it is, if not a local or program variable, the process will require the data to have local (non CG ram) storage... So now we have the additional code to read the graphics ram, the place to store it temporarily and the time to read, store and process the 'recovered' data.
In my rather simplistic manner of thinking your method requires more storage and processor use than if you had used the processor ram or flash area for the data storage initially.
Or is there an outstanding reason why your only access to the data if by reading the display ram?
Whatever, it kind of goes against my initial training and it seems like a great deal of trouble. IMO, a poor method. Do-Able... but certainly "my last choice"

Bob
Title: Re: SSD1289 : question about the RD pin
Post by: floresta on Dec 06, 2012, 05:50 am
Quote
Ok I ask this because if they haven't connected it to a useable pin when designing that shield, that's probably for a good reason no?

To avoid unnecessarily tying up an Arduino I/O pin for a capability that is rarely used. 

Don
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 06, 2012, 09:57 am
Docedison I don't want to use that RAM as additional memory. I've though about doing this but then it will draw weird things on the display :)

Indeed I could store in variables what I write to the display, but then it require up to 320*240*16 bits, that is 150 kB... Hence my need to read data back. Hopefully, I won't constantly read from that RAM, only when needed.

And I already have code to read GDDRAM, thanks to the ArduCam library author(s), the only thing missing is an useable RD pin :)



To avoid unnecessarily tying up an Arduino I/O pin for a capability that is rarely used.


I could agree but that shield is blocking like 6 unused pins on Arduino's 36 pins connector, so they could have used them anyway, also they wasted Arduino's pins 0 and 1, the F_* pins of that shield exists just in case I want to solder a tiny additional Flash chip on the display board. Confusion again, because they wired only 2 of those F_* pins, the 3rd one isn't wired anywhere -_-
(http://i.solidfiles.net/573362865c.png)
Title: Re: SSD1289 : question about the RD pin
Post by: dhenry on Dec 06, 2012, 02:33 pm
Quote
they could have used them anyway


Not a whole lot of thoughts went into designing those products.
Title: Re: SSD1289 : question about the RD pin
Post by: floresta on Dec 06, 2012, 04:35 pm
Quote
Not a whole lot of thoughts went into designing those products.

Well we can be pretty sure that SainSmart is not the party to blame.

Don

Title: Re: SSD1289 : question about the RD pin
Post by: pYro_65 on Dec 15, 2012, 09:29 pm
Hi guix, just wondering how it went, did you manage to use the RD pin on the shield?
I have made a simple oscilloscope using the screen and I want to save some screen shots.

Also, is there a link to the specs of the tiny flash chip you mention. This display is pretty impressive, nice gaming potential.
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 16, 2012, 01:32 am
Hello pYro, I am lazy! No I didn't do it yet, because I still haven't bought a soldering iron... :)

But, I'm almost sure it will work, because the guys who did the ArduCam use it to save a .bmp file from the display's GDDRAM (using a very similar display)

As for the Flash chip, I believe we need a SST25VF chip, especially the 16 Mbits version, SST25VF016B (also exist 32 and 64 Mbits versions of this chip, so in theory it could work too!), can be found on ebay for not much :) I would like to try, but I'm affraid I have no idea how to make it work, I can't really understand datasheets timings etc..

Edit: changed "MB" to "Mbits"..I have misread :)
Title: Re: SSD1289 : question about the RD pin
Post by: pYro_65 on Dec 16, 2012, 06:18 am
Those flash chips look nice and easy to use. They are fast, with an auto address counter, could be very useful in a separate circuit to speed up sprite drawing. They would be nice on the shield for simple storage also. As I'm writing an 'animation capable' library for the screen, I will definitely look into testing one out.

Regarding the RD pin:
How would you connect the pins? Would you connect a digital pin on the 3.3v side or RD side of the resistor? Or maybe disconnect RD completely from 3.3v?
I'm thinking maybe an NPN on the RD side to pull RD low, the 3.3v sets the high.



Title: Re: SSD1289 : question about the RD pin
Post by: MarkT on Dec 17, 2012, 01:22 am

Hello, I have Sainsmart's 3.2" TFT display and adapter shield for Arduino Mega

I need to read data from GDDRAM, (to retrieve pixel color), in order to do that, I need to use the RD (Data Read) pin..which unfortunately isn't useable, look this picture:



Yes that's correct - the RD line must be wired high in serial mode (SPI) - you can't read except in one of the parallel modes.  This is
explained in the datasheet in "Table 2 Pin Function Description".

From what I can see of that adapter it uses the SPI bus - if so then you can't read the graphics memory.
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 17, 2012, 01:37 am
That resistor is only used by the RD pin, so yes I would remove it, and then 2 choices:

1- (Yellow line) Solder a wire from RD pin to pin D42 or whatever (pins D42 to D49 are unused).
2 - (Red line) Solder a wire from the pad of the (now removed) resistor to pin D42 or whatever.

(http://i.solidfiles.net/a526e4472f.jpg)

I prefer the second solution :)

But will it work... What I don't understand is, why is there a 10kohm resistor here? And why on 3.3V and not 5V? Maybe the RD pin will not support 5V from D42? I can't find anything about this in SSD1289 datasheet...

Is a pin in HIGH state as soon as it receive voltage (or current?) that is greater than 0 ?




Yes that's correct - the RD line must be wired high in serial mode (SPI) - you can't read except in one of the parallel modes.  This is
explained in the datasheet in "Table 2 Pin Function Description".

From what I can see of that adapter it uses the SPI bus - if so then you can't read the graphics memory.


The SPI pins are used only by the SD card reader (on the back of the display, it's completely unrelated to the SSD1289). I believe the display use the mode "MPU Parallel 8080-series Interface" so I think no problem to use the RD pin :)
Title: Re: SSD1289 : question about the RD pin
Post by: MarkT on Dec 17, 2012, 01:41 am
Ah good - the 4 highlight traces suggested SPI to me on a quick glance.   If the board supports both SPI and parallel modes that
could explain the decision to hard-wire the RD line (requirement for serial). 
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 17, 2012, 02:07 am
Ok I understand your misinterpretation ;)

Here is the whole thing, a mess :)
(http://i.solidfiles.net/6fb4aabd31.jpg)

If someone want the .pdn project (for Paint.NET), just ask.
Title: Re: SSD1289 : question about the RD pin
Post by: pYro_65 on Dec 26, 2012, 03:44 pm
I've just taken some time and removed the resistor attached to RD/3.3v.
I've also soldered a wire onto the pad on the 'RD' side. For now it goes to a 10k resistor, then to 5v.
I have yet to implement the read code, however the hardware changes have not affected the display's operation.

Hopefully I'll have some screen shots in the next couple of days.

Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 26, 2012, 11:18 pm
I suggest you use the read code that can be found in the ArduCam library.

Waiting your screenshots :)
Title: Re: SSD1289 : question about the RD pin
Post by: pYro_65 on Dec 31, 2012, 12:53 pm
Finally, got some action. Not perfect yet, there is a slight timing error which I'll weed out soon over some coffee. But here is some preliminary shots.

Thanks guix, your thread helped me to do it.

(http://genx.biz/Images/Screen0.png)

(http://genx.biz/Images/Screen1.png)

(http://genx.biz/Images/Screen2.png)

(http://genx.biz/Images/Screen3.png)
Title: Re: SSD1289 : question about the RD pin
Post by: guix on Dec 31, 2012, 02:29 pm
Hello pYro 65,

Good job! Once you fix the errors, can you describe precisely how you did the whole thing?

Thanks :)
Title: Re: SSD1289 : question about the RD pin
Post by: pYro_65 on Jan 01, 2013, 02:31 pm
Sure, i'm going to do a post with a new library one day, for now here is a thread with a video of it running. Once I work out the read function fully I'll post all the details here too.

EDIT: the link may help: http://arduino.cc/forum/index.php/topic,140111.0.html