February 2009 TLE5011 GMR-Based Angular Sensor Application Note TLE5011 Calibration V 1.1 Sensors Edition 2009-02-26 Published by Infineon Technologies AG 81726 München, Germany © 2007 Infineon Technologies AG All Rights Reserved. Legal Disclaimer The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics. With respect to any examples or hints given herein, any typical values stated herein and/or any information regarding the application of the device, Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind, including without limitation, warranties of non-infringement of intellectual property rights of any third party. Information For further information on technology, delivery terms and conditions and prices, please contact the 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 the nearest Infineon Technologies Office. Infineon Technologies components may be used in life-support devices or systems only 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. TLE5011 GMR-Based Angular Sensor Revision History: 2009-02-26, V 1.1 Previous Version: V 1.0 Page 14 Subjects (major changes since last revision) Text modified 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 continously improve the quality of this document. Please send your proposal (including a reference to this document) to: [email protected] Application Note TLE5011 Calibration 3 V 1.1, 2009-02-26 Table of Contents Table of Contents Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1 Giant Magneto-Resistance Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 2.1 2.1.1 2.1.2 2.2 2.3 Calibration of TLE5011 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Extraction of Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Min-Max Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Exact Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Final Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Temperature-dependent Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3 Angle Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Application Note TLE5011 Calibration 4 V 1.1, 2009-02-26 List of Figures List of Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 X, Y output signal (raw values) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Angle performance without parameter correction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 X, Y output signals (offset corrected) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 X, Y output signals (amplitude normalized) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Angle performance after parameter correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Calibration routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Min-Max method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Orthogonality error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Correction of orthogonality error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Temperature coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Implementation of angle calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Application Note TLE5011 Calibration 5 V 1.1, 2009-02-26 TLE5011 Calibration Giant Magneto-Resistance Parameters 1 Giant Magneto-Resistance Parameters The output signals of the TLE5011 can be factored into a sine (Y) and a cosine (X). These signals can be expressed by Equation (1). (1) X = AX * COS (α + ϕ X ) + OX Y = AY * SIN (α + ϕY ) + OY AX .. Amplitude of X(COS) signal AY .. Amplitude of Y(SIN) signal OX .. Offset of X(COS) signal OY .. Offset of Y(SIN) signal ϕX .. Phase of X(COS) signal ϕY .. Phase of Y(SIN) signal The three parameters that affect the angle calculation are the amplitude, the offset, and the phase. Figure 1 displays the output of X and Y signals. The scale in the figure has been exaggerated to make them easier to see. X, Y Output [digits] TLE5011 (X, Y Output) (raw values) 0 45 90 135 180 225 270 315 360 Angle [°] sin (Y) Figure 1 cos (X) X, Y output signal (raw values) The direct angle calculation (Equation (2)) will result in an elliptical shape (Figure 2). (2) Y α = arctan( ) X Application Note TLE5011 Calibration 6 V 1.1, 2009-02-26 TLE5011 Calibration Giant Magneto-Resistance Parameters Y Y α X X Figure 2 Angle performance without parameter correction To minimize the angle error, it is important to achieve a circular shape. Therefore some corrections are necessary. First the offset has to be corrected (Figure 3). X, Y Output [digits] TLE5011 (X, Y Output) (offset corrected) 0 45 90 135 180 225 270 315 360 Angle [°] sin (Y) Figure 3 cos (X) X, Y output signals (offset corrected) The next step is the amplitude normalization (Figure 4), followed by the correction of the non-orthogonality (Figure 8). Application Note TLE5011 Calibration 7 V 1.1, 2009-02-26 TLE5011 Calibration Giant Magneto-Resistance Parameters X, Y Output [digits] TLE5011 (X, Y Output) (amplitude normalized) 0 45 90 135 180 225 270 315 360 Angle [°] sin (Y) Figure 4 cos (X) X, Y output signals (amplitude normalized) After all corrections have been made, the resulting vector of X and Y signal will have a circular shape. Y Y α X Figure 5 X Angle performance after parameter correction Application Note TLE5011 Calibration 8 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 2 Calibration of TLE5011 This chapter explains how to determine the Giant MagnetoResistance (GMR) parameters such as amplitude, offset, and the phase of X- and Y-channels. The end-of-line calibration can be accomplished using the following sequence (Figure 6): 1.) left turn measurement 3.) right & left turn w/o measurement 4.) right turn measurement 90° 180° 0° Start End 270° Figure 6 1. 2. 3. 4. 5. 6. Calibration routine Turn magnetic field 360° left and measure X and Y values Calculate amplitude, offset, phase correction values of left turn Turn further 90° left and 90° back right without measurement Turn magnetic field 360° right and measure X and Y values Calculate amplitude, offset, phase correction values of right turn Calculate mean values of amplitude, offset, phase correction The calibration has to be done at room temperature with a magnet in the specified magnetic field range. The signal amplitude T25 of the temperature measurement path must also be measured afterwards. This is done by setting the TEMP_EN bit at address 0CH. The temperature can then be read out via X-path (XL, XH). Store this value in digits; it is not necessary to convert it into °C. 2.1 Extraction of Parameters There are two possible methods for extracting these parameters. The methods will be discussed in more detail in the next two sections. 2.1.1 Min-Max Method Xmax, Xmin, Ymax and Ymin have to be extracted out of every full-turn measurement (Figure 7). Application Note TLE5011 Calibration 9 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 Y Ymax X(Ymax) Y(Xmax) Xmin Y(Xmin) Xmax SensorZeropoint X X(Ymin) Ymin Figure 7 Min-Max method Afterwards, amplitude (Equation (3), Equation (4)) and offset (Equation (5), Equation (6)) can be calculated: AX = AY = X max − X min 2 (3) Ymax − Ymin 2 OX = X max + X min 2 OY = Ymax + Ymin 2 Application Note TLE5011 Calibration (4) (5) (6) 10 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 The corresponding maximum and zero-crossing points of the SIN and COS signals do not occur at the precise distance of 90°. The difference between X and Y phases is called the orthogonality error (Equation (7)): (7) ϕ = ϕ X − ϕY φX sin (Y) cos (X) 0,800 0,300 -0,200 0 45 90 135 180 225 270 315 360 φY -0,700 -1,200 Figure 8 Orthogonality error There is another more accurate way to determine the orthogonality error. The orthogonality can be calculated out of the magnitude of two 90° angle shifted components. Possible angle combinations are 45° and 135°, 135° and 225°, 225° and 315° or 315° and 45°. The angle value is given by the angle sensor. No reference is necessary. Therefore the final parameters of amplitude and offset (Chapter 2.2) should be used. At an angle output of 45° the corresponding Y(sin) and X(cos) values can be read out. This has been done also at 135° (Figure 9). Next step is to calculate the length of the magnitudes (Equation (8)): 2 M 45 = X 45 + Y45 2 2 M 135 = X 135 + Y135 (8) 2 M45, M135.. Magnitude at 45° and 135° X45, X135 .. Cosine values at 45° and 135° Y45, Y135 .. Sine values at 45° and 135° Application Note TLE5011 Calibration 11 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 With these magnitudes the orthogonality can be calculated (Equation (9)): ϕ = 2 * arctan( M 135 − M 45 ) M 135 + M 45 (9) Y (SIN) 45° 135° M45 M135 X (COS) Figure 9 Correction of orthogonality error 2.1.2 Exact Method This method uses the Discrete Fourier Transform (DFT) to extract the parameters out of the measurements. Therefore an accurate reference system is necessary. This method is done using 2m measurement points at 360° (e.g. m = 8; n = 2m = 28 = 64). DFT Offset Calculation: The offset is calculated by the summation of the X- or Y- measurements divided by the number of measurement points (Equation (10)): Ox = [ X (1) + X (2) + .. + X (n )] / n (10) OY = [Y (1) + Y (2) + .. + Y (n )] / n X(n) .. X value at measurement point n Y(n) .. Y value at measurement point n n .. Measurement points Application Note TLE5011 Calibration 12 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 DFT Amplitude and Phase Calculation: To determine the amplitude, the real and imaginary parts must be calculated. This has been done with Equation (11) for the X values and Equation (12) for the Y values. β describes the reference angle (e.g. n = 64; measurement every 360° / 64 = 5.625° step). DFT _ X _ r = [X (1) * COS (β 1) + X (2 ) * COS (β 2 ) + .. + X (n ) * COS (βn )]* 2 / n DFT _ X _ i = [X (1) * SIN (β 1) + X (2 ) * SIN (β 2 ) + .. + X (n ) * SIN (βn )]* 2 / n DFT _ Y _ r = [Y (1) * COS (β 1) + Y (2) * COS (β 2) + .. + Y (n ) * COS (βn )]* 2 / n DFT _ Y _ i = [Y (1) * SIN (β 1) + Y (2) * SIN (β 2) + .. + Y (n ) * SIN (βn )]* 2 / n (11) (12) Now the amplitude and phase can be calculated (Equation (13), Equation (14)) (13) AX = ( DFT _ X _ r ) 2 + ( DFT _ X _ i ) 2 AY = ( DFT _ Y _ r ) 2 + ( DFT _ Y _ i ) 2 (14) DFT _ X _ i ϕ X = arctan DFT _ X _ r DFT _ Y _ i π ϕ Y = − arctan 2 DFT _ Y _ r ϕ = ϕ X − ϕY 2.2 Final Parameters No matter what calibration method is used, you still have to calculate the symmetrical values of the parameters. This is done using the mean value of the clock-wise (cw) rotation parameters and counterclock-wise (ccw) rotation parameters. This calculation has to be done with X and Y parameters. These parameters have to be used for the signal correction. Acw + Accw 2 O + Occw OM = cw 2 ϕ + ϕ ccw ϕ M = cw 2 AM = (15) (A,O,ϕ)M .. Mean parameters (A,O,ϕ)CW .. Parameters of clock-wise rotation (A,O,ϕ)CCW .. Parameters of counterclock-wise rotation Application Note TLE5011 Calibration 13 V 1.1, 2009-02-26 TLE5011 Calibration Calibration of TLE5011 2.3 Temperature-dependent Behavior The temperature offset gradients (KTOX, KTOY) for both channels depend on the value at 25°C. These gradients are neccesary for the temperature offset compensation. KTOx = tco _ d _ x + (tco _ k _ x * OX 25 ) (16) KTOY = tco _ d _ y + (tco _ k _ y * OY 25 ) tco_d_x, tco_d_y .. Offset temperature coefficient base (in digits/K) tco_k_x, tco_k_y .. Offset temperature coefficient gain (in 1/K) The coefficients (tco_d_x, tco_d_y, tco_k_x, tco_k_y) have to be determined for every sensor separately. This has been done at two different temperatures (e.g. T25 and HT). Offset tco_d P1(T 1/O 1) P2 (T2/O2) 0 Figure 10 HT T25 Temperature Temperature coefficients The offset of X and Y channels at two temperatures has to be known before the coefficients can be calculated with Equation (17) and Equation (18). tco _ k = (17) O2 − O1 T2 − T1 (18) tco _ d = O1 − tco _ k * T1 The temperature offset compensation should be used to achieve more accurate angle values over the whole temperature range. Application Note TLE5011 Calibration 14 V 1.1, 2009-02-26 TLE5011 Calibration Angle Calculation 3 Angle Calculation To get highly accurate angle values, the following angle calculation must be performed. Figure 11 shows the implementation within a microcontroller. CalibrationsAlgorithm Sensor X Sensor Y Figure 11 Offset_ corr Gain_ corr + * + * Angle_ corr X_tmp atan (Cordic) Y_tmp Y-Corr Implementation of angle calculation Offset Correction (Offset_corr) To increase the accuracy, the temperature-dependent offset drift can be compensated for. The temperature of the chip has to be read out. The offset values OX and OY can be described by the following equations: Ox = O X 25 + KTOX * (T − T25 ) ST OY = OY 25 + KTOY * (T − T25 ) ST (19) OX25 .. Offset of X(COS) signal at room temperature (in digits) OY25 .. Offset of Y(SIN) signal at room temperature (in digits) KTOX .. Gradient of X-offset (in digits/K) KTOY .. Gradient of Y-offset (in digits/K) ST .. Temperature sensor sensitivity (in digits/K) T .. Temperature (in digits) T25 .. Temperature at room temperature (in digits) After the X and Y values are read out, the temperature-corrected offset value must be subtracted (Equation (20)): (20) X 1 = X − OX Y1 = Y − OY Application Note TLE5011 Calibration 15 V 1.1, 2009-02-26 TLE5011 Calibration Angle Calculation Amplitude Normalization (Gain_corr) The next step is to normalize the X and Y values by using the mean values determined in the calibration. X2 = Y2 = X1 AXM (21) Y1 AYM Non-Orthogonality Correction (Angle_corr) The influence of the non-orthogonality can be compensated for by using Equation (22), in which only the Y channel must be corrected. Y3 = Y2 − X 2 * sin( −ϕ ) cos( −ϕ ) (22) Resulting Angle After correction of all errors, the resulting angle can be calculated using the arctan function1). α = arctan( Y3 ) −ϕX X2 (23) 1) Microcontroller library function “arctan2(Y3,X2)” works better to resolve 360° Application Note TLE5011 Calibration 16 V 1.1, 2009-02-26 www.infineon.com Published by Infineon Technologies AG