T6963
This driver supports display modules based on the Toshiba T6963 chip. These displays are made by different manufactures, and come in various sizes (mine is a Toshiba TLC1091, which is really large: 240×128 pixels, which make 40 rows and 16 columns). You're right: I said pixels. The T6963 is a graphical display controller. Although there's no support for any graphic elements in lcd4linux at the moment, the driver does all operations in graphics mode (similar to the X11 or raster driver). All the font rendering, bar drawing and so on is only pixel based, the T6963 character mode is never used.
The displays are connected to the parallel board (see Wiring below), and are quite timing-critical. There's no way to delay a usermode program under Linux for e.g. 40 usec, so we have to do busy-waiting. This has been done in a delay loop, which had to be calibrated. Since 0.9.8 there are two new delay loops, one based on the processor's TSC (Time Stamp Counter), one based on gettimeofday(). LCD4Linux decides automatically which one to use (it prefers the TSC method, but falls back to gettimeofday() if neither the TSC flag nor the MHz value is set in /proc/cpuinfo). Calibration is no longer necessary!
The T6963 uses a bidirectional protocol, it is necessary to read data from the controller to perform the so called status check. This check returns if the T6963 is busy or idle (and ready for the next command). Therefore your parallel port has to be bidirectional!
The driver knows of two ways of controlling the parallel port: The (old, ugly and unportable) raw programming of ports, and the new, cool, great ppdev() style. You decide which one to use by specifying either a hexadecimal value or a device file with the 'Port' entry in the config file.
Note that the old port programming only works with standard ports (0x3f8, 2f8,…), but not with PCI parallel port cards. Also, some secured linux systems (LEAF kernels with the grsecurity patches being one) do not allow a userspace program to do raw I/O (not even if running as root), so you have to use ppdev there anyway.
ppdev requires kernel 2.4 or newer, and the ppdev kernel module loaded. The configure script detects if you have the required include files, and deactivates ppdev if they are not there. You should use ppdev whenever possible! Raw port access may be dropped someday.
Note that you have to use parport devices (usually /dev/parports/* or /dev/parport* with major number 99), the printer devices (/dev/printers/* with major number 6) do NOT work! If you are using devfs or udev, these devices may become visible as soon as you load the ppdev kernel module.
Display Section
Display <name> { Driver 'T6963' Model 'generic' Port <string> Size <string> DualScan <0|1> Cell <5|6|7|8> Font <string> Foreground <color> Background <color> Basecolor <color> Wire { CE <string> CD <string> RD <string> WR <string> } Timing { fuzz <percentage> ACC <number of nanoseconds> OH <number of nanoseconds> PW <number of nanoseconds> DH <number of nanoseconds> CDS <number of nanoseconds> } }
Parameters:
Driver | 'T6963' |
Model | 'generic' |
Port | either the hexadecimal address of the parallel port (“0x378”) or a ppdev device (“/dev/parports/0”) |
Size | size of the display in pixels, specified as <width>x<height> (e.g. “240×64”) |
!DualScan | set to 1 if your display is controlled by dual-scan mode. If your display has 128 or more rows, and the lower half stays dark, try this parameter. Default: 0 (deactivated) |
Cell | horizontal pixel size of a character in text mode. This is hardwired on the T6963, but LCD4Linux must know about this value. If your display shows garbage, try playing with this parameter. Default: 6 (6×8 font). Note that this setting has nothing to do with the Font parameter! |
Font | font size, specified as <width>x<height> (only '5×8' and '6×8' supported at the moment) |
Foreground | color of active pixels (RRGGBBAA or RRGGBB), default is opaque black '000000ff' (see colors for details) |
Background | color of inactive pixels (RRGGBBAA or RRGGBB), default is transparent 'ffffff00' (see colors for details) |
Basecolor | color of virtual backlight (RRGGBB), default is white 'ffffff' (see colors for details) |
Wire.* | see below |
Timing.* | see below |
Examples:
T6963 default wiring
This wiring is used by some windows programs, too, and the graphlcd plugin for VDR knows this as the “windows wiring”.
Display T6963-240x64 { Driver 'T6963' Port '/dev/parport0' Size '240x64' Font '6x8' Wire.CE 'STROBE' Wire.CD 'SLCTIN' Wire.RD 'AUTOFD' Wire.WR 'INIT' }
graphlcd wiring
This is the default wiring used by the graphlcd plugin.
Display T6963-240x128 { Driver 'T6963' Port '/dev/parport0' Size '240x128' Font '6x8' Wire.CE 'AUTOFD' Wire.CD 'INIT' Wire.RD 'SLCTIN' Wire.WR 'STROBE' }
Wiring:
My TLC1091 display has 20 pins, the last two (pin 19 and pin 20) are not connected. Power (+5V) must be supplied via pin 2(GND) and pin 3(+5V), be careful not to change polarity, you will destroy your display! Pin 4 is used to control the contrast, it needs a negative voltage of about -7V. To create this negative voltage, I used a DC/DC converter (NMA1212) and a potentiometer (10k) between GND and -12V, and connect pin 4 to the slider.
The wiring configuration uses abstract signal names (e.g. STROBE) instead of pin numbers on the parallel port. So here's a translation table:
Pin | Name | I/O |
1 | STROBE | Out |
2 | DB0 | I/O |
3 | DB1 | I/O |
4 | DB2 | I/O |
5 | DB3 | I/O |
6 | DB4 | I/O |
7 | DB5 | I/O |
8 | DB6 | I/O |
9 | DB7 | I/O |
10 | ACK | In |
11 | BUSY | In |
12 | PAPEROUT | In |
13 | SELECT | In |
14 | AUTOFD | Out |
15 | ERROR | In |
16 | INIT | Out |
17 | SLCTIN | Out |
18-25 | GND | n/a |
My TLC1091 display has 20 pins, the last two (pin 19 and pin 20) are not connected:
Pin | Name | Comment |
1 | FGND | Frame Ground |
2 | GND | Ground |
3 | VCC | +5V |
4 | VEE | negative contrast voltage (about -7V) |
5 | WR | Data Write |
6 | RD | Data Read |
7 | CE | Chip Enable |
8 | CD | Command/Data |
9 | N/C | not connected |
10 | RESET | reset the display |
11 | DB0 | Data Bit 0 |
12 | DB1 | Data Bit 1 |
13 | DB2 | Data Bit 2 |
14 | DB3 | Data Bit 3 |
15 | DB4 | Data Bit 4 |
16 | DB5 | Data Bit 5 |
17 | DB6 | Data Bit 6 |
18 | DB7 | Data Bit 7 |
19 | N/C | not connected |
20 | N/C | not connected |
Now for the wiring details:
- The data lines (DB0..DB7 on the display, DB0..DB7 on the parallel port) are connected directly.
- The “CE” signal has to be connected to one of the control signals (STROBE, SLCTIN, AUTOFD or INIT). LCD4Linux's default is STROBE.
- The “CD” signal has to be connected to one of the control signals. LCD4Linux's default is SLCTIN.
- The “RD” signal has to be connected to one of the control signals. LCD4Linux's default is AUTOFD.
- The “WR” signal has to be connected to one of the control signals. LCD4Linux's default is INIT.
GPO's:
As the T6963 needs all four control signals of the parallel port, it is not possible (at least not in a simple way) to connect an additional circuit for GPO's.
Timing:
As I said above, the T6963 is quite timing-critial, especially the low-level timing on the parallel port. In the past, we tried to use worst-case values, as the timings differ from datasheet to datasheet. But this did not always work, some displays really need smaller values…
So I decided to make the timings configurable. That's what the Timing section in the lcd4linux.conf is for. Note that under normal circumstances you won't need such a section, lcd4linux uses default values which should work with most displays.
You should consult the datasheet of your display before messing around with these values!
To make it easier to play with the timing values, I invented a fuzz factor, which modifies all other timing values. This factor is interpreted as a percentage, with a default of 100% (meaning no modification). If you specify a fuzz factor of 150, this leads to all timings being multiplied by 1.5.
Name | Description | Default | Unit |
ACC | Access Time | 150 | ns |
OH | Output Hold Time | 50 | ns |
PW | CE, RD, WR Pulse Width | 80 | ns |
DH | Data Hold Time | 40 | ns |
CDS | C/D Setup Time | 100 | ns |
Sample Timing Section:
Timing { fuzz 120 ACC 150 OH 50 PW 80 DH 40 CDS 100 }
Schematic:
I built a little interface board to my TLC1091 display. It consists of a stabilized voltage regulator to create the +5V, a DC/DC converter to get the negative contrast voltage, a potentiometer to control the contrast (supplied with -12V) and a connector to the parallel port. The whole board needs +12V supply voltage. Here's the schematic and board (designed with eagle):