TMC5031 DATASHEET (Rev. 1.11 / 2016-APR-28)
51
10.1 Tuning the stallGuard2 Threshold SGT
The stallGuard2 value SG 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.
2. Apply slowly increasing mechanical load to the motor. If the motor stalls before SG reaches zero,
decrease SGT. If SG 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. Now enable sg_stop and 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 the RAMP_STAT register (read and clear function).
4. The optimum setting is reached when SG is between 0 and roughly 100 at increasing load shortly
before the motor stalls, and SG 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
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 starts rising. With a high
SGT, SG will rise up to the maximum value. Reduce again to the highest value, where SG stays at
0. Now the SGT value is set as sensibly as possible. When you see SG 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 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. Monitor VACTUAL to exceed the lower
velocity threshold where stallGuard delivers a good result and enable sg_stop during this time only.
The system clock frequency affects SG. An external crystal-stabilized clock should be used for
applications that demand the highest performance. The power supply voltage also affects SG, so
tighter regulation results in more accurate values. SG 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 13.
For detail procedure see Application Note AN002 - Parameterization of stallGuard2 & coolStep
www.trinamic.com