RX21A Group - Renesas Electronics

APPLICATION NOTE
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
R01AN2180EJ0100
Rev. 1.00
Oct. 1, 2014
Abstract
This document describes the methods of calibration and compensation for the 24-bit ΔΣ A/D converter (DSAD) in the
RX21A Group.
The RX21A is designed to achieve a low cost solution of the 3-phase power meter that satisfies IEC 62052-11 and IEC
62053-22 requirements.
IEC 62053-22 standardizes measurement errors in the range of current 0.01In ≤ I ≤ Imax. To measure current which
varies in this wide range, the RX21A DSAD can amplify differential input from x1 to x64 and single-ended input from
x1 to x4 using the on-chip PGA. Furthermore the G version of RX21A has the calibration data of the accurate gains,
which are programmed before shipping, for available gain settings. With these calibration data, the user can calibrate
gains for all gain settings by choosing only one gain setting and calibrating the gain for the selected gain setting. The
measurement accuracy after calibration at the reference temperature satisfies the class 0.2S meter requirements
standardized in IEC 62053-22.
IEC 62052-11 and IEC 62053-22 also standardize measurement errors due to temperature fluctuations in the ranges of
temperature. The measurement values with the RX21A DSAD are influenced by temperature. However the temperature
characteristics of the RX21A have been clarified. Thus the measured values can be compensated using the powerful
calculation ability of the RX21A.
Even if not using an external reference power supply with high precision, the measurement accuracy after compensation
by the RX21A DSAD satisfies the requirement for the class 0.5S meter standardized by IEC 62053-22 in the
temperature range from -25°C to +75°C. This range is wider than the required range, which is from -25°C to +55°C, for
outdoor use meters by IEC 62052-11.
Products
- RX21A Group 100-pin package with a ROM size between 256 KB and 512 KB
- RX21A Group 80-pin package with a ROM size between 256 KB and 512 KB
- RX21A Group 64-pin package with a ROM size between 256 KB and 512 KB
Note: Only the G-version (operating temperature: -40°C to +105°C) of RX21A is the target device in this application
note.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 1 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
Contents
1.
Specifications ..................................................................................................................................... 3
2.
Operation Confirmation Conditions .................................................................................................... 3
3.
Hardware ............................................................................................................................................ 4
4.
Mechanism of Gain Calibration .......................................................................................................... 5
4.1 Gain Calibrations Among Channels and Among Gains on a Channel ........................................ 5
4.2 Device Gain ................................................................................................................................. 5
4.3 Influences of External Input Resistor and Internal Input Resistor................................................ 6
4.4 System Gain Calibration .............................................................................................................. 7
5.
Result of the System Gain Calibration ............................................................................................... 9
6.
Temperature Characteristics and Compensation Method................................................................ 10
6.1 Temperature Characteristics...................................................................................................... 10
6.2 Device Gain ............................................................................................................................... 11
6.3 VBGR ......................................................................................................................................... 12
6.4 Input Impedance ........................................................................................................................ 13
6.5 Compensation for the Temperature Characteristics of the System Gain .................................. 13
6.6 Coefficients of the Temperature Characteristics in the RX21A Group ...................................... 14
7.
Compensation Results of the Temperature Characteristics............................................................. 15
7.1 Temperature Characteristics of the VBGR ................................................................................ 15
7.2 System Gain of the Differential Input Pins ................................................................................. 16
7.3 System Gain of Single-Ended Input Pin .................................................................................... 18
8.
Software ........................................................................................................................................... 20
8.1 Operation Overview ................................................................................................................... 20
8.2 Required Memory Size .............................................................................................................. 20
8.3 File Composition ........................................................................................................................ 20
8.4 Constants ................................................................................................................................... 21
8.5 Variables .................................................................................................................................... 21
8.6 Functions.................................................................................................................................... 23
8.7 Function Specifications .............................................................................................................. 24
8.8 Flowcharts .................................................................................................................................. 26
8.8.1 Main Processing ................................................................................................................. 26
8.8.2 Coefficient Initialization for Gain Calibration and Temperature Compensation.................. 27
8.8.3 System Gain Calibration ..................................................................................................... 29
8.8.4 Temperature Compensation for the System Gain .............................................................. 29
9.
Sample Code .................................................................................................................................... 30
10. Reference Documents ...................................................................................................................... 30
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 2 of 30
RX21A Group
1.
Calibration and Compensation for the ΔΣ A/D Converter
Specifications
This document describes the methods of calibration and compensation for gains in the RX21A DSAD.
Table 1.1 lists the Peripheral Functions and Their Applications.
Table 1.1 Peripheral Functions and Their Applications
Peripheral Function
24-bit ΔΣ A/D converter (DSAD)
Temperature sensor (TEMPSa)
10-bit A/D converter (AD)
Application
Measures electrical power
Measures temperature
These peripheral functions are not operated in the sample
code. Some dummy functions are used instead.
2. Operation Confirmation Conditions
The sample code accompanying this application note has been run and confirmed under the conditions below.
Table 2.1 Operation Confirmation Conditions
Item
Integrated development
environment
C compiler
iodefine.h version
Endian
Operating mode
Processor mode
Sample code version
Simulator
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Contents
Renesas Electronics Corporation
High-performance Embedded Workshop Version 4.09.01
Renesas Electronics Corporation
C/C++ Compiler Package for RX Family V.1.02 Release 01
Compile options
-cpu=rx200 -output=obj="$(CONFIGDIR)\$(FILELEAF).obj" -debug -nologo
(The default setting in the integrated development environment is used.)
Version 1.1A
Little endian
Single-chip mode
Supervisor mode
Version 1.00
RX200 Simulator Target Platform V.1.00.01.000
Page 3 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
3. Hardware
Figure 3.1 shows the Configuration of the 3-Phase Power Meter with the RX21A.
1.22 V
BGR
N
P1
P2
P3
Temperature
sensor
PGA
Reference
generator
BGR_BO
ANDS0P
PGA
ΔΣ
Modulator
+ Filter
PGA
ΔΣ
Modulator
+ Filter
ANDS0N
ANDS1P
ANDS1N
10 bit
ADC
XTAL
PCLKC
Main
Clock
EXTAL
HOCO
ANDS2P
PGA
ΔΣ
Modulator
+ Filter
PGA
ΔΣ
Modulator
+ Filter
PGA
ΔΣ
Modulator
+ Filter
PGA
ΔΣ
Modulator
+ Filter
PGA
ΔΣ
Modulator
+ Filter
ANDS2N
ANDS3P
ANDS3N
ANDS4
ANDS5
ANDS6
ANDSSG
CPU
RX21A
Figure 3.1 Configuration of the 3-Phase Power Meter with the RX21A
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 4 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
4. Mechanism of Gain Calibration
4.1
Gain Calibrations Among Channels and Among Gains on a Channel
The RX21A has seven independent units of the DSAD and can measure 3-phase of currents and voltages
simultaneously. Having multiple channels is an advantage in measuring multi-phase power while gain errors for all
channels must be minimized.
Offset and gain mismatches among channels occur not only in the RX21A but also in the external devices. The user
must calibrate the system gain (the total gain from the sensor input through the digital output of the DSAD) for all
channels at least once in the finalized product.
Also the user must compensate mismatch among gains on a channel. The calibration data for gains on the RX21A is
measured and stored before shipping for each device. Therefore the user does not have to obtain calibration data for
each gain setting.
Figure 4.1 shows the concept of the gain calibration. The left chart shows the raw gains, the center shows the gains after
calibration of mismatches among channels at x1, and the right shows the gains after the compensation of mismatches
among gains using the calibration data stored in the device.
Gain-to-gain mismatch compensation
by the calibration data internally stored
Calibrated at x1
64.0
64.0
32.0
32.0
32.0
16.0
16.0
16.0
8.0
4.0
Actual Gain
64.0
Actual Gain
Actual Gain
Raw gain
8.0
4.0
8.0
4.0
2.0
2.0
2.0
1.0
1.0
1.0
x1 x2 x4 x8 x16 x32 x64
PGA Gain setting
x1 x2 x4 x8 x16 x32 x64
PGA Gain setting
x1 x2 x4 x8 x16 x32 x64
PGA Gain setting
Note: This figure shows concept only. Errors in these charts are exaggerated.
Figure 4.1 Gain Calibration and Compensation
4.2
Device Gain
The calibration data for gains on each device (device gain) is measured and stored in the GCD[15:0] bits in the ΔΣ A/D
gain calibration data registers (DSADGmXn) before factory shipping. The device gain for each channel and gain setting
can be obtained using the formula below. Note that DSADGmX64 does not exist. The gain of x32 is digitally amplified
and used for the gain of x64. Twice the gain of x32 for the gain of x64.
Formula 4.1
DeviceGain (m, n) = n × DSADGmXn.GCD[15:0] / 47971
DeviceGain (m, 64) = DeviceGain (m, 32) × 2
m: Input channel (0 to 6)
n: Gain (1, 2, 4, 8, 16, and 32) selected with ΔΣ A/D gain select registers 0 to 6 (DSADGSRm)
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 5 of 30
RX21A Group
4.3
Calibration and Compensation for the ΔΣ A/D Converter
Influences of External Input Resistor and Internal Input Resistor
Figure 4.2 shows the Connection Diagram of the Differential Input Channel.
Rp
Rf
Ri
PGA
Ri
ΔΣ
Modulator
+ Filter
Rf
Rp
Rp: External input resistor, Ri: Internal input resistor, Rf: Feedback resistor
Figure 4.2 Connection Diagram of the Differential Input Channel
A low-pass filter (anti-aliasing filter) composed of the external input resistor Rp and the capacitor must be connected to
the input pins of the DSAD for preventing an aliasing error.
The device gain is proportional to the ratio between the input resistor and the feedback resistor. The input resistor is the
sum of the internal input resistor Ri within the DSAD and the external input resistor Rp.
Formula 4.2
DeviceGain (m, n) ∝ Rf(n) / { Ri(n) + Rp(m) }
m: Input channel (0 to 3)
n: Gain (1, 2, 4, 8, 16, 32 and 64) selected with ΔΣ A/D gain select registers 0 to 3 (DSADGSRm)
Rf(n): Feedback resistor at gain n
Ri(n): Internal input resistor at gain n
Rp(m): External input resistor of channel m
Table 4.1 shows the internal resistor (Ri and Rf) for each gain setting.
Table 4.1 Internal Resistor Values when Setting Each Gain
DSADGSRm.
GAIN[2:0]
000b
001b
010b
011b
100b
101b
110b
Gain
x1
x2
x4
x8
x16
x32
x64
Internal Input
Resistor Ri(n)
Ri0
Ri0
Ri0
Ri0
Ri0 / 2
Ri0 / 2
Ri0 / 2
Feedback
Resistor Rf(n)
Rf0
2Rf0
4Rf0
8Rf0
8Rf0
8Rf0
8Rf0
Gain of the ΔΣ
Modulator
1
1
1
1
1
2
4
Ri0 and Rf0 values in Table 4.1 are designed to 100 kΩ. In practice, these values vary depending on devices. This
variation in Ri0 is proportional to variation in impedance. Thus the accurate value of Ri0 for each device can be obtained
by using the value of the IICD[15:0] bits in the ΔΣ A/D input impedance calibration data register (DSADIIC). The
formula is shown below.
Formula 4.3
Ri0 = 100.0 × DSADIIC.IICD[15:0] / 32768 [kΩ]
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 6 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
The system gain is a product of the sensor gain and the device gain. The sensor gain is the gain of all elements except
the DSAD.
Formula 4.4
SystemGain (m, n) = SensorGain (m) × DeviceGain (m, n)
m: Input channel (0 to 6)
n: Gain selected with ΔΣ A/D gain select registers 0 to 6 (DSADGSRm) (1, 2, 4, 8, 16, and 32)
SystemGain (m, n): Total of the sensor gain and the device gain on channel m with gain setting n
SensorGain (m): Sensor gain on channel m
When the gain setting is for x16, x32, and x64, the input resistor becomes half the value of the input resistor with gain
setting for x1, x2, x4 and x8. Therefore the influence of the external input resistor Rp on the system gain varies
depending on the gain setting. The following formula shows the influence ratio.
Formula 4.5
SystemGain (nH = 16, 32, 64) / SystemGain (nL = 1, 2, 4, 8)
∝ {Ri0 / 2 + Rp} / (Ri0 + Rp) ≈ 1 + Rp / Ri0
4.4
System Gain Calibration
To calibrate the system gain, follow the procedure below.
1.
Initialize the DSAD and specify an appropriate value for gain settings of all channels. x1 is set here as an example.
2.
Connect the power supply and load for testing and provide signals to all phases.
3.
Repeat A/D conversion in appropriate periods for an appropriate number of times, and read the A/D converted data
from the ΔΣ A/D data registers (DSADDR0 to DSADDR6) for each channel. Then calculate the root mean square
value (RMS value) of the A/D converted data.
4.
Calibrate the system gain at gain x1 for each channel.
Formula 4.6
SystemGain (m, 1) = (RMS value of DSADDRm) / Itest [digit / A]
m: Input channel (0 to 3)
Itest: RMS value [A] of the test current
Formula 4.7
SystemGain (m, 1) = (RMS value of DSADDRm) / Vtest [digit / V]
m: Input channel (4 to 6)
Vtest: RMS value [V] of the test voltage
5.
Calculate the sensor gain for each channel based on formula 4.4.
Formula 4.8
SystemGain (m, n) = SensorGain (m) × DeviceGain (m, n) (from formula 4.4)
∴ SensorGain (m) = SystemGain (m, 1) / DeviceGain (m, 1)
m: Input channel (0 to 6)
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 7 of 30
RX21A Group
6.
Calibration and Compensation for the ΔΣ A/D Converter
Calculate the system gain for gain x2 to x8 based on formulas 4.1 and 4.4
Formula 4.9
DeviceGain (m, n) = n × DSADGmXn.GCD[15:0] / 47971 (from formula 4.1)
SystemGain (m, n) = SensorGain (m) × DeviceGain (m, n) (from formula 4.4)
∴ SystemGain (m, n) = SensorGain (m) × n × DSADGmXn.GCD[15:0] / 47971
m: Input channel (0 to 3),
n: Gain (2, 4, 8) selected with ΔΣ A/D gain select registers 0 to 3 (DSADGSRm)
or
m: Input channel (4 to 6),
n: Gain (2, 4) selected with ΔΣ A/D gain select registers 4 to 6 (DSADGSRm)
7.
Calculate the system gain for gain x16 to x32 based on formulas 4.1, 4.3 and 4.5
Formula 4.10
DeviceGain (m, n) = n × DSADGmXn.GCD[15:0] / 47971 (from formula 4.1)
Ri0 = 100.0 × DSADIIC.IICD[15:0] / 32768 [kΩ] (from formula 4.3)
SystemGain (n = 16, 32, 64) / SystemGain (n = 1, 2, 4, 8) ≈ 1 + Rp / Ri0 (from formula 4.5)
∴ SystemGain (m, n) = SystemGain (m, 1) / DSADGmX1.GCD[15:0] × DSADGmXn.GCD[15:0] × n
× (1 + Rp/100k × 32768 / DSADIIC.IICD[15:0])
m: Input channel (0 to 3),
n: Gain (16, 32) selected with ΔΣ A/D gain select registers 0 to 3 (DSADGSRm)
8.
For the gain of x64, the gain of x32 is digitally amplified. Twice the gain of x32 for the gain of x64.
Formula 4.11
System Gain (m, 64) = System Gain (m, 32) × 2
m: Input channel (0 to 3)
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 8 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
5. Result of the System Gain Calibration
Figure 5.1 shows an example of the system gain calibration. In the example, the gain is calibrated for each channel with
each gain setting based on the gain with channel 0 and gain x4 using formulas 4.9 and 4.10. In the result, the gain errors
have been reduced from 0.6% to 0.2% or less.
To make the measurement conditions consistent for all channels, in this example, 14.06 mV of voltage is input taking
into account the limit of x32 gain (14.4 mV). To raise the precision of the calibration, use the test voltage appropriate to
the reference gain selected.
Calibrated Gain
1.006
1.006
1.004
1.004
Real Gain / Nominal Gain
Real Gain / Nominal Gain
Raw Gain
1.002
1.000
0.998
0.996
0.994
1.002
1.000
0.998
0.996
0.994
x1
x2
x4
x8
x16
x32
Gain
x1
x2
x4
x8
x16
x32
Gain
Measurement conditions:
- Number of samples: 5
- Channels: 0 to 3
- Gains: x1 to x32,
- Input: AC 50.664 Hz ± 14.06 mV (peak-to-peak: 28.12 mV) for all gains
- External input resistor: 0 Ω
Figure 5.1 Result of the System Gain Calibration
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 9 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
6. Temperature Characteristics and Compensation Method
6.1
Temperature Characteristics
Suppressing the measurement error due to temperature fluctuations is another challenge. The temperature characteristics
of the device gain have been clarified. Thus the system gain can be compensated by using Tj (junction temperature on
the chip) measured with the built-in temperature sensor in the RX21A. The accuracy of the temperature measured with
the temperature sensor affects the accuracy of gain compensation. Therefore the temperature sensor must be calibrated
beforehand. For details on the temperature sensor, refer to the reference application note listed in section 10.
Figure 6.1 shows the Elements that Have Temperature Characteristics in the Power Meter System.
VBGR: See section 6.3.
Voltage Reference
(Optional)
1.22 V
BGR
BGR_BO
VREFDSH (output)
PGA
RL
VBG:
See formulas 6.1 and 6.2
Reference
generator
ΔΣ
Modulator
+ Filter
ZI
Device gain:
See section 6.2.
System gain
(Differential)
System gain
(Single-ended)
See section 6.5.
CPU
Input impedance: See formula 6.2 and section 6.4.
Figure 6.1 Elements that Have Temperature Characteristics in the Power Meter System
The system gain of differential input is proportional to the device gain and inversely proportional to the reference
voltage VBG which comes from the on-chip BGR or the external reference voltage.
Formula 6.1
System gain (differential input) ∝ Device gain / VBG
The system gain of the single-ended input is affected also by the input impedance (ZI).
Formula 6.2
System gain (single-ended input) ∝ Device gain / VBG × (1 + RL / ZI)
RL: External load resistor [Ω]
ZI: Input impedance [Ω]
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 10 of 30
RX21A Group
6.2
Calibration and Compensation for the ΔΣ A/D Converter
Device Gain
Figure 6.2 shows the theoretical temperature characteristics of the device gain shown in Figure 6.1 when the reference
voltage (VBG) assumes to stay constant regardless of temperature fluctuations.
0.08
Device gain error (%)
0.04
x8
x2
x1
x4
0.00
-0.04
x16, x32, x64
-0.08
-25
0
25
50
75
Temperature (degC)
degC: Degrees Celsius
Figure 6.2 Temperature Characteristics of the Device Gain
The temperature characteristics of the device gain can be calculated with the following formula.
Formula 6.3
Device gain (Tj) = Device gain(Tj = 25) × {1 + CXn (Tj - 25)}
Tj: Junction temperature on the chip [°C]
CXn: (n = 1, 2, 4, 8, 16, 32, and 64): Coefficient of the temperature characteristics. Refer to Table
6.1 for coefficient values.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 11 of 30
RX21A Group
6.3
Calibration and Compensation for the ΔΣ A/D Converter
VBGR
1.2205
0.04
1.2200
0.00
1.2195
-0.04
1.2190
-0.08
1.2185
Error (%)
VBGR (V)
The on-chip BGR voltage (VBGR) is usually used as the reference voltage (VBG). Figure 6.3 shows the Temperature
Characteristics of the VBGR. If the external reference voltage (BGR_BO) is used instead of the on-chip BGR, the
influence of the VBGR can be excluded.
-0.12
-25
0
25
50
75
Temperature (degC)
degC: Degrees Celsius
Figure 6.3 Temperature Characteristics of the VBGR
The temperature characteristics of the VBGR is calculated with the following formula.
Formula 6.4
VBGR(Tj) = VBGR(Tj = 25) × {1 + CBA(Tj - 25)2 + CBB(Tj - 25)}
Tj: Junction temperature on the chip [°C]
CBA: Coefficient of quadratic slope. Refer to Table 6.1 for the coefficient values.
CBB: Coefficient of linear slope. Refer to Table 6.1 for coefficient values.
VBGR(Tj = 25): Typical voltage of BGR: 1.220 [V]
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 12 of 30
RX21A Group
6.4
Calibration and Compensation for the ΔΣ A/D Converter
Input Impedance
Figure 6.4 shows the temperature characteristics of input impedance ZI for the single-ended input at gain x1 shown in
Figure 6.1.
Input Impedance (kΩ)
86
84
82
80
78
76
74
-25
0
25
Temperature (degC)
50
75
degC: Degrees Celsius
Figure 6.4 Temperature Characteristics of the Input Impedance
The temperature characteristic of input impedance ZI at each gain setting can be calculated with the following formula.
Formula 6.5
ZI (Tj) = ZI (Tj = 25) × DSADIIC.IICD[15:0] / 32768 × {1 + CZ × (Tj - 25)}
Tj: Junction temperature on the chip [°C]
ZI (Tj = 25): Typical value of the input impedance. The value differs depending on the gain setting.
Refer to the ΔΣ A/D Conversion Characteristics section in the User’s Manual: Hardware
for details.
CZ: Coefficient of linear slope. See Table 6.1 for coefficient values.
6.5
Compensation for the Temperature Characteristics of the System Gain
Formulas 6.1 to 6.5 can be combined and approximated into the following formulas. Make sure the sign of each
member in the formulas is correct.
Formula 6.6
System gain (differential input) (Tj)
≈ System gain (differential input) (Tj = 25) × {1 - CBA(Tj - 25)2 + (CXn - CBB) (Tj - 25)}
Formula 6.7
System gain (single-ended input) (Tj)
≈ System gain (single-ended input) (Tj = 25)
× {1 - CBA(Tj - 25)2 + (CXn - CBB + RL / ZI (Tj = 25) / DSADIIC.IICD[15:0] × 32768 × CZ) (Tj - 25)}
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 13 of 30
RX21A Group
6.6
Calibration and Compensation for the ΔΣ A/D Converter
Coefficients of the Temperature Characteristics in the RX21A Group
Table 6.1 shows the Coefficients of the Temperature Characteristics in the RX21A Group.
Table 6.1 Coefficients of the Temperature Characteristics in the RX21A Group
Element
Coefficient
Input impedance
Value
Unit
-6
Quadratic slope
CBA
-0.26 × 10
Linear slope
CBB
5.5 × 10-6
x1
CX1
-5 × 10-6
x2
CX2
-4 × 10-6
x4
CX4
-7 × 10-6
CX8
-2 × 10-6
x16
CX16
-14 × 10-6
x32
CX32
-14 × 10-6
x64
CX64
-14 × 10-6
BGR
Device Gain
Symbol
x8
Linear slope
Linear slope
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
CZ
-1200 × 10-6
K-2
K-1
K-1
K-1
Page 14 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
7. Compensation Results of the Temperature Characteristics
7.1
Temperature Characteristics of the VBGR
The typical VBGR voltage can be calculated by assigning the coefficients shown in Table 6.1 and the temperature
measured by the temperature sensor to formula 6.4. The Figure 7.1 shows the Temperature Characteristics of the VBGR
(Difference Between the Measured Values and Typical Values).
Difference from the typical value
Raw data
1.0005
1.0005
VBGR / VBGR at 25 degC
Typical value
1.0000
1.0000
0.9995
0.9995
0.9990
0.9990
Compensation error
caused by the measurement
error of temperature sensor
0.9985
0.9985
-50
-25
0
25
50
75
100
Temperature (degC)
-50
-25
0
25
50
75
100
Temperature (degC)
degC: Degrees Celsius
Figure 7.1 Temperature Characteristics of the VBGR (Difference Between the Measured Values and
Typical Values)
Error of temperature causes an error for the calculation value of the VBGR. To minimize the temperature measurement
error, it is recommended to calibrate the temperature sensor at room temperature. Refer to the reference application note
listed in section 10.
The temperature characteristics of the VBGR can be decreased virtually from 30 ppm/°C to 10 ppm/°C by
compensating with formula 6.4.
Table 7.1 Results of the VBGR Compensation
Reference Voltage Temperature Coefficient
Electrical characteristics in the User’s Manual: Hardware
Maximum value of the raw data
Residual error after compensation
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
-40 to +105 °C
±30 ppm/°C
+30 ppm/°C
-24 ppm/°C
(-40°C to +25°C)
(+25°C to +105°C)
±10 ppm/°C
Page 15 of 30
RX21A Group
7.2
Calibration and Compensation for the ΔΣ A/D Converter
System Gain of the Differential Input Pins
The following figure shows the system gain of the differential input pins. The temperature characteristics for the
differential input pins before compensation appear as parabola.
Gain
Test voltage
(Peak-to-peak)
1.002
1.001
1.000
0.999
0.998
Relative Gain
900 mV
Relative Gain
x1
-25
0
25
50
75
Temperature (degC)
-50
-25
0
25
50
75
Temperature (degC)
100
100
-50
-25
0
25
50
75
Temperature (degC)
100
-50
-25
75
0
25
50
Temperature (degC)
100
-50
-25
0
25
50
75
Temperature (degC)
100
-50
-25
0
25
50
75
Temperature (degC)
100
-50
-25
0
25
50
75
Temperature (degC)
100
1.004
1.002
1.000
0.998
0.996
100
1.006
1.003
1.000
0.997
0.994
0
25
50
75
Temperature (degC)
1.002
1.001
1.000
0.999
0.998
100
Relative Gain
Relative Gain
28.12 mV
0
25
50
75
Temperature (degC)
1.004
1.002
1.000
0.998
0.996
-50
x32
-25
-25
1.002
1.001
1.000
0.999
0.998
100
Relative Gain
Relative Gain
56.25 mV
50
75
0
25
Temperature (degC)
1.002
1.001
1.000
0.999
0.998
-50
x16
-25
-50
1.002
1.001
1.000
0.999
0.998
100
Relative Gain
Relative Gain
112.5 mV
0
25
50
75
Temperature (degC)
1.002
1.001
1.000
0.999
0.998
-50
x8
-25
1.002
1.001
1.000
0.999
0.998
100
Relative Gain
Relative Gain
225 mV
0
25
50
75
Temperature (degC)
1.002
1.001
1.000
0.999
0.998
-50
x4
-25
Relative Gain
450 mV
Relative Gain
-50
x2
The ratio of
Row data / Compensated
Raw data
1.006
1.003
1.000
0.997
0.994
degC: Degrees Celsius
Measurement condition:
- Test input: AC 50.664 Hz
Figure 7.2 System Gain of the Differential Input Pins
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 16 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
Table 7.2 lists the Results of the Compensation for Temperature Characteristics of the System Gain on the Differential
Input Pins. The temperature characteristics vary depending on devices. The values shown in the table are compensated
so that the temperature characteristics appear as flat.
Table 7.2
Results of the Compensation for Temperature Characteristics of the System Gain on the
Differential Input Pins
Gain Setting
x1
x2
x4
x8
x16
x32
Temperature Characteristic Coefficient [ppm/K]
Raw data
Data after compensation
(1)
(2)
Every 25 K
-25°C to +75°C
Every 25 K (1)
-25°C to +75°C (2)
-38
-24
16
14
+21
+25
-39
-17
14
10
+17
+23
-31
-13
15
14
+21
+24
-48
-21
18
10
+29
+30
-96
-57
33
23
+45
+64
-136
-97
41
31
+94
+111
Notes:
1. The range between -25°C and +75°C is divided every 25 K, the temperature characteristic
coefficients are calculated for all divided ranges, and the minimum and maximum values are picked
up and shown in the table.
2. Value calculated with the box method.
Temperature characteristic coefficient = Gain range (maximum value - minimum value) /
Temperature range (75 - (-25))
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 17 of 30
RX21A Group
7.3
Calibration and Compensation for the ΔΣ A/D Converter
System Gain of Single-Ended Input Pin
Figure 7.3 shows the temperature characteristics of the system gain for single-ended input pins when compensating with
formula 6.7.
External
load resistor
Raw Data / Compensated gain
1.010
1.010
1.005
1.005
Relative Gain
Relative Gain
1.8 kΩ
Raw Data Gain x1
1.000
0.995
0.990
1.000
0.995
0.990
-50
-25
0
25
50
75
100
-50
-25
1.010
1.010
1.005
1.005
Relative Gain
Relative Gain
Temperature (degC)
5.4 kΩ
0
25
50
75
100
75
100
Temperature (degC)
1.000
0.995
0.990
1.000
0.995
0.990
-50
-25
0
25
50
75
100
Temperature (degC)
-50
-25
0
25
50
Temperature (degC)
degC: Degrees Celsius
1.33 MΩ
50.664 Hz
Peak-to-peak
+/- 20 V
100 Ω
PGA
External
load resistor
ΔΣ
Modulator
+ Filter
Figure 7.3 System Gain of the Single-Ended Input Pins
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 18 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
Table 7.3 lists the Results of the Compensation for Temperature Characteristics of the System Gain on the SingleEnded Input Pins. The temperature characteristics vary depending on devices. The values shown in the table are
compensated so that the temperature characteristics appear as flat.
Table 7.3
Results of the Compensation for Temperature Characteristics of the System Gain on the
Single-Ended Input Pins
External Load
Resistor [kΩ]
1.8
5.4
Temperature Characteristic Coefficient [ppm/K]
Raw data
Data after compensation
(1)
(2)
Every 25 K
-25°C to +75°C
Every 25 K (1)
-25°C to +75°C (2)
-186
-145
54
43
+114
+167
-249
-136
90
55
+104
+176
Notes:
1. The range between -25°C and +75°C is divided every 25 K, the temperature characteristic
coefficients are calculated for all divided ranges, and the minimum and maximum values are picked
up and shown in the table.
2. Value calculated with the box method.
Temperature characteristic coefficient = Gain range (maximum value - minimum value) /
Temperature range (75 - (-25))
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 19 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
8. Software
8.1
Operation Overview
This application note provides functions to calibrate and compensate gains on the DSAD using formulas described in
sections 4.4 System Gain Calibration and 6.5 Compensation for the Temperature Characteristics of the System Gain.
8.2
Required Memory Size
Table 8.1 lists the Required Memory Size.
Table 8.1 Required Memory Size
Memory Used
Size
Remarks
ROM
2396 bytes
Required in the r_dsad_compensate.c
RAM
592 bytes
Maximum user stack usage
92 bytes
Maximum interrupt stack usage
0 bytes
Note: • The required memory sizes vary depending on the C compiler version and compile options.
8.3
File Composition
Table 8.2 lists the Files Used in the Sample Code and Table 8.3 lists the Standard Include Files.
Table 8.2 Files Used in the Sample Code
File Name
main.c
r_dsad_compensate.c
r_dsad_compensate.h
Outline
Main processing
Gain calibration and temperature compensation on the DSAD
Header file for r_dsad_compensate.c
Table 8.3 Standard Include Files
File Name
stdbool.h
stdint.h
float.h
Outline
Defines macros associated with Boolean and its value.
Defines macros declaring the integer type with the specified width.
Defines various limit values relating to the limits of floating-point numbers.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 20 of 30
RX21A Group
8.4
Calibration and Compensation for the ΔΣ A/D Converter
Constants
Table 8.4 and Table 8.5 list the Constant Used in the Sample Code.
Table 8.4 Constants Used in the Sample Code (r_dsad_compensate.c)
Constant Name
RI0TYP
Setting Value
100e3
Contents
Designed value of the internal input resistor [Ω]
Table 8.5 Constants Used in the Sample Code (r_dsad_compensate.h)
Constant Name
DSAD_CH_NUM
DSAD_DIFFER_CH_NUM
DSAD_SINGLE_CH_NUM
DSAD_GAIN_NUM
Setting
Value
7
4
3
7
DSAD_DIFFER_GAIN_NUM
7
DSAD_SINGLE_GAIN_NUM
3
DSAD_GAIN_X1
DSAD_GAIN_X2
DSAD_GAIN_X4
DSAD_GAIN_X8
DSAD_GAIN_X16
DSAD_GAIN_X32
DSAD_GAIN_X64
0
1
2
3
4
5
6
8.5
Contents
Number of channels of the DSAD
Number of channels for the differential input
Number of channels for the single-ended input
Number of gains the DSAD can select
Number of gains that can be selected with the differential
input channel
Number of gains that can be selected with the single-ended
input channel
Gain number to be selected
Variables
Table 8.6 lists the static Variables, and Table 8.7 and Table 8.8 list the const Variables.
Table 8.6 static Variables
Type
Variable Name
static
volatile
float
coef_temp_quad
static
volatile
float
static
volatile
float
static
volatile
float
coef_temp_linear
[DSAD_CH_NUM]
[DASD_GAIN_NUM]
device_gain[DSAD_
CH_NUM][DSAD_
GAIN_NUM]
system_gain[DSAD_
CH_NUM][DSAD_
GAIN_NUM]
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Contents
Linear coefficient of the
temperature characteristics for
temperature compensation
Function
R_DSAD_InternalCalibration
R_DSAD_ Calibration
R_DSAD_CompensatedGain
R_DSAD_InternalCalibration
R_DSAD_Calibration
R_DSAD_CompensatedGain
Device gain for each gain setting
and channel of the DSAD at 25°C
R_DSAD_InternalCalibration
R_DSAD_Calibration
System gain including the sensor
for each gain setting and channel
of the DSAD at 25°C
R_DSAD_Calibration
R_DSAD_CompensatedGain
Quadratic coefficient of the
temperature characteristics for
temperature compensation
Page 21 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
Table 8.7 const Variables (main.c)
Type
Variable Name
const bool
valid_dsad_channel
[DSAD_CH_NUM]
const bool
use_internal_dsad_bgr
const float
dsad_ext_input_res
[DSAD_DIFFER_CH_
NUM]
const float
dsad_ext_load_res
[DSAD_SINGLE_CH_
NUM]
Contents
Indicates whether the channel is valid or not.
Specify an appropriate value according to the
user system.
Indicates whether to use the on-chip BGR or not.
Specify an appropriate value according to the
user system.
Value of the external input resistor [Ω] for
differential input channels (channels 0 to 3).
Specify an appropriate value according to the
user system.
Value of the external load resistor [Ω] for singleended input channels (channels 4 to 6).
Specify an appropriate value according to the
user system.
Function
main
main
main
main
Table 8.8 const Variables (r_dsad_compensate.c)
Type
Variable Name
static const typ_zi[DSAD_SINGLE
float
_GAIN_NUM]
static const
coef_temp_cba
float
static const
coef_temp_cbb
float
static const coef_temp_cxn[DSAD
float
_GAIN_NUM]
static const
float
coef_temp_cz
static const
float
gain_val
[DSAD_GAIN_NUM]
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Contents
Typical value [Ω] of the input impedance (x1,
x2, and x4) of the single-ended input.
Refer to the ΔΣ A/D Conversion Characteristics
section in the User’s Manual: Hardware for
details.
Quadratic coefficient of the temperature
characteristics for the on-chip BGR.
The coefficient value is listed in Table 6.1.
Linear coefficient of the temperature
characteristics for the on-chip BGR.
The coefficient value is listed in Table 6.1.
Coefficient of the temperature characteristics
for the device gain.
The coefficient value is listed in Table 6.1.
Coefficient of the temperature characteristics
for the input impedance.
The coefficient value is listed in Table 6.1.
Amplification factor of a gain
Function
R_DSAD_Internal
Calibration
R_DSAD_Internal
Calibration
R_DSAD_Internal
Calibration
R_DSAD_Internal
Calibration
R_DSAD_Internal
Calibration
R_DSAD_Internal
Calibration
Page 22 of 30
RX21A Group
8.6
Calibration and Compensation for the ΔΣ A/D Converter
Functions
Table 8.9 lists the Functions.
Table 8.9 Functions
Function Name
main
initialize_system_and_peripherals
measure_temperature
measure_calibration_data
Outline
File
Main processing
main.c
System and peripheral initializations
Temperature measurement
(1)
(1)
Power measurement for calibration
main.c
main.c
(1)
(1)
main.c
measure_power
Power measurement
main.c
R_DSAD_InternalCalibration
Coefficient initialization for gain calibration
and temperature compensation
r_dsad_compensate.c
R_DSAD_Calibration
System gain calibration
r_dsad_compensate.c
R_DSAD_CompensatedGain
Temperature compensation for the system
gain
r_dsad_compensate.c
Note:
1. This is the dummy function for testing in the sample code.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 23 of 30
RX21A Group
8.7
Calibration and Compensation for the ΔΣ A/D Converter
Function Specifications
The following tables list the sample code function specifications.
main
Outline
Header
Declaration
Description
Arguments
Return Value
Main processing
None
void main(void)
Calls the following functions: R_DSAD_InternalCalibration, R_DSAD_Calibration, and
R_DSAD_CompensatedGain
None
None
R_DSAD_InternalCalibration
Coefficient initialization for gain calibration and temperature compensation
Outline
r_dsad_compensate.h
Header
bool R_DSAD_InternalCalibration(bool use_internal_dsad_bgr, const float
Declaration
dsad_ext_input_res[DSAD_DIFFER_CH_NUM], const float
dsad_ext_load_res[DSAD_SINGLE_CH_NUM])
Prepares the intermediate calculation result required for the gain calibration and
Description
temperature compensation.
bool use_internal_dsad_bgr:
Indicates whether to use the on-chip BGR or not.
Arguments
Return Value
const float
dsad_ext_input_res[DSAD_
DIFFER_CH_NUM]:
External input resistor for the differential input channels
(channels 0 to 3) [Ω].
const float
dsad_ext_load_res[DSAD_
SINGLE_CH_NUM]:
External load resistor for the single-ended input channels
(channels 4 to 6) [Ω].
true: Values written in the ΔΣ A/D input impedance calibration data register and ΔΣ A/D
gain calibration data registers are valid.
false: Values written in theΔΣ A/D input impedance calibration data register and ΔΣ A/D
gain calibration data registers are invalid.
* Gain calibration using the ΔΣ A/D input impedance calibration data register and ΔΣ A/D
gain calibration data registers are not performed in this application note. The designed
value is used for the internal input resistor Ri0, and the typical values, that are described
in the ΔΣ A/D Conversion Characteristics section in the User’s Manual: Hardware, are
used for the gain and the input impedance of the single-ended input.
Remarks
Execute this function before executing the R_DSAD_Calibration and
R_DSAD_CompensatedGain functions. Otherwise calibration and compensation cannot
be performed correctly.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 24 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
R_DSAD_Calibration
System gain calibration
Outline
r_dsad_compensate.h
Header
void R_DSAD_CALIBRATION(uint16_t channel, uint16_t gain_setting, float
Declaration
acculate_rms_value, uint32_t measured_rms_digital, int16_t junction_temp)
Calculates the system gain before temperature compensation.
Description
unit16_t channel:
Input channel (0 to 6)
Arguments
uint16_t gain_setting:
Reference gain for calibration
- Specify a value from 0 to 6 (gains x1 to x64) for input channels
0 to 3.
- Specify a value from 0 to 2 (gains x1 to x4) for input channels
4 to 6.
Return Value
Remarks
float
acculate_rms_value:
RMS value of a current or voltage input from the reference
power supply, e.g. 10[A] for channels 0 to 3, 230[V] for channels
4 to 6.
This value must be positive. If the value is 0 or negative,
R_DSAD_COMPENSATED_GAIN() returns 0.
uint32_t
measured_rms_digital:
The reference power is A/D converted with the DSAD. This is
the RMS value of the conversion result.
int16_t junction_temp:
The device temperature measured by the temperature sensor.
The value should be from -40°C to +105°C.
None
Execute the R_DSAD_InternalCalibration function before executing this function.
Otherwise calibration and compensation cannot be performed correctly.
If the channel and gain_setting arguments have invalid values, this function exits the
processing without performing calibration.
R_DSAD_CompensatedGain
Temperature compensation for the system gain
Outline
r_dsad_compensate.h
Header
float R_DSAD_CompensatedGain(uint16_t channel, uint16_t gain_setting, int16_t
Declaration
junction_temp)
Calculates the system gain after temperature compensation and returns the calculation
Description
result.
uint16_t channel:
Input channel (0 to 6)
Arguments
uint16_t gain_setting:
Gain to be performed temperature compensation
- Specify a value from 0 to 6 (gains x1 to x64) for input channels
0 to 3.
- Specify a value from 0 to 2 (gains x1 to x4) for input channels
4 to 6.
int16_t junction_temp:
The device temperature measured by the temperature sensor.
The value should be from -40°C to +105°C.
The system gain after temperature compensation
Return Value
Execute the R_DSAD_Calibration function before executing this function. Otherwise
Remarks
calibration and compensation cannot be performed correctly.
If the channel and gain_setting arguments have invalid values, the return value will be 0.
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 25 of 30
RX21A Group
8.8
8.8.1
Calibration and Compensation for the ΔΣ A/D Converter
Flowcharts
Main Processing
Figure 8.1 shows the Main Processing.
main
System and peripheral function
initializations (1)
initialize_system_and_peripherals()
Coefficient initialization for gain calibration
and temperature compensation
R_DSAD_InternalCalibration()
Power measurement for calibration (1)
measure_calibration_data()
Temperature measurement (1)
measure_temperature()
System gain calculation
R_DSAD_Calibration()
Has calibration for all
channels been completed?
No
Yes
Temperature measurement (1)
measure_temperature()
System gain compensation
R_DSAD_CompensatedGain()
Has compensation for all
channels been completed?
No
Yes
Power measurement (1)
measure_power()
return
Note:
1. In the sample code, this is the dummy function only for testing.
Figure 8.1 Main Processing
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 26 of 30
RX21A Group
8.8.2
Calibration and Compensation for the ΔΣ A/D Converter
Coefficient Initialization for Gain Calibration and Temperature Compensation
Figure 8.2 and Figure 8.3 show the Coefficient Initialization for Gain Calibration and Temperature Compensation.
R_DSAD_InternalCalibration
Set "true" to the return value (isvalid_reg)
Read the calibration data for input impedance
Is the
calibration data
valid data?
Arguments:
- bool use_internal_dsad_bgr: On-chip BGR usage
- const float dsad_ext_input_res[DSAD_DIFFER_CH_NUM]: Value of the external input resistor
- const float dsad_ext_load_res[DSAD_SINGLE_CH_NUM]: Value of the external load resistor
Reads the DSADIIC register.
No
Verifies DSADIIC.IICD[15:0].
Yes
Is the
return value (isvalid_reg)
"true"?
Set "false" to the return value (isvalid_reg)
No
Yes
Calculate the calibration coefficient for
calibration with resistor
Is the
return value (isvalid_reg)
"true"?
Calibration coefficient =
DSADIIC.IICD[15:0] / 32768
Set 1 as the calibration coefficient for
calibration with resistor
No
Yes
Calculate device gains for gains x1 to x32
using the calibration data
Compensate device gains for gains x16 and
x32 with input resistor value
Calculate the device gain for gain x64
Have all
gains for channels 0 to 3 been
calculated?
Reads the DSADGmXn register
and calculates device gains.
Set 1, ..., 32 as device gains for
gains x1 to x32, respectively
When the gain setting is for x16 to x64, the input resistor becomes half the value of
the input resistor with gain setting for x1 to x8. Then the influence of the external input
resistor on the system gain changes. Therefore the compensation here is performed
using the external input resistor and internal input resistor.
Calculates the gain using the value of gain x32.
No
Yes
A
Figure 8.2 Coefficient Initialization for Gain Calibration and Temperature Compensation (1/2)
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 27 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
A
Is the
return value (isvalid_reg)
"true"?
No
Yes
Calculate device gains for gains x1 to x4
using the calibration data
Have all
gains for channels 4 to 6 been
calculated?
Reads the DSADGmXn register
and calculates device gains.
Set 1, ..., 4 as the device gains for
gains x1 to x4, respectively
No
Yes
Is the on-chip BGR used?
No
Yes
Set the quadratic slope coefficient of
the temperature characteristics
Is the on-chip BGR used?
Calculates the coefficient based on
the parameter (coef_temp_cba).
Set 0 as the quadratic slope coefficient of
the temperature characteristics
No
Yes
Set the linear slope coefficients of
the temperature characteristics
for gains x1 to x64
Have all
gains for channels 0 to 3 been
calculated?
Calculates the coefficients based on
the parameter (coef_temp_cxn,
coef_temp_cbb) according to gains.
Set the linear slope coefficient of
the temperature characteristics
for gains x1 to x64
Calculates the coefficients based on
the parameter (coef_temp_cxn)
according to gains.
Set the linear slope coefficient of
the temperature characteristics
for gains x1 to x4
Calculates the coefficients based on
the parameter (typ_zi, coef_temp_cxn,
coef_temp_cz) and the external load
resistor according to gains.
No
Yes
Is the on-chip BGR used?
No
Yes
Set the linear slope coefficients of
the temperature characteristics
for gains x1 to x4
Have all
gains for channels 4 to 6 been
calculated?
Calculates the coefficients based on
the parameter (typ_zi, coef_temp_cxn,
coef_temp_cbb, coef_temp_cz) and
the external load resistor according to
gains.
No
Yes
return (isvalid_reg)
Figure 8.3 Coefficient Initialization for Gain Calibration and Temperature Compensation (2/2)
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 28 of 30
RX21A Group
8.8.3
Calibration and Compensation for the ΔΣ A/D Converter
System Gain Calibration
Figure 8.4 shows the System Gain Calibration.
Arguments:
- uint16_t channel: Input channel
- uint16_t gain_setting: Reference gain for calibration (0: x1, 1: x2, ..., 5: x32, 6: x64)
- float accurate_rms_value: RMS value of a current or voltage input from the reference power supply
- uint32_t measured_rms_digital: RMS value of the reference power that is A/D converted with the DSAD
- int16_t junction_temp: Device temperature
R_DSAD_Calibration
Are the
channel and gain setting
valid?
No
Yes
Is the
value of accurate_rms_value
a positive value?
No
Yes
Calculate the sensor gain at 25°C
Is the channel for differential input?
Calculates the sensor gain with the RMS value
and device temperature passed by arguments,
and device gain and coefficient of the
temperature characteristics that are calculated
in the R_DSAD_InternalCalibration function.
Set the sensor gain to 0
No
Yes
Calculate the system gain for
gains x1 to x4 at 25°C
Calculate the system gain for
gains x1 to x64 at 25°C
System gain = sensor gain × device gain
return
Figure 8.4 System Gain Calibration
8.8.4
Temperature Compensation for the System Gain
Figure 8.5 shows the Temperature Compensation for the System Gain.
R_DSAD_CompensatedGain
Are the
channel and gain setting
valid?
Arguments:
- uint16_t channel: Input channel
- uint16_t gain_setting: Gain to be performed temperature compensation
(0: x1, 1: x2, ..., 5: x32, 6: x64)
- int16_t junction_temp: Device temperature
No
Yes
Set the system gain after temperature
compensation as the return value (ret)
Calculates the system gain with the calibrated
system gain, device temperature, and the
coefficient of the temperature characteristics.
Set the return value (ret) to 0
return
Figure 8.5 Temperature Compensation for the System Gain
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 29 of 30
RX21A Group
Calibration and Compensation for the ΔΣ A/D Converter
9. Sample Code
Sample code can be downloaded from the Renesas Electronics website.
10. Reference Documents
User’s Manual: Hardware
RX21A Group User’s Manual: Hardware Rev.1.10 (R01UH0251EJ)
The latest version can be downloaded from the Renesas Electronics website.
Technical Update/Technical News
The latest information can be downloaded from the Renesas Electronics website.
User’s Manual: Development Tools
RX Family C/C++ Compiler Package V.1.01 User’s Manual Rev.1.00 (R20UT0570EJ)
The latest version can be downloaded from the Renesas Electronics website.
Application Note
Using the Temperature Sensor to Calculate the Ambient Temperature (R01AN1923EJ)
The latest version can be downloaded from the Renesas Electronics website.
Website and Support
Renesas Electronics website
http://www.renesas.com
Inquiries
http://www.renesas.com/contact/
R01AN2180EJ0100 Rev. 1.00
Oct. 1, 2014
Page 30 of 30
REVISION HISTORY
Rev.
Date
1.00
Oct. 1, 2014
RX21A Group Application Note
Calibration and Compensation for the ΔΣ A/D Converter
Page
—
Description
Summary
First edition issued
All trademarks and registered trademarks are the property of their respective owners.
A-1
General Precautions in the Handling of MPU/MCU Products
The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the
products covered by this document, refer to the relevant sections of the document as well as any technical updates that
have been issued for the products.
1. Handling of Unused Pins
Handle unused pins in accordance with the directions given under Handling of Unused Pins in the
manual.
 The input pins of CMOS products are generally in the high-impedance state. In operation with an
unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of LSI, an
associated shoot-through current flows internally, and malfunctions occur due to the false
recognition of the pin state as an input signal become possible. Unused pins should be handled as
described under Handling of Unused Pins in the manual.
2. Processing at Power-on
The state of the product is undefined at the moment when power is supplied.
 The states of internal circuits in the LSI are indeterminate and the states of register settings and
pins are undefined at the moment when power is supplied.
In a finished product where the reset signal is applied to the external reset pin, the states of pins
are not guaranteed from the moment when power is supplied until the reset process is completed.
In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function
are not guaranteed from the moment when power is supplied until the power reaches the level at
which resetting has been specified.
3. Prohibition of Access to Reserved Addresses
Access to reserved addresses is prohibited.
 The reserved addresses are provided for the possible future expansion of functions. Do not access
these addresses; the correct operation of LSI is not guaranteed if they are accessed.
4. Clock Signals
After applying a reset, only release the reset line after the operating clock signal has become stable.
When switching the clock signal during program execution, wait until the target clock signal has
stabilized.
 When the clock signal is generated with an external resonator (or from an external oscillator)
during a reset, ensure that the reset line is only released after full stabilization of the clock signal.
Moreover, when switching to a clock signal produced with an external resonator (or by an external
oscillator) while program execution is in progress, wait until the target clock signal is stable.
5. Differences between Products
Before changing from one product to another, i.e. to a product with a different part number, confirm
that the change will not lead to problems.
 The characteristics of an MPU or MCU in the same group but having a different part number may
differ in terms of the internal memory capacity, layout pattern, and other factors, which can affect
the ranges of electrical characteristics, such as characteristic values, operating margins, immunity
to noise, and amount of radiated noise. When changing to a product with a different part number,
implement a system-evaluation test for the given product.
Notice
1.
Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for
the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the
use of these circuits, software, or information.
2.
Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics
assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein.
3.
Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or
technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or
others.
4.
You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Renesas Electronics assumes no responsibility for any losses incurred by you or
third parties arising from such alteration, modification, copy or otherwise misappropriation of Renesas Electronics product.
5.
Renesas Electronics products are classified according to the following two quality grades: "Standard" and "High Quality". The recommended applications for each Renesas Electronics product depends on
the product's quality grade, as indicated below.
"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic
equipment; and industrial robots etc.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-crime systems; and safety equipment etc.
Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems, surgical
implantations etc.), or may cause serious property damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade of each Renesas Electronics product before using it
in a particular application. You may not use any Renesas Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses
incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics.
6.
You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage
range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the
use of Renesas Electronics products beyond such specified ranges.
7.
Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and
malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the
possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to
redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult,
please evaluate the safety of the final products or systems manufactured by you.
8.
Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics
products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes
no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.
9.
Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or
regulations. You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the
development of weapons of mass destruction. When exporting the Renesas Electronics products or technology described in this document, you should comply with the applicable export control laws and
regulations and follow the procedures required by such laws and regulations.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the
contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics
products.
11. This document may not be reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries.
(Note 1)
"Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority-owned subsidiaries.
(Note 2)
"Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics.
SALES OFFICES
http://www.renesas.com
Refer to "http://www.renesas.com/" for the latest and detailed information.
Renesas Electronics America Inc.
2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A.
Tel: +1-408-588-6000, Fax: +1-408-588-6130
Renesas Electronics Canada Limited
1101 Nicholson Road, Newmarket, Ontario L3Y 9C3, Canada
Tel: +1-905-898-5441, Fax: +1-905-898-3220
Renesas Electronics Europe Limited
Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.K
Tel: +44-1628-585-100, Fax: +44-1628-585-900
Renesas Electronics Europe GmbH
Arcadiastrasse 10, 40472 Düsseldorf, Germany
Tel: +49-211-6503-0, Fax: +49-211-6503-1327
Renesas Electronics (China) Co., Ltd.
Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.China
Tel: +86-10-8235-1155, Fax: +86-10-8235-7679
Renesas Electronics (Shanghai) Co., Ltd.
Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333
Tel: +86-21-2226-0888, Fax: +86-21-2226-0999
Renesas Electronics Hong Kong Limited
Unit 1601-1613, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong
Tel: +852-2265-6688, Fax: +852 2886-9022/9044
Renesas Electronics Taiwan Co., Ltd.
13F, No. 363, Fu Shing North Road, Taipei 10543, Taiwan
Tel: +886-2-8175-9600, Fax: +886 2-8175-9670
Renesas Electronics Singapore Pte. Ltd.
80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949
Tel: +65-6213-0200, Fax: +65-6213-0300
Renesas Electronics Malaysia Sdn.Bhd.
Unit 906, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia
Tel: +60-3-7955-9390, Fax: +60-3-7955-9510
Renesas Electronics Korea Co., Ltd.
12F., 234 Teheran-ro, Gangnam-Ku, Seoul, 135-920, Korea
Tel: +82-2-558-3737, Fax: +82-2-558-5141
© 2014 Renesas Electronics Corporation. All rights reserved.
Colophon 4.0