Skip to main content

Resistive Touch Screen on WinCE

Resistive Touch Screen

The Colibri and Apalis modules come with an interface for a 4-wire resistive and 5-wire Resistive Touch Screen. The driver for this interface is already included in our pre-installed Win CE standard image.

Following table shows the availability of touch interface:

Colibri Module4-Wire Touch5-Wire Touch
PXA270 V2.2 and newerYesYes
PXA300NoNo
PXA300 XTYesYes
PXA310YesYes
PXA320YesNo
PXA320(IT) V2.0 and newerYesYes
T20YesYes
T30YesNo
iMX6YesNo
VFxxYesNo
iMX7YesNo

This article focuses on the resistive touch interface, however it is also very easy to integrate capacitive devices.

4 Wire Resistive Touch Interface

This kind of touch screen interface connects to the touch screen by four wires in two pairs: (TSPX and TSMX), (TSPY and TSMY). A 4-wire resistive touch screen consists of two conductive film layers which are laminated to a solid base material or directly to the TFT screen. Each layer has two electrodes. One layer has an electrode on the left and one on the right edge. The other layer has one on the top and one on the bottom edge. When connecting the touch screen it is important to connect one signal pair to one layer.

For example:

  • TSPX to the left electrode and TSMX to the right electrode
  • TSPY to the upper electrode and TSMY to the lower electrode

As long as each wire pair is connected to one layer, every combination will work.

After proper connection the touch screen needs to be calibrated.

For in-depth information on how the 4-wire touch interface is implemented on the Colibri Module see the UCB1400 or WM9715 datasheet.

5 Wire Resistive Touch Interface

On the Colibri T20, Colibri PXA300 XT, Colibri PXA310, Colibri PXA270 V2.2 and newer, and Colibri PXA320(IT) V2.0 and newer, it is possible to directly connect a 5-wire touch screen.

The signals can be found on at the following locations:

Colibri PinEvalboardIrisOrchid4-Wire5-Wire
SODIMM 14X16 Pin5X19 Pin5X1 Pin36TSPX(X+)BR
SODIMM 16X16 Pin3X19 Pin4X1 Pin34TSMX(X-)TL
SODIMM 18X16 Pin4X19 Pin3X1 Pin35TSPY(Y+)TR
SODIMM 20X16 Pin2X19 Pin2X1 Pin33TSMY(Y-)BL
SODIMM 2X16 Pin6X19 Pin6X3 Pin7-WIPER

The 5-wire feature is an option of the Wolfson Audio/Touch controller used on the modules mentioned above. For more information about the 5-wire feature see also the Wolfson WM9715 datasheet.

Driver Support

To activate the support for the 5-wire touch interface you need to set the TouchType=1 in the registry

[HKLM\HARDWARE\DEVICEMAP\TOUCH]
TouchType=1 ; 0: 4-wire (default), 1: 5-wire

Hardware

Colibri PXAxxx, Colibri T20

Touch, ADC and Audio functionality are realized with the audio codec chip. Depending on module type and version, we use a codec from NXP UCB1400 or Wolfson Micro WM9715.

The chip requires power on VDDA_AUDIO. It must be powered even if you don't need Touch, ADC or Audio functionality.

Colibri T30, Colibri iMX6, Apalis iMX6

On the Colibri T30, Colibri iMX6, and Apalis iMX6 touch is realized with STMPE811 resistive touchscreen controller. The STMPE811 is integrated with a hard-wired touchscreen controller for 4-wire resistive type touchscreen.

Colibri Vybrid

On VF50 module touch screen is connected directly to the processor's internal ADC converter, on VF61 the Wolfson Micro WM9715 is used to support audio and touch screen.

Registry Settings

For the Colibri PXAxxx and Colibri T20, you can also use the Touch Tweak tool to make the settings for the touch screen driver. Colibri T30, VF50 and VF61 are not supported by the Touch Tweak tool yet.

Most settings are only supported in BSP version 3.2 and onwards for UCB codec and in BSP version 3.7 and onwards for Wolfson codec. You can reload the registry settings without rebooting the system. Just create an event named TouchSettingsChanged and set it. For an overview about the touch or audio codec, have a look here. The event mechanism is currently not supported on Vybrid modules.

Registry settings supported by all codecs used on Colibri PXAxxx and Colibri T20


[HKLM\HardWare\DeviceMap\Touch]

"Events"=0 ;Defines the events to set: 0=no Events(default), 1=TouchPenDown, 2=TouchPenUp (3=TouchPenDown and TouchPenUp)
"MouseEmulation"=0 ;any value beside 0 enables the sending of mouse events

"SamplingInterval"=100 ;Interval between 2 touch measurements (X,Y,Pressure) in milliseconds
"WaitSample"=0 ;Wait before each (sub)sample
"DummySamples"=0 ;Samples to throw away (can normally be set to 0)
"Samples"=4 ;Samples to process (they will be averaged)
"TouchType"=0 ;Type of touch Screen. 0-> 4 wire, 1 -> 5 wire

;Wait Times (n large touch panels or when using large filter capacitors higher values must be set to let the touch settle into the right measurement mode) O
"WaitX"=300 ;Time to wait before starting the sampling of X [us]. (Replaced by "Wait" key for Txx)
"WaitY"=300 ;Time to wait before starting the sampling of Y [us]. (Replaced by "Wait" key for Txx)
"WaitZ"=300 ;Time to wait before starting the sampling of Z [us]. (Replaced by "Wait" key for Txx)
"Wait"=300 ;For Txx modules only. Time to wait before starting sampling. (Added in 1.3beta3).
"PenUpTimeout"=25 ;For Txx modules only. Time (ms) to wait before triggering a penup event. (Added in 1.3beta3)

;The Driver will sample many values for each measurement (X/Y/Pressure) and if one of these values is too far apart from the others,
;the whole measurement is invalidated. The Max Variance defines this maximum difference between all samples.
"MaxXVariance"=50 ;
"MaxYVariance"=50 ;
"MaxZVariance"=100 ;
"MinZValue"=0 ;Minimum pressure needed to validate all measurements. If the pressure is below this level, all X/Y measurement will be discarded.

"BitDepth"=10 ;ADC Bit Depth

Codec specific settings


;Supported by UCB codec only
"VRefByp"=0 ;VREFbypass. If 1 ,the internal reference voltage is connected to VREFBYP pin (UCB1400).
"Filter"=1 ;This will enable an ADC internal Analog LowPass filter. (Available since image 1.6.) (UCB1400)

;Supported by Wolfson codec only:
"Sensitivity"=32 ;Sensitivity setting for Wolfson codecs (1 to 63, 1=most sensitive) (Wolfson codec register 0x78 RPU bits)

;Supported by Wolfson codec up to BSP V3.6 (obsolete):
"SettlingTime"=4 ;Settling time according to codec datasheet (supported )
"MaxPressure"=150 ;Maximal pressure

Registry settings supported by STMPE811 used on Colibri/Apalis T30 and Colibri/Apalis IMX6

The settings for the STMPE811 is supported in the Tegra BSP 1.2.


;Minimum pressure
;If the pressure is below this level, the X/Y measurement will be discarded. If STMPE811_Min_Pressure=0 then all touches cause a X/Y measurement.
"STMPE811_Min_Pressure"=20 ;default value

;Movement tracking
;The "Tracking Index" in the TSC_CTRL register specifies a value, which determines the distance between the current touch position and the previous touch position. If the distance is shorter than the tracking index, it is discarded.
;The tracking is calculated by summation of the horizontal and vertical movement. Movement is only reported if: (Current X - Previously Reported X) + (Current Y - Previously Reported Y) > Tracking Index.
;An increase in pressure override the movement tracking and report the new data set, even if X/Y is within the previous tracking index. This is to ensure that a slow touch is not discarded.
"STMPE811_Track"=0 ;No tracking
"STMPE811_Track"=1 ;Tranking index 4
"STMPE811_Track"=2 ;Tranking index 8
"STMPE811_Track"=3 ;Tranking index 16
"STMPE811_Track"=4 ;Tranking index 32 (default)
"STMPE811_Track"=5 ;Tranking index 64
"STMPE811_Track"=6 ;Tranking index 92
"STMPE811_Track"=7 ;Tranking index 127

;Average control
;The STMPE811 touchscreen controller can be configured to oversample by 2/4/8 times and provide the averaged value as final output. This feature helps to reduce the effect of surrounding noise.
"STMPE811_Ave_Ctrl"=0 ;1 samples
"STMPE811_Ave_Ctrl"=1 ;2 samples
"STMPE811_Ave_Ctrl"=2 ;4 samples
"STMPE811_Ave_Ctrl"=3 ;8 samples (default)

;Touch detect delay
;The delay between two measurements are influenced many parameters like I2C communication etc. With the "Touch detect delay" this delay can changed but only values between 4 and 7 makes sense (the measured delay and the given delay in the datasheet (..) are not inline).
;Pleas note if STMPE811_Det_Delay is set to 6 or 7 then STMPE811_Pen_Up_Timeout must be to a higher value.
"STMPE811_Det_Delay"=0 ;[10 us]
"STMPE811_Det_Delay"=1 ;[50 us]
"STMPE811_Det_Delay"=2 ;[100 us]
"STMPE811_Det_Delay"=3 ;[500 us]
"STMPE811_Det_Delay"=4 ;8 ms [1ms]
"STMPE811_Det_Delay"=5 ;16 ms [5ms] (default)
"STMPE811_Det_Delay"=6 ;32 ms [10ms]
"STMPE811_Det_Delay"=7 ;160 ms [50ms]

;Touch pen up detect delay
;After a pen down is detected the next pen down must be detected during this time otherwise a pen up is generated.
"STMPE811_Pen_Up_Timeout"=25 ;delay in ms

