TIDUF25 june   2023 ADS131M08 , MSPM0G1507

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 End Equipment
    2. 1.2 Electricity Meter
    3. 1.3 Power Quality Meter, Power Quality Analyzer
    4. 1.4 Key System Specifications
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
      1. 2.2.1 External Supply Voltage Supervisor (SVS) With TPS3840
      2. 2.2.2 Magnetic Tamper Detection With TMAG5273 Linear 3D Hall-Effect Sensor
      3. 2.2.3 Analog Inputs
        1. 2.2.3.1 Voltage Measurement Analog Front End
        2. 2.2.3.2 Current Measurement Analog Front End
    3. 2.3 Highlighted Products
      1. 2.3.1  ADS131M08
      2. 2.3.2  MSPM0G3507
      3. 2.3.3  MSP430FR4131 for Driving Segmented LCD Displays
      4. 2.3.4  TPS3840
      5. 2.3.5  THVD1400
      6. 2.3.6  ISO6731
      7. 2.3.7  ISO6720
      8. 2.3.8  TRS3232E
      9. 2.3.9  TPS709
      10. 2.3.10 TMAG5273
  9. 3System Design Theory
    1. 3.1  How to Implement Software for Metrology Testing
    2. 3.2  Clocking System
    3. 3.3  UART Setup for GUI Communication
    4. 3.4  Real-Time Clock (RTC)
    5. 3.5  LCD Controller in MSP430FR4131
    6. 3.6  Direct Memory Access (DMA)
    7. 3.7  ADC Setup
    8. 3.8  Foreground Process
      1. 3.8.1 Formulas
    9. 3.9  Background Process
    10. 3.10 Software Function per_sample_dsp()
      1. 3.10.1 Voltage and Current Signals
      2. 3.10.2 Frequency Measurement and Cycle Tracking
    11. 3.11 LED Pulse Generation
    12. 3.12 Phase Compensation
  10. 4Hardware, Software, Testing Requirements, and Test Results
    1. 4.1 Required Hardware and Software
      1. 4.1.1 Hardware
      2. 4.1.2 Cautions and Warnings
    2. 4.2 Test Setup
      1. 4.2.1  Connecting the TIDA-010243 to the Metering Test Equipment
      2. 4.2.2  Power Supply Options and Jumper Settings
      3. 4.2.3  Electricity Meter Metrology Accuracy Testing
      4. 4.2.4  Viewing Metrology Readings and Calibration
        1. 4.2.4.1 Viewing Results From LCD
        2. 4.2.4.2 Calibrating and Viewing Results From PC
      5. 4.2.5  Calibration and FLASH Settings for MSPM0+ MCU
      6. 4.2.6  Gain Calibration
      7. 4.2.7  Voltage and Current Gain Calibration
      8. 4.2.8  Active Power Gain Calibration
      9. 4.2.9  Offset Calibration
      10. 4.2.10 Phase Calibration
      11. 4.2.11 Software Code Example
    3. 4.3 Test Results
      1. 4.3.1 SVS Functionality Testing
      2. 4.3.2 Electricity Meter Metrology Accuracy Results
  11. 5Design and Documentation Support
    1. 5.1 Design Files
      1. 5.1.1 Schematics
      2. 5.1.2 BOM
      3. 5.1.3 PCB Layout Recommendations
      4. 5.1.4 Layout Prints
      5. 5.1.5 Gerber Files
    2. 5.2 Tools and Software
    3. 5.3 Documentation Support
    4. 5.4 Support Resources
    5. 5.5 Trademarks
  12. 6About the Author

Calibration and FLASH Settings for MSPM0+ MCU

Calibration is key to any meter performance, and calibration is absolutely necessary for every meter to go through this process. Initially, every meter exhibits different accuracies due to silicon-to-silicon differences, sensor accuracies, and other passive tolerances. To nullify their effects, every meter must be calibrated. To perform calibration accurately, there must be an accurate AC test source and a reference meter available. The source must be able to generate any desired voltage, current, and phase shifts (between V and I). To calculate errors in measurement, the reference meter acts as an interface between the source and the meter being calibrated. This section discusses a simple and effective method of calibration of this 3-phase electricity meter design.

The GUI used for viewing measurement results can also easily be used to calibrate the design. During calibration, parameters called calibration factors are modified in the test software to give the least error in measurement. For this meter, there are six main calibration factors for each phase: voltage scaling factor, active power offset (erroneously called voltage AC offset in the GUI), current scaling factor, reactive power offset (erroneously called current AC offset in the GUI), power scaling factor, and the phase compensation factor. The voltage, current, and power scaling factors translate measured quantities in metrology software to real-world values represented in volts, amps, and watts, respectively. The power offset is used to subtract voltage to current crosstalk, which appears as a constant power offset and causes greater inaccuracies at lower currents. Note that offset calibration was not used for testing this specific design. The last calibration factor is the phase compensation factor, which is used to compensate any phase shifts introduced by the current sensors and other passives. Note that the voltage, current, and power calibration factors are independent of each other. Therefore, calibrating voltage does not affect the readings for RMS current or power.

When the meter software is flashed on the MSPM0G3507 device for the first time, default calibration factors are loaded into these calibration factors. Calibration factors or values are modified through the GUI during calibration. The calibration factors are also stored in the last MSPM0+ MCU FLASH sector and therefore, remain the same if the meter is restarted.

The settings are defined in the mspm0g3507.cmd file using one of the following:

  • #define CALIBRATION_START_ADDR (TOTAL_FLASH_SIZE - TOTAL_FLASH_SIZE)
  • 0x1FC00 being the start address of the last FLASH area sector, when TOTAL_FLASH_SIZE =0x20000 and FLASH_SECTOR_SIZE = 0x400

In addition, all 5 FLASH access routines must be placed into the RAM area because when calibration takes place, multiple read and write operations to the last FLASH sector are executed.

This is achieved using a compiler directive in the "flash_M0G.h" file, for example:

void __attribute__((section(".ramfunc"))) flash_clr_calibration(void);

Because MSPM0+ MCUs FLASH memory is 64-bit aligned, all alignments for data in the FLASH memory are 64-bit or palign(8), as seen in the "mspm0g3507.cmd" file.

.rodata : palign(8) {} > FLASH

.caldata : palign(8) {} > CALIBRATION

Calibrating any of the scaling factors is referred to as gain correction. Calibrating the phase compensation factors is referred to as phase correction. For the entire calibration process, the AC test source must be ON, meter connections consistent with Figure 4-2, and the energy pulses connected to the reference meter.