GLCD Serial interface
Moderators: adafruit_support_bill, adafruit

Re: GLCD Serial interface

by Dr. Au-fait on Fri Sep 14, 2012 10:38 am

Hex file attached. This is from the Arduino temp folder after compiling - I have not tried using it directly. It might not even be the correct file, but the time stamp was right on the nose.

With Arduino, the library must be in your documents/arduino/libraries folder, so in this case the folder containing the unzipped library would be:

documents/arduino/libraries/GLCDSP7920

The demo code itself would be in:

documents/arduino/GLCDSP7920

Restart the Arduino software, then open the sketch GLCDSP7920. It should then compile correctly. The LCDA reference is in the library which the Aduino software is not finding on your system.
Attachments
GLCDST7920.cpp.hex
(8.76 KiB) Downloaded 60 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Dr. Au-fait on Fri Sep 14, 2012 10:43 am

Here's my actual Arduino folder in my W7 profile:

Code: Select all | TOGGLE FULL SIZE
Documents\Arduino\GLCDST7920\GLCDST7920.ino
Documents\Arduino\GLCDST7920\splash_bmp.h
Documents\Arduino\libraries\GLCDSP7920\LCD12864RSPI.cpp
Documents\Arduino\libraries\GLCDSP7920\LCD12864RSPI.h
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Fri Sep 14, 2012 12:37 pm

Okay, the compilation now works as it should. But I still can't upload it (avrdude: stk500_getsync(): not in sync: resp=0x00).
I managed to upload the *.hex file and if it works, I've wired the display in the wrong way.
I don't know what pins may be equal, or which that can be used. :?

If it's not too much to ask, could you please take a look at these PDFs and maybe come up with something?
As I'm still pretty new this, I don't fully understand everything.

The ATMega128: link
PDF for the MPU in the *.zip

Cheers,
Cherno
Attachments
LK_Schem.zip
(329.79 KiB) Downloaded 64 times
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Fri Sep 14, 2012 9:11 pm

This is probably what you're after:

arduino_pinout.png
arduino_pinout.png (10.7 KiB) Viewed 1321 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Sat Sep 15, 2012 5:58 am

Oh, how stupid of me!
I forgot to write that the PDFs are for what I use. :oops:

I did however try and wire the display in all ways I can come up with from looking at the Duemilanove (Not just my OC1+INT0 and PB1+PD2).
I'm all out of ideas as of now.

But if it's SPI, how come it doesn't use SCK, MOSI and the others?

Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Sat Sep 15, 2012 2:23 pm

Could be that the library code bit-bangs it instead of using the built-in SPI resources. I haven't looked at it that closely. Wouldn't it be PB0/1, and not PB1/2?
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Sat Sep 15, 2012 7:09 pm

I don't know. It feels like I've tried it several times already. I just can't it to work correctly.

In other news: I saw the first sign of life I have ever seen in my display! I'm not entirely sure what I did, I tried rewiring the RW and E wires and the display suddenly started "blinking" and showed some small symbols (A dot and another that I can't quite remember) and there was a blinking "cursor", like the pipeline-looking fella when you're writing, except this one was BIG(on the width, so more like FAT).
When I tried to replecate it, it didn't work, however. :(

But still, it feels like I'm a little closer to getting it to work! And all thanks to you! :D
The pins I wired RW and E to are SCK and maybe MOSI, it was in that area, it happend quite abruptly.
The SCK and MOSI are the following on my board: PB1/PCINT1 and PB2/PCINT2, if that's to any help.

Chhers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Sat Sep 15, 2012 9:49 pm

I was able to capture the lines of interest on a logic analyzer. Looks like the Arduino pin 3 is the clock, pin 9 is the data, and pin 8 is enable. Maybe you could compare that with yours. Note the code shows a 10mS delay between commands. This seems to be important, as is the 100mS delay after the first initialize() command. Here's a screen capture of the signals produced when the code below is executed (Pin 7 is the trigger pin for the logic analyzer):

Code: Select all | TOGGLE FULL SIZE
digitalWrite(7, HIGH); //trigger
LCDA.CLEAR();


7920sig_clr_char.png
7920sig_clr_char.png (112.43 KiB) Viewed 1280 times


If you want to download the Salae software, the actual data file is also attached for a more interactive experience. The data file actually contains the output for this section of code from the demo program:

Code: Select all | TOGGLE FULL SIZE
digitalWrite(7, HIGH)//trigger;
LCDA.CLEAR();
delay(10);
LCDA.DisplayString(0,0,line1,16);
delay(10);
LCDA.DisplayString(1,0,line2,16);
delay(10);
LCDA.DisplayString(2,0,line3,16);
delay(10);
LCDA.DisplayString(3,0,line4,16);
Attachments
7920-clr_charx4.zip
(141.68 KiB) Downloaded 61 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Dr. Au-fait on Sat Sep 15, 2012 10:30 pm

Okay, this is weird. The data sheet seems to be way off from the observed data. Where that leaves you I don't know, but it confuses the hell out of me. Must be magic.

7920ser_mode.png
7920ser_mode.png (52.57 KiB) Viewed 1278 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Dr. Au-fait on Sat Sep 15, 2012 11:58 pm

