SLAA638A august 2014 – may 2023 MSP430I2040 , MSP430I2041
Three Sigma-Delta ADC on the MCU are used in this design: one for voltage measurement, one for current measurement, and the other one connects to the built-in temperature sensor for temperature measurement. The Sigma-Delta ADC is running at approximately 1.024 MHz modulator frequency fixed by the hardware, the sample frequency is derived from the modulator frequency divided by 128 equals 8 kHz that give us Nyquist bandwidth of 4 kHz. This bandwidth is sufficient to cover the 66th harmonic for 60Hz AC, 80th harmonic for 50Hz AC frequency as wider bandwidth is usually needed for server power monitoring due to the nature of the switching power supplies being monitored.
The background processing performs its actions in a time critical loop, which is triggered by the ADC at the sample rate. It is running in the interrupt services routine of the ADC and is processed automatically. It performs the actual sample computation based on the information collected from the voltage and current ADC channels. Hand over the less time critical process to foreground processing.
The foreground processing is triggered by the completion of background processing at the reporting and update rate. Background process sets a flag PHASE_STATUS_NEW_LOG in variable phase_state to indicate there is data ready to be processed by the foreground process. The application then needs to monitor this flag to trigger the foreground process by calling to calculate_phase_readings ().
In the actual computation, the following formulas are used in the metrology computation: