ST STMPE2401 User manual

March 2007 Rev 2 1/22
UM0300
User manual
Port expander STMPE2401 demonstration board
Introduction
This Document explains the functioning of the port expander demo board consists of the
port expander IC STMPE2401 and controller ST72F63B microcontroller as I2C master
along with a PC GUI.
The objective of this demonstration board is to display to the user the features and
capabilities of the port expander chip (STMPE2401) using a Windows-based host software
application and one of several USB low-speed microcontrollers (ST72F63B) from ST acting
as a control device.
The host software and the ST7 source code provide a user friendly environment to use
demo board in following modes:
●Standalone mode
●PC GUI mode
In both modes, power to board can be provided from either USB bus itself or from external
power.
In this demo board, the ST72F63B Microcontroller acts as the I2C master and controls two
STMPE2401 devices functioning as I2C Slaves. The STMPE2401 devices are used to
interface LCD, normal keypad, rotator controller, dedicated keys and 6 PWM outputs. All
these interfaces are controlled by just using I2C communication between master and slave
devices.
all events like dedicated key press (four direction keys); keypad key press (4 x 4 keypad),
Rotator direction, power mode etc. are captured and displayed in LCD screen and in the
scan window of PC GUI. For visual display of the PWM output LEDs are provided on the
board. The capability of rotator controller has been demonstrated by mechanically
implementing the rotator configuration using switches.
For interfacing with the PC GUI, the application layer is built above the USB core library that
makes all the hardware control of the USB interface transparent for the developers.
The PC GUI supports various power saving modes of port expander and wake up feature to
get back to default operational mode.
In addition the board has the provision for an alternate I2C path for external control.
Also the board has ICC connector to re-program the ST7 Microcontroller flash memory.
www.st.com

Contents UM0300
2/22
Contents
1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Package contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Software installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Hardware installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.1 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.2 Jumper settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Running the STMPE2401 port expander demo board . . . . . . . . . . . . . . 9
2.1 Running in standalone mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 PWM Output demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.2 Keypad demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.3 Dedicated keypad demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.4 Rotator demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Running in PC GUI mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.1 Read/Scan mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2 Write/program mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.3 Reading internal memory of STMPE2401: . . . . . . . . . . . . . . . . . . . . . . 15
2.2.4 Programming PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.5 Power down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 Using the external I2C master: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

UM0300 List of figures
3/22
List of figures
Figure 1. Installation window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 2. License window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 3. Destination folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 4. Installation ongoing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. Installation complete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 6. Port expander demo board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 7. JP1 and JP2 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 8. JP3 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 9. JP4 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 10. Embedded 4x4 keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 11. Dedicated keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 12. Rotator interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 13. Enumeration result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 14. STMPE2401 PC GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 15. Message for board not connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 16. Message for board connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 17. Read/Scan mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 18. Events in scan window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 19. Write/program mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 20. Reading internal memory of STMPE2401 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 21. Programming STMPE2401 PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 22. Entering in hibernate mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 23. Wake-up from hibernate mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 24. External I2C connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Getting started UM0300
4/22
1 Getting started
1.1 System requirements
In order to use the port expander demonstration board with the Windows operating system,
a recent version of Windows, such as Windows 2000 or Windows XP must be installed on
the PC.
The version of the Windows OS installed on your PC may be determined by clicking on the
"System" icon in the control panel.
1.2 Package contents
The port expander demo board includes the following items:
●Hardware content:
– One demonstration board.
●Software content:
– PC executable software (PE_2401_GUI) to be used along with demo board
●Documentation:
–Usermanual
1.3 Software installation
To install the PC GUI software, follow the step as mentioned below:
●Step1: As soon as the user clicks the portexpander.exe Icon, the following window
appears.
Figure 1. Installation window

UM0300 Getting started
5/22
●Step 2: Read the license file and click the "Yes" button if you accept the license.
Figure 2. License window
●Step 3: Please select the folder in which, you want to install the software. By default it
will install the software in the following path- C:\Program
Files\STMicroelectronics\PortExpanderSTMPE2401
Figure 3. Destination folder

Getting started UM0300
6/22
●Step 4: After you select the folder and click the next button, it will start installing the
software.
Figure 4. Installation ongoing
●Step 5:
Figure 5. Installation complete
After you click the "Finish Button", you will find that the software is installed in the directory
you selected or in the default directory. Also you will find the shortcut of this software also
available in you START menu. This user manual is also available in the same directory.