;Touch settling delay
The delay between the driver X or Y and the ADC takes X or Y reading ist the settling time.
;For large panels (> 6"), a capacitor of 10 nF is recommended at the touchscreen terminals for noise filtering. In this case, settling time of 1 ms or more is recommended.
"STMPE811_Settling"=0 ;10 us
"STMPE811_Settling"=1 ;100 us
"STMPE811_Settling"=2 ;500 us (default)
"STMPE811_Settling"=3 ;1 ms
"STMPE811_Settling"=4 ;5 ms
"STMPE811_Settling"=5 ;10 ms
"STMPE811_Settling"=6 ;50 ms
"STMPE811_Settling"=7 ;100 ms

;Driver control unit
; The touchscreen drivers can be configured with 2 current ratings: 20 mA or 50 mA. In the case where multiple touch-down on the screen is causing a short, the current from the driver is limited to these values. Tolerance of these current setting is +/- 25%.
"STMPE811_I_Drive"=0 ;20 mA typical, 35 mA max
"STMPE811_I_Drive"=1 ;50 mA typical, 80 mA max (default)

;Shield
;Writing each bit would ground the corresponding touchscreen wire
;Bit 3 Bit 2 Bit 1 Bit 0
;X+ X- Y+ Y-
"STMPE811_Shield"=0x00 ;no wire is shielded (default)

;Enables the sending of mouse events
"MouseEmulation"=0 ;disable mouse events (default)
"MouseEmulation"=1 ;any value beside 0 enables mouse events

;Defines the events to send
"Events"=0 ;no Events(default)
"Events"=1 ;TouchPenDown
"Events"=2 ;TouchPenUp
"Events"=3 ;TouchPenDown and TouchPenUp

Registry settings supported by Colibri VF50


[HKLM\HardWare\DeviceMap\Touch]
"MinZValue"=1050 ;(1...4095) Minimum pressure needed to validate all measurements. Highest value means lowest pressure.
"SettlingTime"=1 ;Settling time in ms

Registry settings supported by Colibri VF61


[HKLM\HardWare\DeviceMap\Touch]
"TouchType"=0 ;Type of touch Screen. 0-> 4 wire, 1 -> 5 wire

"MinZValue"=0 ;Minimum pressure needed to validate all measurements. If the pressure is below this level, all X/Y measurement will be discarded.
"Sensitivity"=32 ;Sensitivity setting for Wolfson codecs (1 to 63, 1=most sensitive) (Wolfson codec register 0x78 RPU bits)
"SettlingTime"=4 ;Settling time according to codec datasheet (supported )

Registry settings supported by Colibri IMX7


[HKLM\HardWare\DeviceMap\Touch]
"FirstConversionDelay"=dword:3 ;Range is 0-15
;Configures the time that the controller wait before start sampling the touch screen,
;this will give the internal ADC some time to power-up and screen time to settle.
;0=128 microseconds
;3=512 microseconds
;15=4096 microseconds

"AcquisitionTime"=dword:1 ;Range is 0-3
;Sample acquisition time
;0=2 microseconds
;1=4 microseconds
;2=8 microseconds
;3=16 microseconds

"MedianFilterSize"=dword:2 ;Range is 0-3
;Sets the number of samples taken for every measurement
;0=disabled
;1=4 measurements
;2=8 measurements
;3=16 measurements
;A subset of those samples is then used for averaging

"Averaging"=dword:1 ;Range is 0-3
;Sets the number of valid samples that are taken to calculate the returned value,
;should be less or equal than MedianFilterSize.
;0=2 samples
;1=4 samples
;2=8 samples
;3=16 samples

"SamplingInterval"=100 ;Interval between 2 touch measurements (X,Y,Pressure) in milliseconds From image 1.1b4
"DummySamples"=0 ;Samples to throw away (can normally be set to 0) From image 1.1b4
"Samples"=4 ;Samples to process (they will be averaged) From image 1.1b4

;The Driver will sample many values for each measurement (X/Y) and if one of these values is too far apart from the others,
;the whole measurement is invalidated. The Max Variance defines this maximum difference between all samples.
"MaxXVariance"=50 ; From image 1.1b4
"MaxYVariance"=50 ; From image 1.1b4


Events

The registry setting Events defines the events to be generated by the touch driver. Available named events are

  • TouchPenDown
  • TouchPenUp

If one or more of these events are enabled in the registry, the driver generates this events which can be caught by SW using WaitForSingleObject() or WaitForMultipleObject().

This Feature is available in Toradex WinCE BSP V3.7b1 and onwards.

Enable / Disable Touch Dynamically

The touch screen can be enabled and disabled by an application by following the steps mentioned below.

The following registry entry needs to be created or updated:

[HKLM\HardWare\DeviceMap\Touch]
"Disabled"=1 ; 0=enable touch 1=disable touch

This can be achieved by using the code snipplet below:


{...
HKEY hKey;
DWORD dwDisabled = 1;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\TOUCH",
0, KEY_ALL_ACCESS, &hKey);
RegSetValueEx(hKey, L"Disabled", 0, REG_DWORD,
(LPBYTE)&dwDisabled, sizeof(DWORD));
RegCloseKey (hKey);
...}

Create and set an event to inform the touch driver about the changed configuration.

{...
hEvent=CreateEvent(NULL, FALSE, FALSE, L"TouchSettingsChanged");
SetEvent(hEvent);
CloseHandle(hEvent);
...}

Touch Screen Calibration

  • Please refer this article for Touch screen calibration in WinCE.
  • Please refer this article for Touch screen calibration in Linux.

USB Touch

In addition to the 4-wire resistive touch screen driver, there is also a USB touch screen driver (from TouchKit) in the standard Win CE image. The driver is compatible with various USB Touch Screens but you can also use your own driver. For USB HID driver check here.



Send Feedback!