View detail for 46104 - ATM90E36A Poly-Phase Energy Metering IC

Application Note
Poly-Phase Energy Metering IC
M90E36A
APPLICATION OUTLINE
This document describes system application issues when using the M90E36A (polyphase energy metering ICs) to design poly-phase energy meters.
The M90E36A is applicable in class 0.5S or class 1 poly-phase meter design and also
supports three-phase four-wire (3P4W, Y0) or three-phase three-wire (3P3W, Y or Δ)
connection modes. The M90E36A can also be used in harmonic meter design.
The M90E36A uses 3.3V single power supply. In a typical 3P4W design, there are three
transformers&regulators to provide power supply. The AC power supply outputs 3.3V to
chip digital power supply DVDD after rectifier and voltage regulation. The analog power
supply AVDD should be connected directly to digital power supply DVDD.
The M90E36A has on-chip power-on-reset circuit. The RESET pin should be connected to
DVDD through a 10kΩ resistor and a 0.1μF filter capacitor to ground. The M90E36A has
highly stable on-chip reference power supply. The Vref pin should be decoupled with a
10μF capacitor and a 0.1μF ceramic capacitor.
The M90E36A employs 16.384MHz as the system frequency. The M90E36A has built-in
crystal oscillator circuit and 10pF matching capacitance. Users only need to connect a
16.384MHz crystal between OSCI and OSCO pins in application.
The M90E36A provides a 4-wire SPI interface (CS, SCLK, SDI and SDO) for external MCU
connection. MCU can perform chip configuration and register reading/writing through SPI.
The M90E36A also supports Master mode SPI, which is named Direct Memory Access
(DMA) mode. In DMA mode, The M90E36A streams out ADC sampling raw data to
external MCU at an up to 1800kbps rate.
The M90E36A provides four energy pulse output pins: active energy pulse CF1, reactive
energy pulse CF2 (can also be configured as apparent energy pulse), fundamental energy
pulse CF3 and harmonic energy pulse CF4. They can be used for energy metering calibration and can also be connected to MCU for energy accumulation.
The M90E36A provides three zero-crossing pins ZX0, ZX1 and ZX2 which can select
different phase’s voltage or current as inputs.
The M90E36A provides three output pins IRQ0, IRQ1 and WarnOut to generate interrupt
and warn out signals at different levels.
The default application in this document is 3P4W, otherwise it will be specially indicated.
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Ta bl e o f C o n t en ts
1
HARDWARE REFERENCE DESIGN ........................................................................................... 4
1.1 3P4W Application ................................................................................................................... 4
1.1.1
1.1.2
1.1.3
1.1.4
1.1.5
Schematics (Current Transformer (CT)) ................................................................................... 4
BOM (CT) ................................................................................................................................. 5
Schematics (Rogowski) ............................................................................................................ 6
BOM (Rogowski) ....................................................................................................................... 7
Circuit Description ..................................................................................................................... 7
1.2 3P3W Application ................................................................................................................... 9
1.2.1
1.2.2
1.2.3
Schematics ............................................................................................................................... 9
BOM ........................................................................................................................................ 10
Circuit Description ................................................................................................................... 10
2
INTERFACE ................................................................................................................................ 11
2.1 SPI ........................................................................................................................................ 11
2.2 DMA...................................................................................................................................... 12
3
POWER MODES ........................................................................................................................ 13
3.1 Normal Mode ........................................................................................................................ 13
3.2 Partial Measurement Mode................................................................................................... 13
3.3 Detection Mode..................................................................................................................... 13
3.4 Idle Mode .............................................................................................................................. 14
3.5 Transition and Application of Power Modes ......................................................................... 14
4
CALIBRATION ........................................................................................................................... 17
4.1 Calibration Method................................................................................................................ 17
4.2 Calibration in Normal Mode .................................................................................................. 17
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
Measurement/Metering Startup Command (Configstart/Calstart/HarmStart/AdjStart) ........... 18
PL Constant Configuration (PL_Constant) ............................................................................. 20
Metering Method Configuration (MMode0) ............................................................................. 21
PGA Gain Configuration (MMode1) ........................................................................................ 22
Offset Calibration of Voltage/ Current/ Power ......................................................................... 23
Voltage/ Current Measurement Calibration ............................................................................ 24
Energy Metering Calibration ................................................................................................... 25
Fundamental Energy Metering Calibration ............................................................................. 26
4.3 Calibration in Partial Measurement Mode............................................................................. 28
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
Partial Measurement Configuration (PMConfig) ..................................................................... 28
Sampling Cycle Configuration (PMAvgSamples) ................................................................... 28
PGAgain Configuration (PMPGA) ........................................................................................... 28
Current Offset Calibration ....................................................................................................... 29
Current Measurement Calibration ........................................................................................... 29
Special Application of Partial Measurement Function ............................................................ 30
4.4 Calibration in Detection Mode............................................................................................... 31
4.4.1
4.4.2
Current Detection Module Configuration ................................................................................ 31
Current Detection Threshold Calibration ................................................................................ 32
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_043014
2
5
FUNCTION REGISTERS CONFIGURATION ............................................................................ 33
5.1 Startup Current Configuration............................................................................................... 33
5.2 SAG Function ....................................................................................................................... 34
5.3 Reserved Register/ Address and Reserved bits................................................................... 35
5.3.1
5.3.2
5.3.3
Reserved Register/ Address ................................................................................................... 35
Reserved Register Bits ........................................................................................................... 35
Reserved Bits in the FUNC_EN1 Register ............................................................................. 35
6
TEMPERATURE COMPENSATION .......................................................................................... 36
6.1 On-chip Temperature Sensor Configuration......................................................................... 36
6.2 Temperature Compensation Based on ADC Sampling Channel.......................................... 36
6.3 Temperature Compensation Based on reference Voltage ................................................... 38
7
HARMONIC ANALYSIS ............................................................................................................. 39
7.1 DFT Engine........................................................................................................................... 39
7.2 Obtain Harmonic Analysis of Above 32nd ............................................................................ 42
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_043014
3
D
C
B
A
IB-
IB+
IA-
IA+
UN
UC
UB
UA
1
1
R53
2.4
R51
2.4
R44
2.4
R38
2.4
1K
R55
GND
1K
R49
1K
R46
GND
1K
R35
240K
GND
R26
240K
240K
240K
R25
R17
240K
240K
R16
R4
R3
240K
R29
240K
R20
240K
R7
240K
R30
240K
R21
240K
R8
C20
18nF
C18
18nF
C16
18nF
C11
18nF
IBN
IBP
IAN
IAP
240K
R31
240K
R22
240K
R9
2
R54
2.4
R52
2.4
R45
2.4
R39
2.4
R32
1K
R23
1K
R10
1K
C8
18nF
VCP
1K
R56
GND
1K
R50
1K
R47
GND
1K
VBP
C6
18nF
R36
GND
GND
GND
C3
18nF
VAP
Option for N-line current sampling
IN-
IN+
IC-
IC+
Voltage Sampling
240K
R28
240K
R19
240K
R6
Current Sampling (with CT)
240K
R27
240K
R18
240K
R5
2
3
3
C21
18nF
C19
18nF
C17
18nF
C12
18nF
INN
INP
ICN
ICP
C9
10uF
GND
R40
1K
GND
4
C13
18nF
C10
0.1uF
IAP
IAN
IBP
IBN
ICP
ICN
INP
INN
C5
0.1uF
DVDD33
GND
AVDD33
AGND
I1P
I1N
I2P
I2N
I3P
I3N
I4P
I4N
Vref
AGND
0.1uF
0.1uF
C4
10uF
C2
C1
R2
10K
5
C14
18nF
R43
1K
GND
C15
18nF
16.384MHz
X1
DMA
NC
PM1
PM0
TEST
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
R11
10K
DVDD33
36
35
34
33
32
31
30
29
28
27
26
25
R12
10K
R13
10K
CF4
CF3
CF2
CF1
5
ZX2
ZX1
ZX0
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
PM1
PM0
DMA
SDI
SDO
SCLK
CS
6
6
Connect to MCU
R14
10K
Poly Phase Metering AFE Chip (ATM90E36A)
R41
1K
U5
ATM90E36A
1
2
3
4
5
6
7
8
9
10
11
12
AVDD33
C7
0.1uF
4
48
47
46
45
44
43
42
41
40
39
38
37
DVDD33
DGND
NC
NC
DGND
DVDD18
VPP
RST
SDI
SDO
SCLK
CS
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
V1P
V1N
V2P
V2N
V3P
V3N
NC
OSCI
OSCO
ZX0
ZX1
ZX2
M90E36A [Application Note]
VAP
GND
510
R33
U4
510
R24
U3
510
R15
U2
510
R1
U1
GND
GND
GND
GND
PS2501
PS2501
PS2501
PS2501
1
2
3
4
5
CON-5
1
2
3
4
5
JP1
8
D4 CF1
D3 CF2
D2 CF3
D1 CF4
GND
7
Poly Phase Metering AFE ATM90E36A (3P4W with CT)
1
1.0
of 1
A3
8
ATM90E36A_3P4W_CT.SchDoc
Title:
File:
*
Project:
Revision:
Page:
10:59:16
*
Document Number:
Date:
Size:
*
ApprovedBy:
3/19/2014
Felix Yao
DrawnBy:
*
SMART ENERGY
Atmel China
CheckedBy:
510
R48
510
R42
510
R37
510
R34
Energy Pulse Output Indicate
CF4
CF3
CF2
CF1
Energy Pulse Output (Isolated with Optocoupler)
CF4
CF3
CF2
CF1
7
D
C
B
A
3P4W APPLICATION
VBP
1.1
VCP
HARDWARE REFERENCE DESIGN
13
14
15
16
17
18
19
20
21
22
23
24
4
1
1.1.1 Schematics (Current Transformer (CT))
1.1.2 BOM (CT)
Table-1 3P4W BOM (CT)
Component Type
Designator
Quantity
Parameter
Tolerance
SMT Capacitor
C3 C6 C8 C11 C12 C13
C14 C15 C16 C17 C18
C19 C20 C21
C1 C4 C5 C7 C10
14
18nF
±10% X7R
(anti-aliasing filter capacitor)
5
0.1μF
±10% X7R
2
8
10μF
2.4Ω
±10% X7R
±1% 1/8W 25ppm
8
510Ω
±5% 1/8W 100ppm
14
1kΩ
±1% 1/8W 25ppm
(anti-aliasing filter resistor)
5
21
10kΩ
240kΩ
±5% 1/8W 100ppm
±1% 1/8W 25ppm
LED
SMT Optocoupler
Crystal
C2 C9
R38 R39 R44 R45 R51
R52 R53 R54
R1 R15 R24 R33 R34
R37 R42 R48
R10 R23 R32 R35 R36
R40 R41 R43 R46 R47
R49 R50 R55 R56
R2 R11 R12 R13 R14
R3~R9, R16~R22,
R25~R31
D1 D2 D3 D4
U1 U2 U3 U4
X1
4
4
1
PS2501
16.384MHz
±20ppm
IC
Connector
U5
JP1
1
1
M90E36A
CON-5
-
SMT Resistor
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
5
D
C
B
A
IB-
IB+
IA-
IA+
UN
UC
UB
1
C22
18nF
240K
240K
R28
240K
R19
240K
R6
240K
R29
240K
R20
240K
R7
240K
R30
240K
R21
240K
R8
1K
R53
1k
IBN
IBP
IAN
1K
R54
1K
R52
1K
R45
1K
R39
2
C8
18nF
1K
C29 GND
18nF
R56
C27
18nF
1K
R50
1K
C25 GND
18nF
R47
1K
VCP
C6
18nF
VBP
C3
18nF
R36
GND
GND
GND
C23
18nF
R32
1K
R23
1K
R10
1K
VAP
Option for N-line current sampling
IN-
IN+
IC-
IC+
240K
R31
240K
R22
240K
R9
Current Sampling (with Rogowski Coil)
C20
18nF
C28 GND
18nF
R55
C16
18nF
C11
18nF
IAP
Voltage Sampling
C18
18nF
1K
240K
R27
240K
R18
240K
R5
C26
18nF
R49
1K
1K
R51
1K
R44
1K
1K
C24 GND
18nF
R46
R35
R38
GND
R26
240K
240K
240K
R25
R17
240K
R16
R4
240K
3
C21
18nF
C19
18nF
C17
18nF
C12
18nF
INN
INP
ICN
ICP
C9
10uF
GND
R40
1K
GND
4
C13
18nF
C10
0.1uF
IAP
IAN
IBP
IBN
ICP
ICN
INP
INN
C7
0.1uF
C5
0.1uF
AVDD33
AGND
I1P
I1N
I2P
I2N
I3P
I3N
I4P
I4N
Vref
AGND
0.1uF
0.1uF
C4
10uF
C2
C1
R2
10K
5
C14
18nF
R43
1K
GND
C15
18nF
16.384MHz
X1
DMA
NC
PM1
PM0
TEST
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
R11
10K
DVDD33
36
35
34
33
32
31
30
29
28
27
26
25
R12
10K
R13
10K
CF4
CF3
CF2
CF1
5
ZX2
ZX1
ZX0
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
PM1
PM0
DMA
SDI
SDO
SCLK
CS
6
6
Connect to MCU
R14
10K
Poly Phase Metering AFE Chip (ATM90E36A)
R41
1K
U5
ATM90E36A
1
2
3
4
5
6
7
8
9
10
11
12
AVDD33
DVDD33
GND
VAP
4
VBP
R3
3
VCP
2
48
47
46
45
44
43
42
41
40
39
38
37
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
DVDD33
DGND
NC
NC
DGND
DVDD18
VPP
RST
SDI
SDO
SCLK
CS
M90E36A [Application Note]
V1P
V1N
V2P
V2N
V3P
V3N
NC
OSCI
OSCO
ZX0
ZX1
ZX2
6
13
14
15
16
17
18
19
20
21
22
23
24
UA
1
GND
510
R33
U4
510
R24
U3
510
R15
U2
510
R1
U1
GND
GND
GND
GND
PS2501
PS2501
PS2501
PS2501
1
2
3
4
5
CON-5
1
2
3
4
5
JP1
8
D4 CF1
D3 CF2
D2 CF3
D1 CF4
GND
7
8
Poly Phase Metering AFE ATM90E36A (3P4W with Rogiwski Coil)
1.0
of 1
ATM90E36A_3P4W_Coil.SchDoc
Title:
File:
*
1
A3
Project:
Revision:
Page:
10:59:07
*
Document Number:
Date:
Size:
*
ApprovedBy:
3/19/2014
Felix Yao
DrawnBy:
*
SMART ENERGY
Atmel China
CheckedBy:
510
R48
510
R42
510
R37
510
R34
Energy Pulse Output Indicate
CF4
CF3
CF2
CF1
Energy Pulse Output (Isolated with Optocoupler)
CF4
CF3
CF2
CF1
7
D
C
B
A
1.1.3 Schematics (Rogowski)
1.1.4 BOM (Rogowski)
Table-2 3P4W BOM (Rogowski)
Component Type
Designator
Quantity
Parameter
Tolerance
SMT Capacitor
C3 C6 C8 C11 C12 C13
C14 C15 C16 C17 C18
C19 C20 C21 C22 C23
C24 C25 C26 C27 C28
C29
C1 C4 C5 C7 C10
22
18nF
±10% X7R
(anti-aliasing filter capacitor)
5
0.1μF
±10% X7R
2
8
10μF
510Ω
±10% X7R
±5% 1/8W 100ppm
14
1kΩ
±1% 1/8W 25ppm
(anti-aliasing filter resistor)
5
21
10kΩ
240kΩ
±5% 1/8W 100ppm
±1% 1/8W 25ppm
LED
SMT Optocoupler
Crystal
C2 C9
R1 R15 R24 R33 R34
R37 R42 R48
R10 R23 R32 R35 R36
R38 R39 R40 R41 R43
R44 R45 R46 R47 R49
R50 R51 R52 R53 R54
R55 R56
R2 R11 R12 R13 R14
R3~R9, R16~R22,
R25~R31
D1 D2 D3 D4
U1 U2 U3 U4
X1
4
4
1
PS2501
16.384MHz
±20ppm
IC
Connector
U5
JP1
1
1
M90E36A
CON-5
-
SMT Resistor
1.1.5 Circuit Description
The recommended circuit for the M90E36A three-phase four-wire (3P4W) application is as shown in 1.1.1 Schematics
(Current Transformer (CT)). The M90E36A can use CT and Rogowski coil in current sampling. The recommended circuit
for 3P4W application with Rogowski coil is as shown in 1.1.3 Schematics (Rogowski).
It is recommended to use two-order filtering when sampling with Rogowski coil. The other parts are the same as the CT
application circuit. The recommended type of Rogowski coil is: PA3202NL (Pulse Electronics).
Poly-phase voltage is sampled over resistor divider network with recommended ratio of 240KΩ x 7:1KΩ. The anti-aliasing
filter capacitor is recommended to be 18nF. Poly-phase current and N line current are sampled over CT. The CT ratio and
load resistance should be selected based on the actual metering range. The anti-aliasing filter resistance/capacitor is
suggested to be 1KΩ/18nF for the current sampling circuit.
The CF1~CF4 pins are provided with driving capacity of 8mA which can drive LED and optocoupler parallelly. The other
digital pins are provided with driving capacity of 3mA which can drive optocoupler directly.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
7
Application note: how to select CT and CT load resistance
Condition:
M90E36A ADC input voltage range is 120μVrms ~ 720mVrms
M90E36A ADC input gain PGA_GAIN = 1, 2, 4
Assume:
Metering range of the energy meter is Imin ~ Imax
CT current output ratio is N:1
CT load resistance is RCT
So the parameters meet the formula as below:
120 μVrms <
PGA_GAIN × RCT × I min
N
PGA_GAIN × RCT × I max
< 720mVrms
N
8
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
D
C
B
A
IA-
IA+
UC
UB
1
240K
R44
2.4
1K
R46
GND
1K
R35
240K
240K
R38
2.4
R26
R25
GND
R4
240K
240K
R29
240K
R7
240K
R30
240K
R8
C16
18nF
C11
18nF
IAN
IAP
IC-
IC+
Voltage Sampling
240K
R28
240K
R6
240K
R31
240K
R9
2
Current Sampling (with CT)
240K
R27
240K
R5
R45
2.4
R39
2.4
R32
1K
R10
1K
1K
R47
GND
1K
VCP
C8
18nF
R36
GND
GND
C3
18nF
VAP
3
C17
18nF
C12
18nF
ICN
ICP
GND
C9
10uF
GND
R40
1K
GND
4
C13
18nF
C10
0.1uF
IAP
IAN
IBP
IBN
ICP
ICN
INP
INN
C5
0.1uF
DVDD33
GND
AVDD33
AGND
I1P
I1N
I2P
I2N
I3P
I3N
I4P
I4N
Vref
AGND
0.1uF
0.1uF
C4
10uF
C2
C1
R2
10K
5
R43
1K
GND
C15
18nF
16.384MHz
X1
DMA
NC
PM1
PM0
TEST
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
R11
10K
DVDD33
36
35
34
33
32
31
30
29
28
27
26
25
R12
10K
R13
10K
CF4
CF3
CF2
CF1
5
ZX2
ZX1
ZX0
IRQ1
IRQ0
WarnOut
CF4
CF3
CF2
CF1
PM1
PM0
DMA
SDI
SDO
SCLK
CS
6
6
Connect to MCU
R14
10K
Poly Phase Metering AFE Chip (ATM90E36A)
U5
ATM90E36A
1
2
3
4
5
6
7
8
9
10
11
12
AVDD33
C7
0.1uF
4
VAP
R3
3
VBP
2
VCP
UA
1
48
47
46
45
44
43
42
41
40
39
38
37
DVDD33
DGND
NC
NC
DGND
DVDD18
VPP
RST
SDI
SDO
SCLK
CS
V1P
V1N
V2P
V2N
V3P
V3N
NC
OSCI
OSCO
ZX0
ZX1
ZX2
13
14
15
16
17
18
19
20
21
22
23
24
GND
510
R33
U4
510
R24
U3
510
R15
U2
510
R1
U1
GND
GND
GND
GND
PS2501
PS2501
PS2501
PS2501
1
2
3
4
5
CON-5
1
2
3
4
5
JP1
8
D4 CF1
D3 CF2
D2 CF3
D1 CF4
GND
7
Poly Phase Metering AFE ATM90E36A (3P3W with CT)
1
1.0
of 1
A3
8
ATM90E36A_3P3W_CT.SchDoc
Title:
File:
*
Project:
Revision:
Page:
10:58:57
*
Document Number:
Date:
Size:
*
ApprovedBy:
3/19/2014
Felix Yao
DrawnBy:
*
SMART ENERGY
Atmel China
CheckedBy:
510
R48
510
R42
510
R37
510
R34
Energy Pulse Output Indicate
CF4
CF3
CF2
CF1
Energy Pulse Output (Isolated with Optocoupler)
CF4
CF3
CF2
CF1
7
D
C
B
A
1.2
3P3W APPLICATION
1.2.1 Schematics
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
9
1.2.2 BOM
Table-3 3P3W BOM
Component Type
Designator
Quantity
Parameter
Tolerance
SMT Capacitor
C3 C8 C11 C12 C13
C15 C16 C17
C1 C4 C5 C7 C10
8
18nF
5
0.1μF
±10% X7R
(anti-aliasing filter capacitor)
±10% X7R
2
4
8
10μF
2.4Ω
510Ω
±10% X7R
±1% 1/8W 25ppm
±5% 1/8W 100ppm
C2 C9
R38 R39 R44 R45
R1 R15 R24 R33 R34
R37 R42 R48
R10 R32 R35 R36 R40
R43 R46 R47
R2 R11 R12 R13 R14
R3~R9, R25~R31
8
1kΩ
5
14
10kΩ
240kΩ
±1% 1/8W 25ppm
(anti-aliasing filter resistor)
±5% 1/8W 100ppm
±1% 1/8W 25ppm
LED
SMT Optocoupler
Crystal
D1 D2 D3 D4
U1 U2 U3 U4
X1
4
4
1
NEC2501
16.384MHz
±20ppm
IC
Connector
U5
JP1
1
1
M90E36A
CON-5
-
SMT Resistor
1.2.3 Circuit Description
This circuit is the recommended circuit for the M90E36A three-phase three-wire (3P3W) application.
Phase B is the reference ground in 3P3W application. In 3P3W system, Uab stands for Ua, Ucb stands for Uc and there is
no Ub.
Phase B voltage, phase B current and N line sampling current are not needed in 3P3W application. Pin 5, 6, 9, 10, 15 and
16 should be connected to GND.
If DMA function is not used, pin 36 should also be connected to GND. All NC pins should be left open.
The other parts of 3P3W application circuit are similar to 3P4W and can be treated in the same way.
10
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
2
INTERFACE
The M90E36A provides a four-wire SPI interface (CS, SCLK, SDI and SDO). The interface can be configured to two modes
by the DMA_CTRL pin: Slave mode and Master mode.
2.1
SPI
The SPI interface in Slave mode is mainly used for register read/write operation. A complete SPI read/write operation is of
32 bits, which contains 16-bit address and 16-bit data. In the 16-bit address, bit0 ~ bit9 correspond to valid register address
A0 ~ A9, and bit10 ~ bit14 are reserved (these bits are don’t-care). Bit15 indicates the SPI operation is read or write.
SPI Operation
Description
Highest Bit (Bit15)
Read
Write
Read register data
Write data to register
1
0
The transmission of address and data bits is from high to low, which means MSB first and LSB last. Note that the M90E36A
read/write only supports single address operation, rather than continuous read or write.
The M90E36A has a special register LastSPIData [0FH] for recording the last SPI read/write data. This register can be
used for data check for SPI read/write operation. When the system is in strong interference situation, the disturbance signal
may cause SPI communication disorder and result in SPI read/write error. In this case, LastSPIData can be used to check
the correctness of SPI read/write and strengthen system robustness. For read-clear registers, if the read data is different
from the LastSPIData data, the actual data can be obtained by reading the LastSPIData register repeatedly.
LastSPIData application is as shown in Figure-1 and Figure-2:
SPI Read Data
Buffer
Read LastSPIData
LastSPIData == Buffer ?
Y
N
Buffer=LastSPIData
Read LastSPIData
LastSPIData == Buffer ?
N
Y
End
Figure-1 LastSPIData Application (Read)
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
11
SPI Write Data
Buffer
Read LastSPIData
LastSPIData == Buffer ?
N
Y
End
Figure-2 LastSPIData Application (Write)
2.2
DMA
For details please refer to the “SPI/DMA Interface” chapter in the M90E36A datasheet.
12
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
POWER MODES
3
Four power modes are supported which correspond to four kinds of power consumption. The power mode is configured by
PM1/PM0 pins.
3.1
PM1
PM0
Power Modes
Power Consumption
1
1
0
0
1
0
1
0
Normal mode
Partial Measurement mode
Detection mode
Idle mode
High
↓
Low
NORMAL MODE
In Normal mode, all function blocks are active except for the current detector block. All registers can be accessed, including
the registers related to Partial Measurement mode and Detection mode.
3.2
PARTIAL MEASUREMENT MODE
In Partial Measurement mode, only three-phase current sampling and the related blocks are active. SPI communication is
normal in this mode, but only partial measurement related registers and some special registers can be accessed by
external MCU.The accessible registers in Partial Measurement mode are listed as below:
Address
Name
Address
Name
Address
Name
00H
01H
03H
07H
0EH
0FH
SoftReset
SysStatus0
FuncEn0
ZXConfig
DMACtrl
LastSPIData
14H
15H
16H
17H
18H
19H
PMOffsetA
PMOffsetB
PMOffsetC
PMPGA
PMIrmsA
PMIrmsB
1AH
1BH
1CH
1DH
PMIrmsC
PMConfig
PMAvgSamples
PMIrmsLSB
There is a special enable control bit ReMeasure (bit14 of PMConfig) for Partial Measurement mode. When the control bit is
enabled, sampling and measurement are proceeded at the sampling period determined by the PMAvgSamples[1CH]
register.
Measure function is automatically shut off upon measurement completion. It needs to be enabled again if to measure
again. Upon measurement completion, the IRQ0 pin outputs high level. MCU can judge whether measurement is
completed through IRQ0. IRQ0 is cleared when the control bit (ReMeasure) is enabled again or partial measurement mode
is exited.
There is also a special “Busy” indication bit PMBusy (bit0 of PMConfig) for Partial Measurement mode. MCU can also
judge whether measurement is completed through the PMBusy bit.
Accuracy of current measurement in Partial Measurement mode is the same as Normal mode, because reference power
supply module is active.
3.3
DETECTION MODE
In Detection mode, only the current detector is active and all the registers can not be accessed by external MCU. In this
mode, each I/O is in specific state (for details refer to datasheet) and SPI is disabled. So the control and threshold registers
for Detection mode need to be programmed in Normal mode before entering Detection mode. Once these related registers
are written, there is no need to re-configure them when switching between different power modes. Detection mode related
registers are listed as below:
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
13
Address
Name
10H
11H
12H
13H
DetectCtrl
DetectThA
DetectThB
DetectThC
Current detection is achieved with low power comparators. Two comparators are supplied for each phase on detecting
positive and negative current. When any single-phase current or multiple-phase current exceeds the configured threshold,
the IRQ0 pin is asserted high. When all three phase currents exceed the configured threshold, the IRQ1 pin is asserted
high. The IRQ0/IRQ1 state is cleared when entering or exiting Detection mode.
The all three phase currents are considered as the currents of three current channels I1~I3. As there is no phase B current
in 3P3W application, IRQ1 will not be asserted high even if both phase A and phase C current exceed the configured
threshold.
3.4
IDLE MODE
In Idle mode, all the modules are disabled and all the registers can not be accessed. In this mode, each I/O is in a specific
state (for details refer to datasheet) and SPI is disabled. All register values are lost except for current detection related
registers.
3.5
TRANSITION AND APPLICATION OF POWER MODES
The four power modes are controlled by the PM0 and PM1 pins. In application, any power mode transition goes through
Idle mode to avoid register value confusion or system status uncertainty in mode transition. All function modules are
disabled in Idle mode while the related modules will be enabled after switching from Idle mode to other mode, which is
equivalent to reset to the function modules, thus ensuring normal operation of the function modules.
It needs to reload registers to ensure normal operation when switching from Idle mode to Normal mode or Partial
Measurement mode, while no need to reload registers when switching from Idle mode to Detection mode. Power mode
transition is shown as Figure-3:
Normal Mode
PM1:PM0 = 11
Need to reload all
register values
Idle Mode
PM1:PM0 = 00
All the register
values will be lost
except for the
Detection mode
related registers
Detection Mode
PM1:PM0 = 01
Detection Mode related
register value will be kept
Partial Measurement
Mode
PM1:PM0 = 10
Need to reload Partial
Measurement related
registers
Figure-3 Power Mode Transition
14
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Note: For description convenience, the intermediary Idle mode will be omitted when refering to power mode transition.
The most typical application of power mode transition is no-voltage detection for power meter.
The so-called no-voltage state is when all phase voltages are less than the voltage threshold but the load current is greater
than the configured current value (such as 5% of rated current). In no-voltage state, the power meter usually uses backup
battery for power supply. The system needs to enter low power mode and perform measurement and recording for novoltage state periodically.
The recommended flow for power meter with the M90E36A is as below:
1 Set the current detection threshold to be the minimum load current (such as 5% of rated current) required in no-voltage
state.
2 When no-voltage happens, the system enters Idle mode;
3 The system enters Detection mode every once in a while (such as 5s);
4 Once the load current is greater than the configured value, the system enters Partial Measurement mode to measure
and record the load current;
5 The system returns to Idle mode after measurement and recording are completed;
6 The system enters Partial Measurement mode every once in a while (such as 60s) to measure and record the load
current.
System voltage sag
Enter Partial
Measurement mode
Enter Idle mode
N
Measure
current>minimum load
current?
Y
Delay 5s
Record current
value
(no-voltage event)
Enter Detection
mode
Enter Idle mode
N
IRQ0/IRQ1 output high
level?
Delay 60s
Y
Figure-4 Application of Detection Mode and Partial Measurement Mode
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
15
Application note: Design principle for current detection threshold
It is recommended to do system design based on current detection threshold of 3mVrms.
Example:
Assume:
The requirement is that the minimum load current detected is 5% of rated current. Current specification is 5(60)A;
The minimum load current is Id, which corresponds to a 3mVrms ADC input signal.
The parameters meet the following relations:
Minimum Detection Load Current Id
Rated Current In
Maximum Current Imax
5% In
3mVrms
250mA
In
60mVrms
5A
12In
720mVrms
60A
ratio to rated current
corresponding ADC input signal
actual current
16
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
4
CALIBRATION
4.1
CALIBRATION METHOD
Normally voltage, current, mean power, phase angle, frequency and so on are regarded as measurement values, while
active energy, reactive energy and so on are regarded as metering value.
Measurement and metering function both need calibration before normal use as shown in below table:
Power Mode
Normal mode
Parameter
voltage/current
Need Calibration
√
Calibration Method
offset/gain calibration
power/frequency/phase angle/ power factor
X
--
THD
X
--
full-wave energy metering
√
fundamental energy metering
√
offset/gain/phase angle calibration
offset/gain calibration
harmonic energy metering
X
--
Partial Measurement mode
current measurement
√
offset/gain calibration
Detection mode
current detection
√
threshold calibration
In typical application of three-phase power meter, voltage, current and full-wave energy must be calibrated. The others can
be calibrated according to actual application, no need to calibrate if no use.
The calibration flow follows the sequence of measurement first then metering. Metering calibration is realized by first
calibrating gain and then calibrating phase angle compensation, only single-point calibration is needed over the entire
dynamic range. Reactive does not need to be calibrated since it is guaranteed by chip design.
Frequency, phase angle and power factor do not need calibration, since their accuracy is guaranteed by chip design.
4.2
CALIBRATION IN NORMAL MODE
The basic functions, such as measurement, metering, harmonic analysis and so on are only active in Normal mode. So
calibration in Normal mode is basic and a must. The related registers need to be configured before calibration. Calibration
flow is as shown in Figure-5.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
17
Calibration
Initialize
Voltage/Current
Offset Calibration
Voltage/Current
Gain Calibration
Power Offset
Calibration
Energy Gain
Calibration
Phase Angle
Calibration
End
Figure-5 Active Energy Metering Calibration Flow in Normal Mode
4.2.1 Measurement/Metering Startup Command (Configstart/Calstart/HarmStart/AdjStart)
Startup command registers have multiple valid settings for different operation modes.
Startup Register Value
Usage
6886H
Rower up state
Operation
5678H
Calibration
Similar like 6886H, This state blocks checksum checking error generation. Writing with
this value trigger a reset to the associated registers.
8765H
Operation
Checksum checking is enabled and if error detected, IRQ/Warn is asserted and Metering stopped.
Other
Error
It is the value after reset. This state blocks checksum checking error generation
Force checksum error generation and system stop.
The default value for these registers is '6886H' after power-on reset. At this time, measurement functions can be started but
metering functions can not. The measurement/ metering functions will be started when related startup registers are set to
'5678H' or '8765H'. If other values are written to these registers, the corresponding measurement/ metering functions will
be disabled, the corresponding checksum and CSxErr bits will be set and the WarnOut pin will output high level.
18
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Startup Register/
Address
Register Address Range
(CSx Calculation Range)
ConfigStart / 30H
CalStart / 40H
HarmStart / 50H
31H ~ 3AH
41H ~ 4CH
51H ~ 56H
AdjStart / 60H
61H ~ 6EH
Register Function
CSx / Address
Function Startup on
Reset
function configuration
energy metering calibration
fundamental/ harmonic energy metering calibration
measurement value calibration
CS0 / 3BH
CS1 / 4DH
CS2 / 57H
-not startup
not startup
CS3 / 6FH
startup
When '5678H' is written, the registers resume to their power-on values and metering/measurement functions are started
without checksum check.
When '8765H' is written, the registers do not resume to their power-on values, but checksum will be checked. If the written
checksum is the same as the system self generated checksum, normal metering/measurement functions will be started. If
they are different, metering/measurement functions will not be started, the corresponding CSxErr bits are set and the
WarnOut pin outputs high level. Note that if CS2 is not correct, when the startup register (xxxStart) is 8765H, only harmonic
measurement and metering functions will be disabled. But if CS0, CS1 or CS3 are not correct, all measurement and
metering functions will be disabled.
The written checksum means the value MCU (or other external processor) writes to the addresses 3BH/4DH/57H/6FH
through SPI. The value acquired by MCU reading through SPI is the checksum generated internally. When the startup
register (xxxStart) is 5678H or 8765H, the M90E36A will calculate checksum automatically. As long as there is any register
change, the corresponding CSx value will be updated immediately. So in application the MCU process can be simplified by
reading the CSx registers first to get the correct checksum, then writing the checksum directly back to the CSx registers.
Address
Name
01H
SysStatus0
1
2
3
4
Bit15 ~ Bit0
Bit15
Bit7
URevWn
Bit14
CS0Err
Bit6
IRevWn
Bit13
Bit5
-
Bit12
CS1Err
Bit4
-
Bit11
Bit3
SagWarn
Bit10
CS2Err
Bit2
PhaseLos
eWn
Bit9
Bit1
-
Bit8
CS3Err
Bit0
-
CS0Err: indicates CS0 checksum status
0: CS0 checksum correct (default)
1: CS0 checksum error. The WarnOut pin is asserted at the same time.
CS1Err: indicates CS1 checksum status
0: CS1 checksum correct (default)
1: CS1 checksum error. The WarnOut pin is asserted at the same time.
CS2Err: indicates CS2 checksum status
0: CS2 checksum correct (default)
1: CS2 checksum error. The WarnOut pin is asserted at the same time.
CS3Err: indicates CS3 checksum status
0: CS3 checksum correct (default)
1: CS3 checksum error. The WarnOut pin is asserted at the same time.
In application, it is recommended to set all the startup registers (xxxStart) to 8765H, and timely check the startup registers
(xxxStart) and checksum status indicate bits (CSxErr) in order to judge whether system is in normal operation.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
19
xxxStart == 8765H ?
N
Re-initialize
registers
Y
CSxErr == 0 ?
N
Y
Figure-6 Check the Effectiveness of Register Value
4.2.2 PL Constant Configuration (PL_Constant)
Energy accumulation and metering are usually referenced by energy unit, such as kWh. However, within the M90E36A,
energy calculation or accumulation are based on energy pulse (CF). kWh and CF are connected by Meter Constant (MC,
such as 3200 imp/kWh, which means each kWh corresponds to 3200 energy pulses). The chip’s PL_Constant is a parameter related to MC. One PL_Constant corresponds to 0.01CF. PL_Constant should be configured according to different MC
in application.
The M90E36A provides four energy pulse outputs: active energy pulse CF1, reactive energy pulse or apparent energy
pulse CF2, fundamental energy pulse CF3 and harmonic energy pulse CF4. Their Meter Constants are all set by
PL_Constant in union rather than separately.
The PL_Constant registers consist of the PLconstH[31H] and PLconstL[32H] registers, corresponding to high word and low
word of PL_Constant respectively.
PL_Constant is calculated as below:
PL_Constant = 450,000,000,000 / MC
450,000,000,000: Constant
MC: Meter Constant, unit is imp/KWh, imp/Kvarh or imp/KVA
Example: Calculation of PL_constant
Assume:
Meter Constant MC = 3200
Thus:
PL_constant = 450,000,000,000 / 3200
= 140,625,000 (Hex is 8614C68H)
so the registers are set as below:
PLconstH[31H] = 0861H
PLconstL[32H] = 4C68H
20
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
4.2.3 Metering Method Configuration (MMode0)
The M90E36A can be used in difference systems and metering modes, which can be configured by the MMode0[33H]
register.
Address
Name
33H
MMode0
1
2
3
4
5
6
7
8
Bit15 ~ Bit0
Bit15
Bit7
CF2varh
Bit14
Bit6
CF2ESV
Bit13
I1I3Swap
Bit5
-
Bit12
Freq60Hz
Bit4
ABSEnQ
Bit11
HPFOff
Bit3
ABSEnP
Bit10
didtEn
Bit2
EnPA
Bit9
001LSB
Bit1
EnPB
Bit8
3P3W
Bit0
EnPC
I1I3Swap: this bit defines phase mapping for I1 and I3
0: I1 maps to phase A, I3 maps to phase C (default)
1: I1 maps to phase C, I3 maps to phase A
Note: I2 always maps to phase B.
In PCB layout, the M90E36A may be placed on the top layer or bottom layer. The two placements create input
current cross between phase A and C, affecting assembly of the whole meter. The influence can be eliminated by
adjusting this control bit.
Note that the swapping of I1and I3 only changes ADC channels and does not affect the chip’s internal data
processing.
Freq60Hz: grid operating line reference frequency
0: 50Hz (default)
1: 60Hz
The M90E36A is applicable in 50 Hz or 60 Hz power grid. The M90E36A uses different calculation parameters in
data processing according to different grid frequency. To improve the accuracy of measurement and metering,
please set this control bit according to the real power grid frequency.
HPFOff: HPF enable control bit
0: enable HPF (default)
1: disable HPF
Besides measuring the voltage/current RMS in 50Hz or 60Hz (AC) power grid, the M90E36A can also measure the
mean current value of DC condition. HPF should be disabled when using DC measurement functions.
didtEn: enable integrator for didt current sensor
0: disable integrator for didt current sensor; use CT sampling for current channel (default)
1: enable integrator for didt current sensor; use Rogowski coil sampling for current channel
The M90E36A supports sampling over CT or Rogowski coil. Please set this control bit according to the real current
sampling means. Note that different sampling circuit should be adopted when using Rogowski coil.
001LSB: energy register LSB configuration for all energy registers
0: 0.1CF (default)
1: 0.01CF
3P3W: connection type for three-phase energy meter
0: 3P4W connection (default)
1: 3P3W connection
The M90E36A uses different phase sequence judgment for different connection. Please set this control bit according
to the real connection type.
CF2varh: CF2 pin source configuration
0: apparent energy
1: reactive energy (default)
CF2ESV: this bit is to configure the apparent energy computation type when the CF2 pin is set as apparent energy
output. This control bit is also used to configure the apparent energy computation type when calculating power factor
(PF).
0: All-phase apparent energy arithmetic sum (default)
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
21
9
10
11
12
13
1: All-phase apparent energy vector sum
ABSEnQ: configure the calculation method of total (all-phase-sum) reactive energy and power
0: total reactive energy equals to all-phase reactive energy arithmetic sum (default)
1: total reactive energy equals to all-phase reactive energy absolute sum
ABSEnP: configure the calculation method of total (all-phase-sum) active energy and power
0: total active energy equals to all-phase active energy arithmetic sum (default)
1: total active energy equals to all-phase active energy absolute sum
EnPA: this bit configures whether Phase A is counted into the all-phase sum energy/power (P/Q/S)
0: Corresponding Phase A not counted into the all-phase sum energy/power (P/Q/S)
1: Corresponding Phase A to be counted into the all-phase sum energy/power (P/Q/S) (default)
EnPB: this bit configures whether Phase B is counted into the all-phase sum energy/power (P/Q/S)
0: Corresponding Phase B not counted into the all-phase sum energy/power (P/Q/S)
1: Corresponding Phase B to be counted into the all-phase sum energy/power (P/Q/S) (default)
EnPC: this bit configures whether Phase C is counted into the all-phase sum energy/power (P/Q/S)
0: Corresponding Phase C not counted into the all-phase sum energy/power (P/Q/S)
1: Corresponding Phase C to be counted into the all-phase sum energy/power (P/Q/S) (default)
Application note: Common configuration of MMode0
(a) 3P4W, grid frequency 50Hz, MMode0 = 0087H
(b) 3P3W, grid frequency 50Hz, MMode0 = 0185H
4.2.4 PGA Gain Configuration (MMode1)
The MMode1 register is used to configure PGA gain of ADC sampling channel, making chips applicable to meter designs of
different current specifications.
Address
Name
34H
MMode1
1
2
Bit15 ~ Bit0
Bit15
Bit14
DPGA_GAIN
Bit7
Bit6
PGA_GAIN (I4)
Bit13
Bit12
PGA_GAIN (V3)
Bit5
Bit4
PGA_GAIN (I3)
Bit11
Bit10
PGA_GAIN (V2)
Bit3
Bit2
PGA_GAIN (I2)
DPGA_GAIN: digital PGA gain for the 4 current channels
00: Gain = 1 (default)
01: Gain = 2
10: Gain = 4
11: Gain = 8
PGA_GAIN (V1~V3, I1~I4): analog PGA gain for seven ADC channels
00: 1X (default)
01: 2X
10: 4X
11: N/A
Application note: Configuration principle of PGA gain
(a) Ensure that the ADC channel analog input signal should be within the dynamic range of
0~720mVrms
(b) Configure PGA gain to be the maximum value within the whole dynamic range
22
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Bit9
Bit8
PGA_GAIN (V1)
Bit1
Bit0
PGA_GAIN (I1)
4.2.5 Offset Calibration of Voltage/ Current/ Power
In application, the input signal is often influenced by the interference signal. This interference will enter data processing
module through ADC and high-pass filter, not only producing errors to the voltage/current RMS and power calculation, but
also affecting accuracy of the energy metering. The M90E36A provides offset calibration function to voltage, current and
power, reducing the influence of the interference signal to measurement/metering accuracy.
Every phase’s voltage/current offset calibration should be proceeded individually. Take phase A for example, the signal
source is: Ub=Uc=Un, Ua=0, Ia=0. The calibration flow of voltage/current offset is as below:
a. Read measurement registers (32 bits). It is suggested to read several times to get the average value;
b. Right shift the 32-bit data by 7 bits (ignore the lowest 7 bits);
c. Invert all bits and add 1 (2’s complement);
d. Write the lower 16-bit result to the offset register
Every phase’s power offset calibration should be proceeded individually. Take phase A for example, the signal source is:
Ua=Ub=Uc=Un, Ia=0. Set the input source to be 0, the calibration flow of power offset is as below:
a. Read measurement registers (32 bits). It is suggested to read several times to get the average value;
b. Calculate: register value x 100,000 / 65,536
c. Right shift the caculated result data by 8 bits (ignore the lowest 8 bits);
d. Invert all bits and add 1 (2’s complement);
e. Write the lower 16-bits result to the offset register
The relationship between offset register and measurement register is as below:
Item
Data Width
voltage rms
current rms
mean power
32 bits
32 bits
32 bits
Data Align
9 bits
9 bits
8 bits
16 bits
16 bits
16 bits
Offset register
Minimum Unit
7 bits
7 bits
8 bits
0.02mV
0.2μA
0.00256W
The corresponding offset register and measurement value registers are shown as below:
Offset Registers
Voltage
Current
All-wave
Power
fundamental
power
Measurement Value Registers
Address
Register Name
Address
Register Name
Address
Register Name
63H
67H
6BH
64H
68H
6CH
6EH
41H
42H
43H
44H
45H
46H
51H
52H
53H
UoffsetA
UoffsetB
UoffsetC
IoffsetA
IoffsetB
IoffsetC
IoffsetN
PoffsetA
QoffsetA
PoffsetB
QoffsetB
PoffsetC
QoffsetC
PoffsetAF
PoffsetBF
PoffsetCF
0D9H
0DAH
0DBH
0DDH
0DEH
0DFH
0D8H
0B1H
0B5H
0B2H
0B6H
0B3H
0B7H
0D1H
0D2H
0D3H
UrmsA
UrmsB
UrmsC
IrmsA
IrmsB
IrmsC
IrmsN1
PmeanA
QmeanA
PmeanB
QmeanB
PmeanC
QmeanC
PmeanAF
PmeanBF
PmeanCF
0E9H
0EAH
0EBH
0EDH
0EEH
0EFH
0C1H
0C5H
0C2H
0C6H
0C3H
0C7H
0E1H
0E2H
0E3H
UrmsALSB
UrmsBLSB
UrmsCLSB
IrmsALSB
IrmsBLSB
IrmsCLSB
PmeanALSB
QmeanALSB
PmeanBLSB
QmeanBLSB
PmeanCLSB
QmeanCLSB
PmeanAFLSB
PmeanBFLSB
PmeanCFLSB
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
23
4.2.6 Voltage/ Current Measurement Calibration
Measurement calibration means the calibration of voltage rms (Urms) gain and current rms (Irms) gain. Measurement calibration is the premise of energy metering calibration.
1 Voltage/current offset (Uoffset/Ioffset) calibration:
For calibration method, please refer to 4.2.5 Offset Calibration of Voltage/ Current/ Power. No need of calibration if
the voltage/current offset is very small in general application.
2 Voltage/current gain calibration:
The three phases’ calibration can be proceeded simultaneously. The signal source is: Ua=Ub=Uc=Un,
Ia=Ib=Ic=In(Ib). The calibration method is as below:
a. Read voltage/current value of the external reference meter, and also read the voltage/current measurement value
from chip registers;
b. Calculate the voltage/current gain:
Voltage Gain =
Current Gain =
reference voltage value
voltage measurement value
x 52800
reference current value
x 30000
current measurement value
c. Write the result to the corresponding voltage/current gain registers
Note: voltage/current gain calibration is not necessarily proceeded when gain register is the default value. That is,
when the first calibration result is not ideal, there is no need to reset the gain register to the default value. Calibration
can be performed again based on the current value. The formula is as below:
New Voltage Gain =
New Current Gain =
reference voltage value
voltage measurement value
reference current value
current measurement value
x existing voltage gain
x existing current gain
The corresponding voltage/current gain register and measurement value registers are shown as below:
Gain Register
Voltage
Current
Measurement Value Registers
Address
Register Name
Address
Register Name
Address
Register Name
61H
65H
69H
62H
66H
6AH
6DH
UgainA
UgainB
UgainC
IgainA
IgainB
IgainC
IgainN
0D9H
0DAH
0DBH
0DDH
0DEH
0DFH
0D8H
UrmsA
UrmsB
UrmsC
IrmsA
IrmsB
IrmsC
IrmsN1
0E9H
0EAH
0EBH
0EDH
0EEH
0EFH
-
UrmsALSB
UrmsBLSB
UrmsCLSB
IrmsALSB
IrmsBLSB
IrmsCLSB
-
Application Note:
(a) Voltage rms is unsigned and the minimum unit 1LSB of the UrmsA/UrmsB/UrmsC registers is 0.01V. Only the higher 8
bits of the UrmsALSB/UrmsBLSB/UrmsCLSB registers are valid, the lower 8 bits are always 0, and 1LSB is 0.01/256 V.
(b) Current rms is unsigned and the minimum unit 1LSB of the IrmsA/IrmsB/IrmsC registers is 0.001A; Only the higher 8
bits of the IrmsALSB/IrmsBLSB/IrmsCLSB registers are valid, the lower 8 bits are always 0, and 1LSB is 0.001/256 A.
24
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Example: Voltage gain calibration
Assume:
The initial value of phase A voltage gain register UgainA is 0CE40H (52800)
Reference meter output voltage is 220.00V
Voltage rms register readout UrmsA = 5BA0H (23456)
The higher 8 bits of voltage LSB register readout UrmsALSB = 4EH (78)
Thus:
voltage measured value = (UrmsA x 0.01) + (UrmsALSB x 0.01 / 256)
= (23456 x 0.01) + (78 x 0.01 / 256)
=234.563 V
voltage gain = 220.00 / 234.563 x 52800 = 49521.88 = 0C172H
So the register can be set to:
UgainA = 0C172H
4.2.7 Energy Metering Calibration
Only active energy is required for energy calibration. There is no need to calibrate reactive energy, the accuracy of which is
guaranteed by chip design. Metering calibration flow is gain first then phase angle. Active energy pulse output (CF1) should
be connected to the pulse input port of the calibration bench during calibration.
Energy metering should be calibrated at In (Ib).
1 Power offset (Poffset/Qoffset) calibration
For calibration method please refer to 4.2.5 Offset Calibration of Voltage/ Current/ Power. No need of calibration if the
power offset is very small in general application.
2 Gain calibration
Every phase’s gain calibration should be proceeded individually. Take phase A for example, the signal source is:
Ua=Ub=Uc=Un, Ia=In(Ib), Ib=Ic=0, PF=1.0. The calibration method is as below:
a. Read the energy error value e from calibration bench;
b. Calculate the gain;
Gain = Complementary (
3
-ε
x 215 )
1+ ε
c. Write the result to the corresponding gain registers.
Phase angle calibration. Take phase A for example, the signal source is: Ua=Ub=Uc=Un, Ia=In(Ib), Ib=Ic=0,
PF=0.5L.The calibration method is as below:
a. Read the energy error value ep from calibration bench;
b. Calculate the phase angle error;
AngleError = ε p ∗ Gphase
Gphase is a constant. When grid frequency is 50Hz, Gphase=3763.739. When grid frequency is 60Hz,
Gphase=3136.449
c. Write the result to the corresponding phase angle error registers. The phase angle registers are signed and MSB
of 1 indicates a negative value.
The corresponding gain register and phase angle registers are shown as below:
Phase A
Phase B
Phase C
Address
Register Name
47H
48H
49H
4AH
4BH
4CH
GainA
PhiA
GainB
PhiB
GainC
PhiC
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
25
Example: Energy gain and phase angle calculation
The condition is that power factor PF=1.0, current is Ib, energy error ε is -13.78%, so:
-ε/(1+ε)=0.159823707,
gain = int(0.159823707* 2^15)=5237.10=1475H
Write 1475H to the gain register.
After gain calibration, energy error εP is 0.95% in the condition of PF=0.5L, current is Ib and
frequency is 50Hz, so:
phase angle = εP*3763.739
=0.0095*3763.739=35.75553=24H;
Write 24H to the phase angle register.
4.2.8 Fundamental Energy Metering Calibration
For fundamental energy metering calibration, only gain and offset calibration is needed. There is no need to calibrate phase
angle. Fundamental energy pulse output (CF3) should be connected to the pulse input port of the calibration bench during
calibration.
The startup register for fundamental energy metering calibration is HarmStart [50H]. Calibration related registers are
51H~56H. During calibration, please only start and configure these registers rather than other registers.
Fundamental energy metering calibration is similar to energy metering calibration.
1 Fundamental power offset (PoffsetxF) calibration
For fundamental power offset calibration, only active power error needs to be calibrated per phase individually. Take phase
A for example, the signal source is: Ua=Ub-Uc=Un, Ia=0. For calibration method please refer to 4.2.5 Offset Calibration of
Voltage/ Current/ Power. No need of calibration if the power offset is very small in general application.
2 Fundamental energy gain calibration
Every phase’s fundamental energy calibration should be proceeded individually. Take phase A for example, the signal
source is: Ua=Ub=Uc=Un, Ia=In(Ib), Ib=Ic=0, PF=1.0. The calibration method is as below:
a. Read the error value e from the external reference meter;
b. Calculate the gain;
Gain = Complementary (
-ε
x 215 )
1+ ε
c. Write the result to the corresponding gain registers.
The corresponding fundamental energy gain registers are shown as below:
26
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Address
Register Name
54H
55H
56H
PGainAF
PGainBF
PGainCF
Fundamental Energy
Calibration Startup
Fundamental Power
Offset Calibration
Fundamental Energy
Gain Calibration
End
Figure-7 Fundamental Energy Metering Calibration Flow
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
27
4.3
CALIBRATION IN PARTIAL MEASUREMENT MODE
Partial measurement related registers are 14H~1DH. There are no specific startup and checksum registers. Therefore, the
related register should be cleared and configured with initial values before calibration.
4.3.1 Partial Measurement Configuration (PMConfig)
Address
Register
Name
1BH
PMConfig
1
2
3
4
Bit15 ~ Bit0
Bit15
Bit7
-
Bit14
ReMeasure
Bit6
-
Bit13
MeasureStartZX
Bit5
-
Bit12
MeasureType
Bit4
-
Bit11
Bit3
-
Bit10
Bit2
-
Bit9
Bit1
-
Bit8
Bit0
PMBusy
ReMeasure: enable another measurement cycle
0: not enable (default)
1: trigger another measurement cycle
The partial measurement module is one-time triggered, that is, once the ReMeasure bit is set, current measurement
is performed one time then turned off. If measurement is required again, the ReMeasure bit should be set again.
MeasureStartZX: configure start of measurement
0: Measurement start immediately after the ReMeasure bit is set (default)
1: Measurement start from zero-crossing point after the ReMeasure bit is set
MeasureType: indicate the measurement type
0: RMS measurement (default)
1: Mean Value (DC Average) measurement
PMBusy: indicate the measure ‘Busy’ status
0: Measurement done (default)
1: Measurement in progress, ‘Busy’
4.3.2 Sampling Cycle Configuration (PMAvgSamples)
The PMAvgSamples[1CH] register is used to configure the partial measurement sampling cycle. The unit is the number of
ADC sampling within a partial measurement cycle. The default grid frequency is 50Hz, so at the ADC sampling rate of 8K,
the default value of PMAvgSamples is 160 (0A0H).
4.3.3 PGAgain Configuration (PMPGA)
The ADC PGAgain Configuration in Partial Measurement mode is similar to the MMode1 configuration in Normal mode.
Address
Register Name
17H
PMPGA
1
2
28
Bit15 ~ Bit0
Bit15
Bit14
DPGA_GAIN
Bit7
Bit6
-
Bit13
Bit12
Bit5
Bit4
PGA_GAIN (I3)
DPGA_GAIN: DPGA gain for four current sampling channels
00: Gain = 1 (default)
01: Gain = 2
10: Gain = 4
11: Gain = 8
PGA_GAIN(I1~I3): PGA gain for three ADC sampling channels
00: Gain = 1 (default)
01: Gain = 2
10: Gain = 4
11: N/A
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Bit11
Bit10
Bit3
Bit2
PGA_GAIN (I2)
Bit9
Bit8
Bit1
Bit0
PGA_GAIN (I1)
4.3.4 Current Offset Calibration
Considering the influence of the interference signal, Partial Measurement mode also supports current offset calibration.
The calibration method is slightly different from the current offset calibration in Normal mode. Take the rms measurement
for example, the calibration method is as below:
a. Set the input source to be 0;
b. Set MeasureType=1 and ReMeasure=1 to start one current measurement;
c. Read the current registers (16 bits) after measurement completion
d. Repeat step b and c. It is suggested to read many times to get the average value;
e. Invert all bits and add 1 (2’s complement);
f. Write the result to the corresponding offset register
Offset Registers
Measurement Value Registers
Address
Register Name
Address
Register Name
14H
15H
16H
PMoffsetA
PMoffsetB
PMoffsetC
18H
19H
1AH
PMIrmsA
PMIrmsB
PMIrmsC
Partial Measurement module also provides the measurement value LSB register PMIrmsLSB. This register value has
different definition in rms measurement (AC) and Mean Value measurement (DC) as shown below:
Address
Register Name
1DH
PMIrmsLSB
Bit15 ~ Bit0
Bit15
Bit7
Bit14
Bit13
Bit6
Bit5
IrmsBLSB
Bit12
Bit4
Bit11
Bit3
Bit10
Bit9
IrmsCLSB
Bit2
Bit1
IrmsALSB
Bit8
Bit0
In rms measurement, the PMIrmsLSB register value is the LSB of the measurement value. In mean value measurement, this register value is the MSB of the measurement value.
4.3.5
Current Measurement Calibration
The M90E36A only has current measurement function in Partial Measurement mode, so current gain needs to be calibrated. Current gain calibration for three phases can be proceeded simultaneously. Take rms measurement for example,
the calibration method is as below:
a. Set MeasureType=0 and ReMeasure=1 to start one current measurement;
b. Read the current value from the signal source (reference meter) and read the value of current registers (16 bits);
c. Calculate the current gain
Current gain = reference current value / current measurement value
d. Partial Measurement mode has no special current gain register, so the calculated result should be saved in MCU
or external memory.
Note that the partial measurement module is enabled in both Normal and Partial Measurement mode. That means the
partial measurement module can measure current value in both modes.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
29
Partial
Measurement
Statup
Current offset
calibration
Partial
Measurement
Statup
Current gain
calibration
End
Figure-8
4.3.6
Partial Measurement Calibration Flow
Special Application of Partial Measurement Function
In Normal mode, the current rms measurement uses 16 cycles as the measurement period, that means current measurement period is 320ms when grid frequency is 50Hz. If there is a need to measure current at special period, start partial
measurement function in Normal mode, and proceed specific period current measurement by configuring the partial
measurement sampling period register PMAvgSamples. It is noted that employing specific period current measurement
function will not influence the energy metering and parameters measurement functions in Normal mode, since the partial
measurement module is also active in Normal mode.
The partial measurement module can proceed RMS measurement (AC) and Mean Value measurement (DC). The mean
value measurement can also be proceeded in Normal mode by starting partial measurement function.
Application note: How to measure DC current signal
DC measurement function is proceeded by partial measurement module. The flow of DC
measurement is as below:
a. Disable HPF (HPFOff=1)
b. Set MeasureType to 1
c. Set ReMeasure to start current measurement once
d. Detect the IRQ0 pin or the PMBusy bit to judge whether measurement is completed
e. Read the PMIrmsA/PMIrmsB/PMIrmsC/PMIrmsLSB registers to get measurement result
f. Repeat step c~e if to measure again
30
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
4.4
CALIBRATION IN DETECTION MODE
Current detection is realized by low power consumption comparators. The comparator outputs low level when the external
current is lower than the configured threshold; The comparator outputs high level when the external current is higher than
the configured threshold, as shown in Figure-9.
Current Input
Current
Threshold
IRQ Output
DAC
Figure-9 Current Detection Principle
4.4.1 Current Detection Module Configuration
Six current threshold comparators can be configured for the current detection module to detect positive and negative
current of three phases. These six threshold comparators can be enabled and disabled by the control bits, as shown below:
Address
Register Name
10H
DetectCtrl
1
2
Bit15 ~ Bit0
Bit15
Bit7
-
Bit14
Bit6
-
Bit13
Bit5
PDN3
Bit12
Bit4
PDN2
Bit11
Bit3
PDN1
Bit10
Bit2
PDP3
Bit9
Bit1
PDP2
Bit8
Bit0
PDP1
Bit10
Bit9
Bit8
Bit2
Bit1
Bit0
PDN3/2/1: Control bits for negative detector of channel 3/2/1;
0: Detector enable (default)
1: Detector disable
PDP3/2/1: Control bits for positive detector of channel 3/2/1;
0: Detector enable (default)
1: Detector disable
Each of the six current threshold comparators has its own register configuration as shown below:
Address
Register Name
11H
12H
13H
DetectThA
DetectThB
DetectThC
1
2
Bit15 ~ Bit0
Bit15
Bit7
-
Bit14
Bit13
Bit12
Bit6
Bit5
Bit4
Bit11
CalCodeN
Bit3
CalCodeP
CalCodeN: negative detector threshold, 7-bit width.
7’b000-0000 corresponds to minimum threshold Vc=-4.28mV=-3.03mVrms
7’b111-1111 corresponds to maximum threshold Vc=12.91mV=9.14mVrms
CalcodeP: positive detector threshold, definition is the same as CalCodeN.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
31
4.4.2 Current Detection Threshold Calibration
Because of the low power consumption consideration and the manufacturing process, the current detection threshold is
different from different chips. Therefore, calibration is needed due to the offset of chip’s DAC output (less than ±5mVrms).
The threshold current range is 2mVrms ~ 4mVrms within which the current detection module (low power consumption
comparator) can detect accurately. It is recommended to proceed system design according to current detection threshold of
3mVrms.
In Detection mode, all registers are not accessible, so the current threshold registers need to be configured in Normal
mode first before entering Detection mode.
Dichotomy is suggested in current detection threshold calibration. The recommended calibration flow is as shown in Figure10.
Reference source outputs
current signal that needs
detection (such as 5%Ib)
Th_max = 80H
Th_min = 00H
Th_temp = 40H
Th_max, Th_min, Th_temp:
variable
DetectThx: Threshold register
Switch to Normal mode
DetectThx = Th_temp
Th_min = Th_temp
Th_temp = (Th_max – Th_min) / 2
Th_max = Th_temp
Th_temp = (Th_max – Th_min) / 2
Switch to Detection mode
N
N
Th_max – Th_temp == 1 ?
Y
IRQ0 output high level?
N
Th_temp – Th_min == 1 ?
Y
Y
current detection threshold
= Th_temp
current detection threshold
= Th_min
End
Figure-10 Current Detection Threshold Calibration Flow
32
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
5
FUNCTION REGISTERS CONFIGURATION
5.1
STARTUP CURRENT CONFIGURATION
The registers which related to startup current configuration is shown as below:
1
2
3
4
Address
Register Name
Description
35H
PStartTh
All-phase Active Startup Power Threshold.
36H
QStartTh
All-phase Reactive Startup Power Threshold.
37H
SStartTh
All-phase Apparent Startup Power Threshold.
38H
PPhaseTh
Each-phase Active Startup Power Threshold.
39H
QPhaseTh
Each-phase Reactive Startup Power Threshold.
3AH
SPhaseTh
Each-phase Apparent Startup Power Threshold.
Due to system interference when current is 0, small signal may be gernerated in current sampling channel, producing
a certain amount of energy and affecting the measurement and metering accuracy. To avoid this, the M90E36A
provides the each-phase startup power configuration/judgment function.
PPhaseTh, QPhaseTh and SPhaseTh are used to judge the startup power of each phase (A/B/C). Take active power
for example, when a single phase input power is smaller than the configured PPhaseTh value, the input active power
of that phase will be set to 0 by force, that means input to the next process is 0. Otherwise the signal will be streamed
to the next process.
Note that the threshold are configured separately to active(P), reactive(Q) and apparent (S). The compared value is
(|P|+|Q|).
PStartTh, QStartTh and SStartTh are used to judge all-phase startup power. Take active power for example, when allphase-sum power is less than the configured PStartTh value, energy accumulation will not start. Otherwise energy
accumulation will start.
Calculation methods of the two register groups are the same. The formula is as below:
Register value = N / 0.00032, (N is the configured power threshold).
Example: Startup Current Configuration
Assume:
meter voltage is 220V, current specification 5(100)A, active startup current is 0.1%
Considering the accuracy of current measurement in small-current state, it is recommended to configure the allphase startup current threshold to be 50% of startup current (also can configure based the actual conditions).
Assume the startup threshold of each-phase power is configured to be 10% of startup current.
so:
All-phase Active Startup Power Threshold = 3 x 5 x 0.1% x 50% x 220 = 1.65W
Each-phase Active Startup Power Threshold = 5 x 0.1% x 10% x 220 = 0.11W
Register values are:
PStartTh[35H] = 1.65 / 0.00032 = 5156 = 1424H
PPhaseTh[38H] = 0.11 / 0.00032 = 344 = 158H
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
33
Power Threshold
|P|+|Q|>
PPhaseTh?
A/B/C
Phase Active
Power from DSP
0
Total Active Power
3 phases
ABS >
PStartTh?
+
1
Phase Active
Energy Metering
0
0
0
Power Threshold
|P|+|Q|>
QPhaseTh?
Phase Reactive
Power from DSP
0
Total Reactive Power
3 phases
0
1
Total Reactive
Energy Metering
ABS >
QStartTh?
+
1
1
Phase Reactive
Energy Metering
0
0
0
Power Threshold
|P|+|Q|>
SPhaseTh?
Phase Apparent
Power from DSP
0
0
Total Apparent Power
3 phases
A/B/C
Total Active
Energy Metering
1
0
A/B/C
0
1
ABS >
SStartTh?
+
0
1
Total (arithmetic
sum) Apparent
Energy Metering
1
1
0
0
0
0
Phase Apparent
Energy Metering
Figure-11 Metering Startup Handling
5.2
SAG FUNCTION
Sag detect function is provided in M90E36A. The threshold of sag detection is configured through the SagTh register
(08H). All three voltage phases use the same threshold. The threshold equation is as below:
SagTh =
Vth × 100 × 2
2 × Ugain / 32768
Vth: the voltage threshold to be configured;
Ugain: the gain after calibration
The default value of the SagTh register (08H) is 0000H. It is suggested to set the SagTh register (08H) appropriately even
if the Sag function is not used in application. The reasons are as follows:
In normal mode, all measurement values are calculated based on the average cycle out of 16 voltage cycles. And the
voltage cycle makes use of the internal zero-crossing signal, which is different from the output on the ZX2 / ZX1 / ZX0 pins.
In a 3P4W system, this internal zero-crossing signal is based on phase A voltage Ua firstly. If phase A is in sag, phase C
voltage Uc is switched. If phase A and phase C are both in sag, phase B voltage Ub is switched. In a 3P3W system, the
internal zero-crossing signal is based on phase A voltage Uab firstly. If phase A is in sag, phase C voltage Ucb is switched.
In either 3P4W and 3P3W application, if all phases are in sag, the average cycle of 16 voltage cycles is calculated in accordance with the configured reference frequency (50 Hz or 60 Hz), i.e. 320ms for 50Hz system and 266.7ms for 60Hz
system.
However, for energy meter or power instrument with auxiliary power supply, if the SagTh register is not configured (the
default power-on value is 0), the M90E36A will not enter sag even if there is no signal on voltage circuits due to the interference noise. Thus the wrong average cycle might be used to calculate measurement values such as current rms.
34
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
5.3
RESERVED REGISTER/ ADDRESS AND RESERVED BITS
5.3.1 Reserved Register/ Address
The M90E36A has many reserved registers and non-listed address areas besides the registers listed in datasheet. These
reserved registers are not open to users. Please don’t operate on the address outside of the datasheet. Access to reserved
register/address needs special operation because normal operation can not make change or impact to these register
values.
5.3.2 Reserved Register Bits
Some fields of defined registers in the datasheet are labeled as ‘reserved’. In application, all the reserved bit fields shall be
written with ‘0’ when those bits have to be written, and shall be masked out (hence ignored) upon read.
5.3.3 Reserved Bits in the FUNC_EN1 Register
The most registers’ reserved bits will return ‘fixed 0’ upon read. There is only one exception: the FUNC_EN1 register (04H).
This register has three reserved bits. Those bits may return non-fixed value upon read. Users need to mask out or ignore
those bits when using the read-back value of this register. Please note that the non-fixed return value does not indicate any
abnormal working condition of the internal hardware logic. Users just need to ignore those bit fields.
Address
Name
04H
FuncEn1
Bit15 ~ Bit0
Bit15
INOv1En
Bit7
RevQchgTEn
Bit14
INOv0En
Bit6
RevQchgAEn
Bit13
Reserved
Bit5
RevQchgBEn
Bit12
Reserved
Bit4
RevQchgCEn
Bit11
Bit10
THDUOvEn THDIOvEn
Bit3
Bit2
RevPchgRevPchTEn
gAEn
Bit9
DFTDone
Bit1
RevPchgBEn
Bit8
Reserved
Bit0
RevPchgCEn
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
35
6
TEMPERATURE COMPENSATION
The M90E36A itself embodies good temperature characteristic. Considering that the external components might be
affected by temperature in application, the M90E36A also provides compensation function for external temperature drift.
A series of special registers should be configured for temperature compensation. These registers are located in special
addresses, and access to these registers should be strictly carried out as the following.
6.1
ON-CHIP TEMPERATURE SENSOR CONFIGURATION
The M90E36A provides a built-in temperature sensor. Due to the manufacturing process, the temperature sensor might be
somewhat different for different chips. Therefore the on-chip temperature sensor should be configured before temperature
compensation.
The configuration method is as below:
a. Write AA55H to address 2FDH
b. Write 5122H to address 216H
c. Write 012BH to address 219H
d. Write 0000H to address 2FDH
Read the Temp[0FCH] register directly to get the current temperature after configuration completed. Please note that, the
temperature sensor will sense the temperature of the chip and it may have a few degrees of difference between the chip
junction temperature and ambient temperature.
6.2
TEMPERATURE COMPENSATION BASED ON ADC SAMPLING CHANNEL
The temperature compensation method is as below:
a. Write AA55H to address 2FCH
b. Write the temperature coefficient to be compensated to address 270H
c. Write the fiducial point temperature of the temperature coefficient to address 27BH
d. Write 0000H to address 2FCH
The reference point temperature of the temperature coefficient is generally configured to be the temperature in calibration.
That is, in calibration, read the Temp[0FCH] register first to get the current temperature and then save it as the reference
temperature.
Address
270H
27BH
36
Register Name
TempCompGain
Bit
15:8
Read/Write
Read/Write
7:0
-
-
Temperature compensation coefficient, bit 7 is the sign
bit, unit is ppm/ ℃
15
Read/Write
0
1: enable temperature compensation
0: disable temperature compensation
Reserved bit. Readout value is 0
TempCompRef
Default Value
Description
0
Reserved bit. Readout value is 0.
14:9
-
-
8:0
Read/Write
19H
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
The reference temperature of the temperature coefficient, bit 8 is the sign bit, unit is ℃
Example:
Error
Test data before temperature compensation is as below:
0.08
0.06
0.04
0.02
0
-0.02
-50
0
50
Temp
100
-0.04
-0.06
-0.08
Error
Linear
Compesation
After linearization:
The reference temperature (temperature in calibrating) is 25 ℃ , metering error is 0.0000%;
The error at 85 ℃ point is 0.06%
So the temperature coefficient is calculated as below:
(0.06% - 0.0000%) / (85 ℃ - 25 ℃ ) = 10ppm/ ℃
The temperature coefficient to be compensated is -10ppm/ ℃ . Register configuration is as below:
a. Write AA55H to address 2FCH
b. Write FFF6H to address 270H
c. Write 8019H to address 27BH
d. Write 0000H to address 2FCH
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
37
6.3
TEMPERATURE COMPENSATION BASED ON REFERENCE VOLTAGE
On-chip high-precision reference voltage is provided with excellent low temperature coefficient. But in application, what
should be considered is the temperature drift of the whole system. Therefore, the M90E36A specially provides temperature
compensation based on reference voltage to minimize temperature drift caused by the on-board components.
Note that, as voltage and current ADC sampling adopt the same reference voltage, compensation on the reference voltage
will bring double effect on power and energy.
Temperature compensation on reference voltage is proceeded with every 8 ℃ as a segment. In application, it is suggested
to test on a small batch of components from the same lot to get the best temperature compensation coefficient. And then
use this compensation coefficient as a fixed value to be written directly to register in production.
The temperature compensation method is as below:
a. Write AA55H to address 2FDH
b. Write the reference voltage coefficient of segmented compensation to addresses 202H~209H
c. Write the curvature of segmented compensation curve to address 201H
d. Write 0000H to address 2FDH
In normal condition, reference voltage is 1200mV. The unit of reference voltage compensation is 0.020mV in this compensation method.
The default value of the corresponding compensation registers is the ideal value in chip design. In application, only incremental adjustment is needed.
Address
201H
38
Register Name
BGCurveK
Bit
15:4
Read/Write
-
3:0
Read/Write
Read/Write
Default Value
Description
Reserved bit, readout value is 0
0
Reference voltage temperature compensation curve.
The bit3 is assumed as sign bit, range is -8 to +7.
Scaling factor = 1+ register value*1/8.
So the scaling factor will be from 0, with step of 1/8, all the
way to 1+7/8.
0
Compensation coefficient on the 25 ℃ temperature point
202H
BG_TEMP_P12
15:8
7:0
Read/Write
1
Compensation coefficient on the 17 ℃ temperature point
203H
BG_TEMP_P34
15:8
Read/Write
6
Compensation coefficient on the 41 ℃ temperature point
7:0
Read/Write
2
Compensation coefficient on the 33 ℃ temperature point
204H
BG_TEMP_P56
15:8
Read/Write
25
Compensation coefficient on the 57 ℃ temperature point
7:0
Read/Write
13
Compensation coefficient on the 49 ℃ temperature point
205H
BG_TEMP_P78
15:8
Read/Write
53
Compensation coefficient on the 73 ℃ temperature point
7:0
Read/Write
39
Compensation coefficient on the 65 ℃ temperature point
206H
BG_TEMP_N12
15:8
Read/Write
16
Compensation coefficient on the 1 ℃ temperature point
7:0
Read/Write
6
Compensation coefficient on the 9 ℃ temperature point
207H
BG_TEMP_N34
15:8
Read/Write
54
Compensation coefficient on the -15 ℃ temperature point
7:0
Read/Write
34
Compensation coefficient on the -7 ℃ temperature point
208H
BG_TEMP_N56
15:8
Read/Write
117
Compensation coefficient on the -31 ℃ temperature point
7:0
Read/Write
79
Compensation coefficient on the -23 ℃ temperature point
209H
BG_TEMP_N78
15:8
Read/Write
205
Compensation coefficient on the -47 ℃ temperature point
7:0
Read/Write
159
Compensation coefficient on the -39 ℃ temperature point
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
7
HARMONIC ANALYSIS
7.1
DFT ENGINE
The built-in DFT computation engine supports 2nd-32nd order harmonic analysis function for 6 channels. The calculation
error will be enlarged when input signal is small. To address this issue, a prescaler is designed and placed before the DFT
engine to amplify the signal to be calculated.
The designed ADC sampling rate is 8kHz. Harmonic analysis adopts 4096 sampling points for DFT computation which
takes around 0.5s once.
Considering there are many DFT computation outputs, the DFT computation engine is closed by default to ensure external
MCU can read DFT data from the same calculation. The engine needs to be enabled to startup, and it will automatically
shut off after completing calculation for one time. Calculation results are stored in registers. External MCU can read these
registers to get calculation results through SPI interface.
Harmonic measurement accuracy is guaranteed by chip design after voltage/current calibration.
The control registers of DFT computation engine is as below:
Address
1D0H
1D1H
1
2
3
4
Register Name
DFT_SCALE
DFT_CTRL
Bit
15
Read/Write
Read/Write
Default Value
0
Description
14:13
Read/Write
0
Voltage scale for phase C.
12:11
Read/Write
0
Voltage scale for phase B.
10:9
Read/Write
0
Voltage scale for phase A.
8:6
Read/Write
0
Current scale for phase C.
5:3
Read/Write
0
Current scale for phase B.
2:0
Read/Write
0
Current scale for phase A.
15:1
-
0
Reserved bit.
0
Read/Write
0
0: Disable DFT engine
1: Enable DFT engine
0: Enable Hanning window
1: Disable Hanning window
The function of Hanning window is to bring periodicity to ADC sampling signal in DFT computation to achieve the exact
calculation result. Please enable Hanning window in general application.
Voltage scale, InputGain= 2^Scale
00: Gain = 1
01: Gain = 2
10: Gain = 4
11: Gain = 8
Current scale, InputGain= 2^Scale
000: Gain = 1
001: Gain = 2
010: Gain = 4
011: Gain = 8
100: Gain = 16
101: Gain = 32
110: Gain = 64
111: Gain = 128
DFT engine switch: DFT computation engine is enabled after setting the DFT_CTRL bit. This bit will be cleared automatically after completing calibration for one time. In application, this bit can be used to judge whether DFT computation is completed.
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
39
DFT application is as below:
a. Set DFT computation engine and write 2A49H to the DFT_SCALE [1D0H] register (Assume gain of voltage and current is two)
b. Start DFT computation engine and write 001H to the DFT_CTRL [1D1H] register
c. Check DFT_CTRL. If DFT_CTRL=0, DFT computation is completed (about 0.5s)
d. Read register value and get harmonic component and fundamental voltage/current value after transition
Harmonic Component (%) = Register Value / 163.84
Register address 100H~1BFH
Fundamental Current =
Register Value x 3.2656
2Scale x 1000
Register address 1C0H, 1C2H, 1C4H
Fundamental Voltage =
Register Value x 3.2656
2Scale x 100
Register address 1C1H, 1C3H, 1C5H
For description of the related registers, please refer to datasheet.
Example:
Assume:
Meter ‘s nominal voltage is 220V, nominal current is 5A
The signal source outputs 10% of 5th order harmonic component for phase A voltage and
40% of 5th order harmonic for phase A current.
Register values are as follows after DFT computation engine:
[103H] = 0671H (1649)
[123H] = 19C9H (6601)
so the measured harmonic component is :
Voltage 5th order harmonic component = 1649 / 163.84 = 10.0647 (means 10.0647%)
Current 5th order harmonic component = 6601 / 163.84 = 40.2893 (means 40.2893%)
In application, the THD+N threshold for three-phase voltage and three-phase current can be configured. The M90E36A can
judge whether the THD+N value is greater than the configured threshold by checking the corresponding status bits or the
IRQ output signal. If the THD+N value is greater than the configured threshold, DFT computation engine can be started,
and analysis and recording can be processed to the harmonic signal.
40
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Set THD+N monitor
threshold
N
Check THD+N detector
Y
Start DFT function
N
Detect DFT completion
identification
Y
Read the DFT computation
result directly
Figure-12 Harmonic Analysis Application Flow
M90E36A [APPLICATION NOTE]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
41
7.2
OBTAIN HARMONIC ANALYSIS OF ABOVE 32ND
Harmonic analysis of 32nd to 42nd can be obtained as below:
1. Read the [1D7H] register (divided by 1024, current frequency can be achieved);
2. Write the value of the [1D7H] register to the 1D4H register;
3. Calculate the value of the [1D7H] register *15.872, then convert to hex. Write the high word to the [1D2H] register
and the low word to the [1D3H] register;
4. Write 0x101 to the [1D1H] register to start DFT calculation;
5. Read the 33rd - 42nd order component of each phase’s voltage and current in the 2nd - 11th registers when DFT
calculation is complete after 0.5s (typical).
For example, if the current frequency is 50Hz, the value of the [1D7H] register is 51200 (or 0xC800). Write 0xC800 to the
[1D4H] register. Meanwhile 51200*15.872=812646.4=0xC 6666, so write 0x0C to the [1D2H] register and 0x6666 to the
[1D3H] register.
Of course, if not consider the influence of frequency changes to harmonic analysis, step 3 can be simplified as: write 0xC to
the [1D2H] register and 0x6666 to the [1D3H] register.
It should be pointed out that because of the multiplex of some registers, the 90E36/36A can not provide harmonic analysis
of the 2nd - 32nd and the 33rd - 42nd simultaneously. The common practice is to read the 2nd - 32nd harmonic analysis
first, and then read the 33rd - 42nd harmonic analysis. Hence their corresponding intervals are different.
The THD data of each phase’s voltage/current is analyzed based on current calculated harmonic.
2nd - 32nd harmonic analysis:
31
THDI =
 | X (k ) |
2
k =1
| X ( 0) | 2
× 100%
33rd - 42nd harmonic analysis:
41
THD II =
 | X (k ) |
k = 32
| X (0) |2
2
× 100 %
So the THD for 2nd - 42nd order harmonic:
THDT = THDI 2 + THDII 2
42
M90E36A [Application Note]
Atmel-46104A-SE-M90E36A-ApplicationNote_050514
Revision History
Doc. Rev.
Date
46104A
5/5/2014
Comments
Initial release.
X X X X
Atmel Corporation
1600 Technology Drive, San Jose, CA 95110 USA
T: (+1)(408) 441.0311
F: (+1)(408) 436.4200
|
www.atmel.com
© 2014 Atmel Corporation. All rights reserved. / Rev.: Atmel-46104A-SE-M90E36A-ApplicationNote_050514.
Atmel®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities®, and others are registered trademarks or trademarks of Atmel Corporation or its
subsidiaries. Other terms and product names may be trademarks of others.
DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right
is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE
ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT
SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES
FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this
document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information
contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended,
authorized, or warranted for use as components in applications intended to support or sustain life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where
the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Atmel officer's specific written
consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems.
Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are
not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.