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

Layout Consideration

Though the circuit design of the external circuit is very simple, there are a few points to note in the PCB layout and component placement to achieve best accuracy. Figure 2-3 and Figure 2-4 shows the layout of top and bottom layer, respectively. The principle to keep in mind for the layout and placement is simple:

  • The critical circuit are the two sets of interface filter circuit.
  • The signal from the sensor to the input of the SD24 is differential no matter what.
  • Separate the analog and digital ground, connect back together at power supply ground.
  • Have ground plane around the analog signal as possible to protect against interference.

Now going back to the layout, note that inside the green rectangle on Figure 2-3 are the interface circuit for the voltage sensor and the shunt senor. The placement of this circuit (compose of R10, R11, C12, C13, C14 for voltage sensor, R8, R9, C8, C9, C10) should be arranged to place similar to the way it is drawn on the schematic. Doing this helps to protect the differential nature of the signal while passing through the interface filter circuit.

Inside the yellow rectangle on Figure 2-3 and Figure 2-4 shows that the differential signal pair leaving the interface filter should be closely side-by-side and surrounded by the analog ground plane on their side (of course, it is not always possible).

Although R15, R6, L1 has one terminal essentially connected to AGND, it is important to treat each as a separate signal connecting to AGND with a single point (Cyan circled in Figure 2-4 shows the connection of R15 to AGND just with a single track). In fact, this way of layout also applies to the connection to C12, C13, C8, C9. This helps the circuit to stay independent (neither the voltage signal nor the current signal has a path interfering the other) and free from the noise flowing in the ground plane.

The ground plane is designed such that it surrounds most of the analog circuit. Doing this with i2040 is easy since the analog signal pins are grouped together on a side of the package. Moreover, many via are added on the ground plane so that the top and bottom ground plane are closely tied together and provides stronger noise protection.

GUID-D9B0F4C6-B8F8-40F5-94B0-0F99EBB915CE-low.pngFigure 2-3 Top Layout
GUID-0B7AE722-9847-421B-BA12-241F70DA760B-low.pngFigure 2-4 Bottom Layout