Leonardo with 128x64 LCD

I have a graphic LCD 128x64 (sparkfun LCD-00710) using KS0108B parallel interface chipset and an Arduino Leonardo board. Is there an existing way of using this LCD with Leonardo? At least the GLCD Graphical LCD library doesn't support Leonardo (ATmega32U4). I also couldn't find any wiring specs specific to Leonardo. Any help / hints would be appreciated.

The glcd library does not use any of the Arduino core routines to control the pins
because the Arduino supplied core routines like digitalWrite() are just WAY too slow in my opinion.

What is missing in the glcd library is a couple of pin mapping macros and a config file
for the Leonardo. While it's not too difficult, I haven't gotten around to it.
I could toss in the code for it but I can' test it because I
don't have a board to test it on as my preferred 32U4 product is Teensy.

I've also considered adding a generic i/o mode that uses the Arduino core code routines when
direct i/o support is not available. While much slower than direct i/o it would allow the glcd code
to immediately run on more platforms including Maple, ChipKit, and the new ARM based Teensy.

PM me if you are interested in helping testing out Leonardo direct i/osupport for the glcd library.

--- bill

Hi

Another option would be to use u8glib, which uses standard API procedures from the Arduino Code.
Indeed, u8glib is slower than GLCD. I have tested u8glib with the Leonardo Board.

Oliver

hi,

I'm willing to test the leonardo glcd direct i/o routines. I just got my leonardo board today and using it together with glcd would be great.

Leo

Just starting to look at the leonardo pin mapping.
The choices they made are not favorable for multi pin i/o particularly for 8 bit mode (best speed)
I think this was driven by the inconsistent alternate function to pin mapping that Atmel did - shame on them.
The leonardo doesn't give access to all 8 pins of any of the ports on the standard headers,
which is very unfortunate since the 32U4 has 2 full 8 pin ports available (PORTD and PORTB)
PORTD.5 is not available at all.
PORTB could be used in 8 bit mode but you have to use the ISP connector for PB0-PB3
so I'm not considering this an option.

Best speed will be in nibble mode using D18-D21 (A0-A3), and D0-D3 for the
data lines. This uses the SDA/SCL lines (I2c).
An alternative is to use D8-D11 instead of D0-D3 to keep the I2c lines free.
Not quite a fast but still nibble mode.

I think I'll go with the D18-D21 and D8-11 to avoid the I2c stuff.

Leo,
debugging the direct i/o is pretty much impossible. It requires looking at the assembler output to verify that avio
macros are generating the proper code.
Luckily all that has been debugged in the past and all that should be necessary is to create the new mapping macros
and then create the pin configuration file for the leonardo.
(And then the updates to a few other header files to make them "know" about using the new leonardo config files)

That said I will need to test it on real hardware. I normally don't like to have someone else
test such complex stuff but since I don't have the hardware, I will need at least one volunteer.

--- bill

Ok,
I have the glcd Leonardo macro mappings code that needs testing.
I would prefer to work with someone that has both a standard Arduino board (m328) and a Leonardo
for this testing.
What I want to do is get everything up and running on the standard Arduino to make sure everything
is hooked up properly and working.
For the leonardo testing, I have created identical pin mappings for the Leonardo so that all that will be necessary
is to move the wires from the Arduino to the Leonardo.
While not the ideal pin configuration, it should make the wiring and testing much easier.
Anybody that wants to work with me on this, please PM me your email address so we can communicate
further offline to get things working.

--- bill

