Artifacts on GLCD?

I'm new to the world of arduino so bear with me. About a 2 weeks ago I got a mega1280 with a 128x64 GLCD and basically every time the screen refreshes it potentially leaves artifacts or skews characters by a pixel. Below is an example with the artifacts circled.

I'm guessing/hoping this is something 'simple' that I can do to fix it...

LOL after several days of trying things it is only moments after finally posting here that I removed the 40 wire HDD cable I'd used and plugged the GLCD into the breadboard and the problem vanishes...what an amusingly annoying educational experience...perhaps this can help someone else as well.

EDIT: low and behold it was an 80 wire cable and I'd never noticed...that explains quite a few things...

Thanks for sharing. The 80-wire 40-connector IDE hard drive cable is very tempting but lots of the 40 connections are connected together to the ground. I discussed this a while back. You will need a 40-wire 40-connector older cable.

http://arduino.cc/forum/index.php/topic,54426.0.html

Grrr...So I get a 40 wire ribbon cable and while the display is much improved I still get similar artifacts. If I plug the GLCD directly into the breadboard it works 100% with no artifacts. While with the 40 wire ribbon I get about 1/3 the artifacts show in the image.

Any further thoughts?

EDIT: and it does the 50% of screen disappears after a bit as well...

So this 40-wire cable, does it have a mechanical key (obstruction on pin 28)? If not, try the other row of pins maybe? That's all I can think off. I'll test mine in a little bit.

liudr:
So this 40-wire cable, does it have a mechanical key (obstruction on pin 28)? If not, try the other row of pins maybe? That's all I can think off. I'll test mine in a little bit.

No blocked pin, and I've tried both rows with same results. Could it have anything to do with cable length and some sort of degradation? My cable is about 18 inches long.

Molehs,
while I see your glcd picture very clearly, I can't really tell what has gone wrong
in terms of incorrect pixels as I don't really know what it is supposed to look like.

How long is your cable?
You may be getting some cross talk or ringing on lines.

I also thought that some 40 pin IDE data cables cut the wire on pin 28
for the master/slave select. Are you sure all 20 pins you are using go straight through?

Are you using the ks0108/glcd library?
If so, please use the latest v3 version of the library as the timing on it is better,
has better font rendering, and offers better potential tuning capabilities.
When using the v3 library make sure you use the latest version (currently, glcd-20110324.zip RC1)
if you have a mega2560 as there there are some forum postings that offer incorrect patches
to add in 2560 support to the glcd v3 library. (the early v3 library did not support the mega2560)
Also, you can run the diagnostic sketch to see if you get any data errors when using your
IDE cable.

While the only way to tell for sure if there is crosstalk noise or ringing on the lines
would be to check the signals with a scope,
If you are using the glcd v3 library I can help you go in and modify the timing
to try to slow things down to see if that helps.

--- bill

Ok, so I just noticed the 18 inch cable.
Yes that could easily be creating issues.

If you are using glcd v3, and want to slow down the timing to see
if that helps:

Go in and edit glcd/config/ks0108_Panel.h

down at line 149 you will see the timing defines starting with GLCD_tDDR

A quick check will be to simply insert a 1 in front of all the timing defines.
So 320 turns into 1320, 140 into 1440

It is WAY more than should be needed but if this does not solve it then
there is one other thing to try, but that involves editing the glcd_Device.cpp file
(it is a very small modification)
but more than likely there may be other things at play like voltage drop involved.

--- bill

I'm not using the v3, was v2.2. Tried a more or less drag and drop of v3 and some syntax has changed or something, I'll have to debug this evening. Run both the diagnostics and big demo from v3 and they seem to run fine but some of the parts end up with a handful of artifacts similar to original issue.

The artifacts are the red circled parts, they shouldn't be there at all basically.

I'll try more tonight but for now must go out and enjoy our one day heat spell of 80*. Thanks for the assistance, hopefully in some of that will be my solution.