UM0300 Getting started
7/22
1.4 Hardware installation
Figure 6 below shows the snapshot of the demonstration board.
Figure 6. Port expander demo board
1.4.1 Power supply
The demo board can directly be powered by the USB Connector (Bus powered).
Or you can use an external power supply. The external power supply should be getting
minimum supply of 7 V, 1 A and maximum power supply of 12 V, 1 A.
1.4.2 Jumper settings
There are four jumpers (JP1, JP2, JP3, and JP4) are available on the board. The correct
connections of these connectors are necessary for the proper functioning of the demo
board.
●JP1 and JP2: JP1 and JP2 are the connectors which are used to select between the
I2C lines and ICC lines (for programming the ST7 microcontroller) as shown in the
Figure 7 below.
Figure 7. JP1 and JP2 Settings

Getting started UM0300
8/22
These Jumpers allow the selection between ICC or I2C data lines. While we do the
programming the ST7 microcontroller, the jumpers must be connected on ICC side (right
side) and when the board is used for demonstration, the jumpers must be connected on the
I2C side (left side).
●JP3: As shown in the Figure 8 below, JP3 is used to select the clock source for the ST7
microcontroller.
Figure 8. JP3 Settings
The default connection of this jumper is EXT side (Left Side) that is clock source external
crystal resonator and when the board is used for demonstration. You need to connect to ICC
side (Right Side) only if it is must to provide the ICC clock to the microcontroller during the
re-programming microcontroller.
●JP4: As shown in the Figure 9 below, JP4 is used for choosing power supply to be used
for USB supply or the external board supply.
Figure 9. JP4 Settings
Connect the jumper to the Left side, whenever you want to use external power supply and to
Right side (USB side), whenever you want to use USB supply. There is no restriction as
such on using any of the power supply. You can use external power supply when you want to
use the demo board in the stand-alone mode and USB power supply while you are using the
PC GUI or in stand alone mode.
Even while providing the power to the demo from external source, you can use the PC GUI
but for that you need to provide USB connectivity using USB connector.

UM0300 Running the STMPE2401 port expander demo board
9/22
2 Running the STMPE2401 port expander demo board
This Port Expander demo board consists of two main parts:
●PC GUI
●Demonstration board.
Again in Stand alone mode, the demonstration board can be used without PC GUI.
Before using the demo board in either standalone or PC GUI mode, we need to do following
jumper settings-
●Connect JP1 and JP2 to the I2C side (Left Side).
●Connect JP3 to the Left side to use external crystal oscillator
●Connect JP4 to the power supply you want to use.
2.1 Running in standalone mode
With in a few seconds after you plug in the power supply, a welcome message should come
on LCD and this means that the demo has started correctly.
After that you will see a series of messages coming on the LCD screen. At the end, you will
see a blank LCD screen and you will see all the LEDs blinking. These LEDs are the output
of the 6 PWM outputs coming from 2 STMPE2401 devices. Now the system is ready to be
used.
Again if you find that no message is coming on the LCD after giving the power supply.
Remove the power supply and plugged in again and then observe. You should now see the
message coming on the LCD. If this does not happen even after removing and plugged in
the power supply several times, you need to contact technical support.
2.1.1 PWM Output demo
You can observe the PWM out on the CRO by connecting the probe at the corresponding
LED output (there are 6 LED available in the demo board corresponding to each PWM). In
stand-alone mode the PWM output are pre-programmed and can not be changed.
2.1.2 Keypad demo
As mentioned in the Figure 10, there is a 4 x 4 normal keypad available on the demo board.
You can observe the key press event on the 16x2 LCD interface. You can observe at most 2
simultaneous key press events. For a case when you press more than 2 keys
simultaneously only first 2 keys press will be detected. All key press events are displayed in
LCD screen.

Running the STMPE2401 port expander demo board UM0300
10/22
Figure 10. Embedded 4x4 keypad
2.1.3 Dedicated keypad demo
Similar to normal Key press, there are 4 dedicated keys available on the demo board as
shown in Figure 11. In comparison to normal keypad where you can detect only 2 keys
simultaneously, here you can observe 4 dedicated keys simultaneously. All dedicated key
press events are displayed in LCD screen.
Figure 11. Dedicated keys
2.1.4 Rotator demo
The interface of Rotator is implemented in multiplexed manner with the keypad. That is
either you will observe any key press event on the LCD or the Rotator event. The rotator is
implemented using three switches as shown in Figure 12.

UM0300 Running the STMPE2401 port expander demo board
11/22
Figure 12. Rotator interface
To use rotator, you have to press the 2 keys simultaneously and follow the instruction as
mentioned in the datasheet. For the first 2 events you will not see any reaction but from then
onwards you will the status on the LCD.
2.2 Running in PC GUI mode
In GUI mode, in addition to the functionalities mentioned in the above section, PC GUI is
also available. For running the GUI, the demo board must first be connected to the PC with
the USB cable and then provide the power supply to the demo.
As a result, you should find the demo board enumerated as a HID device as shown
Figure 13, and then board will be ready to use, if this message does not come contact the
technical support.
Figure 13. Enumeration result
By starting the STMPE2401 PC GUI on the PC, you will see a graphical interface
(Figure 14) for controlling the demonstration board. This PC software is used to issue
various commands and to control data transfer between the PC and the ST7 peripheral.

