november 2010 doc id 18113 rev 1 1/13 AN3299 application note a hardware and software guide for the stmpe801 8-bit port expander xpander logic? introduction the stmpe801 is a gpio (general purpose input/output) port expander able to interface a main digital asic via the two-line bidirectional bus (i 2 c). it offers flexib ility as each i/o is configurable as input, output. this device has been designed with very low quiescent current, and includes a wake up feature for each i/o, to optimize the power consumption of the ic. this document highlights the guidelines and information complementary to the stmpe801; 8-bit port expander xpander logic tm , datasheet that is necessary for the successful design of stmpe801 in applications. please also refer to the an2421; using stmpe801 as keypad controller , application note for implementation of a matrix keypad controller with the stmpe801. the first part of the document highlights information on the hardware including external components/connectivity, power, etc. the second part of the document focuses on information regarding the software, in which programming sample codes are shown. www.st.com
contents AN3299 2/13 doc id 18113 rev 1 contents 1 hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1 external components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.1 typical application circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.2 reset pin recommendation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1.3 int pin recommendation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2 power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2.1 power sequence (fail safe) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 gpio output configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3.1 push-pull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.2 open drain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4 unused input pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5 suspend mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1 i2c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.1 i2c initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.2 i2c address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.3 i2c address update/reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 programming guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.1 initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.2 interrupt handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 hotkey de-bounce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
AN3299 list of figures doc id 18113 rev 1 3/13 list of figures figure 1. typical application schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 figure 2. rstb connectivity recommendation 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 3. rstb connectivity recommendation 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 4. rstb connectivity recommendation 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 figure 5. gpio push-pull configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 6. gpio open drain configuration (output low) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 7. gpio open drain configuration (output high) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 8. typical programming flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
hardware AN3299 4/13 doc id 18113 rev 1 1 hardware 1.1 external components 1.1.1 typical app lication circuit figure 1. typical application schematic note: recommended connection at reset is based on the use of baseband/cpu gpio as control signal. please refer to section 1.1.2 for other recommended configurations. sclk and sdata pull up must be to vcc. pull up to voltage that is less than or greater than vcc may result in excessive leakage current. in a typical application, the following external components are required: r1: 10 k pull-up resistor at reset r2: 2.2 k -10 k pull-up resistor at int r3: 2.2 k -10 k pull-up resistor at sclk r4: 2.2 k -10 k pull-up resistor at sdata r5: 1 m pull-up/down resistors at address c1: 100 nf capacitor at vcc c2: 100 nf capacitor at vio ! - v 9 , 2 9 & & & |