SBOA444 November   2020 TMCS1100

 

  1.   Trademarks
  2. 1Introduction
  3. 2Implementation Block Diagram
  4. 3Hardware Implemenation
    1. 3.1 Analog Inputs
      1. 3.1.1 Voltage Measurement Analog Front End
      2. 3.1.2 Current Measurement Analog Front End
    2. 3.2 MSP432 LaunchPad Connections
    3. 3.3 PCB Layout Recommendations
  5. 4How to Implement Software for Metrology Testing
    1. 4.1 Setup
      1. 4.1.1 Clock
      2. 4.1.2 UART Setup for GUI Communication
      3. 4.1.3 Real-Time Clock (RTC)
      4. 4.1.4 Direct Memory Access (DMA)
      5. 4.1.5 ADC Setup
    2. 4.2 Foreground Process
      1. 4.2.1 Formulas
        1. 4.2.1.1 Standard Metrology Parameters
        2. 4.2.1.2 Power Quality Formulas
    3. 4.3 Background Process
      1. 4.3.1 per_sample_dsp( )
        1. 4.3.1.1 Voltage and Current ADC Samples
        2. 4.3.1.2 Pure Waveform Samples
        3. 4.3.1.3 Frequency Measurement and Cycle Tracking
      2. 4.3.2 LED Pulse Generation
      3. 4.3.3 Phase Compensation
  6. 5Metrology Accuracy Testing
    1. 5.1 Test Setup
    2. 5.2 Results
  7. 6Schematics
  8. 7References

ADC Setup

The ADC Initialization and Synchronization Process figure shows the process used to initialize the ADS131M08 before conversions are started.

GUID-20201005-CA0I-J71N-HVQP-W9PZB87PWKFP-low.gif Figure 4-1 ADC Initialization and Synchronization Process .
This process begins by the EUSCIB0 SPI module of the MSP432 MCU being configured for communication to the ADS131M08 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, the DMA is then configured to automatically handle the transfer of packets between the ADS131M08 and MSP432.

Next, the ADS131M08 is reset to get the device in a known state. After resetting the device, a command is sent to the ADS131M08 to disable its internal oscillator and disable the conversions on its ADC channels. Disabling the clock oscillator prevents the ADS131M08 from generating new samples when configuring the ADS131M08 registers.

Finally, commands are sent to the ADS131M08 to initialize its registers for the following configuration:

  • MODE register settings: 16-bit CCITT CRC used, 24-bit length for each word in the ADS131M08 packet, DRDY signal asserted on most lagging enabled channel, DRDY asserted high when conversion value is not available, DRDY asserted low when conversion values are ready

  • GAIN1 and GAIN2 register settings: PGA gain of 1 used for all eight ADC channels (please note that only 4 of these 8 channels are used)

  • CFG register settings: Current detection mode disabled

  • CHx_CNG register settings (where x is the channel number): All eight ADC channel inputs connected to external ADC pins and channel phase delay set to 0 for each channel (note that software phase compensation is used instead of ADS131M08 hardware phase compensation)

  • CLOCK register settings: 512 OSR, all channels enabled, crystal oscillator disabled, internal reference used for conversions, and high-resolution modulator power mode

At this point, the ADS131M08 is still not sampling because the crystal oscillator is still disabled. ADS131M08 sampling is not started until the rest of the setup routines of the MCU are executed. After executing these other setup routines, the MSP432 is configured to generate a port interrupt whenever a falling edge occurs on the DRDY pin, which would indicate that the ADS131M08 has new current samples that are available. Next, a command is sent to enable the crystal oscillator, which starts the voltage and current sampling.

The ADS131M08 modulator clock is derived from the crystal connected between its XTAL1 and XTAL2 pins. This clock is internally divided by two to generate the ADS131M08 modulator clock. The sampling frequency of the ADS131M08 is therefore defined as fs = fM / OSR = fADS13M08_crystal / (2 × OSR), where fs is the sampling rate, fM is the modulator clock frequency, fADS13M08_crystal is the frequency of the crystal connected to the ADS131M08, and OSR is the selected oversampling ratio. In this design, the crystal connected to the ADS131M08 has a frequency of 8.000 MHz and the oversampling ratio is selected to be 512. As a result, the ADS131M08 modulator clock is set to 4.000 MHz and the sample rate is set to 7812.5 samples per second.

In this design, the following ADS131M08 channel mappings are used in software:

  • AIN0P and AIN0N ADS131M08 ADC channel pins → Voltage V1 (Line-to-Neutral Voltage)

  • AIN5P and AIN5N ADS131M08 ADC channel pins → Current I1 (Channel A Current)

  • AIN4P and AIN4N ADS131M08 ADC channel pins → Current I2 (Channel B Current)

  • AIN3P and AIN3N ADS131M08 ADC channel pins → Current I3 (Channel C Current)