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