Building a linux module
Interfacing a character LCD display
by Carlos Becker – http://carlosbecker.com.ar
REVISION A - 24th November, 2007
The idea behind this text is to present the basic guidelines needed to interface a character LCD display
from an embedded linux. In this particular example the target architecture is avr32, running Linux Kernel
2.6.x and uClibc.
The approach chosen is to build a kernel module and implement a char device on /dev/lcddev, in order
to be able to do something like “echo 'hello there' > /dev/lcdddev” to display text on the LCD
It is true that a kernel module might not be the best solution to this particular case, since a non-
preemptive kernel could lead to our kernel driver doing some blocking, avoiding some other important kernel
tasks or other I/O modules from performing their functions. However, this example is a good start point to
demonstrate how easy and straight forward it is to develop a kernel module for I/O.
Most character LCDs get powered from 5V. The avr32 I/O pads work at 3.3V, so some kind of conversion is
If we were to just send data to the LCD and expect nothing back from it, everything would be fine, since
the LCD would recognize 3.3V as High and 0V as Low on its inputs. However, we need to acquire data
regarding busy states.
Working at not-so-high switching frequencies lets us use a simple R-R divider which allows bidirectional
I/O. The problem with higher frequencies is that the RC circuit composed by the R-R divider and the pin's
stray capacitance can distort digital signals importantly.
Here it is the schematic used for this project:
The resistors have to be large enough to avoid drawing too much current from the LCD's output, but not
so high in order to avoid the RC equivalent circuit from distorting the digital signals significantly. 4.7k seems
to work alright with my 08x02 character LCD.
Note that the other lines (E, R/W and RS) do not need the R-R networks, since they alw