<<

Texas Instruments Incorporated Data Acquisition Understanding the pen-interrupt (PENIRQ) operation of touch-screen controllers By Wendy Fang, Precision Analog Applications, High-Performance Analog, and Ing-Yih James Wang, Design Engineer, Precision Analog ——— Introduction PENIRQ function 1 2 ———— The TSC2003 and TSC2007 are both four-wire touch- To understand the PENIRQ function, we must first start screen controllers (TSCs) with an I2C interface. These two with the operation of the entire TSC200x touch screen devices are completely hardware-compatible with respec- system. tive TSSOP-16 packages; they are also software-compatible As Figure 1 shows, there are two interfaces in a TSC in many applications.3 system: one is the analog interface (X+, X–, Y+, and Y–) The digital output, or hardware interrupt pin on a between the TSC and the touch panel, and the other is the ———— ———— TSC2003 or TSC2007 device is called PENIRQ. It provides digital interface (SCL, SDA, and PENIRQ) between the rich information on the touch screen system and its vari- TSC and the processor. The digital interface is the ous connections. For example, this pin indicates whether center of the discussion in this article. the TSC device works as it should, or if the TSC system When there is no touch or pressure applied to the touch analog interface is properly connected. Observing the ———— panel, the touch-screen system is in a and state; PENIRQ pin is very useful for properly configuring the the I2C bus lines (SCL and SDA) and the pen-detect inter- ———— system in a given application as well as debugging the TSC rupt (PENIRQ) are all inactive or at logic high. device operation. ———— When pressure or a touch is applied to the system touch Many users may presume that the PENIRQ pin responds panel, the TSC200x detects the touch. Correspondingly, ———— only to touch on the panel and may be surprised by several PENIRQ goes low or becomes active, and sends an inter- ———— ———— ———— exceptional PENIRQ behaviors. For instance, the PENIRQ rupt request to the host. Upon receiving the PENIRQ pin does not seem to work the same after the touch panel signal, the host processor then sends the TSC a command or the surrounding environment (such as temperature) ———— through the I2C bus. In response to the command from the changes. PENIRQ also goes high at times even though the host, the TSC then powers on the corresponding touch- user maintains pressure on the panel. These behaviors (as panel driver and starts the touch-data sampling/converting well as others) are often unexpected. (or filtering). The data are then sent from the TSC to the This article discusses these types of behaviors and ———— host via the I2C interface. The system continues this cycle describes how the PENIRQ pin may be expected to oper- as long as the touch remains applied to the panel. Refer to ate under a variety of conditions. It also explains the prin- ———— the related sections in the product data sheets1, 2 for fur- ciples of the PENIRQ pin, and provides information about ———— ther details on the I2C digital interface. how and where to investigate PENIRQ behaviors. When the pressure is released or the touch is removed, ———— Throughout this article, the abbreviation TSC200x the PENIRQ returns high or becomes inactive. The entire refers to both the TSC2003 and the TSC2007, except touch screen system returns to the wait state again. where stated otherwise.

Figure 1. TSC200x touch-screen system

Touch Panel TSC2003/ Host Processer TSC2007

X+ SAR (Noise ADC Filtering) 2 Y+ IC SCL Touch 2 Panel Interface SDA IC X Internal Driver and Port Clock Y Control PENIRQ Touch Logic INT Screen

5

Analog Applications Journal 2Q 2008 www.ti.com/aaj High-Performance Analog Products Data Acquisition Texas Instruments Incorporated

———– ———– Figure 2. TSC200x PENIRQPEbehavior following Figure 3. TSC200x PENIRQPEbehavior touch-on or touch-off activity on panel with full I2C interface

4.06 ms 58.6 ms

PENIRQ (2 V/div) PENIRQ (2 V/div) 1 1 SCL (2 V/div) SCL (2 V/div)

3 SDA (2 V/div) 3

4 4 SDA (2 V/div)

Time Base (500 µs/div) Base (10 ms/div)

———— Clearly, the PENIRQ is usually the trigger that moves ——— ———— PENIRQ working principle the TSC device to either a wait state (if PENIRQ is inac- ———— ———— The function of the TSC200x PENIRQ, once it is enabled, tive) or an awake state (if PENIRQ is active). However, ———— can be simplified by the block diagram shown in Figure 4 there are some cases where PENIRQ may not be used to with Q1 and Q4 ON; and Q2 and Q3 OFF. trigger the touch system in some applications; these When the touch panel is not pressed, the touch-panel X exceptions will not be discussed in this article. ———— and Y layers are separated and the power from the TSC The TSC200x PENIRQ reflects the touch-on and touch- touch-panel driver cannot run to ground. Thus, there is no off activity on the touch-screen panel, as shown in Figure 2 driving current in the analog interface, and the entire sys- and Figure 3. Figure 2 illustrates the digital interface tem is in a waiting (that is, sleep) mode. The voltage at when the host software has not yet been loaded; Figure 3 point B in Figure 4 is equal to V . is the digital behavior with a complete I2C interface.

———– Figure 4. PENIRQPEfunctional block diagram

TSC Device PENIRQ

VDD

B RIRQ

Pen Touch Control Logic

Q2 Q1

X+

Y+ GND A X– High when the Y– Q3 Touch X+ or Y+ Off Screen Q4 driver is on On

GND

6

High-Performance Analog Products www.ti.com/aaj 2Q 2008 Analog Applications Journal Texas Instruments Incorporated Data Acquisition

—–– —– Table 1. PENIRQ operation (when enables)

System Condition PENIRQ Circuit Status Analog Interface Status PENIRQ Status

No touch applied to the panel Q1 is on X+ = VDD PENIRQ ≡ VDD (the X and Y layers have no Q2 is off X– = VDD connection) Voltage at B =VB =VDD Y+=GND (no current flows because the Y– = GND X and Y layers have no connection)

Touch applied to the panel Q1 is on X+ ≈ VB PENIRQ ≈ GND (the X and Y layers are Q2 is off X– ≈ VB If VB VThreshold Q4 → GND) Where the gate threshold is: 0.4 × VDD

7

Analog Applications Journal 2Q 2008 www.ti.com/aaj High-Performance Analog Products Data Acquisition Texas Instruments Incorporated

and such weak touch, the TSC2003 would surely have For some touch panels, the R resistance under a ———— Touch trouble because its internal PENIRQ pull-up resistor very weak touch may be very high and very close to the Ω RTouch is relatively low (about 10 k ), and because the resistance without any touch. For example, if RTouch is ≥ Ω voltage at point B is: approximately 100 k , then the TSC2007, with RIRQ = Ω V V 90 k , may still have difficultly detecting it, since from V ≈ DD ××R = DD 20000 B + Touch + Equation 1, VB = 0.526 × VDD. RRIRQ Touch 10000 20000 ——— =×067..V PENIRQ transient state DD ———— If you monitor the TSC2007 PENIRQ signal, you may Obviously, the voltage 0.67 × V at V is too high, and ———— DD B notice that when a touch remains on the panel and when it cannot trigger the PENIRQ. You have to apply signifi- the host is reading touch data (such as X, Y, Z1, or Z2), the cant pressure on such a panel to allow the TSC2003 to ———— PENIRQ may return high shortly and then go back to low sense the touch. again before the TSC sends out the touch data over the Under the same weak touch, however, the TSC2007 has I2C bus. This situation is illustrated by Figure 5 and Figure 6. a advantage. The problem described above on the ———— To explain these types of glitches in the PENIRQ, we TSC2003 cannot occur because the TSC2007 has a much ———— must first understand the function of the switches Q1 and higher internal pull-up resistor in its PENIRQ circuit. ———— Q2 in the PENIRQ functional block diagram (see Figure 4). Under the previous same example, V on the TSC2007 is B In some older TSC devices, such as the ADS7843, it is a either 0.28 × V (for 51-kΩ R ) or 0.18 × V (for DD IRQ DD concern or problem that a so-called ADC Convert Error 90-kΩ R ); both values are much lower than the gate ———— IRQ ———— caused by the PENIRQ circuit may occur. Refer to the threshold. The PENIRQ works correctly and reliably even ———— section, Operation of PENIRQ, in Reference 4. with a very weak touch.

———– ———– Figure 5. PENIRQPEgoes high briefly Figure 6. PENIRQPEdetails while before touch data are sent via I2C reading data

754 µs

PENIRQ (2 V/div) PENIRQ (2 V/div) 1 1

SCL (2 V/div) 92 ns

SCL (2 V/div)

3 3

SDA (2 V/div)

4 4 SDA (2 V/div)

Time Base (100 µs/div) Time Base (50 ns/div)

8

High-Performance Analog Products www.ti.com/aaj 2Q 2008 Analog Applications Journal Texas Instruments Incorporated Data Acquisition

———– Figure 7. Disable PENIRQPEwhen TSC X touch driver on (driver current in orange)

TSC Device PENIRQ

V VDD DD

RIRQ Q5 Off Q6 B Pen Touch Control On Logic

Q2 Q1 X+ On

Y+ Off X– GND

Y– Q3 Touch On High when the Screen Q4 X+ or Y+ Off driver is on

GND

