AN2591 Application note

pleasanthopebrothersElectronics - Devices

Nov 2, 2013 (3 years and 11 months ago)

90 views

Contents AN2591
2/19
Contents
1 Expanding the number of outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Using a decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Expanding the number of outputs to 8 lines . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Expanding the number of outputs to 16 lines . . . . . . . . . . . . . . . . . . . . . 3
1.2 Using a shift register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.1 Expanding the number of outputs to 8 lines . . . . . . . . . . . . . . . . . . . . . . 4
1.2.2 Expanding the number of outputs to 16 lines . . . . . . . . . . . . . . . . . . . . . 5
2 Expanding the number of inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Using a multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Expanding the number of inputs to 8 lines . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Expanding the number of inputs to 16 lines . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Using shift registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Expanding the number of inputs to 8 lines . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2 Expanding the number of inputs to 16 lines . . . . . . . . . . . . . . . . . . . . . . 10
3 Using a STMPE801 (I²C bus) 8-bit I/O port expander . . . . . . . . . . . . . . 11
3.1 Expanding the number of inputs/outputs to 8 lines . . . . . . . . . . . . . . . . . 11
3.2 Expanding the number of I/Os to 16 lines . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Using the External Memory Interface for I/O expansion . . . . . . . . . . . 14
4.1 Expanding the number of inputs and/or outputs to 8 lines . . . . . . . . . . . . 14
4.2 Expanding the number of inputs and/or outputs to 16 lines . . . . . . . . . . . 16
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
AN2591 Using a STMPE801 (I²C bus) 8-bit I/O port expander
13/19
Figure 10.16-channel expander
STR710
SDA
STMPE801MTR
SCL
XTI0
GPIO0
GPIO1
GPIO2
GPIO3
GPIO4
GPIO5
GPIO6
GPIO7
VCC
VIO
3.3v
GND
INT
SCLK
SDAT
GPIOX.Y
RESET
ADDR0
4.7K 4.7K
R1 R2
STMPE801MTR
GPIO0
GPIO1
GPIO2
GPIO3
GPIO4
GPIO5
GPIO6
GPIO7
VCC
VIO
GND
INT
SCLK
SDAT
RESET
ADDR0
3.3V
XTI1
16 inputs/
outputs
3
5
4
6
7
8
9
10
16
1
15
13
11
12
14
2
3
5
4
6
7
8
9
10
16
1
14
15
13
11
12
2
(I2C device address=0x82)
(I2C device address=0x88)
If needed
If needed
AN2591 Using the External Memory Interface for I/O expansion
15/19
0x6C00000C), the bank0 address range will be 0x60000000 to 0x60FFFFFF. So the register
and the buffer addresses must be included in this range for example:
Register address: 0x60000001.
Buffer address: 0x60000002.
Note:You can use the same address for the register and the buffer.
The bank used for the buffer and the register is reserved only for these devices and does not
use any memory or other device in this bank.
EMI configuration:

Configure the EMI effective external bus size as 8-bit data bus wide to read from the
external 8-bit buffer and to write in the external 8-bit register.

Configure the number of wait states to obtain a WRL pulse width delay greater than
15ns (15ns is the greatest propagation time value of the latch, buffer, NOR and AND
gates. Refer to the 74LCX573, 74LCX244, 74V1G02 and 74V1G08 datasheets).
Note:The WRL and RD pulse widths must be greater than the propagation delay of the circuit
which has the highest propagation delay (in this case 74V1G08, refer to its datasheet). So
you must configure the corresponding number of wait states to write to the register and to
read from the buffer properly.
Example of software that gets the value of the 8-bit buffer inputs and writes it in the 8-bit
latch outputs. The two devices are available in bank0 (CSn.x = CSn.0):
int main(void)
{
u8 a;
u8 *Buffer_Data8_in = (u8*)0x60000002; /* Initialize the buffer
address to 0x60000002 */
u8 *Latch_Data8_out = (u8*)0x60000001; /* Initialize the latch
address to 0x60000001 */
*(u8*)0x6C000000 = 0x8004; /* Configure EMI_BCON0 register:
- 8 bit data bus wide
- 1 wait state
- Enable bank 0 */
while(1)
{
a = *Buffer_Data8_in; /* Get the value available on inputs of
the external buffer */
*Latch_Data8_out = a; /* Write this value in the external
latch */
}
}
AN2591 Using the External Memory Interface for I/O expansion
17/19
Example of software that gets the value on the 16-bit buffer inputs and writes it in the 16-bit
latch outputs. The two devices are available in bank0 (CSn.x = CSn.0):
int main(void)
{
u16 a;
u16 *Buffer_Data16_in = (u16*)0x60000002; /* Initialize the buffer
address to 0x60000002 */
u16 *Latch_Data16_out = (u16*)0x60000001; /* Initialize the latch
address to 0x60000001 */
*(u16*)0x6C000000 = 0x8005; /* Configure EMI_BCON0 register:
- 16 bit data bus wide
- 1 wait state
- Enable bank 0 */
while(1)
{
a = *Buffer_Data16_in; /* Get the value available on inputs
of the external buffer */
*Latch_Data16_out = a; /* Write this value in the external
latch */
}
}
Revision history AN2591
18/19
5 Revision history

Table 1.Document revision history
Date Revision Changes
06-Aug-2007
1
Initial release.
AN2591
19/19

Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2007 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan -
Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com