Application Note, V 1.00, December 2007 TLE4997 2-Point Calibration Guide Sensors Edition 2007-12 Published by Infineon Technologies AG 81726 Munich, 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. TLE4997-2P Guide 1 1.1 1.2 1.3 1.4 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Concept of TLE4997 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 3.5 2P setup flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Measurement setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Read out the required data of the magnetic circuit . . . . . . . . . . . . . . . . . . Determine the exact DAC values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Determine the gain/offset values for programming . . . . . . . . . . . . . . . . . . Procedure overview as summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Application Note 1 3 3 3 4 5 12 12 13 13 14 15 V 1.00, 2007-12 TLE4997-2P Guide Revision history Status: Date/Version: 2007-12 Previous Version: V 0.00 Page V 1.00 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.00, 2007-12 TLE4997-2P Guide Overview 1 Overview 1.1 General Information • This document is valid for all TLE4997 products and derivatives. • It is intended as add-on to the current available TLE4997 target and/or data sheets. • It is recommended to read the programming description of this device prior to this document. • It gives an overview and detailed description of the 2-point calibration concept (align magnetic field to output voltage) of the TLE4997. 1.2 Concept of TLE4997 2-point calibration setup The concept is based on shifting as much as possible of the on-chip sensor signal processing 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 also done directly in the first stage of the used sigma-delta analog-to-digital converter (Hall ADC). This principle we call magnetic-to-digital conversion (MDC). By doing that, and of course by using an Hall ADC with outstanding performance, the compensation requirements are mainly reduced to the magnetic circuit or mechanical behavior of the application and of course the Hall probe itself. All other parts do no longer have any significant depedency on the temperature. Figure 1 shows the principle in a simplified block diagram. Tj fixed biasing MAGNETIC CIRCUIT (B-Field) Hall probe A D A D DSP D A OUTPUT VOLTAGE (ratiometric) range setup EEPROM Figure 1 Simplified Block Diagram By providing an accurate digital calibration of the sensor temperature behavior (during pre-calibration by Infineon Technologies), the user setup depends only on analyzing the application temperature behavior correctly. After this step, the behavior of output voltage to given magnetic field is easily determined by setting only two parameters. The TLE4997 incorporates an analog (ratio metric) output stage, but also future derivates with digital interfaces will build on the same methods to allow seamless transitions. Application Note 3 V 1.00, 2007-12 TLE4997-2P Guide Overview 1.3 Principle signal processing operation Figure 2 show the main data processing steps of the TLE4997 digital part: Hardware-trigger (~16kHz) T_ADC sample rate ~ 400 SPS compensate TADC value (IFX), subtract TR value, store it toT_CAL Calculate and store O_TC out of TCAL (IFX) multiply TL value with TCAL, store it multiply TQ value with TCAL*TCAL, add it to previous multiply TT value with TCAL*TCAL², add it to previous and store S_TC H_ADC sample rate ~ 16k SPS Subtract TOFF from H_ADC value, mutiply it with TGAIN and store it asH_CAL Multiply GAIN with HCAL and subtract OFFSET, store it to VALUE Check clamping limits CH/CL and set then V_DAC Wait for next trigger Figure 2 Data processing flowchart As illustrated, the processing occurs with the same data rate as the Hall-ADC update rate with typical 16k SPS (samples per second). This happens due to a hard link of the Hall-ADC-value updates from the decimation filters to the DSP data processing. Therefore it needs to process the new output data within that time frame. Application Note 4 V 1.00, 2007-12 TLE4997-2P Guide Overview 1.4 Signal Flow Figure 3 shows a the signal flow diagram including important internal data values. Range LP H_ADC V_DAC Limiter Gain (Clamp) Hall Sensor Temperature Sensor T_ADC A D P -T0 A P D X X D A TC 2 X + DAC_SET H_CAL X 1 TC1 out LP DAC Offset X + Stored in EEPROM Memory internal device pre-calibration P T_CAL Temperature Compensation Figure 3 + Block Diagram Note: This is just given as reference - please check out the programming description (application note) for details about how to access and use this values. Application Note 5 V 1.00, 2007-12 TLE4997-2P Guide Mathematical background 2 Mathematical background To describe the overall behavior of the IC, we need to separate now between the calculated temperature behavior of the DSP and the natural (physical) temperature behavior of the Hall probe. 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 reality and the model. Nevertheless the system is designed in a way that this error should be always less than one LSB for the resulting output value V_DAC. 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 use virtually 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 an other 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 - TR*256 (Tint is already truncated as integer value) O_TC IFX calibrated (and T dependent) offset value S_TC1 8192 + ((TL-160)*T_CAL)>>7 VALUE1 (T_CAL*T_CAL)>>10 S_TC2 ((TQ-128)*VALUE1)>>8 + S_TC1 VALUE2 (T_CAL*VALUE1)>>11 S_TC ((TT-64)*VALUE2)>>8 + S_TC2 H_CAL ((((H_ADC*3)>>1) + O_TC)*S_TC)>>13 VALUE ((G-16384)*H_CAL)>>15 + OS - 16384 V_DAC 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 a separate application note. Application Note 6 V 1.00, 2007-12 TLE4997-2P Guide Mathematical background For a better overview, the calculation of the output value can be also written simplified as: V _ DAC = ( G − 16384 ) ⋅ H _ CAL + OS − 16384 32768 To get a voltage for the output value, it needs to be divided by 4095 and multiplied by the Vdd value. Of course, if a clamping limit is set, the output value would be limited to it, too. Note: Please remember that the ratiometric output has also physical limitations, which reduces the possible range of the V_DAC value. See specification for details. 2.2 Influence of the Hall probe and output DAC The precalibrated Hall sensor has a typical sensitivity of about 60mV/mT in the 100mT range and a zero-field offset voltage of 2.5V at 5V Vdd (not guaranteed). This sensitivity/offset values need to be adopted to the application by performing a magnetic field to output voltage calibration. Nevertheless some typical values of such a precalibration are shown in Table 2 - please note that this 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 60mV/mT) OFFSET (EEPROM) ~ 18432 (this delivers approx. 2,5V@5V Vdd at zero field) VALUE (DSP REG.) -4914 ... 4914 (internal calculation result) V_DAC (DSP REG.) 0 ... 4095 (and possibly limited to given CL and CH values) For full range, the H_ADC has a typical allowed dynamic range of 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 savety margin). So the typical seen H_ADC values at the required full-range magnetic input (flux density value) applied to the sensor will be approximately 15% below the considered ADC limit (see table above). It is important to note that the Application Note 7 V 1.00, 2007-12 TLE4997-2P Guide Mathematical background ADC value is 100% independent of the lowpass filter setting (the lowpass filter has only effect on the noise of the signal, not its value directly). Saturating the H_ADC input is seen as a nonlinear behavior and an increase of noise in the signal. 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 lower magnetic field range to fully avoid any saturation problems. The 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 ideal (approx. +/-30000 max., again the typical values seen are 15% smaller 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 is 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 1/8 smaller 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/8 (= half) of the H_CAL value. The purpose of that is removing the “noisy LSBs” of the H_CAL signal. However, at the end the 12 bit positive integer range (0 to 4095) of VALUE is used for the output DAC value in the V_DAC register, everything outside is clamped to the nearest maximum border value (0 or 4095). Of cause for OBD functionality the ranges can be restricted even more using the digital clamping value registers (both are again 12 bit). Figure 4 shows the calculation procedure from the H_CAL value to the V_DAC value in a simplified flow diagram. -4.0 … +3.999 -400% to 399.9% 0%...100% EEPROM: Gain EEPROM: VOS EEPROM: VCLH Vdd Usable range: 5%...95% X H_CAL gain setup :8 + VALUE V_DAC A clamping Vout (ratiometric) offset setup -30000…+30000 (maximum allowed) EEPROM: V CLL 0%...100% Figure 4 D 0…+4095 (maximum possible) 0%…100% (theoretical, without el. saturation) Simplified Calculation Flow Diagram Application Note 8 V 1.00, 2007-12 TLE4997-2P Guide Mathematical background 2.3 Calibration of the application circuit For a complete calibration procedure, five steps need to be performed: 1. Read-out the EEPROM and setup the temperature compensation parameters using the temporary EEPROM registers - this is the base for the 2P calibration. 2. Find the ideal DAC values (of both positions and if required of both clamping limits) by measuring the voltage output while testing several V_DAC vaues using a special DAC test mode (overrides the actual V_DAC value calculated by the DSP). Optionally it is possibly just to take the simple equation: DAC = 4095 * required_voltage / vdd_voltage In this simplified way a possible residual output gain/offset error from the analog output stage of the sensor is not canceled out. Nevertheless it also removes the requirement to measure the output voltage for calibration. Of course in this case the specified limits as defined in the 2-point calibration specification of the datasheet can not be fulfilled anymore. 3. Acquire the H_CAL values at (at least) two magnetic flux density values (positions) via the sensor interface (see application note for programming). 4. Calculate the corresponding G and OS values (which fit to the determined V_DAC values and measured H_CAL values). 5. Setup, program (and possibly lock) the EEPROM. This document describes the items 2-4, 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, V_DAC 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. V_DAC Corresponding output DAC value for the linear fieldto-output mapping. 0 to 4095 max. nevertheless values may be possible clamped (clamping registers) 0 % to 100% (theoretical) of the ratiometric output voltage (= Vout / Vdd [%] ), note that the output is saturating at upper/lower limits. Application Note 9 V 1.00, 2007-12 TLE4997-2P 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 ratio Vdd/Vout - 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 TLE4997 delivers following values: - Vdd (the supply of the sensor) is set to 5V. - At the first position of the application setup the output measured is Vout = 1.7V. - At the second position of the application setup the sensor output given is Vout = 4.1V. As the output values are far within the allowed output range from 5% to 95% of Vdd (which is in this case - at 5V supply - a range of 0.25V to 4.75V), we can assume that the sensor is not saturated. As the sensitivity Sprecal of a precalibrated samples is roughly 60mV/mT and the zero field offset is 2.5V, the two field values can be calculated: Vout1 = 1.7V, so the sensor sees a magnetic flux of Bin1 = (Vout1 - Vout_zero) / Sprecal = (1.72.5)/0.06 = -13.33 mT. Vout2 = 4.1V, so the sensor sees a magnetic flux of Bin2 = (Vout2 - Vout_zero) / Sprecal = (4.12.5)/0.06 = +26.67 mT. Using this method, magnetic flux values within (0.25-2.5)/0.06=-37.5mT and (4.752.5)/0.06=+37.5mT can be measured and evaluated roughly without any programming. Application Note 10 V 1.00, 2007-12 TLE4997-2P Guide Mathematical background In case of saturating the sensor, it is required to adjust the sensor RANGE to do allow other measurement limits: - 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 by useful factors. E.g. doubling the gain value (multiply by 2) doubles again the sensitivity (and so on). 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 4.5V and 0.5V, the clamping levels must be set to 4.7V and 0.3V. The precalibrated gain value is 1.62 and the precalibrated 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 = -25mT to Bin1 = +75mT results in a voltage change from Vout2 = 0.5V to Vout1 = 4.5V. So the required sensitivity is (Vout1 - Vout2)/(Bin1 - Bin2) = (4.5-0.5) / (+75-(-25)) = 0.04 V/mT = 40mV/mT. As the default sensitivity is about 60mV/mT, the gain value needs to be lowered by a factor of (40 / 60) = 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 40mV/mT a output change of (75 x 40) = 3000 mV = 3V. With the default offset setup of 2.5V we would see on the output (only theoretically) 5.5V, but we need 4.5V. So the offset value needs to be lowered by (5.5-4.5) = 1V. This corresponds to an ratiometric percentage of (1/5) x 100% = 20%. So it is necessary to set the new offset to (50 - 20) = 30 %. The clamping parameters need to be set to (0.3 / 5) x 100% = 6% and (4.7 / 5) x 100% = 94% to provide the required output limits. Application Note 11 V 1.00, 2007-12 TLE4997-2P Guide 2P setup flow 3 2P setup flow The previous chapter gave already 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 sofisticated methods may be used than that one 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 this values. After describing the basic principle here, it should be easily to enhance this routine for such purposes. 3.1 Measurement setup We assume a magnetic circuit setup with a TLE4997 device as illustrated in below figure. magnetic circuit (temperature dep.) T B(T) 5V GND Vout(T) TLE4997 Figure 5 Principle of a magnetic circuit setup A stable and accurate 5V DC source (accuracy/stability better +/-0.5 mV) and a good voltmeter (accuracy better +/-0.1mV) is required. In case of a less reliable DC source, a second voltmeter (accuracy better +/-0.1mV) measuring the 5V source should be used (to fetch an accurate ratiometric output value). Furthermore some programming tool is required to access the TLE4997 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 voltage 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 TLE4997 the ratiometric 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 cost device (for a first evaluation only) it does not (and can not) unveil the full performance of the TLE4997. Application Note 12 V 1.00, 2007-12 TLE4997-2P Guide 2P setup flow 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 should be later mapped to the desired output voltages. 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 exact DAC values In the next step, the V_DAC values need to be determined for the required output voltages (we call Vout1 and Vout2). This is done by switching the sensor to the DAC test mode. Now several DAC values can be applied and the resulting output voltages can be measured. It is recommended to do this setup with the pull-up/down load applied to include any voltage drops caused by this resistive currents flowing in/out of the sensor output. A simple iteration allows determining the exact DAC value of a required output voltage within a few steps only. The following visual basic code example illustrates this: ’ Vout ... required output voltage (input) ’ Vdd ... given supply voltage (input) ’ Vdac ... determined DAC value (result) ’ SensorDACset() ... routine setting the DAC of the sensor ’ MeasureDeviceOut() ... routine measuring the ratimetric result ’ in percent (0...100) ’ dac, err ... helper values ’ -------------------------------------------------------’ setting up a good DAC starting point dac = Math.Round ( 4095 * Vout/Vdd ) ’ iterate to find the best DAC value For i = 1 To 10 ’ set the sensor dac value using the special test mode SensorDACset(dac) ’ we calculate, how far we are away from the measured output value ’ we need to stay in the LSB region err = Math.Round ( MeasureDeviceOut()*4095/100 - 4095 * Vout/Vdd) If err = 0 Then : Exit For : End If ’ we have a hit -> exit ’ correct the used DAC value dac -= err Next ’ we are finished! Vdac = dac We end up with two DAC values we call V_DAC1 and V_DAC2. Application Note 13 V 1.00, 2007-12 TLE4997-2P Guide 2P setup flow 3.4 Determine the gain/offset values for programming Mathematically, we need to remember the equation how V_DAC is calculated using H_CAL and the GAIN/OFFSET value stored in the EEPROM. V _ DAC = (GAIN − 16384) ⋅ H _ CAL + OFFSET − 16384 32768 With the given relations of the internal value V_DAC to the ratiometric output voltage Vout and the application setup (like a position) to the flux density value B, the relation of V_DAC to the B value can be shown as a line defined by two points, as shown in Figure 6. V_DAC ~ Vout [%] V_DAC1 ~ Vout1 V_DAC2 ~ Vout2 H_CAL1 H_CAL2 ~ Pos2 (Bin2 ) Figure 6 H_CAL ~ Position (Bin ) ~ Pos1 (Bin1 ) Principle of the 2P setup With these 2 value-pairs and the above equation we can easily calculate the G and the OS values, again illustrated using avisual 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(32768 * (V_DAC2 - V_DAC1) / (H_CAL2 - H_CAL1)) OS = Math.Round(V_DAC1 - (GAIN * H_CAL1) / 32768) + 16384 G = G + 16384 Else ’ throw an error message (division by zero, no field applied)! End If Application Note 14 V 1.00, 2007-12 TLE4997-2P Guide 2P setup flow 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.5 Procedure overview as 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 V_DAC values for the two required output voltages – calculate the G/OS parameters and program the new EEPROM values The first two steps may be performed in opposite order, it has no impact if the H_CAL values are read from the sensor after determining the exact V_DAC values. Application Note 15 V 1.00, 2007-12 w w w . i n f i n e o n . c o m Published by Infineon Technologies AG