ST AN3311 User manual

December 2010 Doc ID 18209 Rev 1 1/58
AN3311
Application note
In-home display for ZigBee® smartplug
Introduction
This application note describes the demonstration firmware running on the STM3210C-
EVAL for the STM32F107VC to manage a smartplug network system.
An embedded graphical user interface (GUI) based on the “multi-input embedded GUI
library 2.0 for STM32F10xxx” described in the AN3128 application note, and working on an
LCD TFT 320 x 240 display and 5-position joystick, allows the user to interact with the
smartplug system made up of one coordinator and two smartplugs connected.
Section 1 describes the document and library rules.
Section 2 highlights the features of the ZigBee smartplug and explains its hardware
interface with a device microcontroller (STM32).
Section 3 describes briefly the “multi-input embedded GUI library”.
Section 4 describes the relevant blocks of the STM3210C-EVAL demonstration board.
Section 5 shows the demonstration firmware/board system setup.
Section 6 describes, in detail, how the “in-home display” firmware is structured, its
architecture and its exported APIs.
Section 7 explains how to get started with the system, how to configure and use the IAR
workspace, and contains an example application source code.
Section 8 illustrates how the “in-home display” GUI application works.
Section 9 illustrates the hardware schematics.
www.st.com

Contents AN3311
2/58 Doc ID 18209 Rev 1
Contents
1 Document and library rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1 Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 ZigBee smartplug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Smartplug description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 ZigBee module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Multi-input embedded GUI library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 STM3210C-EVAL demonstration board . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 STM32 peripherals mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Boot option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.5 Clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.6 Reset source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7 Joystick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.8 Pushbuttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.9 Storage memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.10 Development and debug support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.11 Display and input devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.12 JTAG debugging connector CN13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.13 Daughterboard extension connector CN8 and CN9 . . . . . . . . . . . . . . . . . 19
4.14 TFT LCD connector CN14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.15 Power connector CN18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5 Demonstration firmware system setup . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1 Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2 STM3210C-EVAL demonstration board setup . . . . . . . . . . . . . . . . . . . . . 24
5.3 STM3210C-EVAL and ZigBee adapter with M24LR62-r memory . . . . . . 24
5.4 How to navigate the demo menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

AN3311 Contents
Doc ID 18209 Rev 1 3/58
6 In-home display firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.1 Firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.2 main.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2.1 vSmartPlugSamplingTask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2.2 vGraphicLibraryTask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.3 prvApplicationTask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.4 prvSetupHardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.5 vBoardInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7 Getting started with the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.1 Configure IAR tool for building, debugging, and programming the application
31
7.2 Example application - main.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
8 In-home display GUI application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9 Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.1 Smartplug board schematics and layout . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.2 ZigBee/RF adapter for smartplug and dual interface memory . . . . . . . . . 46
9.3 STM3210C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.4 MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
9.5 LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
9.6 I/O expander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.7 I/O peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
9.8 Extension connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
9.9 JTAG and trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.10 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9.11 LCD 3.2" module with SPI and 16-bit interface 1 . . . . . . . . . . . . . . . . . . . 55
10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
11 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

List of tables AN3311
4/58 Doc ID 18209 Rev 1
List of tables
Table 1. List of acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 2. Power related jumpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 3. Boot related switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 4. Reset related jumper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 5. LCD module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 6. JTAG debugging connector CN13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 7. Daughterboard extension connector CN8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 8. Daughterboard extension connector CN9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 9. ZigBee adapter pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 10. Function description format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 11. vSmartPlugSamplingTask task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 12. vGraphicLibraryTask task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 13. prvApplicationTask task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 14. prvSetupHardware function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 15. vBoardInit function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 16. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

