TIDUEM7A April 2019 – February 2021
Figure 2-13 shows the process used to initialize the ADS131M04. This process is followed when the ADS131M04 device is first setup after the MSP432 MCU resets as well as each time calibration is performed.
Before setting up the ADS131M04 device, the test code disables the ADS131M04 modulator clock to prevent the ADS131M04 from generating new samples while trying to set it up. The code disables the modulator clock by disabling the SMCLK output of the MSP432 MCU, which is fed to the CLKIN pin of the ADS131M04 device. Disabling the SMCLK output only needs to be done after calibration and not after an MSP432 MCU reset event since the SMCLK clock output is automatically not output after the MSP432 MCU resets.
After the SMCLK output is disabled, the EUSCIB0 SPI module of the MSP432 MCU is configured for communication to the ADS131M04 device. The EUSCIB0 SPI module is specifically configured as a master device that uses 3-wire mode (the chip select signal is manually asserted high and low in the test software instead of using the chip select feature of the SPI module) and has an 8.192-MHz SPI clock that is derived from the 8.192-MHz SMCLK clock. After the SPI is setup, all interrupts are disabled and a reset command is sent from the MSP432 MCU to the ADS131M04 via SPI. Interrupts are then re-enabled and the MSP432 MCU sends commands to the ADS131M04 to configure its registers.
At this point, note that the modulation clock is not output by the MSP432 MCU, which means that sampling is not started yet. By sending commands to the ADS131M04 to initialize the ADS131M04 registers, the ADS131M04 is configured for the following:
Before initializing the registers, an estimate of the ADC offset(in ADC units) for each current channel is determined using the PC GUI. The offset calibration registers for the current channels are then updated with the corresponding offsets to subtract out most of the ADC offset from both current channels. This offset calibration is done to have better matching between the line and neutral ADC channels, which has significantly different ADC offsets due to different gains being used on these channels. Having better matching between the line and neutral ADC channels enables the line and neutral current channels to cause a trigger in current-detection mode when nearly the same neutral and line current is applied to the meter. For even more precise matching between the line and neutral currents needed to trigger current-detection mode, the gain registers on the two current channels can be modified as well; however, for this design, good enough ADC matching was obtained without modifying the gain calibration registers of the ADS131M04 device so these registers were left unmodified.
In this design, CD_LEN=256, which allows current-detection to be performed over more than 4 Mains cycles of ADC samples. The CD_LEN time determines the maximum time spent in current-detection mode before the device returns to standby mode. Decreasing the value of CD_LEN decreases the time in current-detection mode, which reduces the average current consumption drawn from the ADS131M04 device after an AC supply failure.
After the ADS131M04 registers are properly initialized, the MSP432 MCU is configured to generate a port interrupt whenever a falling edge occurs on the DRDY pin, which indicates that the ADS131M04 device has new samples available. Next, the MSP432 MCU outputs the SMCLK clock to the ADS131M04, which starts the voltage and current sampling.
The ADS131M04 modulator clock is derived from the clock fed to its CLKIN pin, which is output from the SMCLK output of the MSP432 MCU. The clock fed to the CLKIN pin of the ADS131M04 device is internally divided by two, to generate the ADS131M04 modulator clock. The sampling frequency of the ADS131M04 is therefore defined as:
where
In this design, the SMCLK clock of the MSP432 MCU that is fed to the ADS131M04 CLKIN pin has a frequency of 8.192 MHz. The oversampling ratio is selected to be 512. As a result, the ADS131M04 modulator clock is set to 4.096 MHz and the sample rate is set to 8000 samples per second.
In this design, the following ADS131M04 channel mappings are used: