3.5" LANDZO SPI TouchScreen

From Tinker Board Wiki
Jump to navigation Jump to search

Support 3.5" LANDZO SPI TouchScreen

Introduction

This guide gives step-by-step instructions on how to enable WaveShare 4"/3.5"/3.2" touch screens.
Please follow the steps for the device being ported.

Beware: This configuration procedure may be difficult for newbies, be sure you know what you are doing.

Product Info
    http://www.waveshare.com/catalog/product/view/id/2841/s/3.2inch-rpi-lcd-b/category/126/
    http://www.waveshare.com/catalog/product/view/id/2839/s/4inch-rpi-lcd-a/category/126/
    http://www.waveshare.com/product/mini-pc/raspberry-pi/3.5inch-rpi-lcd-a.htm

Porting steps

1 Kernel config

Note: If your version of the TinkerOS is v2.0.1 or later, skip this step and go on to step 2.

Add the following lines into {codebase}/kernel/arch/arm/configs/miniarm-rk3288_defconfig to enable the framebuffer kernel driver:

 CONFIG_FB_TFT=y
 CONFIG_FB_TFT_ILI9340=y
 CONFIG_FB_TFT_ILI9486=y

Copy the DTS overlay files into {codebase}/kernel/arch/arm/boot/dts/overlays/ to notify the kernel that there are new
hardware devices.

Modify the makefile to compile the new overlay files.

Add the following red lines into {codebase}/kernel/arch/arm/boot/dts/overlays/Makefile:

dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
   hifiberry-dac-amp.dtbo \
   waveshare35a-tinker.dtbo \
   waveshare32b-tinker.dtbo \ 


2 Enable DTS overlay

Download this file: Media:Waiveshare-spi-panel.7z and extract its contents into an accessible folder. The overlay files (*.dts) are included in this content.

If using TinkerOS v2.0.1 or later, add the following line to the hardware interface config file /boot/hw_intf.conf :

$ sudo nano /boot/hw_intf.conf

Add this line:

intf:dtoverlay=waveshareXXX-tinker

If using TinkerOS earlier than v2.0.1, add the following line instead:

intf:dts_overlay=/waveshareXXX-tinker.dtbo

XXX = "32b" or "35a"

Warning: The filename of the hardware interface config file may be changed in later versions.

Save the file and exit nano.

3 Install packages & setup

To install the required display support packages enter the following command lines:

 $ sudo apt-get update
 $ sudo apt-get install xserver-xorg-video-fbdev
 $ cd (path to the extracted Media:Waiveshare-spi-panel.7z file folder)
 $ sudo cp 20-modesetting.conf /etc/X11/xorg.conf.d/
 $ sudo reboot


After reboot, the screen should be functional and the touch screen should be active.

4 Touch screen calibration

Even though the display and touch screen are now functional, the coordinates of the touch screen may not match the pointer on the display.
Calibration of the Touch screen is needed.

Do the following to copy the corresponding calibration files into the /usr/share/X11/xorg.conf.d/ folder::

$ sudo apt-get install xserver-xorg-input-evdev
$ sudo mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
$ sudo cp 99-calibration.conf.XX /usr/share/X11/xorg.conf.d/99-calibration.conf  

XX = 32 or 35 here.

The appropiate 99-calibration.conf.XX file can be found in the Media:Waiveshare-spi-panel.7z file extract folder.

Additional note from MCLeft:

The '99-calibration.conf' file was not an accurate calibration for my 3.5 inch device and it was necessary for it to be modified.
See the contents of my file below:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "200 3950 250 3850"
        Option  "SwapAxes"      "0"
		Option  "InvertY"       "1"
EndSection