dm00226201

UM1944
User manual
EVALSTPM3x-3PH evaluation board and graphical user
interface (GUI)
Introduction
This user manual describes the EVALSTPM3x-3PH evaluation board and the related graphical user
interface (GUI).
The STPM3x is a family of mixed signal ASSP designed for high accuracy measurement of power and
energy in power line systems using the Rogowski coil, current transformer or shunt current sensors. The
device has up to two voltage and two current channels.
The EVALSTPM3x-3PH evaluation board implements a 3-phase meter using current transformers for
current sensing, the STPM34 and STPM33 as metrology devices and the STM8S903K3 microcontroller
for synchronization and supervision functions, and to manage UART communication to PC GUI.
The STPM34 and the STPM33 perform R, S and T phase measurements of voltage and current RMS,
active and reactive energy and power. The STM8S903K3 integrates information coming from the
metering devices to calculate total energy and power, generates LED pulses for active and reactive
power, and manages communication with host (GUI software).
Through the GUI, it is possible to read and write either from each metrology device (the STPM34 and
STPM33) or from the STM8S903K3.
Main features of the system are:












0.2% accuracy poly-phase meter evaluation board
VNOM = 140 to 300 V RMS
INOM / IMAX. = 5/100 A RMS
fline = 50/60 Hz ± 10%
USB isolated connector to PC GUI
Power supply 3.3 V through USB connector
SPI/UART connector for the STPM33/34 direct access
SWIM connector for firmware upgrade
SPI/UART connector for expansion to external MCU
2x LEDs on board for active-reactive power output
IEC61000 standard compliant
RoHS compliant
October 2015
DocID028305 Rev 1
1/16
www.st.com
Contents
UM1944
Contents
1
2
3
4
5
2/16
Overview .......................................................................................... 3
1.1
Safety rules ....................................................................................... 3
1.2
Operating conditions ......................................................................... 3
1.3
Prerequisites ..................................................................................... 4
1.4
Recommended readings ................................................................... 4
1.5
Getting technical support .................................................................. 4
Hardware description ...................................................................... 5
2.1
Power supply..................................................................................... 5
2.2
On-board connectors ........................................................................ 5
2.3
Metrology .......................................................................................... 6
2.4
LED ................................................................................................... 6
2.5
Clock ................................................................................................. 6
Graphical user interface description ............................................. 7
3.1
Application working area ................................................................... 7
3.2
Connection ........................................................................................ 7
3.3
Language .......................................................................................... 7
3.4
Log .................................................................................................... 7
3.5
Calculated values .............................................................................. 8
3.6
Miscellaneous commands ................................................................. 8
3.7
Calibration parameters ...................................................................... 9
3.8
Parameter synchronization ............................................................... 9
3.9
Parameter calculations .................................................................... 10
Board setup ................................................................................... 12
4.1
Connection to the line ..................................................................... 12
4.2
Getting started................................................................................. 13
4.3
Calibration ....................................................................................... 14
Revision history ............................................................................ 15
DocID028305 Rev 1
UM1944
1
Overview
Overview
Figure 1: EVALSTP3x-3PH evaluation board
1.1
Safety rules
This board can be connected to mains voltage (230 V/110 V). In the case of improper use,
wrong installation or malfunction, there is a danger of serious personal injury and damage
to property. All operations such as: transport, installation, and commissioning, as well as
maintenance, should be carried out by skilled technical personnel only (national accident
prevention rules must be observed).
Due to the risk of death when this prototype is used on mains voltage (230 V/110 V),
“skilled technical personnel” only, who are familiar with installation, mounting,
commissioning, and operating with power electronic systems, and have the qualifications
needed to perform these functions, may use this prototype.
1.2
Operating conditions
Table 1: Operating conditions
Parameter
Value
VN nominal voltage
230 VRMS
IN nominal current
5 ARMS
IMax. maximum current
100 ARMS
fline line frequency
50/60 Hz ± 10%
TOP operating temperature
-40/+85 °C
DocID028305 Rev 1
3/16
Overview
1.3
UM1944
Prerequisites
The EVALSTPM3x-3PH GUI requires installation of FTDI virtual COM drivers to
communicate with the PC.
1.4
Recommended readings
This document describes how to use and set up a basic test session with a GUI interface.
Additional information is available in the following documents:





1.5
STPM3x datasheet
EVALSTPM3x-3PH schematic
STPM32 schematic
STPM33 schematic
STPM34 schematic
Getting technical support
All our customers receive free technical assistance through local ST distributor/office or by
visiting www.st.com; upgrades are also available free of charge on www.st.com/metering.
Customers should work with the latest version of software/firmware before contacting us.
4/16
DocID028305 Rev 1
UM1944
Hardware description
2
Hardware description
2.1
Power supply
The board does not contain a power supply. Supply voltage is provided externally, through
USB cable. Four supply sources are present on the board.
1.
2.
3.
4.
3V3: swim (debugging interface for the STM8S903K3), interface to external MCU
+3.3 V: STPM3x, STM8S903K3
+5 V: USB, RS485
ISO_5 V: derived from +5 V by a power isolation chip
Power supply system is shown in the figure below.
Figure 2: Power supply distribution
2.2
On-board connectors
The EVALSTPM3x-3PH can be interfaced to PC trough a USB cable A/B. This connector
also supplies all board components with power.
The following connectors are available on the board.
Table 2: EVALSTPM3x-3PH evaluation board connectors
Name
Description
CON4
USB connector to PC
CON5
Swim connector
CON9
MCU port
CON18
Connector to the STPM33/34
Position 1-2: MISO selection of the STPM34
J1
Position 2-3: MISO selection of the STPM33
Position 1-2: CS selection of the STPM34
J2
Position 2-3: CS selection of the STPM33
CON6
RS485 interface
CON7
Reactive power LED output
CON8
Active power LED output
DocID028305 Rev 1
5/16
Hardware description
2.3
UM1944
Metrology
Current sensing is performed through four CTs, while voltage sensing is performed through
voltage dividers.
The STPM34 board has two current and two voltage channels, sensing primary and
secondary phase current and voltage, while the STPM33 senses third phase current and
voltage.
Analog front end component values of the board are reported in table below.
Table 3: STPM34 evaluation board parameters
Channel
Parameter
Value
Current
Current sensor sensitivity kS
2.72 mV/A
Voltage
Voltage divider upper resistor R1
1800000 Ω
Voltage divider upper resistor R2
1200 Ω
Final constant pulse output
400 pulses/kWh
Device internal constant pulse
51200 pulses/kWh
CP
CP fast
A capacitor with value 22 nF, in parallel with R2, implements an antialiasing filter for the
voltage signal. For current signal, the antialiasing filter is implemented through 10 nF
capacitor and 1 kΩ resistor.
Current sensor sensitivity kS of 2.72 mV/A is obtained with a burden resistor RB = 6.8 Ω in
parallel with a current transformer with turn ratio n = 2500.
The application should be calibrated to get a default CP from the devices of 51200
pulses/kWh; the microcontroller then implements the cumulative energy calculation and
scales the output to the final value of 400 pulses/kWh.
2.4
LED
LED output generation is performed by the microcontroller, feeding two LED connectors, P
and Q, for active and reactive power respectively.
2.5
Clock
The STM8S903K3 provides 16 MHz clock to both metrology devices. 16 MHz are derived
by the micro from a 16 MHz crystal oscillator, or could also be provided by MCU connector
COM9.
6/16
DocID028305 Rev 1
UM1944
Graphical user interface description
3
Graphical user interface description
3.1
Application working area
The application working area is divided into several sections logically grouping the relevant
information and calculations.
Figure 3: Application working area
3.2
Connection
In the top most section of the working area, on the left, there is an available group-box for
the connection to the device. After the USB cable is plugged, verify on PC device manager
the proper COM port, described as “USB serial port”. USB driver installation has to be
completed.
After the COM port is selected, press “Connect”.
Communication has a fixed rate of 57600 bps, 8-bit data, 1-bit stop.
3.3
Language
English or chinese can be selected.
3.4
Log
A log window shows application messages and UART transmitted/received frames
between the STM8S903K3 and the PC.
DocID028305 Rev 1
7/16
Graphical user interface description
3.5
UM1944
Calculated values
In the left-central section of the working area, there are three tabs with all measurement
data, coming from the metrology devices and calculated by the micro. They are grouped in
the following sections:

RT info: real time info is: RMS values of voltage and current, active and reactive
power for each phase and cumulative
Voltage and current register readings are converted into physical quantities shown in this
section by multiplying them with LSB values, which are calculated as per “parameter
calculations” window (see Section 3.8: "Parameter synchronization" ).
Active and reactive power information is calculated in firmware and just displayed in this
tab.

Energy info: positive and negative active and reactive energy, for each phase and
cumulative
Energy information is calculated in firmware and displayed in this tab.

Other info: in this tab phase frequency and power factor, phase angles etc. are
displayed
These values are converted by GUI from the device registers.
3.6
Miscellaneous commands
In this group some command buttons and check-boxes are shown:







HW reset: hardware reset
HW latch: not implemented
Clr energy: reset all energy counters
Save all: saves all data to EEPROM
Calc params: open “Parameter calculations” window (see Section 3.8: "Parameter
synchronization" )
Clear log: clear log window
App mode: the application can work in several modes, according to FW setting. When
a new application mode is selected, press “Set” to set it in the microcontroller, “Get” to
retrieve the app mode from the micro
a. Normal: default at startup, the micro is interfaced with the devices and GUI, the
complete application is run (ZCR detection, energy pulse generation, no-load
detection, energy accumulation and store)
b. MCU bypass: energy pulse generation only
c. Direct SPI: the metrology devices can be directly accessed through SPI. The
device is selected by J1 and J2 jumpers
d. Direct UART: the metrology devices can be directly accessed through UART. The
device is selected by J1 and J2 jumpers
e. Normal (DBG): debug mode, reserved for testing
f.
MCU bypass (DBG): debug mode, reserved for testing
g. Direct SPI (DBG): debug mode, reserved for testing
h. Direct UART (DBG): debug mode, reserved for testing
After the reset, the application starts the mode stored in EEPROM, or enters normal mode
if no data are stored. After reset, P and Q LED flash three times if it is one among the
debug modes. During running, app mode cannot be changed by GUI if it is a dummy mode
(modes 3, 4, 7, 8), but pressing [save all] the new mode is saved to EEPROM and at reset
the application enters new app mode.

8/16
Auto update: checking this option, all data are automatically loaded in the GUI
DocID028305 Rev 1
UM1944
Graphical user interface description



3.7
Single phase: reserved. If the microcontroller FW is updated to work as single-phase,
only those data coming from the STPM34 are evaluated
Show raw IO: checking this option, in the log window UART Tx-Rx data are shown
Show log: allows application messages to be shown in the log window
Calibration parameters
For each phase, the following calibration parameters can be read and written:



Voltage and current amplitude calibration bits
Phaseshift calibration bits
Power offset compensation bits
Phase A and phase B refer to primary and secondary channel of the STPM34, while phase
C is the STPM33 primary channel.
Using the button “Load”, the register values are loaded from the device and shown in the
GUI.
“Save” button writes to the STPM34 and STPM33 registers the calibration parameters
shown in the GUI.
“Save calib” saves to EEPROM the calibration parameters directly from the STPM34 and
STPM33 registers. At startup, the microcontroller uses data in EEPROM to program the
STPM3x devices.
3.8
Parameter synchronization
In this section it is possible to access directly the device to read or write.
The information and the value to read/write are selected in the following textbox:




Target selection: the following target can be selected

STPM34: access the STPM34 device directly

STPM33: access the STPM33 device directly

STPM34/33: valid when it is possible to write the same data to the same register
for both devicesa

Virtual 3P: in this mode the STPM34 and STPM33 are integrated and treated as
a whole chip. Register addresses are continuous (virtual) and have a virtual
nameb

EEPROM: access application data saved in EEPROM

Meas app: access directly data shown in “RT info”, “Energy info” and “Other info”
tabs
Item description: according to the selected target, a list of selectable items is
populated
Address, offset, bits: upon item selection, its address in memory, the relative offset
and the bit length is automatically filled
Value: field showing the value to write or to read in the specified memory location
The following actions are possible:



Load: retrieves the information required and shows it in “Value” field
Save: writes the data set to “Value” field in the specified memory location
Load all: reads all memory content of the selected target and shows it in log window
a
When reading, it is read back from one of them, according to the previous “g_nStpm3xCS” variable value in the
FW.
b
This mode is enabled by definition of “STPM3x_CFG_USE_V3P_REG” in the FW.
DocID028305 Rev 1
9/16
Graphical user interface description
3.9
UM1944
Parameter calculations
In this window, the metering front end parameters are displayed and can be configured.
They are used for the following calculations:




R2: lower resistance of voltage divider
R1: higher resistance of voltage divider
RC: current sensor sensitivity
CP: final LED number of pulses per KWh
According to these values, the following parameters are calculated:

Max. V RMS: maximum value of RMS voltage, calculated as:
𝑉𝑀𝐴𝑋 =

1 𝑉𝑟𝑒𝑓 𝑅1 + 𝑅2
[𝑉]
∙
∙
2 𝐴𝑉 ∙ √2
𝑅2
Max. I RMS, maximum value of RMS current, calculated as:
𝐼𝑀𝐴𝑋 =

1 𝑉𝑟𝑒𝑓
1
[𝐴]
∙
∙
2 𝐴𝐼 ∙ √2 𝑅𝐶
Max. power, maximum value of RMS current, calculated as:
𝑃𝑀𝐴𝑋 = 𝑉𝑀𝐴𝑋 ∙ 𝐼𝑀𝐴𝑋

Voltage LSB, LSB value of RMS current register, calculated as:
𝐿𝑆𝐵_𝑉𝑅𝑀𝑆 =

10/16
𝑉𝑟𝑒𝑓
[𝐴/𝑏𝑖𝑡]
𝑐𝑎𝑙𝐼 ∙ 𝑅𝐶 ∙ 𝐴𝐼 ∙ 217
𝑉𝑟𝑒𝑓 2 ∙ (1 + 𝑅1⁄𝑅2)
𝐴𝑉 ∙ 𝐴𝐼 ∙ 𝑅𝐶 ∙ 𝑐𝑎𝑙𝑉 ∙ 𝑐𝑎𝑙𝐼 ∙
228
[
𝑊
]
𝐿𝑆𝐵
Energy LSB, LSB value of energy registers, calculated as:
𝐿𝑆𝐵𝐸 =


[𝑉/𝑏𝑖𝑡]
Power LSB, LSB value of power registers, calculated as:
𝐿𝑆𝐵𝑃 =

𝑐𝑎𝑙𝑉 ∙ 𝐴𝑉 ∙ 215
Current LSB, LSB value of RMS current register, calculated as:
𝐿𝑆𝐵_𝐼𝑅𝑀𝑆 =

𝑉𝑟𝑒𝑓 ∙ (1 + 𝑅1⁄𝑅2)
𝑉𝑟𝑒𝑓 2 ∙ (1 + 𝑅1⁄𝑅2)
𝐷𝐶𝑙𝑘 ∙ 𝐴𝑉 ∙ 𝐴𝐼 ∙ 𝑅𝐶 ∙ 𝑐𝑎𝑙𝑉 ∙ 𝑐𝑎𝑙𝐼 ∙
217
𝑊𝑠
[
]
𝐿𝑆𝐵
CP fast: pulses per kWh produced by the devices as default
CP div: divider ratio between the default device CP and the final output CP
DocID028305 Rev 1
UM1944
Graphical user interface description
Pressing “Calculate” button, LSB and the other ratings are updated with input data R1, R2,
RC and CP. Data as RMS voltage, current are into these new values.
For a correct conversion of values, the following parameters must be set:
Table 4: Input parameters
Parameter
Value
R1
1905264 Ohma
R2
1200 Ohm
RC
2.72 mV/A
CP
400 pulses/kWh
a
This is true even if the real value of R1 on the board is 1.8 MOhm. In fact, to obtain from
the device the target CP = 51200 p/kWh after calibration, given R2 and RC as in this table,
the target value of R1 is 1905264 Ohm. Any difference from this value is compensated by
calibrators. After calibration, for a correct computation of RMS values, target values of
components must be used in formulas because the difference from real ones has already
been compensated by calibrators inside the device.
DocID028305 Rev 1
11/16
Board setup
UM1944
4
Board setup
4.1
Connection to the line
The board can be connected to the line in several ways, as shown in the below figures:
Figure 4: Board connection to phantom load, 3-phase system
S
~
N
R
S
R
12/16
T
DocID028305 Rev 1
T
UM1944
Board setup
Figure 5: Board connection to 3-phase, line and load
LOAD1
LOAD2
LOAD3
N
T
S
R
4.2
Getting started
To start working with the evaluation board:
1.
Connect the EVALSTPM3x-3PH board to either AC line or power source or phantom
load as shown in the paragraph above, without powering it on
2. Plug the USB cable on connector CON4 to a PC, it automatically supplies the board.
D1 and D4 LEDs are lighted
3. Open the EVALSTPM3x-3PH GUI
4. Select the desired language from the language combo-box
5. Select the proper COM port from connection section and press "Connect" button. The
right COM port number can be found in the computer device manager as "USB serial
port"
6. Press "Connect" button, TX and RX LED (D5 and D6) blink
7. "App mode" should be set to "Normal"
8. Select "Auto update" checkbox to see measured values
9. Select "Show raw IO" checkbox to see the exchanged data
10. Power on AC source to see measured data
DocID028305 Rev 1
13/16
Board setup
4.3
UM1944
Calibration
Tolerances from nominal values of analog front end components, the device analog
reference and gain affect final board accuracy have to be compensated through calibration
procedure.
To calibrate the whole meter, each channel must be calibrated separately.
The EVALSTPM3x-3PH GUI does not provide automatic calibration routine but can be
used to read and write data from the devices.
For more details on the STPM3x calibration procedure, instrumentation and setup, please
refer to AN4470.
To perform voltage and current amplitude calibration, first of all open the GUI and connect
it, flag the auto update check and set input parameters as in Table 4: "Input parameters".
Follow the below procedure for any channel:
1.
2.
3.
4.
Connect the board to PC and apply known voltage and current
Set phase voltage and current calibrator to 2048 (medium value)
Check voltage and current reading in “RT info” tab
Calculate calibrators as :
𝐶𝐻𝑉 = 14336 ∗
𝑅𝑒𝑎𝑙_𝑉𝑜𝑙𝑡𝑎𝑔𝑒
− 12228
𝑀𝑒𝑎𝑠_𝑉𝑜𝑙𝑡𝑎𝑔𝑒
𝐶𝐻𝐶 = 14336 ∗
𝑅𝑒𝑎𝑙_𝐶𝑢𝑟𝑟𝑒𝑛𝑡
− 12228
𝑀𝑒𝑎𝑠_𝐶𝑢𝑟𝑟𝑒𝑛𝑡
where Real_Voltage and Real_Current are the applied values, the Meas_Voltage and
Meas_Current are GUI data.
5. Write CHV and CHC to the phase voltage and current calibrators and press “save” and
“save calib” to write them to the devices and EEPROM respectively
For phase shift and offset compensation please follow the procedure described in AN4470.
14/16
DocID028305 Rev 1
UM1944
5
Revision history
Revision history
Table 5: Document revision history
Date
Revision
27-Oct-2015
1
Changes
Initial version.
DocID028305 Rev 1
15/16
UM1944
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST
products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the
design of Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2015 STMicroelectronics – All rights reserved
16/16
DocID028305 Rev 1