UM1719 User manual The STPM3x evaluation software Introduction The STPM3x evaluation software is a graphical user interface to read, configure and calibrate the STPM3x energy metering ICs, suitable for parallel and USB hardware interfaces. The application has a unique work area where the user can read the device’s registers and write configuration and calibration parameters. A specific device can be selected and application parameters (such as sensor sensitivity, crystal oscillator frequency) can be configured to calculate measured power, current and voltage. Data acquisition can be customized to read either a single or a number of data samples from the device. The reading data can be output in table format and saved as an excel file. Wizard tools are provided to guide the user during the application design and automatically calibrate the device. At any time, the current session data can be saved in a project, an existing project can be opened or a new project can be created. Figure 1. STPM3x evaluation software screenshot GIPGLM0801141235 January 2014 DocID025787 Rev 1 1/18 www.st.com Contents UM1719 Contents 1 2 3 4 5 2/18 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Hardware programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1 Application setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 Application tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Application work area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1 Device selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 Calculated values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.3 Status bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.4 Log tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.5 Configuration bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.6 Command area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.6.1 Read button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.6.2 The reading of samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6.3 Write button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6.4 Single read and write transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6.5 Reset button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6.6 Clear SS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.6.7 Clear status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Application menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.1 File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.1 Design wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.2 Calibration wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.3 Sag and swell threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 DocID025787 Rev 1 UM1719 Introduction 1 Introduction 1.1 Prerequisites This evaluation software is a window-based application and requires .NET framework 2.0. It is possible to free download and install this framework from www.microsoft.com. 1.2 Hardware programmer The STPM3x evaluation software can be used with: • Parallel hardware interface • USB isolated hardware interface (available as a separate evaluation board, the STEVAL-IPE023V1) • UART board interface (available as a tool to connect evaluation boards or, for the STPM3x evaluation board, by UART cable) DocID025787 Rev 1 3/18 Getting started UM1719 2 Getting started 2.1 Application setup The setup file guides through the software installation. Double-click on the setup file to start the installation (Figure 2) and follow the guided process. Figure 2. Welcome GIPGLM0801141239 Application setup may also install virtual com drivers for the STEVAL-IPE023V1 USB interface. Note: In the application folder, the file STPMxxProg.dfu is also downloaded. If the USB interface is used, its firmware must be updated by DfuSe application (http://www.st.com). 2.2 Hardware setup In case of parallel programmer, to communicate with the device through the evaluation software, follow below steps: 1. Connect the evaluation board to the parallel programmer 2. Connect the programmer to the PC through a parallel cable 3. Power on the evaluation board In case of USB interface (STEVAL-IPE023V1), follow below procedure: 1. Plug the USB port in the PC 2. Do not power on the STPM3x board 3. While the red led is lighted, connect the STPM3x board to the USB interface This procedure assures that the STPM3x SPI (instead of UART) communication interface is correctly selected when the device starts up. 4/18 DocID025787 Rev 1 UM1719 2.3 Getting started Application tour To start working with the STPM3x evaluation board: 1. Open the STPM3x evaluation software 2. Select the menu Option - Interface - Parallel, USB or UART according to the chosen hardware programmer (see Section 1.2) 3. Configure the application parameters selecting Option - Configuration menu (see Section 4.2) 4. Now you are ready to read, write (see Section 3.6) or calibrate your application (see Section 4.3) DocID025787 Rev 1 5/18 Application work area 3 UM1719 Application work area The application work area is divided into several sections logically grouping the relevant information of the device. In this way, the status of the device and the data of registers are always available to the user at a single glance. Figure 3. Application work area GIPGLM0801141240 3.1 Device selection On the top left of the work area, a group-box is available to select the device. The application work area changes according to the selected device’s features. 3.2 Calculated values On the topmost section of the work area, all data are available, such as: 1. Energy and power values 2. RMS and instantaneous (wide-band and fundamental) values of voltage and current 3. Line voltage frequency 4. Information about sag and swell events Status and event bit check boxes are close to the information they refer to; event bits are read only, because they are updated by the device DSP, while status bits are enabled since they are set by the DSP but they must be cleared by the user. He can clear status bits either unchecking the single check box and then pressing the "Write" button (the configuration and 6/18 DocID025787 Rev 1 UM1719 Application work area status bits are written as shown in the GUI) or pressing the "Clear Status" button in the command area. 3.3 Status bits Tamper status bits, SPI and UART status bits are shown on the left of the form. The user can clear status bits either unchecking the single check box and then clicking on the "Write" button (the configuration and status bits are written as shown in the GUI) or pressing the "Clear Status" button in the command area. 3.4 Log tab The log tab displays registers and application messages as they are read from the device. 3.5 Configuration bits In the configuration area, divided into several tabs, all device configuration bits can be read and written. These bits are automatically updated every time the device is read. To set or clear a configuration bit, the user should select the desired value from the check box or combo-box, then use the button "Write" from the command area. Note: All configuration bits are written at the same time. 3.6 Command area The command buttons to read, write, reset the device, clear status bits and sag-swell event information are in this area. 3.6.1 Read button The “Read” button performs the latch and reading of all data, status and configuration registers. The device can be read once or continuously by checking/unchecking the “Continuous” check box. The time (in ms) can be also set between two readings through the “Interval” numeric text box. DocID025787 Rev 1 7/18 Application work area 3.6.2 UM1719 The reading of samples To perform the reading of samples, the "Samples" check box has to be checked, then the "Read" button has to be pressed. It is possible to choose: • the number of samples ("Readings" numeric text box) • the delay between samples readings ("Delay" numeric text box). If the USB interface is selected, the reading interval is expressed in μs, since, in this case, the USB board microcontroller can collect all readings and then download all values to the PC • First register is the first data register by default (configuration registers in the first part of the memory are not sampled) • Last register is the last data register by default After the samples reading is completed, a form (see Figure 4) is opened displaying in a grid all data taken from registers and the corresponding energy values in two different tabs. Data contained in the read registers are displayed only. Sampled data can be filtered through the filter form opened by the "Filter" - "Filter Results" menu item. All filters can be reset by the "Filter" - "Reset filters" menu item. Sampled data can be exported to excel by selecting one of the "Export Data" menu options. 3.6.3 Write button "Write" button allows the configuration and status bits, shown in the GUI, to be written. 3.6.4 Single read and write transaction The "Write" button allows all configuration registers to be written at the same moment. Thanks to this form, several read/write transactions can be performed by specifying read and write addresses and hexadecimal content of the register to write. Selecting "None" check box means that the correspondent address is the "dummy" 0xFF address. The CRC (cyclic redundancy check) is automatically calculated by the GUI and displayed when the "GO" button is pressed. The "GO" button starts the single read/write transaction. The received data and CRC are then displayed in the text box below. Note: The read address sets the device read pointer of the next transaction. This means that received data during the second transaction are taken from the register, at the address sent during the first transaction. 3.6.5 Reset button The reset button performs a software reset of the device (sets all configuration bits to default and restarts all energy counters). The reset can be performed in different ways, according to the hardware interface: 8/18 1. Send two pulses onto SYN (for UART and parallel interfaces) 2. Write the "SW RESET" bit in DSP_CR3 (for USB hardware interface) DocID025787 Rev 1 UM1719 3.6.6 Application work area Clear SS This button sends the device the command to reset sag and swell event history bits, writing "Clear SAG-SWELL" bits (bits n.4 in DSP_CR1 and DSP_CR2 for primary and secondary channels respectively). 3.6.7 Clear status This button clears both the DSP_SR1 and the DSP_SR2 status register. DocID025787 Rev 1 9/18 Application menu UM1719 4 Application menu 4.1 File From the "File" menu it is possible to: • Open: open an existing .stpm3x file • Save: save data in the current .stpm3x file • Save as: save data in a new .stpm3x file • Exit: quit the application The file .stpm3x contains: 4.2 • Configuration bits • Application parameters set as in the "Configuration" form (see Section 4.2 below) Options • Interface: to open the communication with the device, select the proper hardware interface: – “Parallel" for the parallel hardware interface. Select one of the default LPT ports or insert a different port address. – “USB" if the STEVAL-IPE023V1 is used. When the board is plugged, virtual com drivers map the USB interface as new com. Verify its number in the device manager and select it; the small arrow button on the right refreshes the port list. – "UART" if the device is connected using UART. Select the proper com port, the device default baud rate is 9600, so this value must be selected for the communication. Press "Open" to start the communication with the device or "Close" to close the communication. Once the interface is selected "Advanced" button allows device parameters to be written, impacting the communication (Baud Rate, CRC polynomial, etc). • Configuration This form allows the application – 10/18 Application: to correctly transform data coming from the device into meaningful values, the basic parameters of the board have to be configured, such as: resistors of the voltage divider, current sensor sensitivity, voltage and channel amplification gains. As far as the STPM34 and STPM33 are concerned both channels must be configured; each channel can be selected through a combobox. The "Apply" button is used to save the channel data and "Cancel" is used to exit without applying changes. If a connection interface has been selected, the "Apply" button also writes the channel gain configuration on the device. DocID025787 Rev 1 UM1719 Application menu Figure 4. Configuration - application tab GIPGLM0801141241 – STPM3x: in this tab, all internal device parameters with their values are reported. These parameters are used in the conversion of registers. Figure 5. Configuration - STPM3x tab GIPGLM0801141255 DocID025787 Rev 1 11/18 Application menu 4.3 Tools 4.3.1 Design wizard UM1719 This tool helps the application design and it is a preliminary step of the calibration process. By setting the application parameters and selecting a design method, all ratings of the meter are calculated. Figure 6. Application design GIPGLM0801141258 As to the STPM34 and STPM33, the channel can be selected through a combo-box. The user is asked to input the current sensor type (if CT/Shunt or Rogowski Coil), the calibration working point (nominal voltage, current and frequency of the line), some board parameters and the target value of P (number of pulses per kWh from the LED pin). This is the default value; in fact it can be scaled by configuration bits. The choice of a design method is required to calculate one of the analog front end components. A target value is suggested for this component, and its real value should be chosen as closer as possible to it. Once all these data are input, the “Output” section gives some information about the meter ratings, such as output frequencies, voltage and current maximum ratings and target values of RMS registers at specified load (Xi and Xu). Use the “Apply” button to save the channel data and “Cancel” to exit without applying changes. If a connection interface has been selected, the "Apply" button also writes the channel gain configuration on device. The “Go To Calibration” button opens the calibration wizard form, if a hardware interface is selected. 4.3.2 Calibration wizard The calibration wizard consists of four steps. In the first one, shown in Figure 7, the user has to insert the board parameters and the working point for calibration. First three steps of calibration are those implemented in the design wizard. 12/18 DocID025787 Rev 1 UM1719 Application menu One voltage/current channel can be calibrated at a time, through the channel combo-box. Figure 7. Calibration wizard - working point setting GIPGLM0801141300 In the second step (Figure 8), the user has to select a design method, choose mutually compatible sensor sensitivities for voltage and current so to achieve the calibration. Figure 8. Calibration wizard - design method GIPDLM0801141304 DocID025787 Rev 1 13/18 Application menu UM1719 The third step resumes some of the board parameters, the meter ratings and some target outputs at the selected load: the frequency of LED pin and the hexadecimal values of RMS voltage and current reading. Figure 9. Calibration wizard - target values GIPGLM0801141307 Filling in the mask, by indicating the value of the component mounted on the board, (R1 or Ks according to the design method) allows a later correct calculation of voltage, current and energy values. The last step, in Figure 10, requires the board to be connected to PC through a communication interface (selected by "Option" - "Interface" menu) and also connected to the selected load. Select the number of samples to average and the delay between two samples. Pressing the “Calibrate” button, the calibration procedure starts and it consists of: • Writing device configuration bits and setting calibrators in the middle of the range • Reading and averaging samples of voltage and current RMS • Calculating the calibrators to reach the target measure calculated above If the calibrators are out of range (error on one or both RMS values is greater than the correction range) the user goes back and modifies board parameters and/or the constant pulse to achieve calibration. Once the calibration process is completed correctly, go back to the first page to calibrate the other channel. 14/18 DocID025787 Rev 1 UM1719 Application menu Figure 10. Calibration wizard - calibration completed GIPDLM0801141312 To close the process, press “Write CFG” to write all calibrators in memory and return to the main form. 4.3.3 Sag and swell threshold Thresholds for voltage sag and current, voltage swell event detection inside the device are referred to instantaneous values. The form, shown below, allows the user to calculate thresholds from RMS values, and the sag time threshold as well. Analog front end parameters set in the configuration form impact these calculations. Use the "Apply" button to configure the device and "Cancel" to exit without applying changes. DocID025787 Rev 1 15/18 Application menu UM1719 Figure 11. Sag and swell threshold GIPGLM0801141314 16/18 DocID025787 Rev 1 UM1719 5 Revision history Revision history Table 1. Document revision history Date Revision 29-Jan-2014 1 Changes Initial release. DocID025787 Rev 1 17/18 UM1719 Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2014 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 18/18 DocID025787 Rev 1