dm00063976

AN4158
Application note
Peak current control with automatic decay adjustment and
predictive current control: basics and setup
Enrico Poli
Introduction
The new STMicroelectronics L6472 and L6474 motor drivers provide two new patented
advanced current control systems evolving from traditional peak current control systems:
automatic decay adjustment and the predictive current control.
Using automatic decay adjustment, the L6472 and L6474 devices allow current ripple to be
reduced and control robustness to be increased especially in microstepping applications.
The predictive current control regulates the average current instead of the peak current,
obtaining a more precise positioning, and reduces the variation of the power stage switching
frequency.
Automatic decay adjustment and predictive current control allow stepper motors to be
operated with less torque ripple, fewer vibrations and much more smoothly at low speed.
This document describes the basic principles and the operation of the new control systems
and provides suggestions on parameter setup in order to obtain optimal results.
April 2015
DocID023635 Rev 2
1/34
www.st.com
34
Contents
AN4158
Contents
1
Stepper motor basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1
Full step and half step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2
Microstepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2
Phase current control in stepper motor driving . . . . . . . . . . . . . . . . . . 12
3
Peak current control with PWM and constant off-time . . . . . . . . . . . . 14
4
3.1
Slow decay and fast decay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2
Minimum on-time limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3
Microstepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
STMicroelectronics enhanced current control . . . . . . . . . . . . . . . . . . . 21
4.1
4.2
5
5.2
2/34
4.1.1
Rising and falling steps (reference current changes) . . . . . . . . . . . . . . 23
4.1.2
Auto adjusted duration of fast decay at falling steps . . . . . . . . . . . . . . . 24
Predictive current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2.1
Predictive on-time and average current regulation . . . . . . . . . . . . . . . . 26
4.2.2
Off-time regulation and target switching frequency . . . . . . . . . . . . . . . . 26
Setup and optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1
6
Peak current control with auto adjusted decay . . . . . . . . . . . . . . . . . . . . . 21
Auto adjusted decay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1.1
TON_MIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1.2
TOFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.1.3
TOFF_FAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.1.4
FAST_STEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Predictive current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
DocID023635 Rev 2
AN4158
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Phase driving sequence for a clockwise rotation of a 4-steps per round stepper
motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Phase driving sequence for a clockwise rotation of a 200-steps per round stepper
motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Driving sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Microstepping current level examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Peak current control parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Predictive current control parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Control system parameters and performance relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
DocID023635 Rev 2
3/34
34
List of figures
AN4158
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.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Figure 18.
Figure 19.
Figure 20.
Figure 21.
Figure 22.
Figure 23.
Figure 24.
Figure 25.
Figure 26.
Figure 27.
Figure 28.
4/34
Basic two-phase bipolar stepper motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Torque during a step change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Magnetic field directions in full step and half step driving modes . . . . . . . . . . . . . . . . . . . . . 8
Microstepping phase currents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
full step driving versus microstepping motor torque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Current control system for each motor phase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Motor phase electrical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Constant off-time control sequence (low-side recirculation) . . . . . . . . . . . . . . . . . . . . . . . . 14
Peak current control stability conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Back electromotive force limiting the slow decay effectiveness . . . . . . . . . . . . . . . . . . . . . 16
Constant off-time control using fast decay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Minimum on-time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Peak current control unstable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Peak current control in microstepping (slow decay only) . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Peak and average current and stator magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Minimum on-time threshold and on-time limit relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Decay selection according to on-time duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Decay strategy change due to second on-time threshold violation . . . . . . . . . . . . . . . . . . 23
Fast decay time regulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Current control at rising step (reference current increased) . . . . . . . . . . . . . . . . . . . . . . . . 24
Current control at falling step (reference current decreased) . . . . . . . . . . . . . . . . . . . . . . . 25
Predictive current control basic principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Off-time automatic adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
On-time measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
TOFF_FAST and TON_MIN parameter relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Falling step - 8 microstep example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
High FAST_STEP value example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Low FAST_STEP value example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
DocID023635 Rev 2
AN4158
1
Stepper motor basics
Stepper motor basics
A stepper motor is a particular kind of synchronous electrical motor designed to reach and
keep an angular position. Each position is obtained as a steady-state of the rotor according
to one of the four possible directions of the magnetic field generated by a pair of windings
(called phases) on the stator. The distance between the next two angular positions is called
step and the number of steps composing a full mechanical rotation is a key characteristic of
this kind of motor. A simplified representation of a stepper motor is shown in Figure 1.
Figure 1. Basic two-phase bipolar stepper motor
Rotor
1
4 N
Phase A
S
2
3
Stator phases
Phase B
AM15103v1
Forcing a current in one phase at a time, the four positions shown in Figure 1 can be
reached by the rotor. When the driving sequence listed in Table 1 is generated, the rotor
performs a complete rotation in a clockwise direction. According to the step definition, the
model in Figure 1 is a 4-step motor.
Table 1. Phase driving sequence for a clockwise rotation of a 4-steps per round
stepper motor
Phase A current Phase B current
Stator magnetic field position
Rotor position
Positive
Zero
1
1
Zero
Positive
2
2
Negative
Zero
3
3
Zero
Negative
4
4
Increasing the complexity of the stator and rotor design, the number of available positions
for each driving condition can be increased obtaining a high number of steps per round. The
driving sequence making the motor rotate is the same, but a full rotation of the magnetic
field of the stator (electrical cycle) does not correspond to a full rotation of the rotor
(mechanical rotation). Table 2 shows the driving sequence of a 200-step stepper motor.
DocID023635 Rev 2
5/34
34
Stepper motor basics
AN4158
Table 2. Phase driving sequence for a clockwise rotation of a 200-steps per round
stepper motor
Phase A current Phase B current
Stator magnetic field
position
Rotor position
Positive
Zero
1
1
Zero
Positive
2
2
Negative
Zero
3
3
Zero
Negative
4
4
Positive
Zero
1
5
Zero
Positive
2
6
…
…
…
…
Negative
Zero
3
199
Zero
Negative
4
200
The torque applied to the stator at each step change is directly proportional to the stator
magnetic field, which is proportional to the current flowing into the phase and the sine of the
displacement angle between the rotor and the target step electrical positions. This relation is
described by Equation 1.
Equation 1
T Mot I Phase  sin   Stat –  Rotor 
When a step change is applied, the magnetic field is rotated by 90° in a clockwise or
counterclockwise direction. As a consequence, the torque applied to the motor shaft
reaches its maximum value (according to the phase current) because the displacement
angle Stat –  Rotor is about 90° (see Figure 2). During the approach of the rotor to the
target position, the torque decreases until it is equal to that of the load. The displacement
angle corresponding to the load torque applied to the shaft (HOLD) determines the actual
motor position at the end of motion.
6/34
DocID023635 Rev 2
AN4158
Stepper motor basics
Figure 2. Torque during a step change
TMot
At the step change the displacement
angle is about 90° and the maximum
torque is applied
TMAX
The rotor approaches
the target step position
and stops when Tmot
is equal to TLoad
TLoad
θHOLD
θHOLD
θStat - θRotor
AM15104v1
1.1
Full step and half step
The driving sequence described in the previous section is called full step one phase on (or
wave driving) because the rotor is moved by one step at a time feeding only one of the two
phases of the motor at a time.
It is also possible to drive both the phases in order to generate a magnetic field positioned
halfway between the two phases (1a, 2a, 3a and 4a positions in Figure 3). This driving
mode is called full step two-phase on (or normal driving). In this case, at the same phase
current, the magnetic field is higher by a factor of 2 and the corresponding motor torque is
multiplied by the same factor.
DocID023635 Rev 2
7/34
34
Stepper motor basics
AN4158
Figure 3. Magnetic field directions in full step and half step driving modes
4
Phase A
3a
Rotor
1
4a
N
1a
2
S
3
2a
Stator phases
Phase B
AM15105v1
Mixing the above mentioned two full step driving modes, half step driving is obtained. In half
step driving the stator magnetic field is rotated by 45° at a time (i.e.: half of the full step
rotation) and the resulting rotor movement is half of that obtained using full step driving.
Table 3 summarizes the driving sequences for the different driving modes.
Table 3. Driving sequences
Full step 1ph on
(wave driving)
Full step 2ph on
(normal driving)
1
1
2
2
3
3
4
4
8/34
Half step
Phase A
current
Phase B
current
Stator magnetic
field position
1
Positive
Zero
1
2
Positive
Positive
1a
3
Zero
Positive
2
4
Negative
Positive
2a
5
Negative
Zero
3
6
Negative
Negative
3a
7
Zero
Negative
4
8
Positive
Negative
4a
DocID023635 Rev 2
AN4158
1.2
Stepper motor basics
Microstepping
The driving methods considered in the previous section imply a constant current flowing into
the motor phases and the magnetic field being rotated by turning on/off and reversing the
currents.
Modulating the phase currents, the available positions of the stator magnetic field, and then
the intermediate positions between the subsequent steps, can be increased without any
theoretical limit. This driving method is called microstepping and the intermediate positions
are called microsteps.
As shown in Figure 4, in order to obtain a rotating magnetic field with constant module, the
two-phase current must be sinusoidal and with a phase difference of 90° (sine and cosine).
Figure 4. Microstepping phase currents
Ipeak
IPhA
N
S
IPhB
IPhA = I peak x sin(α)
IPhB= I peak x cos(α)
AM15106v1
The currents applied to the motor phases are not actually continuous sinewaves, but
a sequence of samples of sinewaves generated using the formula of Equation 2, where
Nmicrostep is the microstepping resolution (defined by the number of samples composing
a sinewave quarter which is equivalent to a full step) and n is the incremental number
generating the sequence (some examples are shown in Table 8 on page 33). Different
microsteppings are identified according to their resolution (1/4 step, 1/8 step, etc.).
DocID023635 Rev 2
9/34
34
Stepper motor basics
AN4158
Equation 2

I PhA = I Peak  sin  -----------------------------------  n
 2  N microstep 

I PhB = I Peak  cos  -----------------------------------  n
 2  N microstep 
Table 4. Microstepping current level examples
1/2 step
0
(1)
1/4 step
1/8 step
Phase A current
Phase B current
0
0
0
+100% IPeak
1
+20% IPeak
+98% IPeak
2
+38% IPeak
+92% IPeak
3
+56% IPeak
+83% IPeak
4
+71% IPeak
+71% IPeak
5
+83% IPeak
+56% IPeak
6
+92% IPeak
+38% IPeak
7
+98% IPeak
+20% IPeak
8
+100% IPeak
0
9
+98% IPeak
-20% IPeak
10
+92% IPeak
-38% IPeak
11
+83% IPeak
-56% IPeak
12
+71% IPeak
-71% IPeak
13
+56% IPeak
-83% IPeak
14
+38% IPeak
-92% IPeak
15
+20% IPeak
-98% IPeak
16
0
-100% IPeak
17
-20% IPeak
-98% IPeak
18
-38% IPeak
-92% IPeak
19
-56% IPeak
-83% IPeak
20
-71% IPeak
-71% IPeak
21
-83% IPeak
-56% IPeak
22
-92% IPeak
-38% IPeak
23
-98% IPeak
-20% IPeak
24
-100% IPeak
0
25
-98% IPeak
+20% IPeak
26
-92% IPeak
+38% IPeak
27
-83% IPeak
+56% IPeak
28
-71% IPeak
+71% IPeak
1
1
2
3
2
4
5
3
6
7
4
8
9
5
10
11
6
12
13
7
10/34
14
DocID023635 Rev 2
AN4158
Stepper motor basics
Table 4. Microstepping current level examples (continued)
1/2 step(1)
1/4 step
15
1/8 step
Phase A current
Phase B current
29
-56% IPeak
+83% IPeak
30
-38% IPeak
+92% IPeak
31
-20% IPeak
+98% IPeak
1. Compensated half step.
The microstepping driving technique results in less vibration and higher positioning
resolution. The magnetic field rotation corresponding to a full step is split into a sequence of
smaller rotations in the same number of the microstepping resolution. Each of these small
displacements causes a lower torque variation than a full step change (see Figure 5), so the
torque ripple is lower than in full step driving (smoother motion).
When this driving technique is used, the maximum output torque of the motor is lower than
the one obtained using the full step because the intensity of the stator magnetic field is lower
than a 2 factor.
Figure 5. full step driving versus microstepping motor torque
T
Tmax
Full-step
θStat
T
Tmax
Microstepping
θStat
AM15107v1
DocID023635 Rev 2
11/34
34
Phase current control in stepper motor driving
2
AN4158
Phase current control in stepper motor driving
In order to impose a constant current in the stepper motor phases, a current control
algorithm must be implemented.
The most common control system is shown in Figure 6 and is composed of:

A power H-bridge used to drive the phase

A current sensor (usually a shunt resistor)

A controller driving the power bridge

The motor phase electrical model.
This system is applied to both phases.
Figure 6. Current control system for each motor phase
VBUS
Motor phase equivalent circuit
VBEMF
Controller
L Ph
RPh
RSHUNT
AM15108v1
The motor phase electrical model is shown in Figure 7 and is made up of:
12/34

The equivalent phase resistance RPh

The equivalent phase inductance LPh

The back electromotive force generator VBEMF.
DocID023635 Rev 2
AN4158
Phase current control in stepper motor driving
Figure 7. Motor phase electrical model
Motor phase equivalent circuit
VBEMF
LPh
RPh
AM15109v1
The back electromotive force (BEMF) is the voltage generated by the rotating magnetic field
of the rotor as an effect of Faraday’s law of induction. Its effect can be modeled as
a sinewave voltage generator with frequency equal to a quarter of the motor full step rate
and amplitude proportional to the rotation speed (see Equation 3).
Equation 3
A V BEMF = K e  f BEMF
B
f step
f BEMF = ----------4
The BEMF effect on the current control system is to counter the voltage applied by the
power stage limiting the phase current (especially at high speed). In general, as explained in
the following paragraphs, the BEMF voltage may make it more difficult to regulate the
desired current.
The algorithm implemented by the controller determinates the performance of the
application, in particular when microstepping driving is used.
DocID023635 Rev 2
13/34
34
Peak current control with PWM and constant off-time
3
AN4158
Peak current control with PWM and constant off-time
The peak current control with PWM and constant off-time is one of the most common
algorithms implemented by stepper motor controllers.
The phase current is measured through a shunt resistor and the resulting voltage (see
Equation 4 A) is sent to a comparator input. The other input is a reference voltage setting
the peak current forced into the motor phase (Equation 4 B).
Equation 4
A
V Sense = I Ph  R SHUNT
B
V Ref = I Peak  R SHUNT
At the beginning of driving, the motor phase currents are zero and the controller turns on
one of the diagonals of the power bridge according to the expected current direction. The
phase current is increased until the target reference voltage is reached, then the controller
switches off the forcing side of the bridge making the phase current recirculate in the bottom
side of the power stage. The same effect may be obtained recirculating the current on the
top side; in this case the forcing side of the bridge is kept on and the opposite side is turned
on.
Figure 8. Constant off-time control sequence (low-side recirculation)
VBUS
VBUS
VBUS
IPh
IPh
IPh
VSense
RSHUNT
VSense
R SHUNT
VSense
RSHUNT
I Peak
VRef
AM15110v1
t OFF
14/34
DocID023635 Rev 2
AN4158
Peak current control with PWM and constant off-time
During the recirculation, the current decreases according to the discharge of the equivalent
RL series circuit.
After a fixed tOFF time, the forcing bridge is switched on (or it is kept on) and the opposite
bridge is switched off (or it is kept off) according to the recirculation mode and the phase
current returns to increase.
The stability of the peak current control algorithm with constant off-time is based on
Equation 5.
Equation 5
I PhOFF = I PhON
In every control cycle (on-time + off-time) the total current variation should be zero; in
particular, the current drop of the off-time (IphOFF) should be equal to the current increase
obtained during the on-time (IphON), as shown in Figure 9.
Figure 9. Peak current control stability conditions
Δ IPhOFF = ΔIPhON
ΔIPhOFF = ΔIPhON
ΔIPhOFF = Δ IPhON
IPeak
t OFF
3.1
t OFF
t OFF
AM15111v1
Slow decay and fast decay
The recirculation of the phase current in low-side or high-side switches of the power bridge
is called slow decay. The name highlights the fact that the current is reduced only using the
RL discharge. The effectiveness of this approach is strongly reduced when the BEMF
contribution becomes significant.
As shown in Equation 6, the BEMF voltage changes the current drop during the slow decay
and in some cases may make it negative (i.e.: the current increases instead of decreasing)
causing a current control fail, see Figure 10).
Equation 6
I Ph   R Ph  I Ph + V BEMF   L Ph  t OFF
DocID023635 Rev 2
15/34
34
Peak current control with PWM and constant off-time
AN4158
Figure 10. Back electromotive force limiting the slow decay effectiveness
Motor phase equivalent circuit
IPh
LPh
VBEMF
RPh
VBEMF >> IPh x RPh
V BEMF < 0
AM15112v1
When the slow decay is not able to decrease the phase current, the fast decay method can
be used. The fast decay forces the current reduction applying the supply voltage in reverse
direction. This way the current is actively reduced using the same voltage used to force it
into the phase during the on-time.
In this case the current drop and then the ripple are greater than with slow decay, but the
peak current is kept under control (see Equation 7).
Equation 7
I Ph   R Ph  I Ph + V BUS   L Ph  t OFF
16/34
DocID023635 Rev 2
AN4158
Peak current control with PWM and constant off-time
Figure 11. Constant off-time control using fast decay
VBUS
VBUS
VBUS
IPh
IPh
VSense
VSense
RSHUNT
RSHUNT
IPh
VSense
RSHUNT
IPeak
VRef
t OFF
AM15113v1
Both decay methods have pros and cons: the slow decay allows a lower current ripple to be
obtained, but at low current values or at high speed (significant BEMF value) the current
control may fail. The fast decay, on the other hand, keeps the current under control at the
cost of a higher ripple.
3.2
Minimum on-time limit
The control system, according to its structure, is usually not able to check the phase current
immediately after the beginning of the on-phase (usually a blanking time is adopted to avoid
spurious triggering of the current comparator), as shown in Figure 12. This limits the
minimum on-time the power bridge must remain in the on-phase. The minimum current
increase related to the tcomm can be estimated through Equation 8 (back electromotive force
has not been taken into account for simplicity).
DocID023635 Rev 2
17/34
34
Peak current control with PWM and constant off-time
AN4158
Figure 12. Minimum on-time
VPh
IPhON,Min
IPh
Reference current
Isense
tcomm
AM15114v1
Equation 8
I Ph  V BUS  L Ph  t comm
When the current drop IphOFF becomes lower than IphON,Min, the stability equation can no
longer be satisfied and the current control fails. The current starts to increase until stability is
restored (it is possible because IphOFF increases with the current) and the actual peak
current is different than the target one. The minimum on-time limit is usually reached at low
target currents, motor windings with a high LPh/RPh ratio, and when slow decay is used
during the off-time.
Figure 13. Peak current control unstable
ΔIPhOFF = Δ IPhONMin
IPeak
ITarget
tOFF
18/34
tcomm
tOFF
tcomm
tOFF
tcomm
DocID023635 Rev 2
tOFF
tcomm
tOFF
tcomm
tOFF
AM15115v1
AN4158
3.3
Peak current control with PWM and constant off-time
Microstepping
As described in Section 1.2 on page 9, by driving the stepper motor phases with sinusoidal
currents the step resolution and the motion smoothness can be improved (microstepping).
In order to obtain a microstepping operation using the peak current control with fixed offtime, the reference voltage (VRef) of each phase must be varied in order to obtain the
respective microstep current pairs in the proper sequence (see Equation 2 on page 10 and
Table 4 on page 10).
During the positive slope of the sinewave, the reference current value is increased at each
microstep change and the control algorithm reaches the new target value in a single control
cycle, as shown in Figure 14. During the negative slope of the sinewave, the current
reference is progressively reduced down to the zero and the control algorithm may fail to
properly follow the variations (Figure 14).
Figure 14. Peak current control in microstepping (slow decay only)
Poor performance in correspondance
with the zero crossing of the current sinewave
AM15116v1
The key point is that, except for particular implementations, the phase current can be
sensed during the on-time only. As a consequence, the reference increase can be easily
managed extending the on-time until the new threshold is reached, but the decrease must
be performed as a sequence of off-time which slowly decreases the phase current until the
attainment of the threshold.
This issue is particularly critical when the slow decay is used because of the limited current
decay during the off-time. On the other hand, when the fast decay is used, the large current
drop may limit the microstepping effectiveness causing a current ripple bigger than the
minimum microstep-to-microstep variation.
Another limitation of the microstepping implementation through the peak current control
algorithm is the impossibility of effectively controlling the average phase current. Whereas
the actual average position of the stator magnetic field is related to the average phase
current values (see Figure 15), the peak current control introduces an error in its positioning
and then in microstepping implementation.
DocID023635 Rev 2
19/34
34
Peak current control with PWM and constant off-time
AN4158
Figure 15. Peak and average current and stator magnetic field
Target average position
IPh
IPeak
IAvg
t
Actual average position
20/34
DocID023635 Rev 2
AM15117v1
AN4158
4
STMicroelectronics enhanced current control
STMicroelectronics enhanced current control
The new L6472 and L6474 devices implement a new advanced current control algorithm
that increases the system performance in both full step and microstepping driving.
As discussed in previous paragraphs, the decay mode of a peak current control algorithm is
a critical choice concerning performance and stability of the system.
In particular, the control system must choose between slow and fast decay considering the
following trade-off:

