It is a cool idea to hook up a small tft display to the raspberry pi for portable operations. I usually use raspbmc and here is a quick guide to setup an il9341 tft module to the gpio pins on the raspberry pi via spi. The module has 9 connections for the display and 4 for the SD card. Here we use the display pins.
In order to get the raspbmc/xbmc display on the pi, we use the fbtft driver by norto.
|GPIO pins on the raspberry pi|
The module is 2.2" one with the following connections and an il9341 controller. Data sheet here and more details on the module can be read here.
- SDO: Serial clock output
- LED: 3.4V Power Supply pin
- SCL: Serial clock input
- SDA / SDI: Serial data input
- DC: Data / Command selection
- RST: Reset, Low level active
- CS: Chip Selection, Low level active
- GND: Ground
- VDD33: 3.3V Power Supply pin
CONNECTION TO GPIO on PI
The connection to GPIO are summarised in the figure below. More on GPIO can be read at elinux.org/RPi_Low-level_peripherals
|il9341 connection to GPIO on raspberry pi|
+------------+--------+ | LCD-PIN | GPIO | +------------+--------+ | SDO (MISO) | MISO | | LED | GPIO18 | | SCK | SCLK | | SDI(MOSI) | MOSI | | D/C | GPIO24 | | RESET | GPIO25 | | CS | CE0 | | GND | GND | | VCC | 3.3v | +------------+--------+Note: Add a 50 ohm resistor to the LED pin
1) Install Raspbmc (instruction can be seen at here)
2) ssh into the pi and follow the rest on the pi, one by one (user:pi password:raspberry)
sudo apt-get install ca-certificates -y sudo apt-get install git-core binutils -y sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update sudo -E RPI_UPDATE_UNSUPPORTED=0 REPO_URI=https://github.com/notro/rpi-firmware BRANCH=next rpi-update sudo reboot
3) Now edit the modules file by
sudo nano /etc/modules
fbtft dma fbtft_device name=adafruit22a rotate=270 speed=48000000 fps=50 debug=32
The debug can be later removed after debug (as it output stuff to dmesg and can be turned off later by adding verbose=0 in place of debug
Now reboot the pi and we are ready to go. If you see a dark display, things are fine and need a small step to get the raspbmc in to the tft. But if the display stays white, something is wrong! may be the display name need to be changed to match the one you have.
Get /compil a small program called fbcp, which copies the framebuffer to the tft
sudo cp /boot/fbcp /usr/local/bin/ sudo chmod 755 /usr/local/bin/fbcp
and finally run fbcp and you have the raspbmc on the tft!!
fbcp can be found here or a compiled version at here
A working solution can be watched after a break