Go Down

Topic: Baby steps with Arduino: GLCD (sg12864j4) doesn't show text (Read 801 times) previous topic - next topic

sandrodz

Feb 07, 2013, 04:50 pm Last Edit: Feb 07, 2013, 04:59 pm by sandrodz Reason: 1
This is my first try with Arduino and generally electronics... I used to love this things when I was a kid, I wish Arduino existed back then.

Anyhow,

I'm trying to hook up lcd screen sg12864j4 to Arduino mega 2560.

Datasheet for sg12864j4 is here: http://storage.vas3k.ru/file/SG12864J4.pdf
And GLCD guide for wiring (Panel B): http://playground.arduino.cc/uploads/Code/GLCD_Documentation.pdf

I read datasheet and figured out my LCD was Panel B, not sure if this is correct though.

When I uploade "Hello World" sketch. Screen / backlight and contrast work fine. Potentiometer also correctly controls contrast. But I don't see anything else on the screen, just a solid block of white pixels.

I ran GLCD diagnostic. And in Serial monitor I saw this:

Code: [Select]
Serng GLCD
GLCD initialization Failed: RESET wait Timeout (status code: 2)
----------------------------
Diag Loop: 2
Initializing GLCD
GLCD initialization Failed: RESET wait Timeout (status code: 2)
Serial initialized
--------------------------------------------------------------------
Reported Arduino Revision: 1.3
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec  5 01:50:07 CST 2011
GLCD Lib build number: 442
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
--------------------------------------------------------------------


I also tried to take meaningful photos, but it is very hard... I doubt any1 will understand my wiring :(

First photo shows how contrast changes when I turn the knob.






Maybe I should reshoot these with daylight?

bperrybap

I can't really tell where the wires are going.
The message from diags is stating that the library was waiting for the lcd to finish coming out of reset and it never saw it.
Because of this, it gave up and never sent any initialization commands to the LCD>
Because of this, the LCD pixels are not turned on and you won't see any pixels.

This is due to either mis-wiring or wires not making proper connections.

Can you take some clearer photos?
I need to be able see where all the wires go, so I can be your second set of eyes to look over
your shoulder to see if there is something easily fixable like accidentally hooking up wires to
the wrong pin numbers etc...
Also what about a clear photo of the solder joints.
Sometimes bad solder joints won't make proper connections.
Perhaps write down where each wire is connected.

Some common errors, are:
- using incorrect datasheet.
- getting all the glcd pins backwards/reversed.
- miscounting or mis-connecting wires on the mega do to a parallax error or counting the power rails along the top.
- Not properly hooking up the RST pin on the GLCD.
- Incorrectly wiring up the POT.
- bad solder connections on the header to the GLCD.
- mixing up the RS and RST lines on the GLCD. (some glcds use RS instead of DI for that pin)
RS or DI is pin 4 on your glcd. (based on the datasheet you provided)
RST or RESET is pin 17 on your glcd. (based on the datasheet you provided)

In looking at your datasheet, it appears to show pin 1 on the side that is farther from the edge of the glcd module.
The data sheet shows two header connectors on the glcd. One at the top and one on the bottom.
Does your glcd have two header connectors on it?
On the datasheet both sets of connectors have pin 1 farther from the edge than pin 20.
If so, it looks like you may have all your wires backwards since I see what looks like a wire going from
Arduino RESET (a green wire) to what looks like pin 4 on the glcd.
But then I look at the Vee and Vo connections to the POT and those look ok with Vee (glcd pin 18) going to one leg of the pot
and Vo (glcd pin 3) going to the center of the POT.
So I'm confused.......


First verify that the datsheet you have is correct. Look at the back of your glcd and verify that part number
matches the datasheet you have.
Also look for markings on the glcd to fully identify where pin 1 is.
Is the glcd labeled? Does one of the pins looks a bit different than the others? Is there a square pad vs
a rounded pad? That indicates pin 1.


--- bill

sandrodz

Thank you! And I feel stupid... Indeed I've connected pins in reverse order. I thought pins would be 1-20 from left to right. But on the back side I found little marks saying that it is actually 20-1. I redid wiring the other way and it works!

Thanks!

bperrybap

No worries. I've been there myself.
Sometimes it just takes a second set of eyes help see things.
Glad it's all working now.
--- bill

Go Up