———— When a TSC driver is on (that is, the X driver is on), Such glitches at PENIRQ may become wider or narrower VDD is added on the X+ and X– of the touch panel, and while the touch is moving at different locations. Neverthe- the driving current flows from X+ to X–. Therefore, to less, they occur very briefly and quickly (usually in nano- ———— ———— eliminate the ADC error caused by the internal PENIRQ seconds), and should not affect the PENIRQ function. ———— circuit, the advanced PENIRQ detect circuit (see Figure 4) automatically turns off Q1 and turns on Q2. This means Power-up default state ———— ———— PENIRQ is disabled whenever the TSC X or Y driver is on, To ensure that the TSC2003 PENIRQ is enabled after device power-up, the host may send a dummy read command to and the analog-to-digital converter is sampling the X data, ———— as shown in Figure 7. the TSC to enable the PENIRQ; that is, the command sets ———— When a touch driver is on, the PENIRQ is disabled with the PD0 bit in the command byte to zero, or PD0 = 0. ———— ———— Q1 off and Q2 on; there is no PENIRQ current that runs to The TSC2007 PENIRQ default state after device power- the panel, and point B is connected to ground through Q2, up is automatically enabled. Thus, it is not necessary to ———— as shown in Figure 7. The PENIRQ then remains low. implement any specific software command or initialization After finishing the touch-data acquisition process and process with the TSC2007. turning off the touch driver (that is, Q3 and Q6 change ———— Conclusion from on to off), the TSC should again enable the PENIRQ Understanding the function and operating principles of by turning Q2 off and turning Q1 on. By the nature of ———— the pen-interrupt function, or PENIRQ, can users to material differences, there is a certain transient time when quickly understand the TSC200x states, and therefore either Q1 or Q2 changes from on to off (or from off to on). properly use the device and debug the system when need- This means there is a deviation or timing difference ———— . This article provides details on PENIRQ operation and between Q1 and Q2 on the respective transient times. If behavior for the TSC2003 and TSC2007 devices. With Q2 has been turned off but Q1 has not yet been turned on ———— information about how to the sensitive PENIRQ completely, point B may neither be connected to X+ reliable, users can select the proper touch panel and (through Q1) nor to ground (through Q2). Therefore, ———— TSC device for their specific applications. point B is pulled high by RIRQ, during time PENIRQ jumps high as shown in Figure 5 and Figure 6.

9

Analog Applications Journal 2Q 2008 www.ti.com/aaj High-Performance Analog Products Data Acquisition Texas Instruments Incorporated

—–– —– Table 2. PENIRQ differences between TSC2003 and TSC2007 TSC2003 PENIRQ TSC2007 PENIRQ

Internal PENIRQ Pull-up RIRQ RIRQ =10kΩ RIRQ =51kΩ or 90 kΩ, programmable Power-up Default PENIRQ State Recommended: Issue a software PENIRQ is automatically enabled after command to ensure that PENIRQ is device power-up. enabled.

———— The PENIRQ circuit shown in Figure 4 detects touch on References ———— the panel when enabled, and the PENIRQ signal reflects For more information related to this article, you can down- whether the voltage at point B is greater or less than the load an Acrobat Reader at www-s.ti.com/sc/techlit/ gate threshold, thereby indicating the pen status. litnumber and replace “litnumber” with the TI Lit. # for ———— Without the control of the host software, PENIRQ is the materials listed below. always high when there is no touch and low when touched. With the host sends commands to read touch data, a TSC Document Title TI Lit. # touch driver turns on to convert the touch data or turns 1. “TSC2003 I2C Touch Screen Controller,” off when the data conversion process completes. data sheet ...... sbas162 ———— Therefore, the PENIRQ function must be disabled while 2. “TSC2007 1.2V to 3.6V, 12-Bit, Nanopower, the touch driver is on and enabled after the touch driver is 4-Wire Micro Touch Screen Controller with I2C™ off. As a result of the switch on/off transient timing, there Interface,” Datasheet ...... sbas405 ———— may also be short glitches on the PENIRQ signal. 3. Fang, . (July, 2007), “Migrating from TSC2003 ———— Note the slight differences between the PENIRQ on the to TSC2007,” Application report ...... slaa364 TSC2003 and the TSC2007, as summarized in Table 2. 4. Osgood, S., CK Ong, and R. Downs (April, 2000), “Touch Screen Controller Tips,” Application Report ...... sbaa036 Related Web sites dataconverter.ti.com

10