Yes there are some minor changes from v2x to v3
If you bring up the html documentation (glcd/doc/GLCDref.htm) there is a section
about ks0108 library migration: see "Sketch Migration".

The changes that effect sketches are very minor and
are mostly because the library has grown.
A few things like fonts and bitmaps have changed location and a few functions
have been renamed to be consistent with JAVA graphic functions.

The changes to an existing sketch are normally very minor and if you use the deprecated header file,
the changes should only be near the top of your sketch and not in the main code itself.

I say "normally" because there are some internal library changes that might affect certain sketches.
The text rendering code was completely re-written to give consistent rendering behavior. As such,
the rendering of characters that use variable width fonts that are taller than 8 pixels may be slightly
different. (the old rendering had many issues).

But do have a look at the documentation, we tried to be fairly complete. If you have any comments
or notice any errors or missing items please let me know and we will try to get the documentation updated.

One last thing,
when you run the v3 diag sketch, make sure to look at the serial port output to see if there are any
errors.

--- bill

Ok I'll look at "Sketch Migration". In the mean time here is my serial output from the diag:

Serial initialized
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
Panel Configuration:ks0108
Pin Configuration:ks0108-Mega
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:33(PIN_C4) CSEL2:34(PIN_C3)
 RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0)
 D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3)
 D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1)
Data mode: byte
--------------------------------------------------------------------
Diag Loop: 1
Initializing GLCD
Displaying ChipSelect Screens
Walking 1s data test
Wr/Rd Chip Select Test
Testing GLCD memory pages
Horizonal Page Test Chip: 0 Pixels 0-63
 Verify error: (17,0) 5C!=50
 Verify error: (26,0) E7!=24
 Verify error: (48,0) 87!=84
Vertical Page Test Chip: 0 Pixels 0-63
 Verify error: (59,0) 83!=82
Horizonal Page Test Chip: 1 Pixels 64-127
Vertical Page Test Chip: 1 Pixels 64-127
Full Module Horizontal Page Test:Pixels 0-127
 Verify error: (64,0) 40!=0
 Verify error: (64,0) C0!=0
 Verify error: (64,0) 41!=0
 Verify error: (65,0) 42!=0
 Verify error: (66,0) 43!=0
 Verify error: (67,0) 44!=0
 Verify error: (68,0) 45!=0
 Verify error: (64,0) C1!=0
 Verify error: (64,0) 41!=80
 Verify error: (64,0) C1!=0
 Verify error: (65,0) C2!=0
Full Module Vertical Page Test:Pixels 0-127
 Verify error: (0,0) 8!=0
 Verify error: (0,0) A!=0
 Verify error: (1,0) 12!=0
 Verify error: (0,0) 10!=0
 Verify error: (0,0) 17!=0
 Verify error: (0,0) 18!=0
 Verify error: (1,0) 20!=0
 Verify error: (0,0) 19!=0
 Verify error: (1,0) 21!=0
 Verify error: (2,0) 29!=0
 Verify error: (3,0) 31!=0
TEST FAILED

Doesn't look promising... :astonished:

The old fashion IDE cable should be able to carry at least 33Mb/s communication without problem :roll_eyes:

So it's strange to me that you can't pass signal to a slow display. Did slowing down the display solve your problem?

liudr:
The old fashion IDE cable should be able to carry at least 33Mb/s communication without problem :roll_eyes:

So it's strange to me that you can't pass signal to a slow display. Did slowing down the display solve your problem?

I opted to upgrade to v3 first, but it's tanking a bit to get it sorted. Once I can get v3 running with my sketch I'll check back in. Thanks for the help guys.

Molehs,

Thanks for taking the time to update us. I believe our discussion will be useful to others thinking about doing the same.

Molehs,
Was that diags run with or without the IDE cable?
I'm assuming that it was with the IDE cable?

