AN4439 Application note L99ASC03 current sense amplifier offset adjust Introduction The L99ASC03 is a 3 phase BLDC motor controller. This device drives 6 MOSFETs for standard trapezoidal driven BLDC motors using back EMF for rotor position detection. This device has a current sense amplifier that provides an output of 1/2 Vcc (2.5 V) when there is no current sensed. This was done to provide bi-directional current detection. Some applications only need unidirectional current sensing. When this is the case, reducing or eliminating this offset would be advantageous to allow full use of the available microcontroller ADC range. This application note provides the detailed calculations to provide the proper external resistor selection and tolerances required for optimal current sensing accuracy. March 2014 DocID025908 Rev 1 1/16 www.st.com Contents AN4439 Contents 1 The L99ASC03 current sense amplifier circuit . . . . . . . . . . . . . . . . . . . . 5 2 Calculating the input resistor values . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 Calculating the transfer function from input to CSO . . . . . . . . . . . . . . . . . . 8 3 Tolerance calculations induced by adding external resistors. . . . . . . 10 4 Generating a small offset to overcome input resistor tolerance and CSO lower limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5 2/16 4.1 Bench evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 DocID025908 Rev 1 AN4439 List of tables List of tables Table 1. Table 2. Table 3. Table 4. Rin values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1% Rin values for CSOmin=0.2 V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 DC offset voltages with given resistor values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 DocID025908 Rev 1 3/16 3 List of figures AN4439 List of figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. 4/16 L99ASC03 current sense amplifier circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 L99ASC03 input offset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Second stage Op-Amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 First stage Op-Amp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 CSO typical transfer functions at the 4 different gain settings . . . . . . . . . . . . . . . . . . . . . . . 9 Transfer function tolerance at a gain of 20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Transfer function tolerance at a gain of 100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 DC offset at all inputs and gains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Inserted bias resistors for testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 CSO vs. VIN at Av=20, calculated vs actual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 DocID025908 Rev 1 AN4439 1 The L99ASC03 current sense amplifier circuit The L99ASC03 current sense amplifier circuit The L99ASC03 current sense amplifier consists of two stages. The first stage is a fixed gain of 10 inverting amplifier. The second stage is a programmable gain inverting amplifier. The second stage programmable voltage gain (AV2) can be programmed for a gain of 2, 3, 7, or 10. This translates to system gain settings of 20, 30, 70 and 100 when considering both opamps. 5 [ 5 5 &6, 5 5 &6, &62 9[ 5 9[ ("1(.4 Figure 1. L99ASC03 current sense amplifier circuit Where: • R1=R2=10 kΩ +45 % / -15 % (semiconductor resistor vary a lot and they vary together. As a result ratios stay fairly tight) • VX = 2.5 V +/-2 % With both the CSI+ and CSI- pins available we can add a few resistors to the CSI- pin to generate an appropriate offset to bring the CSO @ 0 A to close to 0 V. Figure 2. L99ASC03 input offset circuit GAPG2002140828MS DocID025908 Rev 1 5/16 15 Calculating the input resistor values 2 AN4439 Calculating the input resistor values We first calculate the voltages needed at the output of the first stage (VOUT1_0A) at the four different second stage gain settings. [5 5 9287B$ &62 9[ ("1(.4 Figure 3. Second stage Op-Amp A simple KCL equation: Equation 1 V OUT1_0V – VX VX ---------------------------------------- = ---------xR 2 R2 where xR2 can be defined by the programmed gain as: Equation 2 xR 2 = A V2 ⋅ R 2 Solving for VOUT1_0V provides: Equation 3 R 2 ⋅ V X + V X ⋅ xR 2 V OUT1_0V = -----------------------------------------------xR 2 Looking at the CSI+ input we determine what the voltage (Vx, lower case x) at the Op-Amp pins must be to generate VOUT1_0V. We set CSI+ to 0V to simplify the equation. 6/16 DocID025908 Rev 1 AN4439 Calculating the input resistor values 5 &6, &6, 5 9[ 5 9[ ("1(.4 Figure 4. First stage Op-Amp Equation 4 VX V OUT1_0V – V X ------- = --------------------------------------R1 10R 1 Solve this for Vx to obtain: Equation 5 V OUT1_0V V X = ------------------------11 Using Kirchoff’s current law (KCL) on the negative input (CSI- or in this equation CSN) we have the following two equations: Equation 6 V CC – V CSN V CSN V CSN – V X -------------------------------- – --------------- – ---------------------------R IN R Bias 11 ⋅ R 1 Equation 7 V CSN – V x V x – V X --------------------------- – -------------------R1 10 ⋅ R 1 Then solving Equation 6 and Equation 7 for CSN and putting them together obtains: Equation 8 11 ⋅ Vx V X 11 ⋅ R1 ⋅ R IN ⋅ V CC + R IN ⋅ R Bias ⋅ V X ----------------- – ------- = -------------------------------------------------------------------------------------------------------------------10 10 11 ⋅ R1 ⋅ R IN + 11 ⋅ R IN ⋅ R Bias + R IN ⋅ RBias DocID025908 Rev 1 7/16 15 Calculating the input resistor values AN4439 Solving for RIN, while including Equation 2, Equation 3 and Equation 5 and simplifying we obtain: Equation 9 11 ⋅ R 1 ⋅ R Bias ⋅ VX R IN = ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------11 ⋅ R 1 ⋅ V X + R Bias ⋅ V X – ( 110 ⋅ A V2 ⋅ R 1 ⋅ V CC ) – ( 10 ⋅ A V2 ⋅ R Bias ⋅ V X ) We can now determine a value for RIN for a given RBias and gain setting. For RBias=10 kΩ 1% and rounding to the nearest 1 % resistor value we have: Table 1. Rin values 2.1 Gain RIN (1%) 20 249Ω 30 162Ω 70 68.1Ω 100 47.5Ω Calculating the transfer function from input to CSO First we rewrite Equation 4 to include CSI+ (CSP) as a non-zero number: Equation 10 Vx – VOUT1 V CSP – V x ---------------------------- = ------------------------------R1 10 ⋅ R 1 We define Vx in terms of RIN, and RBias: Equation 11 Defining VOUT1 in terms of VCSO: Equation 12 Insert Equation 11 and Equation 12 into Equation 10 and solve for VCSO to obtain: 8/16 DocID025908 Rev 1 AN4439 Calculating the input resistor values Equation 13 Where AV is now the programmable gain value of: 20, 30, 70, and 100. CSO vs. CSI+ 5 CSO (V) 4 3 2 AV=20 AV=30 AV=70 AV=100 1 0 0 0.05 0.1 0.15 0.2 0.25 CSI+ (V) GAPG2002140832MS Figure 5. CSO typical transfer functions at the 4 different gain settings DocID025908 Rev 1 9/16 15 Tolerance calculations induced by adding external resistors. 3 AN4439 Tolerance calculations induced by adding external resistors. The L99ASC03 internal resistors have a large tolerance associated with them. The advantage is that they will track with a very high degree of accuracy. As a result resistor value ratios are maintained regardless of their absolute value variations. This is an advantage as long as external resistors are not involved in the equation. Unfortunately to add offset to our system we added two external resistors. Some advantages are that these resistors are added to the ground side of the op-amp system. This means that the effect is simply a DC offset. Variations in the internal resistors with respect to the external resistors will then only affect a simple DC offset and not adversely affect gain. As a result, the DC offset can be calibrated any time there is no current in the ground leg of the inverter (i.e. whenever the motor is not being driven or during freewheeling). Using 1% resistors in Equation 13 above and inserting the worst case min and max values for the internal resistors the variation is calculated. Worst case high: • RIN = min value • RBias = max value • R1 = min value Worst case low: • RIN = min value • RBias = max value • R1 = min value The worst case is where the external resistor, RIN is the largest. That is at the lowest gain. As the gain increases the RIN value drops. This reduces the offset error due to resistor tolerances. Tolerance at AV=20 5 CSO (V) 4 3 2 typ min max 1 0 0 0.05 0.1 0.15 0.2 0.25 CSI+ (V) GAPG2002140834MS Figure 6. Transfer function tolerance at a gain of 20 10/16 DocID025908 Rev 1 AN4439 Tolerance calculations induced by adding external resistors. Tolerance at AV=100 5 CSO (V) 4 3 2 typ min max 1 0 0 0.01 0.02 0.03 0.04 0.05 CSI+ (V) GAPG2002140836MS Figure 7. Transfer function tolerance at a gain of 100 When looking at the errors on the same graph (Figure 18) we find that the input resistor value when kept low (<300 Ω) has little effect on the tolerance. DC offset 0.2 CSO (V) 0.1 AV=20 max error AV=20 min error AV=30 max error AV=30 min error AV=70 max error AV=70 min error AV=100 max error AV=100 min error 0 − 0.1 − 0.2 0 0.05 0.1 0.15 0.2 0.25 CSI+ (V) GAPG2002140838MS Figure 8. DC offset at all inputs and gains DocID025908 Rev 1 11/16 15 Generating a small offset to overcome input resistor tolerance and CSO lower limits 4 AN4439 Generating a small offset to overcome input resistor tolerance and CSO lower limits The output of the current sense amplifier (CSO pin) has a minimum specified voltage of 0.2 V. This means that there will have to be some current in the sense resistor to start moving the CSO voltage up. Generating an offset is needed to bring that current lower. This translates to reducing the RIN resistor value or increasing the RBias value. To know how much that will need to be we look at the transfer equation and set the input voltage (VCSI+) to 0 V and the output voltage (VCSO) to 0.2 V and solve for RIN. Equation 14 Solving this for RIN provides: 11 ⋅ R1 ⋅ R IN ⋅ V CC + R IN ⋅ R Bias ⋅ V X V X + ( V X ⋅ A V ) – VX + 10 ⋅ -------------------------------------------------------------------------------------------------------------------- ⋅ A V = 0.2V 11 ⋅ R1 ⋅ R IN + 11 ⋅ R IN ⋅ R Bias + R IN ⋅ RBias Equation 15 RIN − ( ) 1.0⋅ 11.0⋅ R1⋅ RBias⋅ V − 55.0⋅ R1⋅ RBias⋅ VX 11.0⋅ R1⋅ V + RBias⋅ V − 55.0⋅ R1⋅ VX − 5.0⋅ RBias⋅ VX + 550.0⋅ A V2⋅ R1⋅ VCC + 50.0⋅ A V2⋅ RBias⋅ VX For RBias=10 kΩ 1% and rounding to the nearest 1% resistor and compensating for tolerance we have: Table 2. 1% Rin values for CSOmin=0.2 V Gain RIN (1%) 20 215Ω 30 143Ω 70 60.4Ω 100 42.2Ω This gives a fixed offset that is above 0.2 V over time and temperature allowing the CSO pin to never be out of range from 0 A to whatever gain and sense resistor size will allow. Table 6 below provides worst case offset voltages over time and temperature with respect to the above selected resistors. 12/16 DocID025908 Rev 1 AN4439 Generating a small offset to overcome input resistor tolerance and CSO lower limits Table 3. DC offset voltages with given resistor values CSO DC offset Gain Resistor Min Typ Max 20 215 0.202 V 0.304 V 0.416 V 30 143 0.188 V 0.292 V 0.407 V 70 60.4 0.196 V 0.304 V 0.424 V 100 42.2 0.193 V 0.304 V 0.426 V These voltages are worst case given the external and internal resistor tolerances. There is a small overlap that drops below the worst case 0.2 V CSO minimum voltage. The worst case difference is at the gain of 30 with a 0.012 V error. This translates to a very small sense current. If this is an issue the next 1% resistor value lower will improve this to above the 0.2 V threshold. 4.1 Bench evaluation To verify that the additional resistors did not somehow adversely affect the transfer function of the CSO circuit a bench evaluation was performed. The two resistors were inserted into a test board as shown in Figure 19 below and the CSI+ pin was driven with a finely adjustable power supply. Figure 9. Inserted bias resistors for testing DocID025908 Rev 1 13/16 15 Generating a small offset to overcome input resistor tolerance and CSO lower limits AN4439 The L99ASC03 was programmed to not drive the inverter and the CSO gain was set to 20. The resistors used were 2 x 20 turn potentiometers adjusted to precisely 10.00 k Ohms and 215 Ohms. VCC was measured as 4.982 V. VX was not measurable and the overall gain, calculated from the collected data, varied from 19.5 to 19.8. The circuit was tested from VIN = 0 V to 250 mV in ~10 mV increments. This data was compared to the calculated values generated by Equation 13 where: • VCC = 5 V • VX=2.5 V • RIN=215 Ohms • RBias = 10 kOhms • Av = 20 Figure 20 below compares the calculated versus measured transfer curves at a gain set at 20. 5 4 CSO (V) 3 Measured typ Calculated typ 2 Measured min Measured max Calculated min 1 Calculated max 0 0 50 100 150 200 250 CSI+ (mV) Figure 10. CSO vs. VIN at Av=20, calculated vs actual As can be seen, the additional resistors did not affect the gain of the system. It only changed the zero current starting point. 4.2 Conclusion Adding external resistors to set the CSO output offset to 0.2 V at 0 A is not difficult and does not adversely affect the gain. Low external resistor values have a small effect on the DC offset. The DC offset issues can be easily calibrated out prior to and even during motor operation. This can be done by reading the CSO pin when the motor is not driving current or when the driven phase is in recirculation mode. 14/16 DocID025908 Rev 1 AN4439 5 Revision history Revision history Table 4. Document revision history Date Revision 19-Mar-2014 1 Changes Initial release. DocID025908 Rev 1 15/16 15 AN4439 h Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2014 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 16/16 DocID025908 Rev 1