After a second look, this does make sense. The controller looks at only the upper nibble of each byte on commands and data, so two bytes need to be sent for each one. The clear command is 0x01. It's a basic command as opposed to an extended one, which is 0x30. Commands are preceded by 0xf8.

To send the clear command we need send the 0xf8, followed by 0x30 (converted as two bytes, 0x30 + 0x00), followed by 0x01 (converted as 0x00+ 0x10). And that is exactly how it appears on the signal lines:

7920-cmd-hex.png
7920-cmd-hex.png (35.08 KiB) Viewed 1273 times


The data signals also follow that pattern except they are preceded by 0xfa. To send the letters "Sa" (0x53 + 0x61), we send 0xfa, then 0x50 + 0x30, and 0x60 + 0x10. This is seen here as the first letters of the first line "Sample Char Ln 1":

7920-data-hex.png
7920-data-hex.png (20.58 KiB) Viewed 1273 times


So much for it being magic..
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Sun Sep 16, 2012 8:29 am

I'm not familiar with Saleae. It looks like I might need some sort of equipment?
I've got access to an NI myDAQ, but I don't know how to get graphs like that. I've been trying to get the Digital Reader t owork with a blinking LED, but for some strange reason, it won't pick up the 1s-binks. :S
Using a multimeter I do see (quite obvious) changes. Don't know what's wrong.

After a closer inspection I think there might be something up with the digital reader-software, so I'm reinstalling it.
I used the multimeter on ground and the IO-pin I wired the MPU to myDAQ and I saw the same change as if I were checking directly on the MPU, so something's up..

By the way, I've installed the Saleae software, but I don't know if I can get it working the myDAQ. (It says disconnected)
Don't know what to do with it.

Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Sun Sep 16, 2012 8:52 am

After installing Saleae, just dlouble-click on the .logicdata file I provided above. You don't need the equipment to just read the file. Or, open Saleae and select Option (top-right), then open session and select that file.

BTW, if you have a need for a good analyzer, I can't begin to tell you how much I like the Saleae. The software is fantastic, the developers will talk to you and answer questions, and seem genuinely interested in feedback. Very compact too. Mine is over two years old and gets regular use. No problems yet.

Adafruit has them here.

saleae_example.jpg
saleae_example.jpg (260.11 KiB) Viewed 1253 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Tue Sep 18, 2012 11:50 am

Sorry for not responding for a while.

I've been talking a bit with the professor (he who developed the MPU I'm using), and he said that I'll have to rewrite the code some.
So I spent a few hours yesterday and then realised I have no idea how to rewrite it all, so that it don't use the original shiftOut.
What I got stuck with was how to use something else than digitalWrite to write the data... :?

I asked him for some assistance, but I haven't gotten any response yet.

Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Cherno on Mon Oct 15, 2012 4:26 pm

Time for an update.. :)
I've put this small project on slow-mo/hold as for now. I really have no idea how to get it working properly.
The professor said that I should read the SPI-chapter in the datasheet for the ATMega128 (the MCU I've been using) and go from there.
Problem is, I barely know if it's working as it should. And then I'd need to get the SPI-code to work with the display.

So I decided that I'll buy an Arduino and use that as a form of support. And check signals etc.
And I can try and see if I can figure out a way to set individual pixels.
One way I think of it, when it comes to boxes/rectangles, you could just use a two-dimensional array and loop it.. or something.. Just putting my thoughts in text right now.
I'll take a better look at the codes later, when I get things to work. And if it is made in the way I hope it is (which I might be able to check through some experimenting), I may know how to take it a bit further.
But it may take some time before I can say if I can do it or not.
[What I'm hoping for, is that I can write the code similarily to the code I've written for a small ASCII-game.]

Anyway, that's it for now.

Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Cherno on Wed Dec 05, 2012 5:51 pm

So, I just got my Arduino yesterday. Finally!
Didn't have much time to do anything with it though, but today I did.
The first thing I did was to change/upload the blink program to make sure it worked.
Second thing: Test the display! :D
I don't know how to properly upload an image, so it'll be attached down there..

I also experimented a bit with the image's code and noticed quite quickly that the pixels are represented by binary digits (Hex in the code), so if I'm able to get some time to think more about how it all works I may be able to come up with a way to set individual pixels.
One way I can think of, is to change the picture. But this would be quite clumsy and most likely not very efficient. If you've got a picture and want to draw lines with a somewhat simple code, you may want to have the pixels in binary (at least to keep it easy for a slow and tired brain. i.e. me). It's way easier to see how the picture looks if it's in binary and not hex (you basically see the pixels, and some mumbo jumbo, i.e. ",0b").
[Some of you reading this, probably already knew what I just wrote.]

Anyway, it's working great, except for some faint vertical streaks (on my picture, they're not so faint irl).

Cheers,
Cherno

By the way, when you actually understand how the picture's code is made up, it's really easy to read and change it! :)
Attachments
20121205_221833_small.jpg
The image of the bike. Also a smiley :)
20121205_221833_small.jpg (270.01 KiB) Viewed 887 times
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am