AN3311 List of figures
Doc ID 18209 Rev 1 5/58
List of figures
Figure 1. STM3210C-EVAL block scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 2. Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 3. I/O expander hardware configuration on the STM3210C-EVAL . . . . . . . . . . . . . . . . . . . . . 10
Figure 4. STM3210C-EVAL demonstration board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 5. Hardware block diagram - STM32 peripherals mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 6. STM3210C-EVAL demonstration board layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 7. JTAG debugging connector CN13 viewed from above the PCB . . . . . . . . . . . . . . . . . . . . 18
Figure 8. Power supply connector CN18 viewed from the front. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 9. In-home display firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 10. Application project files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 11. IAR embedded workbench main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 12. IAR embedded workbench debugger options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 13. ZigBee dongle connection problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 14. Main menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 15. Searching plugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Figure 16. No plug detected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Figure 17. Plugs detected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Figure 18. Label changing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Figure 19. TRIAC smartplug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Figure 20. Relay smartplug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Figure 21. Smartplug statistics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Figure 22. Energy consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 23. Global energy consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 24. Power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 25. Global power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 26. ZigBee and dual interface EEPROM adapter schematic for STM3210C-EVAL . . . . . . . . . 45
Figure 27. ZigBee and dual interface EEPROM adapter layout for STM3210C-EVAL . . . . . . . . . . . . 46
Figure 28. STM3210C main schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Figure 29. MCU schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Figure 30. LCD schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Figure 31. I/O expander schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Figure 32. I/O peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Figure 33. Extension connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Figure 34. JTAG and trace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Figure 35. Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Figure 36. LCD 3.2" module with SPI and 16-bit interface 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Document and library rules AN3311
6/58 Doc ID 18209 Rev 1
1 Document and library rules
This document uses the conventions described in the sections below.
1.1 Acronyms
Table 1 lists the acronyms used in this document.
Table 1. List of acronyms
Acronym Meaning
API Application programming interface
HAL Hardware abstraction layer
MCU Microcontroller unit
I2C Inter-integrated circuit
SPI Serial to parallel interface
OOP Object oriented programming

AN3311 ZigBee smartplug
Doc ID 18209 Rev 1 7/58
2 ZigBee smartplug
2.1 Smartplug description
The smartplug coordinator is connected via an SPI to the STM3210C-EVAL through an “Ad-
Hoc” adapter.
In Figure 1 it is possible to take a quick look at the STM3210C-EVAL board and a smartplug
node block diagram.
Figure 1. STM3210C-EVAL block scheme
An adapter is connected to the extended connectors CN8 and CN9 on the STM3210C-
EVAL (for more detailed information please refer to the UM0600 user manual), it allows the
connection of a ZigBee smartplug coordinator and the I2C/RF dual interface EEPROM
M24LR64-r. The Gerber files of the adapter board are included in the setup package of this
project.
The ZigBee smartplug board can be used as a guide to build a home/building automation
subsystem for energy management. In a typical application, the board is plugged into an
electrical wall socket and supplies an electrical load, monitoring the energy consumption;
using several smartplugs it is possible to monitor and control the home/building energy
consumption socket by socket. The board includes the following functions, shown in the
block diagram of Figure 2:
●Energy measurement
●Load differential current
●Load driving by relay or TRIAC (dimming)
●ZigBee communication capability.

ZigBee smartplug AN3311
8/58 Doc ID 18209 Rev 1
Figure 2. Block diagram
The STEVAL-IHP001V3 is a smartplug board based on an STM32F10x microcontroller, a
SPZB260 ZigBee module, and an STPM01 energy metering IC.
It implements a ZigBee metering node which allows the final user to monitor and manage
energy consumption.
The board has been developed as a guide to build a home/building automation subsystem
for energy management. In a typical home system implementation, the board is plugged into
an electrical wall socket and supplies a home appliance or other generic electrical load.
The current, power, energy, and other information, related to the electrical load connected to
the smartplug board, can be displayed locally on an LCD screen, and are sent to a ZigBee
data concentrator through the home/building ZigBee network.
2.2 ZigBee module
ZigBee smartplug communication is based on the SPZB260 module with a DIL adapter. The
module is FCC compliant (FCC ID:S9NZB260A). The module is based on the SN260
ZigBee network processor which integrates a 2.4 GHz, IEEE 802.15.4 compliant
transceiver, as well as IEEE 802.15.4 PHY and MAC. The main features are:
●0dBm nominal TX output power
●-92dBm RX sensitivity
●+2dBm TX output power in boost mode
●RX filtering for co-existence with IEEE 802.11g and Bluetooth®devices.
For further details please refer to the SPZB260 module and the SN260 network processor
datasheet.
Note: For more information, see the UM0608 user manual, STEVAL-IHP001V3 schematics
diagram, and AN2993 application note.