liudr:
The old fashion IDE cable should be able to carry at least 33Mb/s communication without problem :roll_eyes:

So it's strange to me that you can't pass signal to a slow display. Did slowing down the display solve your problem?

But just because the glcd is slow processing things doesn' t mean some of the signal lines are not transitioning "fast".
The IDE 33MB/sec used 120ns clocks. A few of the transitions on the glcd interface are in that range as well.
But the biggest thing is that a proper IDE interface will have much better line drivers than what is being
used in this situation.
My guess is that there may be some ringing going on.

Also, in a couple of places I "cheated" on the timing to bump up the performance.
The ks0108 spec says to wait tAS (normally 140 ns) between setting control lines and raising E.
The proper delay is there for normal reads & writes but not for reading the busy status line.
Even with no added delay, the delay will still be about 1 clock maybe 2 which is 62.5-125 ns at a 16mz clock rate.
With normal short lines this is not an issue, but it might be for these extended wires.

It isn't exactly known when a glcd reacts to the E signal as its clocks are asynchronous
to the Arduino clocks. But if the control lines haven't fully settled when it sees E rise, the glcd might
do unpredictable things.

It is an easy thing to test to see if this is the issue.
(this is the small edit of the code I mentioned earlier)
Edit the module glcd/glcd_Device.cpp
Around line 457 there is a delay for tAS that is commented out.
Uncomment that line to re-insert the proper delay.

To rule out any cable ringing & noise issues,
I would make this change along with increasing all the delays
as mentioned in the earlier post.

--- bill

Well, my biggest issue of compiling v3 successfully was related to PEBKAC, and now it compiles just fine but my screen just comes up blank now when I run 'my' sketch. Even thought the v3 diag and demos worked I re-wired the screen to make sure. Also I've got the screen mounted on the breadboard directly to remove that as a possible issue. So now I'm assuming it's got to do with the code and how it's being handled.

So do I try and get the artifacts or my sketch sorted first?

(and it seems I can't post my full code in the post, where would I do that?)

I would want to focus on the glcd working with diags first.
So can you clarify if the problems you were seeing on the glcd were when the glcd was hooked
up with/without the IDE cable and if it is now working or not working correctly now?
Do diags pass?

--- bill

OK I changed the ks0108_Panel.h and glcd_Device.cpp lines with little to no improvement. Here is my serial output with TEST FAILED. This was done using the 18" 40 wire ribbon cable.

Serial initialized
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
Panel Configuration:ks0108
Pin Configuration:ks0108-Mega
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:33(PIN_C4) CSEL2:34(PIN_C3)
 RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0)
 D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3)
 D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7)
Delays: tDDR:1320 tAS:1140 tDSW:1200 tWH:1450 tWL:1450
ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1)
Data mode: byte
--------------------------------------------------------------------
Diag Loop: 1
Initializing GLCD
Displaying ChipSelect Screens
Walking 1s data test
Wr/Rd Chip Select Test
Testing GLCD memory pages
Horizonal Page Test Chip: 0 Pixels 0-63
Vertical Page Test Chip: 0 Pixels 0-63
Horizonal Page Test Chip: 1 Pixels 64-127
Vertical Page Test Chip: 1 Pixels 64-127
Full Module Horizontal Page Test:Pixels 0-127
 Verify error: (50,0) 5E!=5D
 Verify error: (64,0) FA!=39
 Verify error: (0,0) BC!=0
 Verify error: (64,0) 80!=0
 Verify error: (64,0) 95!=0
 Verify error: (64,0) 9F!=0
 Verify error: (64,0) A5!=0
 Verify error: (64,0) 3D!=0
 Verify error: (64,0) E5!=0
 Verify error: (64,0) E7!=0
 Verify error: (64,0) EA!=0
