Skip to main content
Version: BSP 6.x.y

Resistive Touch Screen (Linux)

General information

Resistive touch works out-of-the-box in all Toradex modules. However, depending on your touchscreen, some calibration may be needed.

Colibri X1 connectorColibri function
14TSPX
16TSMX
18TSPY
20TSMY
Apalis X1 connectorApalis function
315AN1_TSPX
317AN1_TSMX
319AN1_TSPY
321AN1_TSMY

Apalis T30, Apalis iMX6, Colibri T30, Colibri iMX6

The Apalis T30, Apalis iMX6, Colibri T30 and Colibri iMX6 offer a 4-wire resistive touch interface via ST Microelectronics STMPE811, which is connected to the SoC through I2C. The STMPE811 does not support 5-wire operation mode.

Please consult the Microelectronics STMPE811 documentation for more information.

Apalis TK1

The Apalis TK1 offers a 4-wire resistive touch interface implemented via the K20 companion MCU.

Colibri iMX7, Colibri iMX6ULL, Colibri iMX8X

The Colibri iMX7, Colibri iMX6ULL and Colibri iMX8X offer a 4-wire resistive touch interface using the Analog Device AD7879-1 Touchscreen Controller, which is connected to the SoC through I2C. The AD7879-1 does not support 5-wire operation mode.

Please consult the Analog Device AD7879-1 documentation for more information.

Colibri VF61, Colibri T20

The Colibri VF61 and Colibri T20 offer a 4-wire resistive touch interface via the Wolfson WM9715L audio codec.

Please consult the Wolfson WM9715 documentation for more information.

Colibri VF50

The touch interface is provided by using the internal ADC input of the Vybrid SoC.

info

Make sure to check the modules datasheet for additional information.

Touch Calibration

Read the dedicated articles:

Legacy Touch Calibration (BSP 1.x)

For BSP 1.x to automatically apply the calibration settings upon boot proceed as follows:

root@colibri_t20:~# mkdir /etc/X11/xorg.conf.d
root@colibri_t20:~# xinput_calibrator
Calibrating EVDEV driver for "wm97xx touchscreen" id=6
current calibration values (from XInput): min_x=3991, max_x=58 and min_y=3932, max_y=351

Doing dynamic recalibration:
Setting new calibration data: 3999, 74, 4016, 296

--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'
Section "InputClass"
Identifier "calibration"
MatchProduct "wm97xx touchscreen"
Option "Calibration" "3999 74 4016 296"
EndSection

Now just create the 99-calibration.conf file according to the xinput_calibrator output above:

root@colibri_t20:~# vi /etc/X11/xorg.conf.d/99-calibration.conf
:i
Section "InputClass"
Identifier "calibration"
MatchProduct "wm97xx touchscreen"
Option "Calibration" "3999 74 4016 296"
EndSection
~
:wq
root@colibri_t20:~#
Alternative way to make Touch Calibration Persistent (BSP 1.x)

To automatically apply the calibration settings upon boot one can also proceed as follows:

System - Preferences - Startup Applications
Add
Name: Touch Calibration
Command: xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 3995 88 3861 304
Comment: Apply touch calibration

As command one can just use the xinput command as output by the xinput_calibrator application. Alternatively if you require more than one xinput command for proper calibration (e.g. due to swapped axes) you can create a script /usr/bin/touch.sh and use this as above command:

#!/bin/sh
export DISPLAY=:0
xinput set-int-prop "wm97xx touchscreen" "Evdev Axes Swap" 8 1
xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 3957 148 197 3295
xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 137 4130 3147 179

Colibri Evaluation Board with Toradex 4.3" Sharp WQVGA Touch TFT (V1.0a)

Note (BSP 1.x): Somehow due to swapped axes the calibration needs to be run twice in order to get the desired result.

root@colibri_t20:~# export DISPLAY=:0
root@colibri_t20:~# xinput_calibrator
Calibrating EVDEV driver for "wm97xx touchscreen" id=6
current calibration values (from XInput): min_x=3995, max_x=88 and min_y=3861, max_y=304

Doing dynamic recalibration:
Swapping X and Y axis...
Setting new calibration data: 3957, 148, 197, 3295
Making the calibration permanent (EvalBoard with WQVGA BSP 1.x)

If you have the 'xinput' tool installed, a simple way is to create a script that starts with your X session, containing the following command(s):

    xinput set-int-prop "wm97xx touchscreen" "Evdev Axes Swap" 8 1
xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 3957 148 197 3295

If you have evdev version 2.3.0 or higher, there are 2 more ways: the traditional way (xorg.conf) and the new way (udev rule):