AN3311 Multi-input embedded GUI library
Doc ID 18209 Rev 1 9/58
3 Multi-input embedded GUI library
3.1 Description
This solution enables users, comfortable with the use of standard microcontrollers, to create
higher-end “look and feel” human interfaces by replacing conventional electromechanical
switches with touch-sensing controls.
Users can combine touch-sensing functions using multiple configurations (touchscreen,
joystick, and keys) with traditional MCU features (communication, beeper, LCD control, etc.).
The E-multi-input graphic library is part of the application firmware.
The graphic objects are a set of controls that can be printed on the screen and associated to
an action when pressed.
The library has been developed and tested on an LCD panel of QWGA resolution (320x240)
which is the default, but the library is independent of the LCD resolution, although it has not
been tested with others.
The library supports touchscreen features and includes a low level driver which handles the
analog input (for 12-bit ADC), and a function for the touchscreen calibration based on an
algorithm that uses 5 points.
The multi-input embedded GUI firmware library is fully developed in 'ANSI-C' following an
OOP approach. This means that the final application uses instances of page and graphic
objects according to their public methods and properties. In the end, the PageObj is a
structure containing public properties (data fields) and methods (functions pointers). The
OOP encapsulation feature is assured. The library has been developed and tested on the
“STM3210C” STMicroelectronics demonstration board.
The library can be included in the final application as a library file (multi-input embedded
GUI library.a) and used as a black box through its exported public API, or can be included in
the final application as source files (.c and .h), if the user wants to debug the library itself, or
to change the HAL functions in order to port the library on a different LCD (in model and
resolution) from the one attached to STM3210C-EVAL.
For more information on the graphic library see the AN3128, rev. 2, application note.
The calibration process is part of the post-processing layer. The touchscreen must be
calibrated at first power-on and/or upon user request.
Once the calibration is done, final adjustments on future power-on of the board are not
necessary because the calibration parameters are saved on the Flash memory.
The touchscreen and the joystick are controlled by the STMPE811 devices.
The STMPE811 has a simple 2-wire I2C digital serial interface which allows the user to
access the data in the touchscreen controller register at any time. It communicates via the
serial interface with a master controller.
Figure 3 shows how the STM32F10xxx microcontroller (master device) must be connected
to the STMPE811 device.
Refer to the STMPE811 datasheet for more information on the register concerning the data
of the touched points on the touchscreen.

Multi-input embedded GUI library AN3311
10/58 Doc ID 18209 Rev 1
Figure 3. I/O expander hardware configuration on the STM3210C-EVAL
AM08449v1
Y- 1
INT
2
A0/Data
A0/Data
Out
Out
3
4
5
VC
VCC
6
Data
Data in
7
IN0 8
IN1 9
GN
GND
10
10
IN2
11
11
IN3
12
12
X+
13
13
Vio
Vio
14
14
Y+
15
15
X-
16
16
U7
ST
STMPE
81
811
Y- 1
INT
2
A0/Data
A0/Data
Out
Out
3
4
5
VC
VCC
6
Data
Data in
7
IN0 8
IN1 9
GN
GND
10
10
IN2
11
11
IN3
12
12
X+
13
13
Vio
Vio
14
14
Y+
15
15
X-
16
16
U8
ST
STMPE
81
811
R5
R56
10
10K
+3V
+3V3
I2C
devic
device
address:0x8
address:0x8 2
I2C
devic
device
address:0x8
address:0x88
+3V
+3V3
+3V
+3V3
R5
R57
100
100K
R5
R58
100
100K
TouchScreen_X+
TouchScreen_X+
TouchScreen_X-
TouchScreen_X-
TouchScreen_Y+
TouchScreen_Y+
TouchScreen_Y-
TouchScreen_Y-
EXP
EXP
_I
_IO2
EXP
EXP
_I
_IO3
EXP
EXP
_I
_IO4
EXP
EXP
_I
_IO5
EXP
EXP
_I
_IO6
EXP
EXP
_I
_IO7
EXP
EXP
_I
_IO8
EXP
EXP
_I
_IO9
EXP
EXP
_I
_I
O1
O10
EXP
EXP
_I
_I
O1
O11
EXP
EXP
_I
_I
O1
O12
EXP
EXP
_I
_IO1
R160
R160
10
10K
R15
R159 0
+3V
+3V3
R3
R37
10
10K
R164
R164
10
10K
+3V
+3V3
C8
C89
100n
100nF
C9
C90
100n
100nF
PB6
PB7
P
B1
B14
IO_Expander_SCK
IO_Expander_SDA
IO_Expander_INT
SCLK
SCLK
SDAT
SDAT
SCLK
SCLK
SDAT
SDAT

AN3311 STM3210C-EVAL demonstration board
Doc ID 18209 Rev 1 11/58
4 STM3210C-EVAL demonstration board
Figure 4. STM3210C-EVAL demonstration board

STM3210C-EVAL demonstration board AN3311
12/58 Doc ID 18209 Rev 1
4.1 Features
●Three 5 V power supply options: power jack, USB connector, or daughterboard
●Boot from user Flash, system memory or SRAM
●I2S audio DAC, stereo audio jack
●512 MByte (or bigger) micro-SD cardTM
●Both type A and B smartcard support
●I2C compatible serial interface 64-Kbit EEPROM, MEMS and I/O expander
●RS-232 communication
●IrDA transceiver
●USB-OTG full speed, USB mini-AB connector
●IEEE-802.3-2002 compliant Ethernet connector
●Two channels of CAN2.0A/B compliant connection
●Inductor motor control connector
●JTAG and trace debug support
●3.2" 240x320 TFT color LCD with touchscreen
●Joystick with 4-direction control and selector
●Reset, wake-up, tamper, and user button
●4 color LEDs
●RTC with backup battery
●MCU consumption measurement circuit
●Extension connector for daughterboard or wrapping board.
4.2 STM32 peripherals mapping
The STM3210C-EVAL demonstration board is designed around the STM32F107VC in a
100-pin TQFP package. The hardware block diagram, Figure 5, illustrates the connection
between the STM32F107VC and peripherals (LCD, EEPROM, MEMS, USART, IrDA, USB-
OTG, Ethernet, audio, CAN bus, smartcard, micro-SD card, and motor control) and these
features can be located on the actual demonstration board in Figure 6.

AN3311 STM3210C-EVAL demonstration board
Doc ID 18209 Rev 1 13/58
Figure 5. Hardware block diagram - STM32 peripherals mapping
For more details of calibration parameters, refer to the STPM01 datasheet on www.st.com.
!-V
!UDIO$!#
-%-3
%%02/-
*OYSTICK
)/EXPANDER
4OUCHSCREEN
53"-INI!"
CONNECTOR
53"POWER
SWITCH
)NTEGRATED2*
CONNECTOR
0(9
6REGULATOR
-#5
CONSUMPTION
MEASUREMENT
,%$SKEY
%XTENSION
CONNECTORFOR
'0)/S
4&4,#$
-ICRO3$
CARD
-#CONTROL
CONNECTOR
*4!'
4RACE
".#CONNECTOR
0OTENTIOMETER
"ATTERYVOLTAGE
MEASUREMENT
'0)/
30)
-#
$EBUG
!$#
/4'
#!.
#!.
53!24
53!24
#!.
TRANSCEIVER
#!.
TRANSCEIVER
23
TRANSCEIVER
)R$!
TRANSCEIVER
3MARTCARD
INTERFACE
#!.
$"CONNECTOR
#!.
$"CONNECTOR
53!24
$"CONNECTOR
3MARTCARD
INTERFACE
34-&6#4
)3
)#
-))2-)

STM3210C-EVAL demonstration board AN3311
14/58 Doc ID 18209 Rev 1
Figure 6. STM3210C-EVAL demonstration board layout
4.3 Power supply
The STM3210C-EVAL demonstration board is designed to be powered by a 5 V DC power
supply and protected by PolyZen from a wrong power plug-in event. It is possible to
configure the demonstration board to use any of the following three sources for the power
supply:
●5 V DC power adapter connected to CN18, the power jack on the board (PSU on silk
screen for power supply unit)
●5 V DC power with 500 mA limitation from CN2, the USB mini-AB connector (USB on
silkscreen)
●5 V DC power from both CN8 and CN9, the extension connector for the daughterboard
(DTB for daughterboard on silkscreen).
!-V
&10RWRUFRQWURO
&1
&1
56
&1
86%0LFUR$%
5-
&1&1([WHQVLRQKHDGHU
&1
&$1
&1
&$1
8
670)9&7
&1&1%1&
&1
7U D F H
&1
-7$*
&1
9SRZHU
&1
$XGLRMDFN
&1
0LFUR6'FDUG
%
5HVHW
%:DNHXS
&1
%7DPSHU 8-R\VWLFN
%
59
3RWHQWLRPHWHU
8
,U'$
&1
&RORU/&'
FRQQHFWRU
6PDUWFDUG
8VHUNH\
FRQQHFWRU

AN3311 STM3210C-EVAL demonstration board
Doc ID 18209 Rev 1 15/58
The power supply is configured by setting the related jumpers JP24 and JP25, as described
in Ta b l e 2 .
4.4 Boot option
The STM3210C-EVAL board is able to boot from:
●Embedded user Flash
●System memory with boot loader for ISP
●Embedded SRAM for debugging.
The boot option is configured by setting switches SW1 (BOOT1) and SW2 (BOOT0). The
BOOT0 can be configured also via the RS-232 connector CN6.
Table 2. Power related jumpers
Jumper Description Configuration
JP25
JP25 selects one of the three possible power supply resources.
For power supply jack (CN18) to the STM3210C-EVAL only, JP25 is set as shown:
(Default)
For power supply from the daughterboard connectors (CN8 and CN9) to the
STM3210C-EVAL only, JP25 is set as shown:
For power supply from USB (CN2) to the STM3210C-EVAL only, JP25 is set as shown:
For power supply from power supply jack (CN18) to both the STM3210CEVAL
and daughterboard connected on CN8 and CN9, JP25 is set as
shown to the right (the daughterboard must not have its own power supply
connected):
JP24
Vbat is connected to 3.3 V power when JP24 is set as shown: (Default)
Vbat is connected to battery when JP24 is set as shown:

STM3210C-EVAL demonstration board AN3311
16/58 Doc ID 18209 Rev 1
4.5 Clock source
Two clock sources are available on the STM3210C-EVAL demonstration board for
STM32F107VC, and RTC is embedded.
●X2, 32 kHz crystal for embedded RTC
●X3, 25 MHz crystal with socket for an STM32F107VC microcontroller, it can be
removed from the socket when an internal RC clock is used.
4.6 Reset source
The reset signal of the STM3210C-EVAL board is low active and the reset sources include:
●Reset button, B1
●Debugging tools from JTAG connector CN13 and trace connector CN12
●Daughterboard from CN9
●RS-232 connector CN6 for ISP.
Table 3. Boot related switches
Switch Boot from Configuration
SW1 and SW2
STM3210C-EVAL boots from user Flash when SW2 is set as shown on
the right. SW1 setting does not matter in this configuration. (Default)
STM3210C-EVAL boots from system memory when SW1 and SW2 are
set as shown:
STM3210C-EVAL boots from embedded SRAM when SW1 and SW2
are set as shown:
Table 4. Reset related jumper
Jumper Description
JP20
Enables reset of the STM32F107VC embedded JTAG TAP controller each
time a system reset occurs. JP20 connects the TRST signal from the JTAG
connection with the system reset signal RESET#.
Default setting: not fitted.

AN3311 STM3210C-EVAL demonstration board
Doc ID 18209 Rev 1 17/58
4.7 Joystick
The joystick is four-directional and includes a selection key.
4.8 Pushbuttons
The following pushbuttons are provided:
●Key: user pushbutton
●Tamper: user pushbutton
●Wake-up: pushbutton used to wake up the processor from low-power mode.
4.9 Storage memory
The ZigBee adapter has a 64-Kbit I2C/RF dual interface memory (M24LR64-r) on board,
and it is connected to the I2C1 peripheral of the MCU.
The I2C address of the memory can be set by using the jumpers JP1 and JP2 on the ZigBee
adapter and must be different from the one already present on the STM3210C-EVAL (with
address 0xA0).
4.10 Development and debug support
The two debug connectors available on the STM3210C-EVAL demonstration board are:
1. CN13, standard 20-pin JTAG interface connector which is compliant with the debug
tools of ARM7 and ARM9
2. CN12, SAMTEC 20-pin connector FTSH-110-01-L-DV for both SWD and trace which is
compliant with ARM CoreSightTM debug tools
4.11 Display and input devices
The 3.2" TFT color LCD connected to SPI3 and 4 general purpose color LED's (LED 1, 2, 3,
4) are available as display devices.
A touchscreen connected to an I/O expander (U7), a 4-direction joystick with selection key, a
general purpose button (B3), a wake-up button (B2), and a tamper detection button (B4) are
available as input devices.
Table 5. LCD module
3.2" TFT LCD with touchscreen
CN14 (default)
Pin on CN14 Description Pin connection
1 CS PB2
2RS-
3 WR/SCL PC10
4RD -

STM3210C-EVAL demonstration board AN3311
18/58 Doc ID 18209 Rev 1
4.12 JTAG debugging connector CN13
Figure 7. JTAG debugging connector CN13 viewed from above the PCB
5 RESET RESET#
22 BL_GND GND
23 BL_Control +5 V
24 VDD 3.3 V
25 VCI 3.3 V
26 GND GND
27 GND GND
28 BL_VDD +5 V
29 SDO PC11
30 SDI PC12
31 XL I/O Expander
32 XR I/O Expander
33 YD I/O Expander
34 YU I/O Expander
Table 5. LCD module (continued)
3.2" TFT LCD with touchscreen
CN14 (default)
Pin on CN14 Description Pin connection
Table 6. JTAG debugging connector CN13
Pin number Description Pin number Description
1 3.3 V power 2 3.3 V power
3 PB4 4 GND
5PA156GND
7PA138GND
9PA1410GND
!-V

AN3311 STM3210C-EVAL demonstration board
Doc ID 18209 Rev 1 19/58
4.13 Daughterboard extension connector CN8 and CN9
Two 50-pin male headers, CN8 and CN9, can be used to connect a daughterboard or
standard wrapping board to the STM3210C-EVAL demonstration board. All 80 GPIOs are
available on it. The space between these two connectors and the power position, GND and
RESET pin are defined as a standard, which allows to develop common daughterboards for
several demonstration boards. The standard width between CN8 pin1 and CN9 pin1 is 2700
mills (68.58mm). This standard was implemented on the majority of demonstration boards.
Each pin on CN8 and CN9 can be used by a daughterboard after disconnecting it from the
corresponding function block on the STM3210C-EVAL demonstration board.
11 RTCK 12 GND
13 PB3 14 GND
15 RESET# 16 GND
17 DBGRQ 18 GND
19 DBGACK 20 GND
Table 6. JTAG debugging connector CN13 (continued)
Pin number Description Pin number Description
Table 7. Daughterboard extension connector CN8
Pin Description Alternate function How to disconnect with function block on STM3210C-
EVAL board
1GND -
3PC7 MC
Disconnect STM3210C-EVAL board from motor power drive
board
5 PC9 USB power switch On Remove R36
7 PA9 USB VBUS Remove R78
9 PA0 MC/Ethernet/WKUP Keep JP14 open. Disconnect STM3210C-EVAL board from
motor power drive board.
11 PC14 via SB1 32 kHz oscillator Remove R161, close SB1
13 PA12 USB_DP Remove R43 or disconnect USB cable
15 PC15 via SB2 32 kHz oscillator Remove R59, close SB2
17 PC10 SPI1_CLK
19 GND -
21 PC12 SPI1_MOSI
23 PD1 CAN1_TX
25 PD3 LD3 Remove R96
27 PD5 USART2_TX
29 PD7 LD1 Remove R94
31

STM3210C-EVAL demonstration board AN3311
20/58 Doc ID 18209 Rev 1
33 PB3 TDO/SWO
35 PB5 CAN2_RX Remove R45
37 PB7 I2C1_SDA Remove R132
39 GND -
41 PE2 Trace_CK
43 PE4 Trace_D1
45 PB8 MC Disconnect STM3210C-EVAL board from motor power drive
board
47 PE6 Trace_D3
49 D5V
2 PC6 I2S_MCK/MC JP10 open
4PC8 MC
Disconnect STM3210C-EVAL board from motor power drive
board
6 PA8 MCO JP4 open
8 PA10 USB_ID Remove R38 or disconnect USB cable
10 GND
12 PA11 USB_DM Remove R42 or disconnect USB cable
14 PA13 TMS/SWDIO
16 PA14 TCK/SWCLK
18 PC11 SPI1_MISO Remove R135 and LCD
20 PA15 TDI
22 PD0 CAN1_RX Remove R44
24 PD2 MC
Disconnect STM3210C-EVAL board from motor power drive
board.
26 PD4 LD4 Remove R97
28 PD6 USART2_RX Keep JP16 open
30 GND
32
34 PB4 TRST Keep JP20 open
36 PB6 CAN2_TX/
I2C1_SCK Keep JP9 open
38 PE0 MC/Micro-SD card
detection
Remove micro-SD card. Disconnect STM3210C-EVAL board
from motor power drive board.
40 PE1 USB_Overcurrent Remove R35
42 PE3 Trace_D0
44 PE5 Trace_D2
Table 7. Daughterboard extension connector CN8 (continued)
Pin Description Alternate function How to disconnect with function block on STM3210C-
EVAL board
Table of contents
Other ST Monitor manuals