Full Module Vertical Page Test:Pixels 0-127
 Verify error: (0,0) 2C!=0
 Verify error: (64,0) 4A!=42
 Verify error: (0,0) 4E!=0
 Verify error: (71,0) 82!=81
 Verify error: (0,0) 63!=0
 Verify error: (64,0) BF!=B7
 Verify error: (0,0) C1!=B9
TEST FAILED

But does it all work/pass without the cable?

And are you positive that all the 20 pins you are using on the cable
go straight through with no opens, shorts, or cross connections?

And how is everything connected? In particular, how are you connecting the 40 pin cable
to the mega?

--- bill

Looks like it failed worse without the cable...

Serial initialized
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
Panel Configuration:ks0108
Pin Configuration:ks0108-Mega
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:33(PIN_C4) CSEL2:34(PIN_C3)
 RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0)
 D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3)
 D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7)
Delays: tDDR:1320 tAS:1140 tDSW:1200 tWH:1450 tWL:1450
ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1)
Data mode: byte
--------------------------------------------------------------------
Diag Loop: 1
Initializing GLCD
Displaying ChipSelect Screens
Walking 1s data test
Wr/Rd Chip Select Test
Testing GLCD memory pages
Horizonal Page Test Chip: 0 Pixels 0-63
 Verify error: (0,0) 0!=3F
 Verify error: (43,0) 2B!=2A
 Verify error: (44,0) 2C!=2B
 Verify error: (45,0) 2D!=2C
 Verify error: (46,0) 2E!=2D
 Verify error: (47,0) 2F!=2E
 Verify error: (48,0) 30!=2F
 Verify error: (49,0) 31!=30
 Verify error: (50,0) 32!=31
 Verify error: (51,0) 33!=32
 Verify error: (52,0) 34!=33
Vertical Page Test Chip: 0 Pixels 0-63
 Verify error: (23,0) B8!=C0
 Verify error: (7,0) 3E!=46
 Verify error: (6,0) 3C!=44
 Verify error: (3,0) 28!=30
 Verify error: (7,0) 44!=4C
 Verify error: (6,0) 40!=48
 Verify error: (25,0) E0!=E8
 Verify error: (3,0) 30!=38
 Verify error: (4,0) 40!=48
 Verify error: (2,0) 2C!=34
 Verify error: (0,0) 1E!=26
Horizonal Page Test Chip: 1 Pixels 64-127
 Verify error: (64,0) C4!=3
 Verify error: (114,0) F6!=F5
 Verify error: (115,0) F7!=F6
 Verify error: (116,0) F8!=F7
 Verify error: (117,0) F9!=F8
 Verify error: (118,0) FA!=F9
 Verify error: (119,0) FB!=FA
 Verify error: (120,0) FC!=FB
 Verify error: (121,0) FD!=FC
 Verify error: (122,0) FE!=FD
 Verify error: (123,0) FF!=FE
Vertical Page Test Chip: 1 Pixels 64-127
Full Module Horizontal Page Test:Pixels 0-127
 Verify error: (43,0) 2B!=2C
 Verify error: (51,0) B4!=B5
 Verify error: (24,0) 1B!=1C
 Verify error: (0,0) 6!=45
 Verify error: (9,0) F!=E
 Verify error: (10,0) 10!=F
 Verify error: (11,0) 11!=10
 Verify error: (12,0) 12!=11
 Verify error: (13,0) 13!=12
 Verify error: (14,0) 14!=13
 Verify error: (15,0) 15!=14
Full Module Vertical Page Test:Pixels 0-127
 Verify error: (39,0) 39!=41
 Verify error: (28,0) EB!=F3
 Verify error: (40,0) 46!=4E
 Verify error: (12,0) 67!=6F
 Verify error: (32,0) A!=12
 Verify error: (47,0) 80!=88
 Verify error: (25,0) D7!=DF
 Verify error: (2,0) 1C!=24
 Verify error: (47,0) 92!=9A
 Verify error: (2,0) 2D!=35
 Verify error: (49,0) A9!=B1
TEST FAILED