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

The example IAR project has been configured for MSP430i2041. To run on MSP430i2040, follow these steps once:

  1. Open the workspace. After launching IAR 5.5, select FileOpenWorkspace.
    GUID-67253D12-2C0F-40F0-8F1A-55231336894F-low.png Figure 12-1 IAR 5.5 Launch Window

    When prompted to open the project, select emeters.eww from the project directory of the example code.

    GUID-188C998E-CF05-46B6-AC6B-D2195257D393-low.png Figure 12-2 Open Workspace Window
  2. Set the option. Right click on the project emeter-app-i2041 and select Options...
    GUID-11B9B513-C699-4EDF-BECC-09D45F1AD7A0-low.pngFigure 12-3 Workspace Options

    In the Options window, click on General Options on the left-hand column and then select the Target tab. Then, in the Device section, click on the right-hand side button of the entry box and select MSP430Ixxxx FamilyMSP430I2040.

    GUID-D999FD65-0A3B-491E-8614-2FB144ECAC6F-low.pngFigure 12-4 Options Window

    Click on Linker in the left-hand column and select the Config tab. Then click on the right-hand button in the Linker configuration file box.

    GUID-A1B63736-D493-408A-A319-20B52CEB5327-low.pngFigure 12-5 Config Tab

    Select lnk430i2040_temp.xcl when prompted and click Open.

    GUID-07C29289-4E6E-4211-9482-51B574355BC9-low.pngFigure 12-6 Selecting Default XCL File

    When brought back to the Options window, click OK.

    GUID-284FC399-C9D3-4B89-AFFA-2E7143CDA9CC-low.pngFigure 12-7 Finishing the Setting Changes

    When brought back to the main screen, select FileSave to save the setting.

    GUID-D64F3791-58A8-487E-A514-3C2FD494CB76-low.pngFigure 12-8 Saving the Setting Changes

The project is now set for run on MSP430i2040. To have the project to run back on MSP430i2041, follow the same steps except to select MSP430Ixxxx Family→MSP430I2041 in the Options window and select lnk430i2041_temp.xcl when prompted in the Linker configuration file box.