TIDUFB8 December   2024

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 Key System Specifications
    2. 1.2 End Equipment
    3. 1.3 Electricity Meter
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
      1. 2.2.1 Voltage Measurement – Analog Front End
      2. 2.2.2 Current Measurement Analog Front End
      3. 2.2.3 Input Voltage
      4. 2.2.4 Clock
    3. 2.3 Highlighted Products
      1. 2.3.1 AMC130M02
      2. 2.3.2 MSPM0G1106
      3. 2.3.3 LMK6C
      4. 2.3.4 TLV76133
  9. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Hardware Requirements
    2. 3.2 Software Requirements
      1. 3.2.1 Formulas
      2. 3.2.2 Metrology Software Process
        1. 3.2.2.1 UART for PC GUI Communication
        2. 3.2.2.2 Direct Memory Access (DMA)
        3. 3.2.2.3 ADC Setup
        4. 3.2.2.4 Foreground Process
        5. 3.2.2.5 Background Process
        6. 3.2.2.6 Software Function per_sample_dsp ()
        7. 3.2.2.7 Frequency Measurement and Cycle Tracking
        8. 3.2.2.8 LED Pulse Generation
    3. 3.3 Test Setup
      1. 3.3.1 Power Supply and Jumper Settings
      2. 3.3.2 Viewing Metrology Readings and Calibration
      3. 3.3.3 Calibration
        1. 3.3.3.1 Voltage and Current Offset Calibration
        2. 3.3.3.2 Voltage and Current Gain Calibration
        3. 3.3.3.3 Active Power Gain Calibration
        4. 3.3.3.4 Offset Calibration
        5. 3.3.3.5 Phase Calibration
    4. 3.4 Test Results
      1. 3.4.1 Electricity Meter Metrology Accuracy Results
  10. 4Design and Documentation Support
    1. 4.1 Design Files
      1. 4.1.1 Schematics
      2. 4.1.2 BOM
      3. 4.1.3 PCB Layout Recommendations
        1. 4.1.3.1 Layout Prints
      4. 4.1.4 Altium Project
      5. 4.1.5 Gerber Files
      6. 4.1.6 Assembly Drawings
    2. 4.2 Tools and Software
    3. 4.3 Documentation Support
    4. 4.4 Support Resources
    5. 4.5 Trademarks
  11. 5About the Author

Foreground Process

The foreground process includes the initial setup of the MSPM0+ MCU hardware and software and AMC130M02 registers immediately after a device RESET. Figure 3-2 shows the flow chart for this process

TIDA-010960 Foreground Process Figure 3-2 Foreground Process

The initialization routines involve the setup of the MSPM0G1106:

  • General purpose input/output (GPIO) port pins
  • Clock system (MCLK or CPU clock, RTC clock, SPI clock, CLK_OUT pin)
  • 2 UART port
  • 4 DMA channels, one each per SPI receive and transmit and one each per UART receive and transmit
  • AMC130M02 registers
  • Metrology variables

After the hardware is set up, any received frames from the GUI are processed. Next, the foreground process checks whether the background process has notified the foreground process to calculate new metrology parameters for any voltage-current mappings. This notification is accomplished through the assertion of the PHASE_STATUS_NEW_LOG status flag whenever a frame of data is available for processing. The data frame consists of the processed dot products that were accumulated for CYCLES_PER_COMPUTATION number of cycles of data. The value for CYCLES_PER_COMPUTATION is 10 cycles when the nominal frequency setting in the software is 50Hz and 12 cycles when the nominal frequency setting in the software is set to 60Hz. When the measured line frequency is equal to the nominal frequency of the design, this is equivalent to 200 milliseconds of accumulated data.

The processed dot products include the VRMS, IRMS, active power, reactive power, fundamental voltage, fundamental active power, and fundamental reactive power. These dot products are used by the foreground process to calculate the corresponding metrology readings in real-world units. All the processed dot products are accumulated in separate 64-bit registers to further process and obtain the RMS and mean values. The apparent power is calculated using the calculated values of active and reactive power of the foreground process,.

Similarly – using the calculated values of the foreground for the fundamental voltage, fundamental reactive power, and fundamental active power, the fundamental current, fundamental apparent power – voltage THD, and current THD are calculated. Additionally, voltage underdeviation and voltage overdeviation are calculated using the value of the calculated RMS voltage and the defined nominal voltage of the design. The frequency (in Hz) and power factor are also calculated using parameters calculated by the background process using the formulas in Section 3.2.1.