Incorrect pixel potition on Sainsmart 320*240 (SSD1289) display using UTFT

Hi Folks,

Just got my hands on a Sainsmart branded 320*240 display shield. When I ran up the demo it just did not look right, so I just knocked up a little test up that prints a pixel at a time. What I found is that its printing the pixel in the wrong location. IT seems to swap every the location every second pixel.

ie,
drawPixel(1,1) paints pixel 2,1
drawPixel(2,1) paints pixel 1,1
drawPixel(3,1) paints pixel 4,1
drawPixel(4,1) paints pixel 3,1

and so on so forth.

Any ideas before I start trawling through data sheets and the library?

Thanks.

Not sure I understand, but changing

LCD_Write_COM_DATA(0x01,0x2B3F);

to

LCD_Write_COM_DATA(0x01,0x3B3F);

in initlcd.h fixes it.

To me that suggested that the following setting is changed according to the data sheet I have.

CAD: Set up based on retention capacitor configuration of the TFT panel. Setting that bit means Cs on Gate. I am afraid I dont know a huge amount about these displays, so its double dutch to me.

Other folk have had a similar problem, see here and also here. It is great that you have found a solution.

Looking at the SSD1289 data sheet shuggests that the SM bit of the control word is the one to change, rather than the CAD bit.

The SM bit (on most controllers) does interlace mode. You see odd lines in the top half, even lines in the bottom half of the screen. i.e. it looks like repeated picture.

The GD (hardware pin) seems to control the gate sequence.
I can't find a software method to change it.

But if CAD does the business, you will have got a functional display.
If I summon up enthusiasm, I will toggle CAD on my (regular) SSD1289 controller.

If I can exchange the pixel pairs, this would imply your solution is correct.

David.

Like I said, I dont really understand the TFT stuff. Been doing micro programming for about 25 years, but most of my display experience has has been 7 seg or character LCD!

When I get some spare time, I will do some reading up on the subject and get a better idea on how it all works.

I would be interested in hearing the results of your test David. In the next few days I will reread the datasheet and have a play with the SM bit just to see what happens!

Well, I tried the CAD bit. It did not affect my display.
I tried the SM bit. It controlled the interlace as expected.

GD is a hardware pin, I can understand how your display can give this behaviour.
I can understand how a wrong trace routing (or solder bridge) could affect the GD pin.

This particular "problem" has been reported several times.
I suggest that you PM the other owners to see if your "fix" works.

If it is a solution, I suspect that the GD pin has got an open trace (i.e. Sainsmart quality workmanship)
And perhaps the CAD bit switches capacitance which "steers" the open GD pin.

Pure speculation. I do not understand the hardware.

David.

Thanks David. I will download the schematics (assuming they are available) and will try check the GD Pin. Might be a bit hard as the display is well stuck to the pcb.

I will also contact sainsmart.

I doubt if the GD pin is accessible on the ribbon cable.

If your display is working 100% correctly when you set the CAD bit, I would just feel smug.
But I would check with the other "problem" owners to see if it is a reliable "solution" for them.

Quite honestly, you should ask for your money back if your display does not work correctly.

I wish you luck with Sainsmart. They have a reputation to keep up.

David.

Quick update, I tried to change SD Bit and not CAD, but it did not work.

Clearly, change the CAD bit is the only thing that seems to have worked for me.

So for Register 0x01 (Driver Output Control), 3b3f is the correct value to make the Sainsmart controller work for me. I have not had a chance to email sainsmart about the issue yet.

For those having issues, the file that needs to be changed is in the library directory under UTFT. I am using windows for arduino stuff, so the file is \Program Files (x86)\Arduino\libraries\UTFT\tft_drivers\ssd1289\initlcd.h

I have no idea what the SD bit is. I can not find it in the datasheet.
The GD pin is hardware. And probably inaccessible to you.

Several people have this particular Sainsmart "feature".
It would be good news if reg(0x01)=0x3B3F works for other owners.

David.

Apologies, I meant the SM bit, not SD bit.

The SM bit controls interlace mode of the Gate Scan (GS). I can not see how it can affect the horizontal scan (SS).

As I said earlier, it works for your display.
It will be good news if it "works" for the other Sainsmart "victims".

David.

I had the same problem with my new sainsmart display and I have solved it with the reg(0x01)=0x3B3F modification. The device is working fine now and there is no sign of instability. No need to send back this low budget display!

Karsten Lohscheidt

Hello guys,

Today I received my Sainsmart 320*240 display.I tryed your fix but it fixes only the vertical lines,have you found a solution for the horizontal lines as well?

Thank you!

Your fix worked for me.

I have been through 3 Sainsmart and even tried a Viewtool TFT and hours of Googling till I came across your thread.
Thank you on behalf of the community for putting the time in.

Think I will look for a TFT Module with a ILI9341 controller next time I need one.

-Neil.

Pearo:
Not sure I understand, but changing

LCD_Write_COM_DATA(0x01,0x2B3F);

to

LCD_Write_COM_DATA(0x01,0x3B3F);

in initlcd.h fixes it.

To me that suggested that the following setting is changed according to the data sheet I have.

CAD: Set up based on retention capacitor configuration of the TFT panel. Setting that bit means Cs on Gate. I am afraid I dont know a huge amount about these displays, so its double dutch to me.

Many thanks - this solved my sainsmart TFT problem.