December 2010 Doc ID 18161 Rev 1 1/35
AN3301
Application note
S-Touch
®
STMPE812A: a hardware and software guide
Introduction
The STMPE812A is a 4-wire resistive touchscreen controller with an integrated 4-bit port
expander. The touchscreen controller is designed to be fully autonomous, requiring only
minimal CPU intervention for sampling, filtering and preprocessing operations.
The purpose of this document is to highlight the guidelines and information complementary
to the datasheet that is necessary for a proper operation of the STMPE812A device in
applications.
The first part of the document highlights information on the hardware. This includes external
components/connectivity, power, PCB design and etc.
The second part of the document focuses on information in software in which programming
reference codes are shown. This part is to be used in conjunction with the STMPE812A
software library available in www.st.com.
www.st.com
Contents AN3301
2/35 Doc ID 18161 Rev 1
Contents
1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 Typical application circuit and external components . . . . . . . . . . . . . . . . . 5
1.2 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 Power sequence (fail safe) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Power modes transition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Touchscreen tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.1 Track resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5 Noise prevention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Noise filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.7 PWM controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.8 ADC controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.9 GPIO output configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.9.1 Push-pull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.9.2 Open drain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1 Touchscreen controller acquisition modes . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.1 Data acquisition by internal timer (ACQ_mode “00”) . . . . . . . . . . . . . . . 13
2.1.2 Data acquisition by ACQ command (ACQ_mode “01”) . . . . . . . . . . . . . 14
2.1.3 Data acquisition by host read control (ACQ_mode “10”) . . . . . . . . . . . . 14
2.2 Embedded data valid bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 Pen down interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 TSC_DATA read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.5 Touchscreen controller sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Programming guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.6.1 Touchscreen initialization and interrupt handling (pen down mode) . . . 19
2.6.2 Touchscreen initialization and interrupt handling (normal interrupt mode)
23
2.6.3 GPIO initialization and interrupt handling . . . . . . . . . . . . . . . . . . . . . . . 28
2.6.4 ADC initialization and interrupt handling . . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.5 PWM initialization and interrupt handling . . . . . . . . . . . . . . . . . . . . . . . 32
3 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
AN3301 List of figures
Doc ID 18161 Rev 1 3/35
List of figures
Figure 1. Typical application schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 2. Track resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 3. Noise prevention. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 4. PWM LED driving configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 5. GPIO push-pull configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 6. GPIO open drain configuration (output low) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 7. GPIO open drain configuration (output high) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 8. Data acquisition by internal timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 9. Data acquisition by ACQ command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 10. Data acquisition by host read command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 11. TSC data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 12. Touchscreen controller sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

STMPE812ABJR

Mfr. #:
Manufacturer:
STMicroelectronics
Description:
Touch Screen Controllers Touchscreen cntrlr S-Touch
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet