Personal tools

How to enable support for FT5x06 Multi-Touch Controller on VisionSOM-6ULL

From SomLabs Wiki

Jump to: navigation, search

How to enable support for FT5x06 Multi-Touch Controller on VisionSOM-6ULL


This tutorial based on Debian 9.2 image for VisionSOM-6ULL module. Please visit How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Linux or How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Windows for more detailed instruction how to create a bootable microSD card.

To enable support for LCD-TFT display, please download and apply enable-tft-lcd.patch for somlabs-visionsom-6ull.dts device tree file:

root@ubuntu:~# wget
root@ubuntu:~# unzip
root@ubuntu:~# patch /home/developer/source/somlabs-dts-1.0/somlabs-visionsom-6ull.dts ./enable-tft-lcd.patch

For more info how to customize, build and upload Device Tree file, please visit How to customize Debian 9.2 device tree.

Enabling support for FT5x06 Multi-Touch Controller

The 7’ LCD-TFT display for SoMLabs module SL-TFT7-TP-800-480 is equipped with a capacitive touch panel controller from FT5x06 series (single-chip capacitive touch panel controller ICs with a built-in 8-bit microcontroller unit). A simple driver for the FT5x06 touch controller using I²C is already included in the Linux kernel for SoMLabs module. To enable support for FT5x06 driver, configure kernel with menuconfig tool (alternatively use make xconfig or make qconfig):

root@ubuntu:~# cd /home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga
root@ubuntu:/home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga# make ARCH=arm menuconfig

and choose the right driver:

Device Drivers -->
	Input device support -->
		-*- Generic input layer (needed for keyboard, mouse, ...)
		*** Userland interfaces ***
		 <*>  Event interface
		 < >  Event debugging
		*** Input Device Drivers ***
		 [ ]  Joysticks/Gamepads  --->
		 [ ]  Tablets  --->
		 [*]  Touchscreens  --->
			<*>  EDT FocalTech FT5x06 I2C Touchscreen support

20180504 img01.png

After all these options have been selected, save your configuration, exit the menuconfig tool, build a new kernel image:

root@ubuntu:/home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga# make ARCH=arm zImage

and transfer the new kernel images to a microSD:

root@ubuntu:/home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga# sudo mount /dev/sdbX /mnt/sdcard
root@ubuntu:/home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga# cd /mnt/sdcard
root@ubuntu:/home/developer/source/kernel/linux-rel_imx_4.1.15_2.1.0_ga# sudo cp <linuxsources>/arch/arm/boot/zImage boot/

In last steps, customize Device Tree file (somlabs-visionsom-6ull.dts). Because FT5x06 is using I²C bus, it is needed to enable I2C controller (I2C2):

&i2c2 {
	clock_frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c2>;
	status = "okay"

In IOMUX section set proper I2C pin definition:

pinctrl_i2c2: i2c2grp {
	fsl,pins = <
		MX6UL_PAD_UART5_TX_DATA__I2C2_SCL 0x4001b8b0
		MX6UL_PAD_UART5_RX_DATA__I2C2_SDA 0x4001b8b0

According to Device Tree documentation for FT5x06 chips, add following entry in somlabs-visionsom-6ull.dts file:

&i2c2 {
	clock_frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c2>;
	status = "okay";

	polytouch: edt-ft5x06@38 {
		compatible = "edt,edt-ft5406", "edt,edt-ft5x06";
		reg = <0x38>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_edt_ft5x06>;
		interrupt-parent = <&gpio1>;
		interrupts = <2 0>;

		touchscreen-size-x = <800>;
		touchscreen-size-y = <480>;


  • reg: I2C slave address of the chip (0x38),
  • interrupt-parent: a handle pointing to the interrupt controller serving the interrupt for this chip,
  • interrupts: interrupt specification for the touchdetect interrupt.

Above description also defines two optional properties for Touchscreens:

  • touchscreen-size-x: horizontal resolution of touchscreen (in pixels),
  • touchscreen-size-y: vertical resolution of touchscreen (in pixels).

IOMUX section for touchscreen controller:

pinctrl_edt_ft5x06:edt-ft5x06grp {
	fsl,pins = <
		MX6UL_PAD_GPIO1_IO02__GPIO1_IO02	0x1b0b0

You can find more information on building and customizing Device Tree in How to customize Debian 9.2 device tree tutorial.

Testing and configuring touchscreen with desktop environment - Xfce

To test touchscreen driver, let’s install one of lightweight desktop environment:

root@somlabs:~# apt-get update
root@somlabs:~# apt-get install xfce4

To be sure that your SD card has enough space for it, please remember to resize it before installing xfce4 package - more information: How to resize Debian 9.2 root partition to fit SD card.

After Xfce installation we will notice that touchscreen input is rotated according to screen orientation (180°). Because kernel driver for FT5x06 chips doesn’t support additional DT properties like touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y, we need to calibrate touchscreen directly in userspace. In Debian – like in most of nowadays Linux distributions – default input device driver is libinput (as a replacement for evdev). Libinput uses Coordination Transformation Matrix (CTM) ( to transform input coordinate (x, y, z) to output coordinate (X, Y, Z). To check current values for CTM, list all input devices:

root@somlabs:~# xinput list

You will see output like:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ USB Optical Mouse                       	id=7	[slave  pointer  (2)]
⎜   ↳ EP0790M09                               	id=9	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ 20cc000.snvs:snvs-powerkey              	id=6	[slave  keyboard (3)]
    ↳ USB2.0 Camera                           	id=8	[slave  keyboard (3)]

To print the CTM of selected device (in our case it is EP0790M09), run the following command:

root@somlabs:~# xinput list-props EP0790M09 | grep "Transformation”

To change and test transformation matrix (please visit for more info how to use and configure CTM):

  • in case of rotating left (counterclockwise 90°)
xinput set-prop EP0790M09 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
  • in case of rotating right (clockwise 90°)
xinput set-prop EP0790M09 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
  • and like in our case - inverting rotate (clockwise 180°)
xinput set-prop EP0790M09 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1

Once we have determined the CTM, modify /usr/share/X11/xorg.conf.d/40-libinput.conf file in the section with "libinput touchscreen catchall" identifier and add new line with TransformationMatrix option:

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"

Reboot system and enjoy!

Ready to use image file

You can also use a prepared image file.

You need to download the image file:

Then you need to write the image file to microSD card. More information you can find in manuals: How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Linux or How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Windows.

NXP Partner ST Partner Renesas Partner