We’ve received many support tickets for asking how to make Raspberry Pi B+ 2.8 TFT Add-on V2.0 touchable. In this blog, we will demonstrate how to make Raspberry Pi B+ 2.8 TFT Add-on V2.0 show desktop upon Raspberry Pi B+ and its touch function.
Preparation
·Download Raspbian-2015-2-15.img into SD card, then launch Raspberry Pi B+
·Ensure your network connection working well
·Connect Raspberry Pi B+ 2.8 TFT Add-on V2.0 to Raspberry Pi B+ correctly
Install rpi-update and fbtft driver (intallation under the Raspberry Pi B+)
1.Before install the needed software, please do the configuration first. Raspberry Pi Software Configuration
sudo raspi-config
Enable Device Tree,SPI
2.Enter into the file /etc/modprobe.d/raspi-blacklist.conf
sudo vi /etc/modprobe.d/raspi-blacklist.conf
3.Comment the mask of spi out
#blacklist spi-bcm2708
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 B+
sudo reboot
Configure the file /usr/share/X11/xorg.conf.d/99-fbdev.conf
sudo touch /usr/share/X11/xorg.conf.d/99-fbdev.conf
sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
Configure 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:5,dc:6,wr:12,cs:13,db00:20,db01:21,db02:22,db03:23,db04:24,db05:25,db06:26,db07:27 rotate=90 fps=50 startx &
Now, the desktop of Raspberry Pi B+ is demonstrated on the 2.8 TFT Add-on V2.0. 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
1.Add the following contents to file /boot/config.txt
dtoverlay=ads7846,cs=1,speed=2000000,penirq=17,swapxy=1,xmin=230,xmax=3850,ymin=190,ymax=3850,pmax=255,xohms=100
2.Reboot Raspberry Pi B+
sudo reboot
3.Load TFT display driver
sudo modprobe fbtft_device name=itdb28 gpios=reset:5,dc:6,wr:12,cs:13,db00:20,db01:21,db02:22,db03:23,db04:24,db05:25,db06:26,db07:27 rotate=90 fps=50
4.start up X Server
startx &
Adjust the X&Y directions of this touch screen
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 0 1
Test
·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.
·Touch screen calibration
sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event3 ts_calibrate
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.