Auto Current Offset Trim using DRV8323RS Gate Driver

Motivation

Hardware offset compensation will not make a drastic difference with the low-power motors we are currently using. The main problem arises when the measured ADC value is close to the limit when the motor is drawing high current (when the motor is under load) with a more powerful motor. When approaching the measurement limits at high currents, it enters the upper or lower non-linear measurement region according to the offset deviation and flow direction. Since the system is closed-loop and the measured currents are fed back to the PI controllers, errors in motor behavior occur in such cases. In addition, there will be a loss equal to the compensated current value in the measuring range. When offset compensation is performed by Gate Driver, the error caused by the current sense amplifier(integrated into Gate Driver) is directly compensated and given to the ADC. In this way, depending on the direction of the current, cropping will occur equally in the upper and lower non-linear regions. Thanks to hardware offset compensation, we will not have to worry about whether the determined offset compensation threshold will cause problems with new motor control boards and motors, and we will reduce software complexity.

Abstract

Motor phase current measurement is performed bidirectionally with ADC. The integrated ADC used is 12-bit and the ADC value should be 2048 in the case of no flowing current. In order for the current to be measured by the ADC in a wide range, the voltage on the Shunt Resistor is amplified by the CSA (Current Sense Amplifier) integrated into Gate Driver. In practice, CSAs have input offset and drift errors. These input errors are summed up with the voltage measured over the shunt, and these errors are reflected on the output by multiplying the voltage gain of the CSA. We can compensate for these errors, which are reflected in the output, in two different ways:

  • Software Offset Compensation: While the motor control PWM is disabled, the phase current measurement is performed using ADC. It is checked whether the measured value is within the desired limits and then this value is compensated for after each measurement. Since the offset compensation is performed after the measurement with the ADC, an unusable area is created in the measurement range of the ADC. This insufficiency occurs especially when the motor is operating at its maximum current limits.

  • Hardware Offset Compensation: The compensation process is started by setting the corresponding bit in the calibration register of the gate driver. These errors are eliminated before they are measured with the ADC.

Detailed Information

Motor phase currents are measured by the shunt resistors in each phase. The voltage drop on the shunt resistor is very small and must be amplified by CSA(Current sense amplifier) before it can be measured with the ADC. These current sense amplifiers are integrated into the gate driver. This amplifying coefficient(Av) varies according to the current measurement range we want to perform, therefore the shunt resistance is calculated and used.

Figure 1 - Block Diagram for DRV8323RS

In general, operational amplifiers have problems due to their structure. The most important of these is the input offset. Because this input offset value is multiplied by the determined Av value and reflected in the output(Figure 2). The major one of this input offset value is VOFF and it differs according to each gate driver produced and does not change depending on the temperature (≈ 4mV). However, the other minor is VDRIFT and it changes depending on the temperature (≈ 10μV/oC). VDRIFT doesn’t have much effect unless there is a large temperature change. The total input offset is obtained by the sum of VDRIFT and VOFF.

Note: Since the motor current is AC, the current is bidirectional and the "Bidirectional Measurement" method is used to measure this current with a single-ended ADC.

Figure 2 - Bidirectional Current Sense details for DRV8323RS

Looking at Figure 1, the “Output Offset Bias“ module is seen. This is the module that performs the automatic current offset trim. This is normally in software performed with the Current Offset state machine in the MCL FOC Control layer. However, when this offset is not hardware corrected, it steals from our ADC range (we compensate for this after the measurement in software). Since it is necessary for us to measure the AC current during FOC control, this state machine will not be changed and the DC value of the current will be cropped. However, since the CSA offset value will be hardware compensated by the Gate Driver, the problem of using separate threshold values of the Current Offset state machine in MCL layer for each Gate Driver will be eliminated.

 

Figure 3 - Position of the Auto Offset Calibration state

Gate Driver’s automatic current offset calibration algorithm is explained in Figure 4.

Figure 4 - Auto Offset Calibration algorithm

 

  1. Motor PWM signals are stopped to avoid interference in measurements during calibration.

  2. Initialize and enable Gate Driver.

  3. Wait for the wake-up Gate Driver.

  4. “CSA_CAL_A”, “CSA_CAL_B”, “CSA_CAL_C” bits are set from the CSA register. Thus, the calibration process will start and the inputs of all Op-Amps will be short-circuited. As a result, the input will be zero and the offset value reflected on the output will be hardware shifted to the center (trimming). It should be noted that Av values are automatically set to the maximum during calibration because the input offset value is multiplied by Av coefficient.

  5. A minimum of 100μs is expected for the calibration to be finished.

  6. “CSA_CAL_A”, “CSA_CAL_B”, “CSA_CAL_C” bits are reset from the CSA register to finish the calibration.

  7. The trimming process is finished and current offset values are compensated.

  8. Gate Driver is ready to be used after it has been set with the necessary settings for our application.