Running the STMPE2401 port expander demo board UM0300
12/22
Figure 14. STMPE2401 PC GUI
Again as you can see in the Figure 14, you can check whether the board is connected to the
board or not by clicking the connection check button. If the board is not connected then you
will see the following message.
Figure 15. Message for board not connect
And if board is connected then following message will appear.
Figure 16. Message for board connect
Once this is done, the PC GUI is properly connected to the demo board and ready to be
used.

UM0300 Running the STMPE2401 port expander demo board
13/22
Now there are two modes operation in which GUI operates:
●Read/Scan mode
●Write/Program mode
In addition to these two modes, there are 2 power-down options available in the GUI to put
STMPE2401 in power down modes. Again there is a RESET option available which can put
the demo back in default settings.
2.2.1 Read/Scan mode
You can enter in to the Read/Scan mode by clicking the Read/Scan button as highlighted in
the Figure 17.
Figure 17. Read/Scan mode
In Read/Scan mode, the key press, dedicated key press and rotator events are visible as
blinking LEDs available on the GUI. These events are recorded in the scan window which
allows observing past activity as shown in Figure 18.

UM0300 Running the STMPE2401 port expander demo board
15/22
Once we click the Write/Program Button, The Write mode become active if previously
scanning is being done that will be stopped.
The write mode provides the feature of the reading the internal memory of the either slaves
or to program the any PWM output.
2.2.3 Reading internal memory of STMPE2401:
We can read the internal memory of particular STMPE2401 slave device by selecting that in
"Memory Read" section from the pop menu as shown in the Figure 20. Then we can read
the memory by writing the 8 bit address in the "Address" and then clicking "Read". The
return data is in HEX format.
Figure 20. Reading internal memory of STMPE2401
2.2.4 Programming PWM
Any of the 6 PWM outputs coming from 2 STMPE2401 slave devices can be programmed.
In the "Write mode" section as shown in Figure 21 select the PWM to be programmed from
the pop up menu, and then load the correct PWM file (*.pex) by clicking the "Open" button.
Then click the "Program" button to program the particular PWM. If the PWM file is correctly
programmed, the correct PWM signal can be observed on the CRO by connecting the CRO
probe at the programmed LED output. Any error, (for example a PWM programmed with a
faulty program) causes the particular PWM LED to stop blinking.

Running the STMPE2401 port expander demo board UM0300
16/22
Figure 21. Programming STMPE2401 PWM
Again if you click the "RESET" button then demo will be put in the default settings and all the
PWM will start running with the default program loaded in to their memory.
2.2.5 Power down mode
There are 2 power-down modes as mentioned below:
●Hibernate mode
●Sleep mode
The STMPE2401 slave devices can be put in to Hibernate mode or sleep mode by clicking
corresponding button available on the GUI. For e.g. as shown in the Figure 22, if we click
"Hibernate" button the device will be STMPE2401 device will be put in the hibernate mode.

UM0300 Running the STMPE2401 port expander demo board
17/22
Figure 22. Entering in hibernate mode
A “sleep” mode is also available. A corresponding message appears on the LCD screen as
well.
In Hibernate mode, as the clock to PWM is stopped, output LEDs stop blinking. While in
sleep mode, PWM keeps running as these are controlled by the 32 KHz clock. In order to
wake up the demo in low power mode, click the "Wake Up" button. A message in the Scan
Window appears as soon as the demo comes out of the power down mode as shown in
Figure 23 .You can also wake up the demo from the sleep mode by clicking any normal key
or dedicated key available on the demo board.
Figure 23. Wake-up from hibernate mode

Using the external I2C master: UM0300
18/22
3 Using the external I2C master:
We can also use an external I2C Master by using pins available on J1 connector as shown in
the Figure 24, below:
Figure 24. External I2C connector
To control the STMPE2401 devices using the external masters, do the following steps:
1. Set the demo board to run mode as explained earlier.
2. Remove the I2C connections from jumper JP1 and JP2. This is required to avoid any
conflict due to I2C operations done by the demo itself.
3. Connect the SCL and SDA lines available in jumper J1.
4. For controlling the Interrupt line, use PA4 for INT1 (Slave1 interrupt line) and use PA5
for INT2 (Slave 2 interrupt line),
5. After you have done the required operations, remove all the connections as mentioned
in steps 2, 3 and 4. Now connect the make the I2C connections Jumper JP1 and JP2
again.
6. Reconnect the RESET button on the demo board to put demo back in action.
In this mode, PC GUI will not be available for the external user to use. Again you have to use
the slave address as specified in the demo which is 0 x 84 for Slave1 and 0x86 for Slave2.
Again this I2C lines are working at 5 V power supply so external I2C Master should use 5 V
power supply.

