TMC5160 DATASHEET (Rev. 1.08 / 2018-NOV-19)
87
13.1 Tuning stallGuard2 Threshold SGT
The stallGuard2 value SG_RESULT is affected by motor-specific characteristics and application-specific
demands on load and velocity. Therefore the easiest way to tune the stallGuard2 threshold SGT for a
specific motor type and operating conditions is interactive tuning in the actual application.
INITIAL PROCEDURE FOR TUNING STALLGUARD SGT
1. Operate the motor at the normal operation velocity for your application and monitor SG_RESULT.
2. Apply slowly increasing mechanical load to the motor. If the motor stalls before SG_RESULT
reaches zero, decrease SGT. If SG_RESULT reaches zero before the motor stalls, increase SGT. A
good SGT starting value is zero. SGT is signed, so it can have negative or positive values.
3. Set TCOOLTHRS to a value above TSTEP and enable sg_stop to enable the stop on stall feature.
Make sure, that the motor is safely stopped whenever it is stalled. Increase SGT if the motor
becomes stopped before a stall occurs. Restart the motor by disabling sg_stop or by reading and
writing back the RAMP_STAT register (write+clear function).
4. The optimum setting is reached when SG_RESULT is between 0 and roughly 100 at increasing load
shortly before the motor stalls, and SG_RESULT increases by 100 or more without load. SGT in
most cases can be tuned for a certain motion velocity or a velocity range. Make sure, that the
setting works reliable in a certain range (e.g. 80% to 120% of desired velocity) and also under
extreme motor conditions (lowest and highest applicable temperature).
OPTIONAL PROCEDURE ALLOWING AUTOMATIC TUNING OF SGT
The basic idea behind the SGT setting is a factor, which compensates the stallGuard measurement for
resistive losses inside the motor. At standstill and very low velocities, resistive losses are the main
factor for the balance of energy in the motor, because mechanical power is zero or near to zero. This
way, SGT can be set to an optimum at near zero velocity. This algorithm is especially useful for tuning
SGT within the application to give the best result independent of environment conditions, motor
stray, etc.
1. Operate the motor at low velocity < 10 RPM (i.e. a few to a few fullsteps per second) and target
operation current and supply voltage. In this velocity range, there is not much dependence of
SG_RESULT on the motor load, because the motor does not generate significant back EMF.
Therefore, mechanical load will not make a big difference on the result.
2. Switch on sfilt. Now increase SGT starting from 0 to a value, where SG_RESULT starts rising. With
a high SGT, SG_RESULT will rise up to the maximum value. Reduce again to the highest value,
where SG_RESULT stays at 0. Now the SGT value is set as sensibly as possible. When you see
SG_RESULT increasing at higher velocities, there will be useful stall detection.
The upper velocity for the stall detection with this setting is determined by the velocity, where the
motor back EMF approaches the supply voltage and the motor current starts dropping when further
increasing velocity.
SG_RESULT goes to zero when the motor stalls and the ramp generator can be programmed to stop
the motor upon a stall event by enabling sg_stop in SW_MODE. Set TCOOLTHRS to match the lower
velocity threshold where stallGuard delivers a good result in order to use sg_stop.
The power supply voltage also affects SG_RESULT, so tighter voltage regulation results in more
accurate values. stallGuard measurement has a high resolution, and there are a few ways to enhance
its accuracy, as described in the following sections.
Quick Start
For a quick start, see the Quick Configuration Guide in chapter 22.
For detail procedure see Application Note AN002 - Parameterization of stallGuard2 & coolStep
www.trinamic.com