ST AN3311 Application note

AN3311

Application note

In-home display for ZigBee® smartplug

Introduction

This application note describes the demonstration firmware running on the STM3210CEVAL 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.

December 2010

Doc ID 18209 Rev 1

1/58

www.st.com

Contents

AN3311

 

 

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

2/58

Doc ID 18209 Rev 1

AN3311 Contents

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

Doc ID 18209 Rev 1

3/58

List of tables

AN3311

 

 

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

4/58

Doc ID 18209 Rev 1

AN3311

List of figures

 

 

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

Doc ID 18209 Rev 1

5/58

Document and library rules

AN3311

 

 

1 Document and library rules

This document uses the conventions described in the sections below.

1.1Acronyms

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

 

 

 

6/58

Doc ID 18209 Rev 1

AN3311

ZigBee smartplug

 

 

2 ZigBee smartplug

2.1Smartplug description

The smartplug coordinator is connected via an SPI to the STM3210C-EVAL through an “AdHoc” 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 STM3210CEVAL (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.

Doc ID 18209 Rev 1

7/58

ZigBee smartplug

AN3311

 

 

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.2ZigBee 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.

8/58

Doc ID 18209 Rev 1

AN3311

Multi-input embedded GUI library

 

 

3 Multi-input embedded GUI library

3.1Description

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.

Doc ID 18209 Rev 1

9/58

Multi-input embedded GUI library

AN3311

 

 

Figure 3. I/O expander hardware configuration on the STM3210C-EVAL

 

 

 

+3V3

 

 

 

 

 

 

 

C89

 

 

 

 

 

 

 

 

100nF

6

U7

 

1

 

 

 

 

 

VCC

Y-

TouchScreen_Y-

 

 

 

 

14

16

 

 

 

 

Vio

X-

TouchScreen_X-

 

 

 

 

10

15

 

 

 

 

GND

Y+

TouchScreen_Y+

 

PB6

 

 

4

13

IO_Expander_SCK

 

 

SCLK

X+

TouchScreen_X+

PB7

 

 

5

12

IO_Expander_SDA

 

 

SDAT

IN3

EXP_IO9

PB14

R159

0

2

11

IO_Expander_INT

INT

IN2

EXP_IO10

 

 

 

7

9

 

 

 

 

Data in

IN1

EXP_IO11

 

 

 

 

3

8

 

 

 

R37

A0/Data Out

IN0

EXP_IO12

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10K

 

STMPE811

 

 

 

 

 

 

 

 

I2C device address:0x8 2

R57

 

 

 

+3V3

 

 

 

 

100K

 

 

 

 

 

 

 

 

 

 

 

+3V3

 

 

 

 

 

 

 

C90

 

 

 

 

 

 

 

 

100nF

6

U8

 

1

 

 

 

 

 

VCC

Y-

EXP_IO1

 

 

 

 

14

16

 

 

 

 

Vio

X-

EXP_IO2

 

 

 

 

10

15

 

 

 

 

GND

Y+

EXP_IO3

 

 

 

 

4

13

 

 

 

 

SCLK

X+

EXP_IO4

 

 

 

 

5

12

 

 

 

 

SDAT

IN3

EXP_IO5

 

 

 

 

2

11

 

 

 

 

INT

IN2

EXP_IO6

 

 

 

 

7

9

 

 

 

 

Data in

IN1

EXP_IO7

 

 

 

R160

3

8

 

 

 

A0/Data Out

IN0

EXP_IO8

 

 

 

10K

 

 

 

 

 

 

 

 

 

 

 

 

 

R164

R56 STMPE811

 

 

 

 

 

 

10K

10K

I2C device address:0x88

 

R58

 

 

 

+3V3

 

 

 

 

100K

 

 

 

+3V3

 

 

 

 

 

 

 

 

 

 

 

 

 

AM08449v1

10/58

Doc ID 18209 Rev 1

ST AN3311 Application note

AN3311

STM3210C-EVAL demonstration board

 

 

4 STM3210C-EVAL demonstration board

Figure 4. STM3210C-EVAL demonstration board

Doc ID 18209 Rev 1

11/58

STM3210C-EVAL demonstration board

AN3311

 

 

4.1Features

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.2STM32 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, USBOTG, 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.

12/58

Doc ID 18209 Rev 1

AN3311

STM3210C-EVAL demonstration board

 

 

Figure 5. Hardware block diagram - STM32 peripherals mapping

66REGULATOR

 

) 3

!UDIO $!#

 

 

 

 

-#5

 

 

 

 

CONSUMPTION

 

) #

 

 

MEASUREMENT

 

 

-%-3

 

,%$S KEY

'0)/

 

%%02/-

 

%XTENSION

 

 

 

*OYSTICK

CONNECTOREFOR

 

 

)/ EXPANDER

 

'0)/S

 

 

 

 

 

 

 

 

4OUCHSCREEN

4&4&,#$

 

 

 

53"3-INI!"

 

 

/4'

 

 

 

 

CONNECTOR

-ICRO3$

 

 

 

30)

34- & 6#4

53"3POWER

 

CARD