UM0300 Application diagram
19/22
Appendix A Application diagram
Table 1. Bill of materials
Index Qty Reference Value / generic
part number Package Manufact
urer
Manufacturer’s
ordering code /
orderable part
number
Supplier
Supplier’s
ordering
code
1 2 C1, C2 33 pF 0805 Any
213
C6, C7, C8, C9, C10,
C11, C12, C13, C14,
C15, C16, C21, C22
100 nF 0805 Any
3 4 C17, C18, C19, C20 10PF 0805 Any
4 1 C23 100 µF/10 RB-5.5 Any
5 1 C3 4.7 µF/25 RB-5.5 Any
6 2 C4, C5 1µF/10 RB-5.5 Any
7 1 CON1 USB-B-TYPE USB-B Any
8 1 CON2 HEADER 5X2 IDC-10B Any
9 1 J1 HEADER 4 SIP4 Any

Application diagram UM0300
20/22
10 8 J5, J6, J7, J8, J9, J10,
J11, J12 CON9 SIP9 Any
11 1 J2 CON3 POWER Any
12 1 J3 JHD162A LCD Any
13 1 J4 CON2 SIP2 Any
14 4 JP1, JP2, JP3, JP4 CON3 SIP3 Any
15 3 LD7, PWM1, PWM4 RED LED LED-3 mm Any
16 2 PWM2, PWM5 GREEN LED LED-3 mm Any
17 2 PWM3, PWM6 YELLOW LED LED-3 mm Any
18 8 Q1, Q2, Q3, Q4, Q5,
Q6, Q7, Q8 2STR1215 SOT-23 ST 2STR1215
19 1 R1 1K5 0805 Any
20 6 R6, R7, R9, R10, R13,
R16 220E 0805 Any
21 9
R5, R8, R11, R12,
R14, R15, R44, R45,
R46
1 k 0805 Any
22 R17, R26 100E 0805 Any
23 6 R18, R19, R20, R21,
R22, R23 5k1 0805 Any
24 6 R24, R25, R40, R41,
R42, R43 2k2 0805 Any
25 5 R27, R28, R29, R30,
R31 10 k 0805 Any
26 3 R2, R3, R4 4k7 0805 Any
27 4 R32, R33, R34, R35 18 k 0805 Any
28 4 R36, R37, R38, R39, 3k3 0805 Any
29 1 U1 ST72F63BK4B1 SDIP-32 ST ST72F63BK4B1
30 2 U2, U3 STMPE2401 TFBGA36 ST STMPE2401TBR
31 2 U4, U5 ST2378ETTR TSSOP20 ST ST2378ETTR
32 1 U6 LF18ABDT DPAK ST LF18ABDT
33 1 U7 L7805CV TO-220 ST L7805CV
34 2 Y1, Y2 32.768 KHz CRYS Any
35 1 Y3 12 MHz XTAL-3 Any
36 24
0, 1, 2, 3, 4, 5, 6, 7, 8,
9, A, B, C, D, E, F,
ROT_A, ROT_B,
ROT_C, S1, S2, S3,
S4, S5
SWITCH Push Button Any
Table 1. Bill of materials (continued)
Index Qty Reference Value / generic
part number Package Manufact
urer
Manufacturer’s
ordering code /
orderable part
number
Supplier
Supplier’s
ordering
code
Table of contents
Other ST Computer Hardware manuals

ST
ST X-NUCLEO-LED61A1 User manual

ST
ST ST25DV-DISCOVERY User manual

ST
ST EVLONE65W User manual

ST
ST FP-LIT-BLEMESH1 User manual

ST
ST X-LINUX-NFC5 User manual

ST
ST STM32Cube User manual

ST
ST STDES-PFCBIDIR User manual

ST
ST L6470H User manual

ST
ST STM8SVLDISCOVERY Installation and operating instructions

ST
ST X-NUCLEO-AMICAM1 User manual

ST
ST STM32Cube Quick setup guide

ST
ST X-NUCLEO-NFC03A1 Parts list manual

ST
ST STM32Cube User manual

ST
ST X-NUCLEO-OUT19A1 User manual

ST
ST X-NUCLEO-IDB04A1 User manual

ST
ST STLINK-V3PWR User manual

ST
ST STEVAL-IFP042V1 User manual

ST
ST STEVAL-C34KAT1 User manual

ST
ST ST8034T User manual

ST
ST STM32Cube User manual