xorg.conf: edit /etc/X11/xorg.conf and add in the 'Section "InputDevice"' of your device:
Option "Calibration" "3957 148 197 3295"
Option "SwapAxes" "1" # unless it was already set to 1
udev rule: create the file '/etc/udev/rules.d/99_touchscreen.rules' with:
ACTION!="add|change", GOTO="xorg_touchscreen_end"
KERNEL!="event*", GOTO="xorg_touchscreen_end"
ATTRS{product}!="wm97xx touchscreen", GOTO="xorg_touchscreen_end"
ENV{x11_options.calibration}="3957 148 197 3295"
ENV{x11_options.swapxy}="1"
LABEL="xorg_touchscreen_end"

Iris with EDT ET070080DH6


root@colibri_t20:~# export DISPLAY=:0
root@colibri_t20:~# xinput_calibrator
Calibrating EVDEV driver for "wm97xx touchscreen" id=6
current calibration values (from XInput): min_x=350, max_x=3900 and min_y=320, max_y=3750

Doing dynamic recalibration:
Setting new calibration data: 3995, 88, 3861, 304
Making the calibration permanent (Iris with EDT BSP 1.x)

If you have the 'xinput' tool installed, a simple way is to create a script that starts with your X session, containing the following command(s):

    xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 3995 88 3861 304

If you have evdev version 2.3.0 or higher, there are 2 more ways: the traditional way (xorg.conf) and the new way (udev rule):

xorg.conf: edit /etc/X11/xorg.conf and add in the 'Section "InputDevice"' of your device:
Option "Calibration" "3995 88 3861 304"
udev rule: create the file '/etc/udev/rules.d/99_touchscreen.rules' with:
ACTION!="add|change", GOTO="xorg_touchscreen_end"
KERNEL!="event*", GOTO="xorg_touchscreen_end"
ATTRS{product}!="wm97xx touchscreen", GOTO="xorg_touchscreen_end"
ENV{x11_options.calibration}="3995 88 3861 304"
LABEL="xorg_touchscreen_end"

MECS Tellurium with Ampire 5.7" LED VGA Touch TFT

Please note that instead of PWM A the Tellurium uses PWM C aka PWFM2 for back light control requiring a custom kernel to be built with MECS_TELLURIUM being defined (see arch/arm/mach-tegra/board-colibri_t20-panel.c).


root@colibri_t20:~# export DISPLAY=:0
root@colibri_t20:~# xinput_calibrator
Calibrating EVDEV driver for "wm97xx touchscreen" id=6
current calibration values (from XInput): min_x=350, max_x=3900 and min_
y=320, max_y=3750

Doing dynamic recalibration:
Setting new calibration data: 107, 3959, 3939, 137
Making the calibration permanent (MECS with Ampire BSP 1.x)

If you have the 'xinput' tool installed, a simple way is to create a script that starts with your X session, containing the following command(s):

    xinput set-int-prop "wm97xx touchscreen" "Evdev Axis Calibration" 32 107 3959 3939 137

If you have evdev version 2.3.0 or higher, there are 2 more ways: the traditional way (xorg.conf) and the new way (udev rule):

xorg.conf: edit /etc/X11/xorg.conf and add in the 'Section "InputDevice"' of your device:
Option "Calibration" "107 3959 3939 137"
udev rule: create the file '/etc/udev/rules.d/99_touchscreen.rules' with:
ACTION!="add|change", GOTO="xorg_touchscreen_end"
KERNEL!="event*", GOTO="xorg_touchscreen_end"
ATTRS{product}!="wm97xx touchscreen", GOTO="xorg_touchscreen_end"
ENV{x11_options.calibration}="107 3959 3939 137"
LABEL="xorg_touchscreen_end"

Colibri T20

[    6.865817] wm97xx-ts 0-0:WM9711,WM9712,WM9715: detected a wm9712 codec
[ 6.880561] input: wm97xx touchscreen as /devices/platform/tegra-ac97/0-0:WM9711,WM9712,WM9715/input/input2

Colibri VF61

The Colibri VF61 uses the Wolfson WM9712 AC97 audio codec for resistive touch support. The driver has several kernel parameters which can be tuned:

ParameterData typeDescription
rpuintSet internal pull up resistor for pen detect.
pilintSet current used for pressure measurement.
pressureintSet threshold for pressure measurement.
delayintSet adc sample delay.
abs_xarray of intTouchscreen absolute X min, max, fuzz
abs_yarray of intTouchscreen absolute X min, max, fuzz
abs_parray of intTouchscreen absolute Pressure min, max, fuzz

The source file in drivers/input/touchscreen/wm9712.c has some more hints to the exact meaning of the values.

The WM9712 driver module is built-in, to set a module parameter the kernel command line needs to be altered. Use the module name wm97xx-ts as prefix so set a parameter:

setenv defargs wm97xx-ts.pil=1


Send Feedback!