Slow decay allows lower current ripples (more accurate average current, lower power
dissipation, lower noise), but it may fail to reduce the current bringing the system into
a minimum on-time limit condition (see Section 3.2 on page 17).

Fast decay increases the robustness to the minimum on-time limit, but it implies
a higher current ripple (higher average current error, higher power dissipation).
The best solution is a compromise between the two methods, where the fast decay is used
only when needed and for the shortest time possible. The auto adjusted decay system
addresses this balance.
4.1
Peak current control with auto adjusted decay
The new current control algorithm is based on the parameters listed in Table 5.
Table 5. Peak current control parameters
Symbol
Name
tOFF
Off-time
tON_MIN
Description
It sets the current decay duration of the control cycle (fixed
off-time current control).
It defines which is the shortest on-time (i.e. the time to reach
reference current) which guarantees a correct operation of
Target minimum on-time the control algorithm (Figure 16). This parameter should be
set to a value higher than the intrinsic minimum on-time of the
system.
tOFF_FAST
Maximum fast decay
time
tFAST_STEP
Maximum step fall time
It is the maximum duration of a fast decay during operation of
the current control system.
It is the maximum duration of a fast decay during reference
current changing.
The first three parameters are used when the system keeps the phase current constant; the
fourth parameter is used when the reference current is decreased only (see Section 4.1.2).
DocID023635 Rev 2
21/34
34
STMicroelectronics enhanced current control
AN4158
Figure 16. Minimum on-time threshold and on-time limit relation
Reference current
ton
t
ton,min
Target minimum on-time
limit
tcomm on-time
of the control system
AM15118v1
At every control cycle the on-time is measured and it is compared to the programmable
threshold tON_MIN. If the measured on-time is longer than the programmed threshold the
current is well controlled and no fast decay is needed, so slow decay is used (Figure 17).
As the slow decay reduces its effectiveness, the on-time is reduced until the programmed
tON_MIN is reached. When tON is shorter than tON_MIN, a fast decay is used in order to
increase the current drop (Figure 17) and to avoid the failure of the current control algorithm
due to the minimum on-time limit (see Section 3.2 on page 17). In the first occurrence of this
event the fast decay duration is 1/8th of the maximum programmed value (tOFF_FAST).
If the next on-time is longer than the tON_MIN threshold, the control system returns using the
slow decay, as shown in Figure 17.
Figure 17. Decay selection according to on-time duration
tON_MIN
tON_MIN
tON_MIN
Reference current
t on
On-time is overthe
target minimum value
A slow decay is used
t on
t fast
t OFF
t on
t on > tON_MIN
t on > tON_MIN
On-time is over the
target minimum value
A slow decay is used
On-time is below the
target minimum value
A fast decay is used
t on < tON_MIN
AM15119v1
When two or more minimum on-time violations occur at the same reference current value
(i.e. the electrical position of the motor is not changed), the control system changes the
decay strategy using slow decay followed by a fast decay (Figure 18). The total duration of
the decay phase is equal to the programmed off-time (tOFF) and the fast part is equal to the
last tFAST used.
22/34
DocID023635 Rev 2
AN4158
STMicroelectronics enhanced current control
Figure 18. Decay strategy change due to second on-time threshold violation
t ON_MIN
t ON_MIN
t ON_MIN
t ON_MIN
Reference current
System returns to normal
operation (slow decay)
t on
t fast
t on
ton > tON_MIN
t on
t fast
ton < t ON_MIN
t fast
t on
t OFF
Second minimum
on-time violation.
Fast decay is used.
First minimum on-time violation.
Fast decay is used.
The second violation causes the control system
to change the decay strategy.
A slow decay followed by a fast decay are used
from now, until the change of the reference current.
t on > tON_MIN
t on < tON_MIN
AM15120v1
The tFAST value is regulated according to the following rules:

At the first occurrence of the minimum on-time violation, the fast decay duration is set
to tOFF_FAST /8.

If a further minimum on-time violation occurs, a new fast decay is used with double the
length of the previous one (tFAST = 2 x tFAST).

The maximum tFAST value is set by the tOFF_FAST parameter.
At the next minimum on-time violation the sequence starts from the last tFAST value used
(except if a current reference change occurred, see Section 4.1.1).
The tFAST value obtained using this sequence is used by the control system during the
decay phase when the slow and fast decay combination is used. Figure 19 shows an
example of the system operation.
Figure 19. Fast decay time regulation
t ON_MIN t ON_MIN
t ON_MIN
Reference current
t on
t on < t ON_MIN
t fast t on
1st fast decay
t fast = 1/8 x t OFF_FAST
t fast
t
2nd fast decay
t fast = 1/4 x t OFF_FAST
t on < tON_MIN
4.1.1
t on
t fast
slow + fast decay strategy
with t fast = 1/4 x tOFF_FAST
t on > tON_MIN
AM15121v1
Rising and falling steps (reference current changes)
In microstepping operation the current reference changes according to the point of the
current sinewave which must be obtained.
When the reference value is changed, there are two cases:
1.
The reference current is increased. This event is called “rising step”.
2.
The reference current is reduced. This event is called “falling step”.
These events are managed by the L6472 and L6474 current control, as follows.
In the case of rising step the phase is immediately turned on regardless of the control cycle
conditions and the system switches to slow decay strategy. If the tFAST value has been
increased during the previous microstep (see Section 4.1), it is halved (tFAST = tFAST / 2).
DocID023635 Rev 2
23/34
34
STMicroelectronics enhanced current control
AN4158
Figure 20 shows the system behavior in the case of a rising step.
Figure 20. Current control at rising step (reference current increased)
t ON_MIN
Reference current
Rising step
t fast
t OFF
The rising step causes the system
to switch to slow decay only strategy.
The t fast value is halved.
t on < tON_MIN
(lower limit is tOFF_FAST /8)
t fast
t OFF
At first minimum on-time violation
the fast decay duration is half of
the one used during the control of
the previous current reference level.
AM15122v1
In the case of falling step a sequence of fast decays is immediately used regardless of the
control cycle conditions. The decay strategy and the respective tFAST value are unchanged.
The system behavior in the case of a falling step is described in detail in Section 4.1.2.
When the reference current is set to zero (zero crossing of the current sinewave) or when
the motor is stopped, the control system is reset to the default: slow decay only and tFAST
equal to 1/8th of tOFF_FAST.
4.1.2
Auto adjusted duration of fast decay at falling steps
When the reference current is reduced by a microstep change (falling step), the control
system immediately uses a fast decay in order to reach the new target value as soon as
possible. The fast decay duration is adjusted using an algorithm similar to the one used
during normal operation (see Section 4.1).
At first occurrence of this event, the fast decay length is set to a quarter of the programmed
maximum step fall time (tFAST_STEP). At the end of the decay, the phase is turned on and the
on-time is measured; if its duration is below the programmed minimum threshold (tON_MIN)
a further fast decay is performed with double the length of the previous. The maximum fast
decay duration is imposed by the tFAST_STEP parameter.
The fast decay sequence continues until the on-time exceeds the programmed minimum
limit (see Figure 21).
At the next falling step occurrence the last fast decay value is used. When the reference
current is set to zero (zero crossing of the current sinewave) or the motor is stopped, the
fast decay time is reset to the starting value of tFAST_STEP /4.
Note:
24/34
The fast decay time used during falling step sequence is totally independent from the one
used during the current control.
DocID023635 Rev 2
AN4158
STMicroelectronics enhanced current control
Figure 21. Current control at falling step (reference current decreased)
Falling step
t fast
t OFF
Causes the falling step
a fast decay of
tfast,fall = t FAST_STEP /4
is used.
t ON_MIN
t fast,fall
t ON_MIN
t on
Reference current
t fast,fall
t on
t on < tON_MIN
On-time is below the target
minimum value.
A further fast decay is used
with duration of t fast,fall = 2 x t fast,fall
The maximum value is t FAST_STEP
t on > t ON_MIN
4.2
t fast
t OFF
On-time is over the target
minimum value.
System returns to normal operation
using the previous decay stategy
(slow only or slow + fast).
AM15123v1
Predictive current control(a)
The peak current control with fixed off-time has two cons:

The average current value is not controlled, so the actual rotor position is affected by
some errors (see Section 3.3 on page 19).

The PWM frequency is not fixed but it is determined by the on-time which varies
according to several conditions (current value, BEMF, etc.).
The new predictive current control provided by the L6472, which is based on the peak
current control described in Section 4.1 on page 21, allows these limits to be reduced and
removed in some cases.
The control system operation can be configured through the parameters listed in Table 6.
Table 6. Predictive current control parameters
Symbol
Name
tSW
Target switching time
tON_MIN
Description
It sets the target PWM frequency of the control system.
It defines which is the shortest on-time (i.e.: the time to reach
Target minimum on-time reference current) which guarantees a correct operation of
the control algorithm (Figure 16).
tOFF_MIN
Minimum off-time
It defines which is the shortest off-time (i.e.: the current decay
duration) which guarantees a correct operation of the control
algorithm.
tOFF_FAST
Maximum fast decay
time
It is the maximum duration of a fast decay during operation of
the current control system.
tFAST_STEP
Maximum step fall time
It is the maximum duration of a fast decay during reference
current changing.
The tON_MIN, tOFF_FAST and tFAST_STEP parameters act as described in Section 4.1, but tOFF
listed in Table 5 on page 21 is replaced by the tSW and tOFF_MIN combination as described in
Section 4.2.2.
a. Not available for the L6474.
DocID023635 Rev 2
25/34
34
STMicroelectronics enhanced current control
4.2.1
AN4158
Predictive on-time and average current regulation
The classic peak current control limits the maximum current value (peak) but cannot control
the value of the average current.
The predictive current control adds an extra on-time (tpred) after reaching the reference
current which is the two-step average of the last on-time values, as described in Equation 9
(see Figure 22).
Equation 9
t on  n  + t on  n – 1 
t pred  n  = ----------------------------------------------2
Figure 22. Predictive current control basic principle
Average current
Reference current
I
I
t pred(1)
Average current
t on(2)
t on(1)
First system turns on
t pred(0) and t on(0) are zero.
t pred(1) =
t on(1) + ton(0)
t pred(2) =
t pred(2)
t on(n) t pred(n)
t
t on(2) + ton(1)
2
2
t pred(n) =
t on(n) + ton(n-1)
= ton(n)
2
AM15124v1
When the system reaches the stability, ton and tpred are equal and the resulting average
current value is equal to the reference threshold.
In order to avoid instability, all those conditions causing the on-time to be excessively long or
short must be carefully managed. The following cases should be considered:

The motor has been stopped

The bridges have just been enabled (exit from high impedance status)

The current threshold has been changed (both falling and rising steps)

The on-time is below the minimum on-time limit (tON_MIN)

The on-time is over the target switching time (tSW).
In these cases the measured on-time is excluded from the average calculation and the
previous tpred is used. If the next on-time does not fall under the cases listed above, its value
is used in the tpred calculation.
4.2.2
Off-time regulation and target switching frequency
In the control system described in Section 4.1 on page 21, the decay phase of the current
(namely, off-time) is constant and it is set through the tOFF parameter. Because of this, the
PWM frequency of the control system may vary significantly depending on situations
(current value, BEMF, etc.).
The predictive current control automatically adjusts the off-time duration in order to obtain
a PWM frequency near to the target value. This function is configured through the tSW and
tOFF_MIN parameters.
At every current reference change the off-time of the control system is recalculated
according to Equation 10, where tpred(n-1) is the last predictive on-time used. If the new
value is lower than the tOFF_MIN parameter, tOFF_MIN is used instead.
26/34
DocID023635 Rev 2
AN4158
STMicroelectronics enhanced current control
Equation 10
t off = t sw – 2  t pred  n – 1 
Figure 23. Off-time automatic adjustment
New steady-state
t on(B) = t PRED(B) tPRED(A)
I
Reference current
I
t on(B)
Steady-state
t on(A) = t PRED(A)
t pred(A)
t
t pred(B)
t
t switch(B)
t switch(B) is almost equal to target switching time tSW
Current reference changed
t
= t SW - 2 x tPRED(A)
t on(A)t pred(A)
t
t on(A)t pred(A)
AM15125v1
Considering that the on-time and the predictive time at the steady-state of two subsequent
current levels is almost the same (see Figure 23), the resulting switching time tswitch is
almost equal to the target tSW value.
DocID023635 Rev 2
27/34
34
Setup and optimization
5
AN4158
Setup and optimization
In the following sections the optimization of the parameters of the control system is
investigated.
5.1
Auto adjusted decay
The parameters used in the peak current control with auto adjusted decay and their relation
with system performance are listed in Table 7.
Table 7. Control system parameters and performance relation
Parameter
Lower values
Higher values
TON_MIN
Less frequent use of the fast
decay
Lower ripple
Higher probability of control fail
More frequent use of the fast
decay
Higher ripple
Higher control stability
TOFF(1)
Higher switching frequency
Lower ripple
Higher probability of control fail
More frequent use of the fast
decay
Lower switching frequency
Higher ripple
Higher control stability
Less frequent use of the fast
decay
TOFF_FAST
Lower ripple
Longer on-fast sequences
Higher probability of control fail
Higher ripple
Shorter on-fast sequences
Higher control stability
FAST_STEP
Longer on-fast sequences
during falling steps (more
commutation)
Shorter on-fast sequences
during falling steps (less
commutations)
Deeper current undershoot at
falling steps
1. The same considerations are valid for TSW when predictive current control is used.
The optimal setup depends on several factors such as supply voltage, load current, motor
characteristics and microstepping resolution.
5.1.1
TON_MIN
The minimum on-time value determinates the frequency of use of fast decay during current
control and limits the minimum duty cycle value of the control.
The on-time measurement starts as soon as a turn-on is requested by the power bridges of
the device, as shown in Figure 24. TON_MIN should always be longer than the
commutation time of the power bridge, otherwise the minimum on-time condition is always
satisfied and the fast decay is never used (the auto adjusted decay feature is actually
disabled). This condition causes the current control to fail when the slow decay reduces its
effectiveness (see Section 3.1 on page 15 and Section 3.2 on page 17).
28/34
DocID023635 Rev 2
AN4158
Setup and optimization
Figure 24. On-time measurement
Even if the reference current is reached
the system cannot detect this condition
until the end of commutation
Reference current reached
Power bridge
driving signal
VBUS
VBUS
VBUS
VBUS
OFF
OFF
ON
ON
ON
OFF
OFF
OFF
Low side
turn-
Dead time
High side
turn-on time
Blanking time
Current sensing disabled
Current sensing
enabled
Commutation time
t on
AM15126v1
In order to obtain the lowest current ripple possible, the TON_MIN value should be slightly
longer than the commutation time. Using longer TON_MIN increases the current ripple but
forces a higher minimum duty cycle value increasing the robustness of the control system.
5.1.2
TOFF
The off-time of the control system sets the maximum PWM frequency of the control system
fSW,max (minimum on-time violation events excluded), as described in Equation 11.
Equation 11
f SW,max = 1/  t ON_MIN + t OFF 
In general, motors having a lower LPh/RPh ratio (weak inductive motor) require higher
control frequencies and then lower TOFF values. On the contrary, higher TOFF values and
then lower control frequencies may be needed when the LPh/RPh ratio is higher (strong
inductive motor).
5.1.3
TOFF_FAST
The maximum fast decay duration should be set taking into account that its value is directly
proportional to the ripple of the current control algorithm.
High current ripple increases the noise, causes higher power dissipation and reduces the
positioning precision in microstepping operation. In general, the current ripple should be as
low as possible.
The minimum fast decay, which is one-eighth of TOFF_FAST, must be longer than
TON_MIN to avoid subsequent minimum on-time violations (see Figure 25).
DocID023635 Rev 2
29/34
34
Setup and optimization
AN4158
Figure 25. TOFF_FAST and TON_MIN parameter relations
t ON_MIN
t ON_MIN
t ON_MIN
Reference current
tOFF_FAST /8
ton
tOFF_FAST /4
The fast decay time and the following
on-time are almost equal.
if t OFF_FAST /8 < t ON_MIN than t on< tON_MIN
ton
The minimum fast decay time (t OFF_FAST /8)
never satisfies the tON_MIN limit.
A second fast decay is always necessary.
t ON_MIN
t ON_MIN
Reference current
if t OFF_FAST /8 > tON_MIN than ton > tON_MIN
5.1.4
The minimum fast decay time (t OFF_FAST /8)
could satisfy the t ON_MIN limit.
AM15127v1
FAST_STEP
The FAST_STEP parameter defines the fast decay duration used at current reference
changes; the shorter fast decay value (FAST_STEP/4) is used in the first falling steps, then
the algorithm increases the fast time up to the longer value (FAST_STEP) which is used in
the final part of the sinewave (see Figure 26 and Section 4.1.2 on page 24).
30/34
DocID023635 Rev 2
AN4158
Setup and optimization
Figure 26. Falling step - 8 microstep example
100 %
At the beginning of the negative slope of
. is required
the sinewave a shorter fast decay
At the end of the negative slope of
the sinewave a longer fast decay is required.
In the last falling step the system forces
a zero current disabling the power bridge.
The falling step algorithm is not used
0%
AM15130v1
In parameter dimensioning the microstepping resolution of the system should be
considered; the higher the resolution, the shorter the fast step time. In fact, the drop
between subsequent microsteps decreases with the resolution.
Long FAST_STEP timings may cause deep undershoots in the first part of the negative
slope of the sinewave, but give better performance in the final part where the drop between
the microsteps is higher (see Figure 27).
Short FAST_STEP timings fit better to the drops of the first falling steps, but require a longer
fast decay sequence in the final part of the negative slope of the sinewave, causing more
commutations (see Figure 28).
The optimal trade-off between the starting and the final part of the negative slope requires
a fine tuning.
In any case, the minimum fast decay (one-fourth of FAST_STEP) must be longer than
TON_MIN to avoid subsequent minimum on-time violations.
DocID023635 Rev 2
31/34
34
Setup and optimization
AN4158
Figure 27. High FAST_STEP value example
t FAST_STEP / 4
Current reference
100 %
Deep current undershoot
in the first microsteps
Current reference
t FAST_STEP
0%
AM15128v1
Figure 28. Low FAST_STEP value example
tFAST_STEP / 4
Current reference
100 %
tFAST_STEP
Current reference
Long fast decay sequence is
required to reach target current
0%
AM15129v1
5.2
Predictive current control
When the predictive current control is used, two more parameters need to be set: the target
switching time TSW and the minimum off-time TOFF_MIN.
The TSW parameter is equivalent to the TOFF parameter described in Section 5.1.2 and it
should be set according to the same considerations.
The TOFF_MIN limits the variation of the off-time imposing its minimum value. It is
equivalent to the TOFF parameter described in Section 5.1.2 and it should be set according
to the following golden rules:
32/34

TOFF_MIN < TSW

TOFF_MIN > TOFF_FAST

TOFF_MIN + 2 x TON_MIN > 1/fSW,max, where fSW,max is the maximum allowed
switching frequency of the system.
DocID023635 Rev 2
AN4158
6
Revision history
Revision history
Table 8. Document revision history
Date
Revision
20-Sep-2012
1
Initial release.
2
Replaced “dSPIN” by “L6472” and “easySPIN” by “L6474”
throughout document.
Removed notes in Section : Introduction on page 1.
Replaced “dSPIN family of motor drivers” by “L6472” and note a.: “Not available for the easySPIN family of stepper motor drivers.” by
“Not available for the L6474” in Section 4.2 on page 25.
Updated cross-references throughout whole document.
Minor modifications throughout document.
07-Apr-2015
Changes
DocID023635 Rev 2
33/34
34
AN4158
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2015 STMicroelectronics – All rights reserved
34/34
DocID023635 Rev 2