SLAA638A august   2014  – may 2023 MSP430I2040 , MSP430I2041

 

  1.   1
  2.   Single Phase and DC Embedded Metering (Power Monitor) Using MSP430I2040
  3.   Trademarks
  4. Introduction
    1. 1.1 Safety and Precautions
    2. 1.2 Features
  5. Design Details
    1. 2.1 Block Diagram
    2. 2.2 Hardware Design
      1. 2.2.1 Interface Circuit
      2. 2.2.2 11
      3. 2.2.3 Shunt Resistor
      4. 2.2.4 Voltage Divider Circuit
      5. 2.2.5 Layout Consideration
      6. 2.2.6 Shunt Sensor Pad Design
    3. 2.3 Software Design
      1. 2.3.1 The Toolkit Package
      2. 2.3.2 Metrology Computation Engine
      3. 2.3.3 Background Process
      4. 2.3.4 Phase Correction
      5. 2.3.5 Frequency Measurement and Cycle Tracking
      6. 2.3.6 Cycle Tracking and Forground Process Triggering
      7. 2.3.7 Foreground Process
  6. Calibration Techniques
    1. 3.1 Introduction
    2. 3.2 Calibration Techniques
      1. 3.2.1 Calibration Setup
        1. 3.2.1.1 Apparatus
        2. 3.2.1.2 Setup
    3. 3.3 Calibration Procedures
      1. 3.3.1 Calibration of AC and DC Parameters
      2. 3.3.2 Calibration of Compensation Resistance and Capacitance
      3. 3.3.3 Calibration of Current AC Offset
      4. 3.3.4 Calibration of Voltage AC Offset
      5. 3.3.5 Calibration of Phase Correction
      6. 3.3.6 Calibration of DC Parameters
  7. Hardware Setup
    1. 4.1 Top View of the EVM
    2. 4.2 Bottom View of the EVM
    3. 4.3 Hardware Setup Procedures
      1. 4.3.1 Setting Up the Power Supply to EVM
      2. 4.3.2 Setting Up the Serial Communication Interface
      3. 4.3.3 Setting Up Line Input and Load Output
      4. 4.3.4 Setting Up the Debugging Interface
  8. Calibrator Software
    1. 5.1 Software Package Content
    2. 5.2 Setting Up the PC Software Tool
      1. 5.2.1 Minimum System Requirement
      2. 5.2.2 Installing the Software
      3. 5.2.3 Configuring the Software
    3. 5.3 Instruments
  9. Operating the PC Software Tool
    1. 6.1 Introduction
    2. 6.2 Start Using the EVM
    3. 6.3 Known Issues
  10. Serial Communication Commands
    1. 7.1 Introduction
    2. 7.2 Communication Protocol
      1. 7.2.1 Polling Mode
        1. 7.2.1.1 Command and Respond Frame
    3. 7.3 Commands
      1. 7.3.1  HOST_CMD_GET_METER_NAME
        1. 7.3.1.1 Command Format
      2. 7.3.2  HOST_CMD_GET_METER_VER
        1. 7.3.2.1 Command Format
      3. 7.3.3  HOST_CMD_GET_METER_CONFIGURATION
        1. 7.3.3.1 Command Format
        2. 7.3.3.2 Parameter Definition
      4. 7.3.4  HOST_CMD_GET_RTC
        1. 7.3.4.1 Command Format
      5. 7.3.5  HOST_CMD_ALIGN_WITH_CALIBRATION_FACTORS
        1. 7.3.5.1 Command Format
      6. 7.3.6  HOST_CMD_SET_PASSWORD
        1. 7.3.6.1 Command Format
      7. 7.3.7  HOST_CMD_GET_READINGS_PHASE_N
        1. 7.3.7.1 Command Format
      8. 7.3.8  HOST_CMD_GET_EXTRA_READINGS_PHASE_N
        1. 7.3.8.1 Command Format
      9. 7.3.9  HOST_CMD_SUMCHECK_MEMORY
        1. 7.3.9.1 Command Format
      10. 7.3.10 HOST_CMD_CLEAR_CALIBRATION_DATA
        1. 7.3.10.1 Command Format
      11. 7.3.11 HOST_CMD_SET_CALIBRATION_PHASE_N
        1. 7.3.11.1 Command Format
      12. 7.3.12 HOST_CMD_GET_CALIBRATION_PHASE_N
        1. 7.3.12.1 Command Format
      13. 7.3.13 HOST_CMD_SET_CALIBRATION_EXTRAS
        1. 7.3.13.1 Command Format
      14. 7.3.14 HOST_CMD_GET_CALIBRATION_EXTRAS
        1. 7.3.14.1 Command Format
  11. Firmware and Embedded Metering Library API
    1. 8.1 Introduction
    2. 8.2 Embedded Metering LIbrary API
      1. 8.2.1 Embedded Metering Library Function Calls
        1. 8.2.1.1 Functions for Metrology Engine Control
          1. 8.2.1.1.1 Functions for Metrology Engine Control
          2.        int metrology_init (void)
          3.        int metrology_init_from_nv_data (void)
          4.        void align_metrology_with_calibration_data (void)
          5.        void metrology_switch_to_normal_mode (void)
          6.        void metrology_init_analog_front_end_normal_mode (void)
          7.        void metrology_disable_analog_front_end (void)
        2. 8.2.1.2 Procedure for Metrology Engine Initialization
        3. 8.2.1.3 Functions for Calculate and Reading the Readings
          1. 8.2.1.3.1 Functions for Calculate and Reading the Readings
          2.        power_t calculate_phase_readings (void
          3.        power_t active_power (int ph)
          4.        power_t reactive_power (int ph)
          5.        power_t apparent_power (int ph)
          6.        power_t fundamental_active_power(int ph)
          7.        power_t fundamental_reactive_power(int ph)
          8.        power_factor_t power_factor (int ph)
          9.        rms_voltage_t rms_voltage (int ph)
          10.        rms_voltage_t fundamental_rms_voltage(int ph)
          11.        thd_t voltage_thd(int ph)
          12.        rms_current_t rms_current (int ph)
          13.        rms_current_t fundamental_rms_current(int ph)
          14.        thd_t current_thd(int ph)
          15.        int16_t mains_frequency (int ph)
          16.        uint16_t phase_status (int ph)
      2. 8.2.2 Embedded Metering LIbrary Callbacks
      3. 8.2.3 Application Level Calibration Functions
        1. 8.2.3.1 Functions for Reading and Writing Calibration Parameters
          1. 8.2.3.1.1 Functions for Reading and Writing Calibration Parameters
          2.        int get_calibration_status (void)
          3.        void set_calibration_status (int value)
          4.        int clear_calibration_data (void)
          5.        int16_t get_temperature_intercept (void)
          6.        int16_t get_temperature_slope (void)
          7.        void set_temperature_parameters (int16_t temperature_at_calibration, int16_t temperature_sensor_intercept, int16_t temperature_sensor_slope)
          8.        calibration_scaling_factor_t get_P_scaling (int phx)
          9.        void set_P_scaling (int phx, calibration_scaling_factor_t value)
          10.        calibration_scaling_factor_t get_V_rms_scaling (int phx)
          11.        void set_V_rms_scaling (int phx, calibration_scaling_factor_t value)
          12.        int16_t get_v_dc_estimate (int phx)
          13.        int16_t get_initial_v_dc_estimate (int phx)
          14.        void set_v_dc_estimate (int phx, int16_t value)
          15.        int32_t get_v_ac_offset (int phx)
          16.        void set_v_ac_offset (int phx, int32_t value)
          17.        calibration_scaling_factor_t get_I_rms_scaling(int phx);
          18.        void set_I_rms_scaling(int phx, calibration_scaling_factor_t value);
          19.        int32_t get_i_dc_estimate(int phx);
          20.        int32_t get_initial_i_dc_estimate(int phx)
          21.        void set_i_dc_estimate(int phx, int32_t value);
          22.        int32_t get_i_ac_estimate(int phx);
          23.        void set_i_ac_offset (int phx, int32_t value)
          24.        uint16_t get_compensate_capacitor_value (int phx)
          25.        void set_compensate_capacitor_value (int phx, uint16_t value)
          26.        uint16_t get_compensate_resistance (int phx)
          27.        void set_compensate_resistance (int phx, uint16_t value)
          28.        int16_t get_phase_corr (int phx)
          29.        void set_phase_corr (int phx, int16_t value)
      4. 8.2.4 Setting Default Calibration Parameters
  12. Example Application Code
    1. 9.1 Introduction
    2. 9.2 Preparing the Application Code to Run
    3. 9.3 Downloading Without an IAR License
  13. 10Hardware Design Files
    1. 10.1 PACKAGE
    2. 10.2 Schematic
  14. 11EVM Specification and Performance
    1. 11.1 EVM Specifiction
  15. 12Running on MSP430i2040 and MSP430i2041
    1. 12.1 164
  16. 13Revision History

Setting Default Calibration Parameters

Being part of metrology but not the metrology itself, the calibration parameter default values reading and manipulation functions are provided as source code in the application level. The user-defined default parameter is defined in “metrology-calibration-template.h” and “metrology-capacitor-compensation.h”.

Note:

The file “metrology-calibration-defaults.c” provides the source code level support for default values to be put into the flash. Unless the code is thoroughly understood, do not modify the code in this file.

  • DEFAULT_TEMPERATURE_INTERCEPT

    ADC reading at the calibration temperature in 16 bits scale

  • DEFAULT_TEMPERATURE_SLOPE

    ADC counts per 1° Celsius increment

  • DEFAULT_ROOM_TEMPERATURE

    Calibration temperature in 0.01° C unit

  • DEFAULT_BASE_PHASE_A_CORRECTION

    The phase correction between voltage and current channel due to hardware.

  • DEFAULT_P_SCALE_FACTOR_A

    Power scaling factor

  • DEFAULT_V_RMS_SCALE_FACTOR_A

    Voltage scaling factor

  • DEFAULT_V_DC_ESTIMATE_A

    DC offset of voltage channel ADC

  • DEFAULT_V_AC_OFFSET_A

    Square of estimated noise level on voltage channel ADC (so small to be noticeable, usually put 0).

  • DEFAULT_I_RMS_SCALE_FACTOR_A

    Current scaling factor

  • DEFAULT_I_DC_ESTIMATE_A

    DC offset of current channel ADC

  • DEFAULT_I_AC_OFFSET_A

    Square of estimated noise level on voltage channel ADC (usually put 0), calculated as:

    Equation 26. GUID-AF1194DA-254F-4996-B817-075E336B0315-low.gif
  • DEFAULT_EMI_FILTER_CAP_UF_A

    EMI filter capacitance in 1/64 µF unit, Maximum 1023 (15.984375 µF)

    Putting value greater than 0x8000 results in no EMI filter compensation done.

  • DEFAULT_WIRE_RESISTANCE_A

    Estimate wire resistance in 1/256 Ω unit, Maximum 255 (0.99609375 Ω)

  • METER_NAME

    Defines the name of the meter as reported by HOST_CMD_GET_METE_NAME and is defined as in the provided example code "MSP430I2040SUBMETEREVM.

  • METER_SOFTWARE_VERSION

    Defines the software version of the meter as reported by HOST_CMD_GET_METE_VER.

  • METER_METROLOGY_VERSION

    Defines the Metrology library version of the meter as reported by HOST_CMD_GET_METE_VER.

  • METER_PROTOCOL_VERSION

    Defines the Protocol version of the meter as reported by HOST_CMD_GET_METE_VER.