C.3.2. Touchscreen controller programmer’s interface

The LCD Touch Screen Controller Interface (TSCI) is based on a TSC2200 PDA analogue interface circuit. Use the baseboard SSP interface to configure and read the touch screen. For information on the touch screen registers, see the TSC2200 data sheet.

The TSC2200 also incorporates a sixteen key keypad interface and two 12bit analogue inputs that are available through the LCD expansion header J13. With the 3.8 inch Sanyo and 2.2 inch Epson build options, six keypad push buttons are mounted on the LCD board.

SSP and TSCI Configuration

The SSP interface is controlled by the SSP PrimeCell and the SSP TSCI chip select is enabled through SYS_CLCD TSnSS signal. Configuration of the SSP to TSCI interface requires the data format, phase, size, and clock to be set correctly. Example configuration code is given in the selftest (TSCI) software on the CD, a code fragment from this is shown in Example C.1.

Example C.1. SSP to TSCI interface setup

// Set serial clock rate (/3), Phase (SPH), Format (MOT), data size (16bit)
// Clock prescale register (/8), with SCR gives 0.78MHz SCLK: 24MHz / 8*(1+3)
// Enable serial port operation

The TSC2200 TSCI controller registers must be configured through the SSP interface to enable correct touch screen operation.

After the TSCI is configured, conversion of touch screen X/Y values is fully automated by the TSCI controller and the application code simply reads the converted values. Use either the pen down flag in the touch screen controller interface or SIC interrupt 8 to detect the current pen state. The pseudo code in Example C.2 shows the sequence for configuring and reading the TSCI interface.

Read and write functions are used in the selftest code to transfer data to and from the TSCI registers TSCI_RTSC and TSCI_WTSC. The selftest example configures the TSCI for 12bit operation and 16 data averages with minimum precharge and sense times. This gives high accuracy and fast reading of the current pen position.

Example C.2. Configuring and reading the TSCI interface

Configure the SSP interface
Configure the TSCI registers
Enable the touch screen pendown interrupt (on SIC)
(other general setup code here)
On touch screen pendown interrupts
    (touch screen interrupt handler)
    Enable the touch screen event timer (TIMER 1-4) for 2mS intervals
    (other pendown handling code here)
On touch screen timer events
   (touch screen reading code here)
   If (pendown flag (PSM) is cleared)
        Disable the touch screen event timer
        Clear and re-enable the touch screen interrupt
        Read the pen X/Y values
        Draw the pen position on the screen


The selftest example provided on the CD uses a simple polled system to determine pen down and timer events.

The pseudo code in Example C.2 is recommended for OS ports as they typically require interrupt-driven device drivers.

Copyright © 2005-2011 ARM Limited. All rights reserved.ARM DUI 0411D