We’ve received many support tickets for asking how to make Raspberry PI 2.8 TFT Add-on touchable. In this blog, we will demonstrate how to make Raspberry PI 2.8 TFT Add-on V1.1 show desktop upon Raspberry Pi v2 and its touch function realize. However, what you should pay attention to is that the previously sold 2.8 TFT add-on V1.0 doesn’t support touch function.
Preparation
- Download 2014-01-07-wheezy-raspbian.img into SD card, then launch Raspberry Pi v2
- Ensure your network connection working well
- Connect Raspberry PI 2.8 TFT Add-on v1.1 to Raspberry Pi v2 correctly
Install rpi-update and fbtft driver (intallation under the Raspberry Pi v2)
1. Enter into the file /etc/modprobe.d/raspi-blacklist.conf
sudo vi /etc/modprobe.d/raspi-blacklist.conf
2. Comment the mask of spi out
#blacklist spi-bcm2708
3. Adjust the time into your current time:
date -s "2014-08-16 16:27:00"
4. Install the necessary software
sudo apt-get update
sudo apt-get install xinput evtest tslib libts-bin
5. Download the fbtft driver, and you may need to run the following command three times:
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
Finnally got the codes:
*** Running pre-install script
Work around rpi-update issue #106
*** Updating firmware
*** Updating kernel modules
*** depmod 3.12.21+
*** Updating VideoCore libraries
*** Using HardFP libraries
*** Updating SDK
*** Running ldconfig
*** Storing current firmware revision
*** Running post-install script
/lib/firmware
*** Deleting downloaded files
*** Syncing changes to disk
*** If no errors appeared, your firmware was successfully updated to b77683205688d3f6ae2b32a3c7f4e63de1c06a5d
*** A reboot is needed to activate the new firmware
By now, you need to reboot your Raspberry Pi v2
sudo reboot
Configure the file /usr/share/X11/xorg.conf.d/99-fbdev.conf
sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
Configuration content as below:
Section "Device"
Identifier "itdb28"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
EndSection
Load the tft display driver
sudo modprobe fbtft_device name=itdb28 gpios=reset:14,dc:2,wr:3,cs:8,db00:17,db01:18,db02:27,db03:22,db04:23,db05:24,db06:25,db07:4 rotate=90 fps=50
Startx
startx &
Now, the desktop of raspberry pi is demonstrated on the 2.8 TFT Add-on. However, you can’t use the touch function by now. Let’s do the following steps to make it can do.
Load the touch driver
sudo modprobe ads7846_device cs=1 speed=2000000 gpio_pendown=15 x_max=3850 x_min=230 x_plate_ohms=100 swap_xy=1 verbose=2 pressure_max=255 y_min=190 y_max=3850
Adjust the X&Y directions of this touch screen
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0
Test
1. Check the event’s number which is in accord with the touch screen.
cat /proc/bus/input/devices
This event’s number here is event3, then you need to execute the following command to do the calibration and test touch screen according to the event’s number you’ve got. When do calibrating, you’d better use touch pen to click the cross’s center unless you want a rough calibration result.
2. Touch screen calibration
sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event3 ts_calibrate
3. Touch screen test
sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event3 ts_test
Now, ctrl+c to return back to the Raspberry Pi desktop, and you are free to use mouse or touch pen to control the cursor.
Watch the video here: http://youtu.be/e4GjCjQuslc