I'm in. I'd change the config files myself (i'm an embedded system engineer) but i am on business travel and have little time to "play" with my leaonardo board. I started working on the needed changes last evening and also noticed the completly unfavorable pin layout. Anyways feel free to send me any source files and i'll gladly test the functionality and report back.

Leo

Hi everyone,

I know, its just an old topic ... but has anyone got an KS0108 compatible 128x64 LCD working with GLCD library and leonardo (in my case a TG12864B)?

There are somme issues too, because I need leonardo ports 0-3 (int0-3) for additional hardware (alert and time pulses).

Some help would be great because I'm new to arduino, only done some small projects (DCF77 with 2x16 LCD and other little tests).

Thanks

Dirk

dirk,
I've not created another glcd library release yet.
The next release will have 32u4 support in it, which includes support
for Leonardo, Micro, and LillyPadUSB.
For the time being I've created a set of patch files that can be used to add
ks0108 leonardo support into the glcd v3 release.
It isn't as complete as what would be in a full release in that it only works
with the default ks0108 panel file.
But for standard 128x64 ks0108 displays it should work just fine.

Here is a link to the google project sited where you can download the zip image
of the files: Google Code Archive - Long-term storage for Google Code Project Hosting.

As far as your pin needs go, the included documentation includes instructions
for how to change the pins that are used. While you can't reduce the number of pins
used, you can change which pins are used.
See the included html files for the details.
(There are instructions on the ks0108 playground page and on the google project
glcd v3 download page for where to locate the html documentation)

For additional assistance on things like pin mappings, please start a new thread.

--- bill

Thanks a lot, I've downloaded the patches.
I will try my best and will report about.

Dirk

So, I started my hot wire iron and connecting everything. PINOUT B is my, if you want to add it to the list.
The thing with Vee has to be understand ... in my case it has to be so:

  • one end of contrast poti (10k) to +5V
  • one end of contrast poti to PIN 18 of LCD
  • middle contact of contrast poti to PIN 3 of LCD

Reset is connected to reset of arduino, works great.
A picture by the way to show the work.

Thanks for your really great job, bill!

Dirk

Great. glad it works.

dischneider:
The thing with Vee has to be understand ... in my case it has to be so:

  • one end of contrast poti (10k) to +5V
  • one end of contrast poti to PIN 18 of LCD
  • middle contact of contrast poti to PIN 3 of LCD

This works for all the ks0108 displays.
The early documentation (before I was involved) included drawings that used gnd instead of +5v for one of the legs.
Now most of the documentation shows using gnd and Vee on the pot legs
and that should work for glcds at room temperature.
Did your display not work when using gnd instead of +5v on the pot?

BTW, if your application doesn't need much RAM you can turn on the read cache
to speed things up. See glcd/glcd_Config.h (down near the bottom) for details.
The 32u4 also has more RAM than the m328 so it the 1k read cache isn't as big of an issue
on the 32u4 as it is on the m328.

--- bill

Hi,

OK, I found the documentation with gnd to one end of poti and before I was using an 2x16 LCD, so the concept with Vee is different.
Was not in my brain till now, its my blame.
Enabling Cache brings fps from 13 to 25, works fine.
I think my application will not need much RAM, because it's only a DCF77 (radio clock) receiver and time / date logic to have a correct time (without RTC) and interrupt routines for 3 external pulse sources with a small amount of pulses a day.
The display has to give the actual clock (hmm, the analog clock lookes fine) and the amount of pulses of the 3 lines, should be less overhad.

Thanks for your assistance.

Dirk

Hi

forgive me if didn't post in the right location, but i'm new on this forum and on arduino
however i'm not new in microcontroller (not an expert either)

i tried your library plus the patch for the leonardo board, i wired the board and the 128x64 lcd display with the PINOUT A recommendation, but when i try to compile i got :

In file included from GLCDdiags.pde:35:
C:\Program Files (x86)\Arduino\libraries\glcd/include/glcd_io.h:35:29: error: ks0108_Leonardo.h: No such file or directory
In file included from C:\Program Files (x86)\Arduino\libraries\glcd/include/glcd_io.h:37,
                 from GLCDdiags.pde:35:
C:\Program Files (x86)\Arduino\libraries\glcd/include/arduino_io.h:67:2: error: #error "Arduino pin mapping not defined for this board"

i tried a few things (a lot actually) like tampering with the headers (put it back as it was), tried to compile with the Uno board selected, it works, but when i try to upload it fails, i read the forums, search for other entrys who might help me... but now i'm completely stuck...

i'm also pretty sure it's something trivial for a experienced arduino user :slight_smile:
thanks for any help

It looks like the patch was not properly applied.
The ReadME.txt contains instructions as to where each of the leonardo patch files should be copied
into the glcd library tree.

I'd recommend starting over to ensure starting with a clean install.
Completely removed the glcd library directory tree.
Re-install it, then apply the patch files.

--- bill

arf i should never try this kind of thing late at night, my mind does me tricks....

you were right of course, and i suspected that but i didn't triple check the location, i put the arduino_io.h (the file i tampered with at the beginning :)) in config instead of include :slight_smile:

and to make things worse i also had too much contrast and only saw black pixels...

anyway, thanks a lot for your quick answer !