Datasheet
TMC2209 DATASHEET (Rev. 1.03 / 2019-JUN-26) 56
www.trinamic.com
11.2 Tuning StallGuard4
The StallGuard4 value SG_RESULT is affected by motor-specific characteristics and application-specific
demands on load, coil current, and velocity. Therefore, the easiest way to tune the StallGuard4
threshold SGTHRS for a specific motor type and operating conditions is interactive tuning in the actual
application.
INITIAL PROCEDURE FOR TUNING STALLGUARD SGTHRS
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. Check the lowest value of SG_RESULT
before the motor stalls. Use this value as starting value for SGTHRS (apply half of the value).
3. Now monitor the StallGuard output signal via DIAG output (configure properly, also set
TCOOLTHRS to match the lower velocity limit for operation) and stop the motor when a pulse is
seen on the respective output. Make sure, that the motor is safely stopped whenever it is stalled.
Increase SGTHRS if the motor becomes stopped before a stall occurs.
4. The optimum setting is reached when a stall is safely detected and leads to a pulse at DIAG in
the moment where the stall occurs. SGTHRS 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).
DIAG is pulsed by StallGuard, when SG_RESULT falls below SGTHRS. It is only enabled in StealthChop
mode, and when TCOOLTHRS ≥ TSTEP > TPWMTHRS
The external motion controller should react to a single pulse by stopping the motor if desired. Set
TCOOLTHRS to match the lower velocity threshold where StallGuard delivers a good result.
SG_RESULT measurement has a high resolution, and there are a few ways to enhance its accuracy, as
described in the following sections.
11.3 StallGuard4 Update Rate
The StallGuard4 measurement value SG_RESULT is updated with each full step of the motor. This is
enough to safely detect a stall, because a stall always means the loss of four full steps.
11.4 Detecting a Motor Stall
To safely detect a motor stall, the stall threshold must be determined using a specific SGTHRS setting
and a specific motor velocity or velocity range. Further, the motor current setting has a certain
influence and should not be modified, once optimum values are determined. Therefore, the maximum
load needs to be determined the motor can drive without stalling. At the same time, monitor
SG_RESULT at this load. The stall threshold should be a value safely within the operating limits, to
allow for parameter stray. More refined evaluation may also react to a change of SG_RESULT rather
than comparing to a fixed threshold. This will rule out certain effects which influence the absolute
value.
11.5 Limits of StallGuard4 Operation
StallGuard4 does not operate reliably at extreme motor velocities: Very low motor velocities (for many
motors, less than one revolution per second) generate a low back EMF and make the measurement
unstable and dependent on environment conditions (temperature, etc.). Other conditions will also lead
to a poor response of the measurement value SG_RESULT to the motor load. Very high motor
velocities, in which the full sinusoidal current is not driven into the motor coils also leads to poor
response. These velocities are typically characterized by the motor back EMF exceeding the supply
voltage.