TLE4998 - 2 Point Calibration Setup Guide

Application N ote, V 1.0, August 2008
TLE4998
2-Point Calibration Guide
Sensors
N e v e r
s t o p
t h i n k i n g .
Edition 2008-08
Published by Infineon Technologies AG,
Am Campeon 1-12,
85579 Neubiberg, Germany
© Infineon Technologies AG 2008.
All Rights Reserved.
Attention please!
The information herein is given to describe certain components and shall not be considered as a guarantee of
characteristics.
Terms of delivery and rights to technical change reserved.
We hereby disclaim any and all warranties, including but not limited to warranties of non-infringement, regarding
circuits, descriptions and charts stated herein.
Information
For further information on technology, delivery terms and conditions and prices please contact your nearest
Infineon Technologies Office (www.infineon.com).
Warnings
Due to technical requirements components may contain dangerous substances. For information on the types in
question please contact your nearest Infineon Technologies Office.
Infineon Technologies Components may only be used in life-support devices or systems with the express written
approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the failure
of that life-support device or system, or to affect the safety or effectiveness of that device or system. Life support
devices or systems are intended to be implanted in the human body, or to support and/or maintain and sustain
and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other persons may
be endangered.
TLE4998-2P Calibration Guide
1
1.1
1.2
1.3
1.4
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Concept of TLE4998 2-point calibration setup . . . . . . . . . . . . . . . . . . . . . . .
Principle signal processing operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signal Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
2.1
2.2
2.3
2.4
2.5
2.5.1
2.5.2
Mathematical background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Influence of the DSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Influence of the Hall probe and output DAC . . . . . . . . . . . . . . . . . . . . . . . . 7
Calibration of the application circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Conversion table for the G and OS value . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Rough manual calculations and simple experiments . . . . . . . . . . . . . . . . . 10
Using pre-calibrated samples to check out an application . . . . . . . . . . . 10
Using pre-calibrated samples to do a rough 2P calibration . . . . . . . . . . 11
3
3.1
3.2
3.3
3.4
2P setup flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Measurement setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Read out the required data of the magnetic circuit . . . . . . . . . . . . . . . . . .
Determine the gain/offset values for programming . . . . . . . . . . . . . . . . . .
Procedure overview - Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Note
1
3
3
3
4
5
12
12
13
13
14
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Revision history
Status:
Date/Version:
2008-08
V 1.0
Previous Version:
Page
Subjects (major changes since last revision)
We Listen to Your Comments
Any information within this document that you feel is wrong, unclear or missing at all?
Your feedback will help us to continuously improve the quality of this document.
Please send your proposal (including a reference to this document) to:
[email protected]
Application Note
2
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Overview
1
Overview
1.1
General information
•
•
•
•
This document is valid for all TLE4998 products and derivatives
It is intended as add-on to the currently available TLE4998 data sheets.
It is recommended to read the programming description of this device before.
It gives an overview and detailed description of the 2-point calibration concept (align
magnetic field to output voltage) of the TLE4998.
1.2
Concept of TLE4998 2-point calibration setup
The concept is based on shifting as much of the on-chip sensor signal processing as
possible to the digital domain. This can be achieved by directly converting the output of
the Hall probe, without additional analog pre-processing. The range setup is done
directly in the first stage of the employed sigma-delta analog-to-digital converter as well
(Hall ADC). We call this principle magnetic-to-digital conversion (MDC).
By doing that, and of course by using a Hall ADC with outstanding performance, the
compensation requirements are mainly reduced to the magnetic circuit, mechanical
behavior of the application, and to the Hall probe itself. All other parts do no longer have
any significant temperature depedency.
Figure 1 shows the principle in a simplified block diagram.
MAGNETIC
CIRCUIT
(B-Field)
Hall probe
A
Tj
fixed biasing
D
A
DSP
D
range
setup
Figure 1
Protocol
Generation
Digital OUT value
(PWM, SENT,
or SPC)
EEPROM
Simplified Block Diagram
After setting the appropriate temperature compensation coefficients (which is described
in the separate document “TLE4998 Temperature Coefficients Setup Guide”), the
transfer function between a given magnetic field and the sensor’s output signal is easily
set by determining only two parameters: Gain and Offset.
Application Note
3
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Overview
1.3
Principle signal processing operation
Figure 2 show the main data processing steps of the TLE4998 digital part.
Hardware-trigger
(~16kHz)
T_ADC sample
rate ~ 400 SPS
compensate TADC value (IFX),
store it to T_CAL
H_ADC sample
rate ~ 16k SPS
Calculate and
store O_TC out of
TCAL (IFX)
Multiply GAIN with
HCAL and
subtract OFFSET,
store it to VALUE
multiply TL value
with TCAL, store it
Check clamping
limits CH/CL and
set OUT value
multiply TQ value
with TCAL*TCAL,
add it to previous
Wait for next
trigger
multiply TT value
with TCAL*TCAL²,
add it to previous
and store S_TC
Figure 2
Subtract TOFF
from H_ADC
value, mutiply it
with TGAIN and
store it as H_CAL
Data processing flowchart
As illustrated, the processing of the Hall-ADC update occurs with typically 16k SPS
(samples per second). The DSP data processing has to be performed according to the
selected interface mode. For SENT and SPC, the processing of a new output value
happens during the synchronisation frame, for PWM the processing is done before the
subsequent frame.
Application Note
4
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Overview
1.4
Signal Flow
Figure 3 shows the signal flow diagram including important internal data values.
Range
LP
H_ADC
D_OUT
Limiter
Gain
(Clamp)
Hall
Sensor
A
D
TC 2
T_ADC
X
D
Protocol
Generation
out
H_CAL
X
1
+
TC 1
-T0
+
Offset
Temperature
Sensor
A
X
X
Stored in
EEPROM
Memory
+
X
T_CAL
Temperature
Compensation
Figure 3
Block Diagram
Note: This is just given as reference - please check out the “TLE4998 User
Programming Guide“ for details about how to access and use these values.
Application Note
5
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
2
Mathematical background
2.1
Influence of the DSP
All processing happens in a deterministic way using integer operations. To reconstruct
this behavior in a simulation model, this needs to be considered. Otherwise (when using
just simple models using floating point operations e.g. in tools like SimulinkTM) some
notifiable truncation effects could lead to small inconsistencies between the model and
the reality. Nevertheless, the system is designed in a way that this error should be always
less than one LSB for the resulting digital output value.
Therefore it is necessary to know that the calculations within one line shown in the table
below use 20bit (signed) integers and that the results itself are stored in 16bit (signed)
integers. All combined “multiply and shift right” operations virtually use a broader integer
width (20bit plus the amount of bits shifted right) due to the used mechanism in the
processor.
When storing a value, a proper saturation is taking place, so that there is no clipping for
too big/small results of any calculation. On the other hand, when using a value in another
equation, a proper sign extension is performed.
Table 1
Equations performed
Internal value (16bit)
Calculation (20bit integer operations)
Tint
Tj*16 (IFX calibrated junction temperature from T_ADC in °C)
T_CAL
Tint -768 (Tint is already truncated as integer value)
O_TC
IFX calibrated (and T dependent) offset value
S_TC1
8192 + ((TL-160)*T_CAL)>>8
VALUE1
(T_CAL*T_CAL)>>10
S_TC2
((TQ-128)*VALUE1)>>8 + S_TC1
VALUE2
(T_CAL*VALUE1)>>11
S_TC
((-TT)*VALUE2)>>6 + S_TC2
H_CAL
((((H_ADC*3)>>1) + O_TC)*S_TC)>>13
VALUE
((G-16384)*H_CAL)>>11 + (OS - 16384)<<4
D_OUT
VALUE
(but limited to given CL and CH values)
Note: This document describes only the bold lines above. The temperature
compensation calculation is described in the “TLE4998 Temperature
Coefficient Setup Guide”
For a better overview, the calculation of the output value can be also written simplified as:
Application Note
6
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
D _ OUT
D _ OUT
12 bit
=[
=
16 bit
2 ⋅ (G − 16384 ) ⋅ H _ CAL
+ (OS − 16384 ) ⋅ 16 ]/ 16
4096
2 ⋅ (G − 16384 ) ⋅ H _ CAL
+ (OS − 1638 4 ) ⋅ 16
4096
The parameters G (Gain) & OS (Offset) are stored in EEPROM. If a clamping limit is set,
the output value would be limited to it, too.
2.2
Influence of the Hall probe and output DAC
The precalibrated Hall sensor has a typical sensitivity of about 1.2%/mT in the 100mT
range and a zero-field offset value of 50% (not guaranteed). This sensitivity/offset values
need to be adopted to the application by performing a magnetic field to output value
calibration.
Nevertheless some typical values of such a precalibration are shown in Table 2 - please
note that these values of course vary from part to part:
Table 2
Typical system values
System value
Value range in 100mT range
Applied field
-100mT ... +100mT
H_ADC (ADC REG.)
-17519 ... +17519 (independent of LP setting, in 100mT range)
S_TC (DSP REG.)
~ 8192 ... S(T)=S_TC/8192=1, dep. on TC setup (±30% max.)
O_TC (DSP REG.)
~ 0 ... varies over T to compensate for Hall probe/ADC offset
H_CAL (DSP REG.)
-26278 ... +26278 (limits at -32768...32767 as it is 16bit)
GAIN (EEPROM)
~ 22500 (this is approx. a factor of 1.5 to set 1.2%/mT)
OFFSET (EEPROM)
~ 18432 (this delivers approx. 32768 LSB at zero field)
VALUE (DSP REG.)
-32768 ... 32767 (internal calculation result 16bit signed)
D_OUT (DSP REG.)
0 ... 65535 (unsigned and possibly limited to given CL and CH
values)
For full range, the H_ADC has an allowed dynamic range of typically up to 2/3 of the
maximum possible range represented by a 16 bit integer value (-32768...+32767) in the
H_ADC register (which means approximately +/- 20000 max.). Above this point, the
H_ADC will start to saturate. A certain production spread is needed to be covered, too
(+/-15% are used as safety margin). So the actual H_ADC values at the required fullrange magnetic input (flux density value) applied to the sensor will typically be
Application Note
7
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
approximately 15% below the considered ADC limit (see table above). It is important to
note that the ADC value is 100% independent of the lowpass filter setting (the lowpass
filter only has an effect on the noise of the signal, not directly on its value).
Saturating the H_ADC input is seen as a nonlinear behavior and an increase of signal
noise. This saturation is a smooth process, but finally the H_ADC value saturates at the
(lower or upper) numeric limit. During calibration, it is important to check that the H_ADC
value is always within the decimal range of -20000 to +20000. Otherwise the flux density
of the application is outside the allowed limit and it is recommended to use the next
magnetic field range to fully avoid any saturation problems.
Sensitivity temperature compensation of the Hall probe introduces a fixed gain factor of
1.5 which is temperature dependent (see temperature compensation application note).
This increases the dynamic range to fit the 16 bit representation in the H_CAL register
more ideally (approx. +/-30000 max. Again, the actual values are 15% smaller in order
to cover production spreads). This is done not directly for accuracy increase, but for
minimizing truncation effects of the digital signal processing itself.
Finally, the output related sensitivity and offset setup are done. The result is kept in a 16
bit integer register called VALUE. The relation between VALUE and H_CAL is as follows:
when setting the gain register to 1.0 (which means G=16384+4096 decimal, according
to the product specification), the resulting VALUE is 2x bigger than the H_CAL register.
For a maximum gain of +3.999 or -4.0 (this is G=32767 or G=0 decimal) the final VALUE
is 4*2 (= 8x) of the H_CAL value. The purpose of that is removing the “noisy LSBs” of
the H_CAL signal.
However, at the end the 16 bit positive integer range (0 to 65535) of VALUE is used for
the output value in the D_OUT register, everything outside is clamped to the nearest
maximum border value (0 or 65535). Of course for OBD functionality the ranges can be
restricted even more using the digital clamping value registers (both are again 7 bit).
Figure 4 shows the calculation procedure from the H_CAL value to the D_OUT value in
a simplified flow diagram.
-4.0 … +3.999
-400% to 399.9%
0%...100%
EEPROM:
G
EEPROM:
OS
EEPROM:
CLH
X
H_CAL
gain setup
⋅2
+
VALUE
D_OUT
clamping
Protocol
Generation
OUT
offset setup
-30000…+30000
(maximum
allowed )
EEPROM:
CLL
0…+65535
(maximum
possible)
0%…100%
(theoretical)
0%...100%
Figure 4
Simplified Calculation Flow Diagram
Application Note
8
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
2.3
Calibration of the application circuit
For a complete calibration procedure, five steps need to be performed:
1. Readout the EEPROM and setup the temperature compensation parameters using
the temporary EEPROM registers - this is the base for the 2P calibration.
2. Acquire the H_CAL values at (at least) two magnetic flux density values (positions) via
the sensor interface (see application note for programming).
3. Calculate the corresponding G and OS values (which fit to the determined D_OUT
values and measured H_CAL values).
4. Setup, program (and possibly lock) the EEPROM.
This document describes the items 2-3, the first and last item are described in separate
documents.
2.4
Conversion table for the G and OS value
This table should help when mapping different notations for the H_CAL value, D_OUT
value, G parameter and OS parameter for the 2-point calibration:
Table 3
Mapping between important 2P values/parameters
Definition
Description
Range
Corresponds to
H_CAL
Calibrated Hall ADC
value as the input
value for the linear
field-to-output
mapping.
-30000 to +30000
maximum allowed otherwise use next
range setup
-FSR to +FSR (full scale
range) of Hall probe and Hall
ADC (temperature
calibrated), e.g. -100mT to
+100mT in the middle range.
D_OUT
Corresponding
output value D_OUT
for the linear fieldto-output mapping.
0 to 65535 max. 0 % to 100% (theoretical) of
nevertheless
the digital output value range
values may be
possible clamped
(clamping registers)
Application Note
9
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
Table 3
Mapping between important 2P values/parameters
Definition
Description
Range
Corresponds to
G
Defines the
amplification factor
from the input value
to the output value.
0 to 32767 max. value is shifted in
the DSP by 16384
to generate +/integer values
-4.0 to +3.999 max. a gain of 0.0 corresponds to
a value of 16384. See
datasheet for this mapping.
OS
Defines the offset
shift for the output
value.
0 to 32767 max. value is shifted in
the DSP by 16384
to generate +/integer values
-400.0% to +399.9% of the
output value - a offset of
0.0% corresponds to a value
of 16384. See datasheet for
this mapping.
2.5
Rough manual calculations and simple experiments
For first checks it makes sometimes sense to verify if a certain setup is feasible or
plausible. Here some examples for hand calculations are given for demonstration.
2.5.1
Using pre-calibrated samples to check out an application
When using pre-calibrated samples, it is possible to roughly estimate the flux density
values directly - even without programming, as long as it is within the default setup range.
Example:
An application using the pre-calibrated TLE4998P4 delivers following values:
• At the first position of the application setup the sensor output (DYPWM) is OUT1= 34%.
• At the second position of the application setup the sensor output is OUT2= 82%.
As the output values are far within the theoretical allowed duty cycle range of 0% to
100% (in practice useful range e.g. 5% to 95%), we can assume that the sensor is not
saturated. As the sensitivity Sprecal of a pre-calibrated sample is roughly 1.2 %/mT and
the zero field offset is 50 %, the two field values can be calculated:
OUT1 = 34 %, so the sensor sees a magnetic flux of Bin1 = (OUT1 - OUTzero) / Sprecal =
(34-50)/1.2 = -13.33 mT.
OUT2 = 82 %, so the sensor sees a magnetic flux of Bin2 = (OUT2 - OUTzero) / Sprecal =
(82-50)/1.2 = +26.67 mT.
Using this method, magnetic flux values within (5%-50%)/1.2=-37.5mT and (95%50%)/1.2=+37.5mT can be measured and evaluated roughly without any programming.
In case of saturating the sensor, it is required to adjust the sensor RANGE to allow other
measurement limits:
Application Note
10
V 1.0, 2008-08
TLE4998-2P Calibration Guide
Mathematical background
• using the smaller range setting (+/- 50mT) doubles the sensitivity (measures magnetic
flux from -18.75mT to +18.75mT).
• using the larger range setting (+/- 200mT) halves the sensitivity (measures magnetic
flux from -75mT to +75mT).
If this is not sufficient, also the G parameter setting can be modified. E.g. doubling the
gain value (multiply by 2) doubles again the sensitivity.
2.5.2
Using pre-calibrated samples to do a rough 2P calibration
The method explained in the last section can be also used to do a coarse or preliminary
2P calibration without any measurement. Sometimes this might be useful to be done with
just the sensor alone (before the module is set up), as it does not require any further
measurement or programming after the module assembly. Of course this method does
not provide the accuracy as given with a full-featured calibration, but it might be useful
to do a first assembly check before continuing with the final calibration.
Example:
A module provides a magnetic flux of +75mT and -25mT which needs to be mapped to
90% and 10% of the digital output value, the clamping levels must be set to 94% and 6%.
The pre-calibrated gain value is 1.62 and the pre-calibrated offset value is 50% (sensor
read-out).
The +/- 100mT default range is well suited, as both magnetic flux values are well within
the allowed range.
The sensitivity needs to be set in that way that the magnetic flux change from
Bin2 = -25 mT to Bin1 = +75 mT results in a output value change from
OUT2 = 10% to OUT1 = 90%. So the required sensitivity is
(OUT1 - OUT2)/(Bin1 - Bin2) = (90-10) / (+75-(-25)) = 0.8 %/mT.
As the default sensitivity is about 1.2 %/mT, the gain value needs to be lowered by a
factor of (0.8 / 1.2) = 0.667. So the gain must be reprogrammed to (1.62 x 0.667) = 1.08.
For the offset setup, we can proceed as follows:
A magnetic flux of 75mT will cause with the new sensitivity value of 0.8 %/mT an output
change of (75 x 0.8) = 60 %. With the default offset setup of 50 % we would see (only
theoretically) 110 % on the output, but we need 90 %. Therefore, the offset value needs
to be lowered by (110-90) = 20 %. So it is necessary to set the new offset value to (50 20) = 30 %. The clamping parameters need to be set to 6% and 94% to provide the
required output limits.
Application Note
11
V 1.0, 2008-08
TLE4998-2P Calibration Guide
2P setup flow
3
2P setup flow
The previous chapter already gave some examples to demonstrate how the calibration
works basically. Now the generic basic algorithm for the two point setup is shown which
allows the accuracy as specified in the datasheet.
To find a certain gain/offset setup, even more sophisticated methods may be used as
described here. Especially if the magnetic field to be measured is not exactly linear, it
might be useful to aquire more points and to do a best fit through all these values. After
describing the basic principle here, it should be easy to enhance this routine for such
purposes.
3.1
Measurement setup
We assume a magnetic circuit setup with a TLE4998x device as illustrated in below
figure.
magnetic circuit
(temperature dep.)
T
B(T)
TST
VDD
GND
OUT(T)
TLE4998
Figure 5
Principle of a magnetic circuit setup
A stable and accurate VDD source (accuracy/stability better +/-0.5 mV) and a decoding
unit (oscilloskop, microcontroller) for the digital output value is required. In case of a less
reliable DC source, a second voltmeter (accuracy better +/-0.1mV) measuring the 5V
source should be used.
Furthermore, some programming tool is required to access the TLE4998x using a digital
protocol. This protocol is described in a separate programming application note.
Beside that, the temperature during the setup must kept stable, otherwise the measured
value is a mix of the given application setup (e.g. the flux density at a certain position)
and the temperature behavior of the whole system (e.g. used magnet).
When using the PGSISI programmer/demonstration kit for the TLE4998x the digital
output value is directly measured and the temperature is correctly read and displayed.
With this configuration, no further measurement equipment is required, but as it is a low
Application Note
12
V 1.0, 2008-08
TLE4998-2P Calibration Guide
2P setup flow
cost device (for a first evaluation only) it does not (and can not) unveil the full
performance of the TLE4998.
3.2
Read out the required data of the magnetic circuit
It is necessary to apply the two magnetic flux values to the sensor, which later should be
mapped to the desired output values. For current sensing applications this means to
apply two currents, for a positional detection two positions need to be set or for a angular
detection two angles must be applied.
For these two magnetic flux values the corresponding H_CAL values need to be read.
To reduce errors possibly caused by noise or environmental distortions, it is
recommended to read out the H_CAL value several times and average it. This gives two
values, H_CAL1 and H_CAL2. Check that the values are within the allowed range to
avoid calibration while the ADC might be saturated.
3.3
Determine the gain/offset values for programming
Mathematically, we need to remember the equation how D_OUT is calculated using
H_CAL and the GAIN/OFFSET value stored in the EEPROM. With the given relations of
D _ OUT
16 bit
=
2 ⋅ (G − 16384 ) ⋅ H _ CAL
+ (OS − 16384 ) ⋅ 16
4096
the internal value D_OUT to the flux density value B, the relation of D_OUT to the B value
can be shown as a line defined by two points, as shown in Figure 6.
D_OUT [LSB]
~ OUT (PWM or SENT)
D_OUT1
D_OUT2
H_CAL1
~ Pos1 (Bin1)
H_CAL2
~ Pos2 (Bin2 )
Figure 6
H_CAL
~ Position (Bin)
Principle of the 2P setup
Application Note
13
V 1.0, 2008-08
TLE4998-2P Calibration Guide
2P setup flow
With these 2 value-pairs and the above equation we can easily calculate the G and the
OS values, again illustrated using a visual basic code example:
’ check if the input values are different to avoid a division by zero
If ( (H_CAL2 - H_CAL1) != 0 ) Then
G = Math.Round(2048 * (D_OUT2 - D_OUT1) / (H_CAL2 - H_CAL1))+16384
OS = Math.Round(D_OUT1 - ((G-16384) * H_CAL1) / 2048) + 16384
Else
’ throw an error message (division by zero, no field applied)!
End If
Now we determined the values for the G and OS parameter. Check that they are within
the specified limits before updating the EEPROM parameters settings. You may perform
a temporary setup first, check the result and finally program the data to the EEPROM.
3.4
Procedure overview - Summary
To program a new gain and offset parameter for a two-point setup, perform these steps:
– acquire the H_CAL values for two magnetic flux setups
– determine the exact D_OUT values for the two required output values
– calculate the G/OS parameters and program the new EEPROM values
Application Note
14
V 1.0, 2008-08
TLE4998-2P Calibration Guide
2P setup flow
Application Note
15
V 1.0, 2008-08
w w w . i n f i n e o n . c o m
Published by Infineon Technologies AG