Controlling HD44780 as a character device?

Sep 17, 2013 29 Replies

Hello,



beeing a Linux guy for nearly two decades now, I wonder why all the suggestions for controlling a HD44780 from a Raspberry Pi will use direct GPIO (or I2C) access from userland?



Despite the fact, that these HD44780 displays are basically terminal devices (like VT100) thus would need a character device driver to be able to control them in the unix way.



It would then be possible to control them using a termcap/terminfo entry and the ordinary ncurses library for access.



Could it be true, that nothing like this is available for such common stuff than HD44780 compatible displays?



Sven


.. this message has been created using an outdated OS (UNIX-like) with an outdated mail- or newsreader (text-only) :-P /me is giggls@ircnet, http://sven.gegg.us/ on the Web

Because there is no other easy way...

Please feel free to write it and contribute it to the kernel...

Yes, once a suitable driver has been written.

The closest I found was the lcd4l

formatting link

Gordon

There is

formatting link

But this is old code without GPIO support.

I also think, that this misses the target anyway.

A VT10x translation layer is IMO not something which should be done inside a kernel driver.

What would be needed instead is a simple character driver and an appropriate terminfo file.

I found this post:

formatting link

But unfortunately the URL pointing to the code is unavailable.

Regards

Sven

"Whenever there is a conflict between human rights and property rights, human rights must prevail." (Abraham Lincoln) /me is giggls@ircnet, http://sven.gegg.us/ on the Web

Is this it?

formatting link

Ian "Tamahome!!!" - "Miaka!!!"

Jepp, looks fine.

Using a slightely modified Makefile and it will compile out of the box using a recent kernel. Seems to be a start!

I will see what I can do as soon as I got my LCD Hardware.

I would at least want to add a modification which will allow for the gpio ports in use to be specified at module load time.

Regards

Sven

TCP/IP: telecommunication protocol for imbibing pilsners (Man-page uubp(1C) on Debian/GNU Linux) /me is giggls@ircnet, http://sven.gegg.us/ on the Web

As well as 4 or 8 bit mode?

Paul Carpenter | paul@pcserviceselectronics.co.uk PC Services Raspberry Pi Add-ons Timing Diagram Font GNU H8 - compiler & Renesas H8/H8S/H8 Tiny For those web sites you hate

Sources look like 4-Bit Mode (7 GPIO lines):

formatting link

I would rather think about implementing I2C Mode first.

Regards

Sven

"Those who do not understand Unix are condemned to reinvent it, poorly" (Henry Spencer) /me is giggls@ircnet, http://sven.gegg.us/ on the Web

Only if you have an I2C device - and there are more variants of I2C connections to HD44780 than there are of direct connections - e.g. which I2C GPIO expansion chip, or microcontroller or .... etc.

So unless you have a specific device and I2C interface, I'd personally go for the GPIO way first.

And you only need 6 lines - especially with 5v displays connected to the Pi's 3.3v lines - the R/W line must be tied to the 0v line (so display is permanently in read mode) unless you use level shifters or a 3.3v display.

But I have to say... Watching people build kernel modules for other things for the Pi; is it worth it? If it's a personal project, then of-course it is, but for general use - it can be somewhat challenging to get some Pi users to compile a module for whatever kernel they're using, then install it and use it... Maybe easier to just use one of the libraries for C/C++, Python, etc.

Gordon

Wouldn't the Raspbian project be happy to include a driver that supported the HD44780 and related displays as part of the distro? Especially if it came with a configuration utility like Sven mentioned? It would be really neat if it was similar to the setserial and stty utilities which, IIRC, work by setting parameters in the device file.

martin@ | Martin Gregorie gregorie. | Essex, UK org |

HD44780 has a parallell interface, none of the rpi GPIO is well suited. Is there a USB interface available? maybe start with AVRUSB or an FT-something

?? 100% natural

Yet we have that on the linux console....

you probably want an IOCTL interface for programming the the user-defined characters too.

?? 100% natural

Ask them...

But this is really a Linux kernel thing, so if you presented it as a pre-done kernel module and had it inserted into the mainline kernel, then it stands more of a chance than a Pi specific thing - especially as there are Linux systems other than the Pi that might benefit from it e.g. Beaglebone people might find it interesting too, etc.

Gordon

Why do you think that?

The Pi is perfectly suited for it. 6 wires plus power & ground and off you go. It's not rocket science.

formatting link

It's the sort of thing the Pi's GPIO was designed to do.

Gordon

The rpi is a 3.3V device and the HD44780 is a 5V device. Yes, this is rocket science for most desk top people.

As long as the wires between the rpi and the HD44780 is only 3-4 inches long there _may_ not be any problems.

Mmm. the spec sheet says it is CMOS with a minimum vcc of 1.5V, and a max of

7v, so it is not a '5V device' specifically

Input specs are less than 0.6V and greater than 2.2V to guarantee logic transitions. At Vcc 4.5-5.5V.

So it will run well within spec drven by a 0-3,3v signal.

Ineptocracy (in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

Bit Banging GPIO's is just anything but elegant. All I want to achieve is beeing able to write Software using standard libraries like ncurses and generic terminal IO instead of highly non-portable stuff.

Sven

Why are there so many Unix-haters-handbooks and not even one Microsoft-Windows-haters handbook? Gurer vf ab arrq sbe n unaqobbx gb ungr Zvpebfbsg Jvaqbjf! /me is giggls@ircnet, http://sven.gegg.us/ on the Web

In Linux you can write a program that runs in a user process and does all the terminal simulation that you want, plus the translation to bitbanging, and then you can connect it via a "pty" to another program that thinks that it is talking to a tty. So it can use ncurses etc.

When you want to see an example of what is possible, look at the "screen" program. It provides a virtual terminal for all standard programs (including ncurses programs) to write on, and that virtual terminal can then be connected from another system.

You could adapt it (or write some similar program) to send output to your LCD instead. Once you have done that you can run any program with output to your LCD.

The HD44780 will do, the LCD may not.

Saludos Miguel Giménez

The LCD I thought was driven by the HD44780, with whatever voltage it uses as supply rails.

So I cant see the releavance of your (entirely correct) comment.

Ineptocracy (in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

I've tried to run 5v displays at 3.3v Vcc - they don't work, but all the ones I've tried run fine at 5v Vcc, driven by the Pi's 3.3v signals. (And judging by the feedback I get over my Pi software for them, there are 100s of others out there doing it like that too)

There are ones designed to run directy at 3.3v though, but they're more expensive.

Gordon

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required