Getting Started with the MAXQ3180: Configuring the Registers
IntroductionThe MAXQ3180 is a sophisticated, three-phase electricity-meter IC that can be configured to operate in a wide variety of metering environments. To support that flexibility, it contains 68 configuration registers. Understanding how all of these registers work can be a daunting task. However, in most cases it is not necessary to load all 68 registers. In fact, to enable basic meter operation only 10 registers must typically be configured.
This application note describes which MAXQ3180 registers must be initialized and which can be initialized to enable certain features. The article also explains which registers can be safely left alone in almost all applications.
Essential InitializationAs soon as power is applied, the MAXQ3180 will begin operating, accumulating energy, and measuring voltage, current, and power. It is, nonetheless, critical to configure the device to match the transducers that connect the MAXQ3180 to the line so that it will deliver readings in meaningful units.
The MAXQ3180 performs measurements in a two-step process: first, it reads the physical phenomena (e.g., voltage, current, and power) and internally expresses them as arbitrary values called "meter units;" and second, it converts the values expressed as meter units to real-world units such as volts, amperes, and watts.
Reading the Physical Phenomena (Metrology)The MAXQ3180's first step is to perform the required measurements and express these measurements accurately in "meter units," i.e., units that are suited to the measurement circuitry. Ensuring that a given measurement unit—volts, amperes, watts, or kilowatt-hours—is accurately reflected in meter units is accomplished in the calibration process. Once current, voltage, power, and energy are accurately expressed in meter units, the device must convert these meter unit measurements to some unit that is meaningful in the real world.
We will use voltage calibration as an example, but the general procedure applies to current, power, or energy as well. Assume a voltage-divider as an input circuit with a target conversion ratio of 600:1. This means that if 600V DC is applied to the input of the divider, the output voltage would be close to 1V. The logic for the MAXQ3180's current and voltage inputs has a range of 224 counts. Consequently in this example, one least-significant bit (LSB) change in the output code would correspond to a change in voltage of 600 × 2-24 volts, or 35.8µV. Put another way, if one applied a 120VRMS sine to the input, one would expect the raw RMS voltage register to read 120/(600 × 2-24), or 3,355,443 (0x33 3333).
Because of natural variability in the passive components used for scaling and filtering the input signal and in the input ADC itself, it is unlikely that the value read from the ADC will match the expected value. For this reason, a correction factor must be applied to the x.V_GAIN (where x is the phase identifier: A, B or C) register. For this example, assume that the value read from the raw RMS register was only 3,000,000 (0x2D C6C0). This means that a gain must be applied equal to 3,355,443/3,000,000 = 1.12.
The gain adjustment registers are configured so that a value of 0x4000 (16,384) is unity gain. To apply additional gain, program a value greater than this. In this case, we would program 16,384 × (3,355,443/3,000,000) = 18,325 (0x4795).
That completes the first step of the process: make the voltage channel accurately reflect the actual voltage applied in meter units. The second step now is to convert from a system in which one LSB is equal to 35.8µV to a system in which one LSB is equal to something simpler, for example, 1mV.
Calculate the Conversion ConstantsThe immediate problem is that only an integer-multiply operation is provided. To perform this conversion, one would normally divide by a noninteger, specifically, 1,000/35.8. The solution is, therefore, to arrange the scaling factor so that the desired unit is multiplied by a power of two. In this instance, the LSB will not be 1mV, but rather 1mV/216, or 15.3nV. When we take a measurement, we will simply discard the low-order 16 bits. What is left will be the voltage in millivolts.
To determine the scaling factor, just divide the raw LSB value (35.8µV) by the desired LSB value (15.3nV) and you will obtain 2,344 (0x0928). This is the value to load into the VOLT_CC register.
Now, anytime the V.A virtual register is read, the MAXQ3180 will multiply the A.VRMS register by 2,344 and report the product. This product will be the RMS voltage in units of 1mV/65,536. Host software will then discard the low-order 16 bits and report the remainder directly as the voltage in millivolts RMS.
Thus, for most applications one need only perform the calibration step (to establish the proper VRMS and IRMS levels) and calculate the conversion constants (for voltage, current, power, and energy).
Optional InitializationFollowing the steps outlined above for voltage, current, energy, and power will provide accurate readings of these parameters. But there are many other functions provided in the MAXQ3180.
InterruptsThe MAXQ3180 has a sophisticated interrupt subsystem to alert the host processor of exceptional conditions. Conditions that can trigger an interrupt include:
- Real or reactive energy flow changes direction, per phase
- No zero-crossing events are detected on a phase for longer than some threshold time, per phase
- Undervoltage, overvoltage, or overcurrent conditions are detected, per phase
- An energy register has overflowed (a normal condition indicating that an accumulation should be made) , per phase
- The configuration checksum has changed
- The power to the MAXQ3180 is about to fail
Pulse ConfigurationMeter pulses are used to increment mechanical counters or to increment electronic energy-accumulation registers in many meters, and the MAXQ3180 fully supports meter pulses. Each of the two supported meter-pulse outputs has: a configuration register to select the parameter to be reflected in the meter pulse; a threshold register to establish the meter constant; and a pulse duration register to set the width of the meter pulse. For more information about the meter-pulse subsystem, consult the MAXQ3180 reference design.
Improved AccuracyWith ideal current and voltage transducers, the MAXQ3180 will provide excellent accuracy over a wide range of input currents. However, current transducers are never ideal. Often they have nonlinearities at the extreme ends of their operating range; frequently, the phase response of the sensor will change with changing current. The MAXQ3180 contains registers to compensate for this.
The MAXQ3180 has two fine-adjustment mechanisms to adjust for sensor inaccuracy. The first fine adjustment is a separate gain for low currents and offset adjustments for both low and high currents. This approach allows calibration using up to four points to adjust both gain and offset at low- and high-current levels.
The second fine adjustment is for trimming the voltage-to-current phase offset. In this adjustment scheme, you establish three current ranges by setting two thresholds. Current below both thresholds forms the first range. Current between the two thresholds forms the second range, and current above both thresholds forms the third range. A phase offset is then established for each of the three ranges for each of phase A, phase B, or phase C.
For more information about using the fine-adjustment registers to tune the accuracy of the MAXQ3180, see the MAXQ3180 reference design.
SummaryThe MAXQ3180 is a flexible, electricity meter analog front-end (AFE) with several options to allow it to operate over a wide range of metering applications. By setting only a few registers (the calibration and scaling registers, in particular) you can get the electricity meter operating quickly and begin characterizing the accuracy of the new system.
||Registers that in common use must be loaded on initialization.|
||Registers that are required to enable certain MAXQ3180 features, but may not be required in many applications.|
||Registers that need not be modified in most applications.|
|0x002||0x00||OPMODE1||Set this register only if your connection mode is not standard delta or wye, if you wish to reverse pulse output polarity, or if you wish to enable communication CRC.|
|0x003||0x00||OPMODE2||This register contains bits for features that are infrequently used.|
|0x006||0x0000||IRQMASK||Load only if interrupts are used.|
|0x010||0x0000||AUX_CFG||Load only if the auxiliary channel is used (typically specialized applications).|
|0x014||0x0001||VOLT_CC||Conversion constant for meter unit to real units conversion.|
|0x016||0x0001||AMP_CC||Conversion constant for meter unit to real units conversion.|
|0x018||0x0001||PWR_CC||Conversion constant for meter unit to real units conversion.|
|0x01A||0x0001||ENR_CC||Conversion constant for meter unit to real units conversion.|
|0x01C||0x0010||CYCNT||Load only if the DSP cycle time must be set to something other than 16 line cycles.|
|0x01E||0x00||PLSCFG1||Load if meter pulses are in use.|
|0x01F||0x00||PLSCFG2||Load if meter pulses are in use.|
|0x020||0x009C||PLS1_WD||Load if meter pulses are in use.|
|0x022||0x00100000||THR1||Load if meter pulses are in use.|
|0x026||0x009C||PLS2_WD||Load if meter pulses are in use.|
|0x028||0x00100000||THR2||Load if meter pulses are in use.|
|0x02C||0x00C8||REJ_NS||Line-cycle filter; handle with care!|
|0x02E||0x4000||AVG_NS||Line-cycle filter; handle with care!|
|0x030||0x4000||AVG_C||Signal-path filter; handle with care!|
|0x032||0x00C8||HPF_C||Signal-path filter; handle with care!|
|0x034||0x0091||B0FUND||Fundamental-mode filter; handle with care!|
|0x036||0x000003B6||A1FUND||Fundamental-mode filter; handle with care!|
|0x03A||0x0091||B0HARM||Harmonic-mode filter; handle with care!|
|0x03C||0x000003B6||A1HARM||Harmonic-mode filter; handle with care!|
|0x040||0x03E80000||Number of ADC frames per DSP cycle; automatically calculated and seldom needs manual intervention.
|0x044||0xFFFF||OCLVL||Load only if overcurrent limits are used.|
|0x046||0xFFFF||OVLVL||Load only if overvoltage limits are used.|
|0x048||0x0000||UVLVL||Load only if undervoltage limits are used.|
|0x04A||0x0003||NOLOAD||Modify to match with your design specification.|
|0x054||0x2328||NZX_TIMO||No zero-crossing timeout; generally no need to adjust this.|
|0x056||0x03E8||COM_TIMO||Communications timeout; generally no need to adjust this.|
|0x058||0x0005||ACC_TIMO||Energy accumulation startup delay; generally no need to reload this.|
|0x05A||0x0B00||ZC_LPF||Zero-crossing filter; handle with care!|
|0x05C||0x0000||I1THR||Set only if multirange phase compensation is desired.|
|0x05E||0x0000||I2THR||Set only if multirange phase compensation is desired.|
|0x12E||0x0000||N_GAIN||Neutral gain; adjust only if neutral current monitoring is used.|
|0x130||0x0000||A.I_GAIN||Primary calibration register for phase A current.|
|0x132||0x0000||A.V_GAIN||Primary calibration register for phase A voltage.|
|0x134||0x0000||A.E_GAIN||Primary calibration register for phase A energy and power.|
|0x136||0x0000||A.EF_GAIN||Adjust only if fundamental mode is used.|
|0x138||0x0000||A.OFFS_HI||Secondary calibration for enhanced accuracy: phase A current offset, high range.|
|0x13A||0x0000||A.GAIN_LO||Secondary calibration for enhanced accuracy: phase A current gain, low range.|
|0x13C||0x0000||A.OFFS_LO||Secondary calibration for enhanced accuracy: phase A current offset, low range.|
|0x13E||0x0000||A.PA0||Secondary calibration for improved phase compensation.|
|0x140||0x0000||A.PA1||Secondary calibration for improved phase compensation.|
|0x142||0x0000||A.PA2||Secondary calibration for improved phase compensation.|
|0x145||0x00||A.MASK||Set only if interrupts from this phase are desired.|
|0x21C||0x0000||B.I_GAIN||Primary calibration register for phase B current.|
|0x21E||0x0000||B.V_GAIN||Primary calibration register for phase B voltage.|
|0x220||0x0000||B.E_GAIN||Primary calibration register for phase B energy and power.|
|0x222||0x0000||B.EF_GAIN||Adjust only if fundamental mode is used.|
|0x224||0x0000||B.OFFS_HI||Secondary calibration for enhanced accuracy: phase B current offset, high range.|
|0x226||0x0000||B.GAIN_LO||Secondary calibration for enhanced accuracy: phase B current gain, low range.|
|0x228||0x0000||B.OFFS_LO||Secondary calibration for enhanced accuracy: phase B current offset, low range.|
|0x22A||0x0000||B.PA0||Secondary calibration for improved phase compensation.|
|0x22C||0x0000||B.PA1||Secondary calibration for improved phase compensation.|
|0x22E||0x0000||B.PA2||Secondary calibration for improved phase compensation.|
|0x231||0x00||B.MASK||Set only if interrupts from this phase are desired.|
|0x308||0x0000||C.I_GAIN||Primary calibration register for phase C current.|
|0x30A||0x0000||C.V_GAIN||Primary calibration register for phase C voltage.|
|0x30C||0x0000||C.E_GAIN||Primary calibration register for phase C energy and power.|
|0x30E||0x0000||C.EF_GAIN||Adjust only if fundamental mode is used.|
|0x310||0x0000||C.OFFS_HI||Secondary calibration for enhanced accuracy: phase C current offset, high range.|
|0x312||0x0000||C.GAIN_LO||Secondary calibration for enhanced accuracy: phase C current gain, low range.|
|0x314||0x0000||C.OFFS_LO||Secondary calibration for enhanced accuracy: phase C current offset, low range.|
|0x316||0x0000||C.PA0||Secondary calibration for improved phase compensation.|
|0x318||0x0000||C.PA1||Secondary calibration for improved phase compensation.|
|0x31A||0x0000||C.PA2||Secondary calibration for improved phase compensation.|
|0x31D||0x00||C.MASK||Set only if interrupts from this phase are desired.|