Project

General

Profile

Resolved: GLCD swaps upper and lower half

Added by arwedonline about 6 years ago

Hi everybody,
I recently bought the GLCD kit and downloaded the demo. But now I’m having little trouble with it: When I start the demo I see the upper and lower half of the display swapped; can this be a hardware issue? Is there something I could have made wrong while aasembling? But I already double checked the soldering and the pins …

Any help and ideas really appreciated …
Arwed


Replies (14)

RE: GLCD swaps upper and lower half - Added by martynj about 6 years ago

arwed, do you have some pictures of both sides of the PCB to post with GLCD Demo running?

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

Hi, I attached my sample ino file and a picture of the PCB backside and two pictures of what the sketch displays. There is a little dirty margin at the right hand side filled with more or less random pixels which I’m also wondering about. The backlight is connected to PWR.

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

oops, sorry, the screenshot sar enot exactly from the sketch, but showing the problem. I attach othetr sreenshots later today if needed. Is there something else that I should check/show?

Thanks a lot in advance!

RE: GLCD swaps upper and lower half - Added by martynj about 6 years ago

arwed,

Hmm - very strange for a hardware problem. You get similar ‘swapping’ with the latest github GLCD Demo running?

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

Yes, indeed, and I was under the impression, that the first demo sketch I let run did not show that behavior. But meanwhile I hesitate and do not really believe my senses anymore ;—((

I downloaded the sketch and only changed the contrast setting from 0x15 to 0x05 and the baudrate from 57600 to 9600. And I still see the swapping and also the crazy right margin. As shown in the top picture …

RE: GLCD swaps upper and lower half - Added by martynj about 6 years ago

arwed,

I’ve added in a “correct” (apart from the typo on gLCD!) display for comparison. If you compare the two and the source code, only the block of four glcd.drawstring() are on the display looking close to what is expected, the remaining drawline, drawcircle etc are absent.

The GLCD board to JeeNode interface uses all four DIO pins from port2/4 - since individual characters are selected correctly, all four pins are likely to be ok. The handshake with the display controller interface is quite time sensitive. Are you running the standard clock rate so that delayMicroseconds() is accurate?

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

I’m using an ATMega328 on a JeeNode v6 PCB with a 16MHz crystal together with 2 Cs of 22pF each. Logging to serial works fine; so timings should be ok in general. The fuses are set to ext. crystal and EEPROM save (lfuse=ff, hfuse=d6, efuse=5).
The GLCD itself was built from a kit.

RE: GLCD swaps upper and lower half - Added by martynj about 6 years ago

arwed,

Here are the standard fuse settings I use, dumped out with the fusebyte tool:

Fuse bits (L/H/E): FF DE FD
Lock bits:         CF
Signature:         1E 95 F (ATmega328P)
Oscal:             B2

Fuse Low = 11111111 (FF)
           ||||++++______Low Power Crystal 8 - 16MHz
           ||++__________Start Up Time=11
           |+____________Clock Output Disabled
           +_____________(no divide)

Fuse High = 11011110 (DE)
            |||||||+______Reset to Bootstrap
            |||||++_______256 words (512 bytes)
            ||||+_________EEPROM Erased on chip erase
            |||+__________Watchdog programmable
            ||+___________ISP programming enabled
            |+____________DebugWire off
            +_____________RST enabled

Fuse Extended = 11111101 (FD)
                |||||+++______Brownout at 2.7V

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

So I see as only difference that I’ve EESAVE enabled to keep the EEPROM values through chip erase. Shoul dnot make a difference, should it? And regarding one of you questions, Martyn, th eLCD moduel was soldered in from teh beginning. I did not want to make a test with flying wires or unsave pins. I’m using a sheet of card board between the PCB and the GLCD to avoid shortcuts. This is to be seen from the attached picture.

And I just resoldered all the pins of the LCD module. I also tried anothe JeeNode module. Unfortunately still no change.
That can make one real sad …

The only idea I have right now to add some index calculation which just turns the lines back to the correct place. I.e. instead of

    // draw a string at a location
    glcd.drawstring(40, 0, "ARDUINO");
    glcd.drawstring(10, 2, "ST7565 128x64 GLCD");
    glcd.drawstring(22, 4, "Graphics Board");
    glcd.drawstring(20, 6, "JeeLabs.org/gb1");

I would code

    // draw a string at a location
    glcd.drawstring(40, *4*, "ARDUINO");
    glcd.drawstring(10, *6*, "ST7565 128x64 GLCD");
    glcd.drawstring(22, *0*, "Graphics Board");
    glcd.drawstring(20, *2*, "JeeLabs.org/gb1");

Martyn, when you say, timing issues are most likely, what would be worth to check? I do not have a real oscilloscope, only a very small ATMega based OLED toy like one …

But what I just reaized is, that now, when I’m using the original sketch that was mentioned above and the original library (from https://github.com/adafruit/ST7565-LCD.git)
I do not see any output that comes from the lines

    glcd.drawcircle(5, 5, 5, WHITE);
    glcd.fillcircle(121, 5, 5, WHITE);
    glcd.fillcircle(6, 58, 5, WHITE);
    glcd.drawcircle(121, 58, 5, WHITE);

    glcd.drawline(40, 9, 81, 9, WHITE);
    glcd.drawline(40, 11, 81, 11, WHITE);
    glcd.drawline(0, 42, 14, 28, WHITE);
    glcd.drawline(112, 42, 126, 28, WHITE);
    glcd.drawrect(0, 28, 127, 15, WHITE);

I only see the text lines from the code piece above. Just like as it is running in some text only mode … ;-o
For reference I attach my current sketch here.

Any further ideas really appreciated …
Arwed

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

Yet another comment: The graphics stuff (as shown in the first screenshots above) works for instance with the Arduino demo for ST7565 — but with the swapped halfs as shown …

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

Things getting more and more crazy. I played around with several offsets of the drawstring function and tried:

    glcd.drawstring(0, 4, "Hello Ladies and Gentlemen! 0,4");
    glcd.drawstring(2, 6, "Hello Ladies and Gentlemen! 2,6");
    glcd.drawstring(4, 0, "Hello Ladies and Gentlemen! 4,0");
    glcd.drawstring(6, 2, "Hello Ladies and Gentlemen! 6,2");

The result is shown in the attachment. I set the contrast a bit darker so that anyone can somehow see the pixel structure.
Beside the “swapping” there is an offset in x direction of 3 pixels. But the missing pieces are not just shown on the right hand side instead; there is shown some more random looking pixels.

RE: GLCD swaps upper and lower half - Added by martynj about 6 years ago

arwed,

> I’m using the original sketch that was mentioned above and the original library (from https://github.com/adafruit/ST7565-LCD.git)

The GLCD library was extensively enhanced. I suggest you pull the library you need fresh from github.

RE: GLCD swaps upper and lower half - Added by arwedonline about 6 years ago

Believe or not: with this library the Display works! I had to change the contrast setting to 0x1A to make the letters a bit more clear, but even the graphics work now!
Thanks Martyn, for the hint. Although I still not understand teh problem at all I’m totally fine with using THIS library.

Thanks a lot!

RE: GLCD swaps upper and lower half - Added by JohnO about 6 years ago

Nice one @martynj.

    (1-14/14)