High-Performance Analog Products www.ti.com/aaj 2Q 2008 Analog Applications Journal IMPORTANT NOTICE TI Worldwide Technical Support Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, Internet improvements, and other changes to its products and services at TI Semiconductor Product Information Center Home Page any time and to discontinue any product or service without notice. support.ti.com Customers should obtain the latest relevant information before TI Semiconductor KnowledgeBase Home Page placing orders and should verify that such information is current support.ti.com/sc/knowledgebase and complete. All products are sold subject to TI's terms and conditions of sale supplied at the time of order acknowledgment. Product Information Centers Americas TI warrants performance of its hardware products to the Phone +1(972) 644-5580 Fax +1(972) 927-6377 specifications applicable at the time of sale in accordance with TI's Internet/Email support.ti.com/sc/pic/americas.htm standard warranty. Testing and other quality control techniques are Europe, Middle East, and Africa used to the extent TI deems necessary to support this warranty. Phone Except where mandated by government requirements, testing of European Free Call 00800-ASK-TEXAS all parameters of each product is not necessarily performed. (00800 275 83927) TI assumes no liability for applications assistance or customer International +49 (0) 8161 80 2121 product design. Customers are responsible for their products and Russian Support +7 (4) 95 98 10 701 applications using TI components. To minimize the risks Note: The European Free Call (Toll Free) number is not active in all countries. If you have associated with customer products and applications, customers technical difficulty calling the free call number, please use the international number above. should provide adequate design and operating safeguards. Fax +(49) (0) 8161 80 2045 TI does not warrant or represent that any license, either express or Internet support.ti.com/sc/pic/euro.htm implied, is granted under any TI patent right, copyright, mask work Japan right, or other TI intellectual property right relating to any Fax combination, machine, or process in which TI products or services International +81-3-3344-5317 Domestic 0120-81-0036 are used. Information published by TI regarding third-party Internet/Email products or services does not constitute a license from TI to use International support.ti.com/sc/pic/japan.htm such products or services or a warranty or endorsement thereof. Domestic www.tij.co.jp/pic Use of such information may require a license from a third party Asia under the patents or other intellectual property of the third party, or a Phone license from TI under the patents or other intellectual property of TI. International +886-2-23786800 Domestic Toll-Free Number Toll-Free Number Reproduction of information in TI data books or data sheets is Australia 1-800-999-084 Malaysia 1-800-80-3973 permissible only if reproduction is without alteration and is China 800-820-8682 New Zealand 0800-446-934 accompanied by all associated warranties, conditions, limitations, Hong Kong 800-96-5941 Philippines 1-800-765-7404 and notices. Reproduction of this information with alteration is an India +91-80-41381665 (Toll) Singapore 800-886-1028 unfair and deceptive business practice. TI is not responsible or Indonesia 001-803-8861-1006 Taiwan 0800-006800 liable for such altered documentation. Korea 080-551-2804 Thailand 001-800-886-0010 Fax +886-2-2378-6808 Email [email protected] Resale of TI products or services with statements different from or Internet support.ti.com/sc/pic/asia.htm [email protected] beyond the parameters stated by TI for that product or service C010208 voids all express and any implied warranties for the associated TI Safe Harbor Statement: This publication may contain forward- product or service and is an unfair and deceptive business looking statements that involve a number of risks and practice. TI is not responsible or liable for any such statements. uncertainties. These “forward-looking statements” are intended Following are URLs where you can obtain information on other to qualify for the safe harbor from liability established by the Texas Instruments products and application solutions: Private Securities Litigation Reform Act of 1995. These forward- looking statements generally can be identified by phrases such Products as TI or its management “believes,” “expects,” “anticipates,” Amplifiers amplifier.ti.com “foresees,” “forecasts,” “estimates” or other words or phrases Data Converters dataconverter.ti.com of similar import. Similarly, such statements herein that describe DSP dsp.ti.com the company's products, business strategy, outlook, objectives, Interface interface.ti.com plans, intentions or goals also are forward-looking statements. All such forward-looking statements are subject to certain risks Logic logic.ti.com and uncertainties that could cause actual results to differ Power Management power.ti.com materially from those in forward-looking statements. Please Microcontrollers microcontroller.ti.com refer to TI's most recent Form 10-K for more information on the risks and uncertainties that could materially affect future results Applications of operations. We disclaim any intention or obligation to update Audio www.ti.com/audio any forward-looking statements as a result of developments Automotive www.ti.com/automotive occurring after the date of this publication. Broadband www.ti.com/broadband Trademarks: All trademarks are the property of their respective Digital control www.ti.com/digitalcontrol owners. Military www.ti.com/military Optical Networking www.ti.com/opticalnetwork Mailing Address: Texas Instruments Post Office Box 655303 Security www.ti.com/security Dallas, Texas 75265 Telephony www.ti.com/telephony Video & Imaging www.ti.com/video © 2008 Texas Instruments Incorporated Wireless www.ti.com/wireless SLYT292