EVALSTPM-3PHISO: Getting started with the STPMS2 3-ph full shunt evaluation
board
Introduction
The EVALSTPM-3PHISO evaluation board implements a 3-phase AC Watt meter that meets accuracy class 0.5 according to
IEC 62053-22 standard using low-cost, electromagnetic-immune shunt sensors and advanced galvanic-isolation technology.
The evaluation board combines the high-accuracy STPMS2 metering front-end IC and the STISO621 digital isolator with
customizable firmware running on an STM32 microcontroller to compute metrology and power-quality data.
The STPMS2, a two-channel 24-bit second-order, sigma-delta modulator, measures voltage and current for each phase through
an on-board voltage divider and a shunt current sensor. It oversamples the signal using a synchronized 4 MHz clock distributed
by the microcontroller and multiplexes voltage and current sigma-delta bitstreams on a single output pin. Three STPMS2 are
used in the 3-phase system to collect voltage and current data from each phase.
The STISO621, a dual-channel digital isolator based on a 6 kV thick-oxide, galvanic-isolation technology, transfers data
between isolated domains and guarantees 6 kV VIOTM and 1.2 kV VIORM between the phases.
The FW implemented on the STPM32F413 uses digital filters for sigma-delta modulator (DFSDM) peripheral to demultiplex the
six bitstreams, convert them into 24-bit voltage and current values, and computes all metrology data in real-time every 200 µs.
The firmware also implements a Virtual COM port that provides access to internal parameters for reading metrology data,
modifying the internal configuration, and calibrating the board.
Figure 1. EVALSTPM-3PHISO image
UM2847 - Rev 1 - March 2021
For further information contact your local STMicroelectronics sales office.
www.st.com
1Safety and operating instructions
1.1General terms
Warning:
During assembly, testing, and operation, the evaluation board poses inherent hazards due to high
voltage.
Danger:
There is danger of serious personal injury, property damage or death due to electrical shock if the
kit or components are improperly used or installed incorrectly.
The kit is not electrically isolated from the high-voltage supply AC/DC input. The evaluation board is
directly linked to the mains voltage. No barrier is present between the accessible parts and the high
voltage. All measuring equipment must be isolated from the mains before powering the board. When
using an oscilloscope with the demo, it must be isolated from the AC line. This prevents shock from
occurring as a result of touching any single point in the circuit, but does NOT prevent shock when
touching two or more points in the circuit.
All operations involving transportation, installation and use, and maintenance must be performed by skilled
technical personnel able to understand and implement national accident prevention regulations. For the purposes
of these basic safety instructions, “skilled technical personnel” are suitably qualified people who are familiar with
the installation, use and maintenance of power electronic systems.
UM2847
Safety and operating instructions
1.2Intended use of evaluation board
The evaluation board is designed for demonstration purposes only. Technical data and information concerning the
power supply conditions are detailed in the documentation and should be strictly observed.
1.3Installing the evaluation board
The board contains electrostatically-sensitive components that are prone to damage if used incorrectly. Do not
mechanically damage or destroy the electrical components (potential health risks).
1.4Operating the evaluation board
To operate properly the board, follow these safety rules.
1.Work area safety:
–The work area must be clean and tidy.
–Do not work alone when boards are energized.
–Protect against inadvertent access to the area where the board is energized using suitable barriers and
signs.
–A system architecture that supplies power to the evaluation board must be equipped with additional
control and protective devices in accordance with the applicable safety requirements (i.e., compliance
with technical equipment and accident prevention rules).
–Use non-conductive and stable work surface.
–Use adequately insulated clamps and wires to attach measurement probes and instruments.
UM2847 - Rev 1
page 2/20
Operating the evaluation board
2.Electrical safety:
–Proceed with the arrangement of measurement set-up, wiring or configuration paying attention to high
voltage sections.
–Remove power supply from the board and electrical loads before performing any electrical
measurement on the high voltage sections of the board.
–Once the set-up is complete, energize the board.
Danger:
Do not touch the evaluation board when it is energized or immediately after it has been
disconnected from the voltage supply as several parts and power terminals containing potentially
energized capacitors need time to discharge.
Parts of the kit are not electrically isolated from the AC/DC input. The USB interface, the JTAG
connector and the strip line connector are in the low voltage side of the board, so they can be used to
connect a host computer. Please refer to Figure 2.
3.Personal safety :
–Always wear suitable personal protective equipment such as insulating gloves and safety glasses.
–Take adequate precautions and install the board in such a way to prevent accidental touch. Use
protective shields such as an insulating box with interlocks if necessary.
Figure 2. High and low voltage sides
UM2847
UM2847 - Rev 1
page 3/20
2Getting started
2.1Hardware and software requirements
Using the EVALSTPM-3PHISO evaluation board requires the following software and hardware:
•A Windows PC (XP, Vista, Win 7, Win 8, Win 10) to eventually install the software package available on
www.st.com (optional) or to communicate through the mini-shell
•A 'USB type A to Micro-B' cable, used to power on the board (through USB connector CN1) from host PC
and to allow communication with terminal or software GUI
•JTAG arm debugging probe (optional)
•3-Ph AC power supply and 3-Ph load
•Reference meter (optional)
The system could be run and evaluated in the following ways:
•Installing the software GUI STSW-STPM005 from www.st.com . In this case please refer to the related
documentation.
•Connecting to a shell terminal on the host PC
•Using a JTAG arm debugging probe which can be connected to JTAG connector for debugging and
programming. For this purpose, it is necessary to install the IDE “IAR embedded workbench for ARM”
version 8.5.
UM2847
Getting started
2.2Hardware description
Figure 3. EVALSTPM-3PHISO board function description
2.2.1Power supply
The board can be supplied alternatively by:
•connecting a USB cable to the PC
•providing 5 VDC by the coaxial jack
UM2847 - Rev 1
page 4/20
Each phase STPMS2 is supplied by an independent capacitive power supply, providing the necessary 3.3 V to
the device. The jumpers P4, P7 and P8 must remain fit to use the power supply, otherwise it is bypassed.
2.2.2Voltage and current sensing section
The STPMS2 devices onboard are configured as follows:
Note:For further information on STPMS2 configuration please refer to device datasheet.
The metrology section analog front-end component values are as follows:
UM2847
Running the built-in demonstration
Table 2. AFE components
ComponentValueDescription
Shunt0.3 mOhmCurrent sensor
R1810 kOhmVoltage divider resistor (actually 3 x 270 kOhm)
R2470 OhmVoltage divider resistor
2.2.3Board ratings
The ratings of the board, given by the parameters specified above, are as follows:
•Power stage supply voltage between 80 V RMS and 350 V RMS
•Maximum load current 86 A RMS
2.3Running the built-in demonstration
The board comes with the demonstration firmware preloaded in the Flash memory. Please make sure to
download and use the latest release of STSW-STPM004 firmware from www.st.com.
Before running the application, the user should establish the connection with the 3-phase full shunt board.
Follow the steps below to run it:
•Connect the board to a PC with a 'USB type A to Micro-B' cable through USB connector CN1 to power the
board. Green LED (PWR ON) then lights up.
•First connect the board to a 3-phase generator and load as shown in the figure below, then power on the
generator:
UM2847 - Rev 1
page 5/20
Figure 4. Electric connections
UM2847
Running the built-in demonstration
•When the load is connected, LED0 and LED1 blink with a frequency proportional to respectively active and
reactive power consumption.
•Connect a shell terminal to the board Virtual COM port as specified in Section 4.3 below.
•Alternatively, use the software GUI STSW-STPM005 to read/calibrate the metrology data. For more details
on the Metrology GUI please refer to its user manual.
•For application development and debug, connect the JTAG probe and open “IAR Embedded Workbench for
ARM” IDE. For STSW-STPM004 FW details please refer to related user manual.
UM2847 - Rev 1
page 6/20
3Metrology application
3.1Metrology calculations
The metrology features implemented by EVALSTPM-3PHISO FW are the following:
•6 channels V-I decimated samples available every 200 us
•Line period and phase shift measurement for each phase
•Phase to phase voltage delays
•RMS and THD calculation (optional) of each V-I signal
•1-ph Active wideband, active fundamental and reactive power/energy calculation
•1-ph Apparent RMS power/energy calculation
•3-ph Active wideband, active fundamental and reactive power/energy calculation
•3-ph Apparent RMS power/energy calculation
•Data latch in STPM3x like registers
•Full calibration (amplitude, power offset and samples offset for DC measurement)
•DC measurement optional excluding high-pass filter on ADC data
•Status bits for power sign, frequency error and signal stuck
•Two configurable LEDs for pulsed outputs
•Interface to Metrology GUI through USB
UM2847
Metrology application
3.2
Power is a signed value, that can be expressed as a normalized value as:
p n
P
norm
Energy register is an up/down counter, always positive, that increases or decreases according to the power sign.
All metrology calculations are performed in real-time every 200 us, which is the signal sampling period.
Time registers, like period, V-C phase shift and phase to phase voltage delay have an LSB equal to 8 us.
For more information on the signal processing and register LSBs please refer to FW user manual.
−1 ∙ 228∙ p n 28 + p n 27: 0
=
28
2
Metrology registers
The data can be accessed in STPM32-like registers; data mapping in the registers is shown in Figure 5. Not all
the STPM32 registers are filled; only the used registers are shown.
–Red field registers configure application LEDs and reference frequency. Since these configurations
refer to the whole application and are common to all the phases, they must be set only in the first
phase configuration registers.
–Yellow fields contain calibration and configuration data specific for each phase, so they must be set in
2.Data registers, indicated in blue, contain calculated data; they are all computed by the processing kernel on
UM2847 - Rev 1
each phase configuration register.
All the configuration registers, both application and phase ones, are written by the application and not
modified by the processing kernel. They can be configured in one of the following ways:
–either by setting them in the metroDefaultNvm in the handler_metrology.c file (please refer to FW user
–or at runtime by sending a write command (please refer to Section 3.3 below).
a 200 us basis, but updated in the registers upon request by setting the Latch bit in DSPCTRL3. Setting the
AutoLatch bit instead, these data are automatically updated every 200 us.
manual for details)
page 8/20
3.2.1Registers description
BitConfig.DescriptionDefault
19BHPFV
20BHPFC
24-27LPW1
28-29LPS1
30-31LCS1
Table 3. DSP control register 1 (DSPCTRL1)
Bypass Hi-Pass Filter for voltage channel:
BHPFV = 0: HPF enabled
BHPFV = 1: HPF bypassed
Bypass Hi-Pass Filter for current channel:
BHPFC = 0: HPF enabled
BHPFC = 1: HPF bypassed
LED1 Speed Dividing Factor: 0x0 = 2-4, 0xF = 2
Default 0x4 = 1
LED1 pulse-out power selection:
LPS1 = 00: Active
LPS1 = 01: Active fundamental
LPS1 = 10: Reactive
LPS1 = 11: Apparent
LED1 pulse-out channel selection:
LCS1 = 00: Phase 1
LCS1 = 01: Phase 2
LCS1 = 10: Phase 3
LCS1 = 11: Three-phase
11
UM2847
Metrology registers
0x0
0x0
0x4
0x0
0x3
Bit
24-27LPW2
28-29LPS2
30-31LCS2
Bit
21Latch
Config.DescriptionDefault
Config.DescriptionDefault
Table 4. DSP control register 2 (DSPCTRL2)
LED2 Speed Dividing Factor: 0x0 = 2-4, 0xF = 2
Default 0x4 = 1
LED2 pulse-out power selection:
LPS2 = 00: Active
LPS2 = 01: Active fundamental
LPS2 = 10: Reactive
LPS2 = 11: Apparent
LED2 pulse-out channel selection:
LCS2 = 00: Phase 1
LCS2= 01: Phase 2
LCS2 = 10: Phase 3
LCS2 = 11: Three-phase
11
Table 5. DSP control register 3 (DSPCTRL3)
Updates measurement registers
This bit is automatically set to zero after action
0x4
0x2
0x3
0x0
UM2847 - Rev 1
page 9/20
UM2847
Metrology registers
BitConfig.DescriptionDefault
23Auto LatchUpdates measurement registers at 5 kHz0x0
LED1 pin output disable
24LED1OFF
25LED2OFF
27REF_FREQ
BitConfig.DescriptionDefault
0-11CHVCalibration register of voltage channel0x800
‘0’: LED1 output on
‘1’: LED1 output disabled
When the LED output is disabled the pin is set at low state
LED2 pin output disable
‘0’: LED2 output on
‘1’: LED2 output disabled
When the LED output is disabled the pin is set at low state
Reference line frequency:
‘0’: 50Hz,
‘1’: 60Hz
Table 6. DSP control register 5 (DSPCTRL5)
0x0
0x0
0x0
Table 7. DSP control register 6 (DSPCTRL6)
Bit
0-11CHCCalibration register of current channel0x800
Config.DescriptionDefault
Table 8. DSP control register 7 (DSPCTRL7)
Bit
0-23OFVOffset compensation of voltage channel0x800
Config.DescriptionDefault
Table 9. DSP control register 8 (DSPCTRL8)
Bit
0-23OFCOffset compensation of current channel0x800
Config.DescriptionDefault
Offset on voltage and current is added to ADC sample in case of DC measurement, then if the bit BHPF for the
respective signal is set. Offset register LSB is equal to voltage or current sample register LSB.
Table 10. DSP control register 9 (DSPCTRL9)
Bit
12-21OFAOffset compensation of active wideband power0x0
22-31OFAFOffset compensation of active fundamental power0x0
Config.DescriptionDefault
UM2847 - Rev 1
page 10/20
UM2847
Metrology registers
Table 11. DSP control register 10 (DSPCTRL10)
BitConfig.DescriptionDefault
12-21OFROffset compensation of reactive power0x0
22-31OFSOffset compensation of apparent power0x0
Power offset is added to its respective power value to compensate error at low current. This register LSB is equal
to four times power register LSB:
LSB
Table 12. DSP interrupt register (DSPIRQ1)
BitConfig.DescriptionDefault
12AWB_SIf set, upon event occurrence an interrupt variable is set0x0
13AF_SIf set, upon event occurrence an interrupt variable is set0x0
14RE_SIf set, upon event occurrence an interrupt variable is set0x0
20C Signal StuckIf set, upon event occurrence an interrupt variable is set0x0
24V Signal StuckIf set, upon event occurrence an interrupt variable is set0x0
25V Freq ErrIf set, upon event occurrence an interrupt variable is set0x0
POFF
= 4*LSB
P
Table 13. DSP status register (DSPSR1)
Bit
12AWB_S
13AF_S
14RE_S
20C Signal Stuck
24V Signal Stuck
25V Freq Err
Config.DescriptionDefault
If set, active wideband power sign is negative
Set by the processing kernel, must be cleared by the application
If set, active fundamental power sign is negative
Set by the processing kernel, must be cleared by the application
If set, reactive power sign is negative
Set by the processing kernel, must be cleared by the application
If set, current signal bitstream is stuck to 1 or 0
Set by the processing kernel, must be cleared by the application
If set, current signal bitstream is stuck to 1 or 0
Set by the processing kernel, must be cleared by the application
If set, voltage frequency is out of the range [33 Hz, 83 Hz]
Set by the processing kernel, must be cleared by the application
0x0
0x0
0x0
0x0
0x0
0x0
Table 14. DSP live events register (DSPEV1)
Bit
12AWB_S
13AF_S
14RE_S
20C Signal StuckIf set, current signal bitstream is stuck to 1 or 00x0
Config.DescriptionDefault
If set, active wideband power sign is negative
Set and cleared by the processing kernel
If set, active fundamental power sign is negative
Set and cleared by the processing kernel
If set, reactive power sign is negative
Set and cleared by the processing kernel
0x0
0x0
0x0
UM2847 - Rev 1
page 11/20
BitConfig.DescriptionDefault
Set and cleared by the processing kernel
24V Signal Stuck
25V Freq Err
If set, current signal bitstream is stuck to 1 or 0
Set and cleared by the processing kernel
If set, voltage frequency is out of the range [33 Hz, 83 Hz]
Set and cleared by the processing kernel
3.3Register access through mini-shell
It is possible to access all the metrology data by connecting to the virtual serial COM port associated to the board
with the following settings:
•Baud rate: 115200
•Handshake: request to send
•Parity: none
•Data bits: 8
•Stop bits: 1
To communicate with the board use the command set in Table 15, where:
•<phase> could be 1, 2 or 3;
•<address> is the address or the register to read, as in the second column of the registers map in Figure 5 ;
•<n> is the number of registers to read, maximum is 70. Please consider that some of the registers are
unused, they are not listed in Figure 5 but are actually present in the memory structure. It is necessary to
take them into account when requesting a read or write access on several registers.
UM2847
Register access through mini-shell
0x0
0x0
Table 15. Minishell commands
CommandData received
met metro 0 1 <phase>Voltage Period
met metro 6 1 <phase> 1 1Current RMS
met metro 6 1 <phase> 2 1Voltage RMS
met metro 17 1 <phase> 1 1Fund Current RMS
met metro 17 1 <phase> 2 1Fund Voltage RMS
met metro 18 1 <phase> 1Current THD
met metro 18 1 <phase> 2Voltage THD
met metro 7 1 <phase>Phase shift
met metro 19 1 <phase>V - V delay
met metro 1 1 <phase> 11-ph Active WB power
met metro 1 1 <phase> 21-ph Active Fund power
met metro 1 1 <phase> 31-ph Reactive power
met metro 1 1 <phase> 41-ph Apparent power
met metro 2 1 <phase> 11-ph Active WB energy
met metro 2 1 <phase> 21-ph Active Fund energy
met metro 2 1 <phase> 31-ph Reactive energy
met metro 2 1 <phase> 41-ph Apparent energy
met metro 20 1 13-ph Active WB energy
met metro 20 1 23-ph Active Fund energy
met metro 20 1 33-ph Reactive energy
UM2847 - Rev 1
page 12/20
Register access through mini-shell
CommandData received
met metro 20 1 43-ph Apparent energy
met metro 21 1 <phase>All data
met rd <phase> <address> <Nb>Read < Nb > registers starting from <address>
met wr <phase> <address> <Nb> <data1> <data2> … <dataNb>
Write < Nb > registers starting from <address> ; <datax> is
the 32-bit register value to write
UM2847
UM2847 - Rev 1
page 13/20
4Accuracy results
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0.0010.010.1110100
3-ph AWB
phi = 0°phi = 60°phi =-60°
IEC Class 0.5 PF 0.5 LimitsIEC Class 0.5 PF 1 Limits
The board needs to be calibrated to get target accuracy. For this purpose, it is possible to use the procedure
indicated in application note AN4470, “The STPM3x and the STCOMET application calibration”.
All the design and calibration formulas apply to the STPMS2 application as well, using the AFE parameters
reported in Table 2 and the application constants in Table 16.
An excel file with all the related formulas is available on request.
ParameterValueUnitDescription
Vref1.2VVoltage reference value
Ai16Current channel gain
Au2Voltage channel gain
Cal_i0.875Calibrator mid value
Cal_v0.875Calibrator mid value
Dclk5000HzDecimation frequency
UM2847
Accuracy results
Table 16. Application constants
Some of the accuracy test results after calibration are reported below:
Figure 6. Active wideband energy error over full scale current input range
UM2847 - Rev 1
page 14/20
Figure 7. Current RMS error over full scale input range
-2.00%
-1.50%
-1.00%
-0.50%
0.00%
0.50%
1.00%
1.50%
2.00%
0.1110100
RMS Current
I1
I2
I3
UM2847
Accuracy results
UM2847 - Rev 1
page 15/20
Revision history
UM2847
Table 17. Document revision history
DateVersionChanges
10-Mar-20211Initial release.
UM2847 - Rev 1
page 16/20
UM2847
Contents
Contents
1Safety and operating instructions ..................................................2
Figure 6. Active wideband energy error over full scale current input range ................................. 14
Figure 7. Current RMS error over full scale input range .............................................. 15
UM2847 - Rev 1
page 19/20
UM2847
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. For additional information about ST trademarks, please refer to www.st.com/trademarks. 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.