SWITCH

 

 

 

 

-# CONTROL

-#

-)) 2-)

0(9

)NTEGRATED 2*

CONNECTOR

CONNECTOR

 

 

 

*4!'

 

#!.

#!.

#!.

 

TRANSCEIVER

$" "CONNECTOR

 

 

 

$EBUG

 

#!.

#!.

4RACE

 

#!.

 

TRANSCEIVER

$" "CONNECTOR

 

 

 

".#"CONNECTOR

!$#

 

23

53!244

53!24

TRANSCEIVER

$" "CONNECTOR

 

 

 

 

0OTENTIOMETER

 

 

)R$!

 

 

 

TRANSCEIVER

 

 

 

 

 

"ATTERYYVOLTAGE

 

53!24

3MARTTCARD

3MARTTCARD

MEASUREMENT

 

INTERFACE

INTERFACE

 

 

!-V

For more details of calibration parameters, refer to the STPM01 datasheet on www.st.com.

Doc ID 18209 Rev 1

13/58

STM3210C-EVAL demonstration board

AN3311

 

 

Figure 6. STM3210C-EVAL demonstration board layout

&1 &1 %1&

&1 &1 ([WHQVLRQ KHDGHU

&1 0RWRU FRQWURO

 

&1

 

 

 

&1

 

 

 

5-

&$1

 

 

 

FRQQHFWRU

 

 

 

 

&1

 

 

8

 

56

 

 

 

 

&1

 

670 ) 9&7

 

 

&$1

 

 

 

 

 

 

 

 

&1

 

 

 

 

86% 0LFUR$%

 

 

 

 

FRQQHFWRU

&1

 

 

 

&1

 

 

 

7UDFH

9 SRZHU

 

 

 

 

 

 

 

 

 

 

 

&1

&1

 

 

 

-7$*

$XGLR MDFN

 

 

 

 

 

 

 

 

&1

 

 

 

 

&RORU /&'

&1

 

 

 

 

0LFUR6' FDUG

 

 

 

8

 

 

 

 

 

 

 

 

,U'$

&1

 

 

 

59

6PDUWFDUG

 

 

 

3RWHQWLRPHWHU

%

 

 

 

%

5HVHW

 

 

 

8VHU NH\

 

% :DNHXS

% 7DPSHU

8-R\VWLFN

!-V

4.3Power 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).

14/58

Doc ID 18209 Rev 1

AN3311

STM3210C-EVAL demonstration board

 

 

The power supply is configured by setting the related jumpers JP24 and JP25, as described in Table 2.

Table 2.

Power related jumpers

 

Jumper

Description

Configuration

 

 

 

 

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:

 

JP25

 

 

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):

 

 

 

 

 

Vbat is connected to 3.3 V power when JP24 is set as shown: (Default)

 

JP24

 

 

Vbat is connected to battery when JP24 is set as shown:

 

 

 

 

 

 

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.

Doc ID 18209 Rev 1

15/58

STM3210C-EVAL demonstration board

AN3311

 

 

 

 

Table 3.

Boot related switches

 

 

 

 

 

Switch

 

Boot from

Configuration

 

 

 

 

 

 

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

 

SW1 and SW2

set as shown:

 

 

 

 

 

 

 

STM3210C-EVAL boots from embedded SRAM when SW1 and SW2

 

 

 

are set as shown:

 

 

 

 

 

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.6Reset 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 4.

Reset related jumper

Jumper

Description

 

 

 

 

 

Enables reset of the STM32F107VC embedded JTAG TAP controller each

 

JP20

time a system reset occurs. JP20 connects the TRST signal from the JTAG

 

connection with the system reset signal RESET#.

 

 

 

 

Default setting: not fitted.

 

 

 

16/58

Doc ID 18209 Rev 1

AN3311

STM3210C-EVAL demonstration board

 

 

4.7Joystick

The joystick is four-directional and includes a selection key.

4.8Pushbuttons

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.9Storage 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.10Development 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.11Display 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

 

 

 

 

 

2

RS

-

 

 

 

 

 

3

WR/SCL

PC10

 

 

 

 

 

4

RD

-

 

 

 

 

Doc ID 18209 Rev 1

17/58

STM3210C-EVAL demonstration board

 

AN3311

 

 

 

 

 

 

Table 5.

LCD module (continued)

 

 

 

 

 

 

 

 

 

3.2" TFT LCD with touchscreen

 

 

 

 

CN14 (default)

 

 

 

 

 

 

 

 

Pin on CN14

Description

Pin connection

 

 

 

 

 

 

 

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

 

 

 

 

 

4.12JTAG debugging connector CN13

Figure 7.

JTAG debugging connector CN13 viewed from above the PCB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

!-V

 

 

 

 

 

 

 

 

 

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5

 

 

 

 

PA15

 

 

 

 

 

6

 

 

 

 

GND

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7

 

 

 

 

PA13

 

 

 

 

 

8

 

 

 

 

GND

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9

 

 

 

 

PA14

 

 

 

 

 

10

 

 

 

 

GND

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

18/58

Doc ID 18209 Rev 1

Loading...
+ 40 hidden pages