TFT LCD display with 320x240 resolution for
The project is based on following publication: SpritesMods.com
RASPBERRY PI is credit card size computer, which price is only about 35Euro. This makes it accessible to a wide range of people.
Despite its low price it is equipped with Broadcom's SoC BCM2835, it contains very powerful ARM1176JZFS CPU running at 700MHz, with floating point, Videocore 4 GPU capable of BluRay quality playback, using H.264 at 40MBits/s. Unfortunately it needs a TV or monitor to display information.
The goal of this project is to show how to change this TV with TFT LCD display 320x240 resolution, which is enough for presenting of simple text and even video information.
Such displays are fairly common and cheap. Can be found at Ebay for about $20. Their only disadvantage is that it needs at least 21 I/O lines to be handled. 16 data bits, SC, RS, RD, WR, RESET
The project avoids this disadvantage, with using SPI bus instead paralel. This way you need only 3 I/O lines to communicate with the LCD.
There is a disadvantage when using serial communication - low frame rate. But this low frame rate is enough for displaying static or slow changing information.
In addition there is touch panel which can replace keyboard and mouse. We need 3 more I/O lines to drive it.
The first step is building SPI to parallel data converter. Its electrical circuit is:
A little explanation of how the circuit works:
The serial data are latched in the cascade connected shift registers CD4094 through SPI_MOSI on rising front of SPI_SCLK. The CD4040 counts to 32 when it is enabled by SPI_CS0. After 16th clock pulse its Q5 output goes high. It causes every changing of internal state of shift registers to affect its parallel outputs. After 32th clock pulse Q5 goes low. It "latches" the state of shift registers. In the same time entering the data to LCD is enabled by its CS input.
This way by sending 4 bytes to SPI bus you can transfer 16 data bits and other driving signals (CS, DC, RD, WR, BL_CNT) to LCD display. Using this circuit you can increase the speed of data transfer to the LCD because it isn't necessary to select SPI bus for every byte sent which is very slow proces.
The next step is to write a driver for so described converter. Or download already compiled from here and just copy it to Raspberry's SD card
If you choose the long way you can follow next instrictions:
1. Follow the instructions from here, but before compile the kernel you should apply this patch ssd1289-linux.3.6.11.diff to the sources by using "patch -p1 -i ssd1289-linux.3.6.11.diff" from directory ~/linux
2. Comment blacklist spi-bcm2708 in the file /etc/modprobe.d/raspi-blacklist.conf
3. Add into the file /etc/modules a line with content ssd1289
4. After reboot the module ssd1289 should be loaded. You can check this by "lsmod | grep ssd1289"
5. The easiest way to check if LCD is working is by redirecting console to new frame buffer "con2fbmap 1 1" or by staring X with "FRAMEBUFFER=/dev/fb1 startx"
6. If you want this redirecting to be permanent you can change content of the file /boot/cmdline.txt to: "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:1 fbcon=font:ProFont6x11"