Adafruit PiTFT Plus 480x320 3.5" TFT
Contents
Adafruit PiTFT 35" Touch Panel
Introduction
This guide shows how to bring up Adafruit PiTFT 3.5" touch screens on Tinker Borad (TB) step-by-step.
PiTFT is a little display with 480x320 16-bit color pixels and a resistive touch overlay, you can visist the official website for more details.
Porting Steps
1. Configure kernel
First of all, we should configure kernel to support the devices, FBTFT and Touchscreen.
Add the following lines into {codebase}/kernel/arch/arm/configs/miniarm-rk3288_defconfig:
CONFIG_FB_TFT_HX8357D=y
CONFIG_TOUCHSCREEN_STMPE=y
CONFIG_MFD_STMPE=y
CONFIG_STMPE_SPI=y
And copy the DTS overlay files into {codebase}/kernel/arch/arm/boot/dts/overlays/ to notice kernel there are new hardware devices.
Please reference to the overlay files pitft35-resistive-tinker-overlay.dts in attachment.
Next, modify the makefile to compile those new overlay files.
Add the following red line into {codebase}/kernel/arch/arm/boot/dts/overlays/Makefile:
dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
hifiberry-amp.dtbo \
hifiberry-dac.dtbo \
hifiberry-dacplus.dtbo \
iqaudio-dacplus.dtbo \
waveshare35a-tinker.dtbo \
waveshare32b-tinker.dtbo \
pps-gpio.dtbo \
w1-gpio.dtbo \
pitft35-resistive-tinker.dtbo \
The kernel now can support our new device, please re-build the image and flash to SD card.
2. Configure DTS overlay
To launch our setting in step 1, please add following line into /boot/hw_intf.conf on Tinker board:
Please note that the overlay keyword is changed in newer image, if you have old one (i.e. <= v2.0.1), use below command instead:
3. Install packages & setup
After Kernel configuration, we need to install the required packages to support display.
Please follow the instructions below:
sudo apt-get update
sudo apt-get install xserver-xorg-video-fbdev
After above, modify the config file /etc/X11/xorg.conf.d/20-modesetting.conf:
The red parts are modified.
Section "Device"
Identifier "Rockchip Graphics"
Driver "fbdev"
Option "AccelMethod" "glamor"
Option "DRI" "2"
Option "fbdev" "/dev/fb0"
EndSection
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Depth 24
Modes "1920x1080" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection
Then, save the file and reboot, you should see the desktop on PiTFT.
Additional Information
If you have done above steps, both of display and touch screen should work well now.
However, there are different applications, and you may want to change the rotation angle of display or calibrate the touch screen.
For the screen rotation, you can modify the rotation degree in pitft35-resistive-tinker-overlay.dts
And the vendor, Adafruit, has provided many kinds of ways for the touch calibration.
Please reference to the vendor's teaching page for more information.
https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/touchscreen-install-and-calibrate