TMC5031 DATASHEET (Rev. 1.11 / 2016-APR-28)
53
10.2 stallGuard2 Update Rate and Filter
The stallGuard2 measurement value SG 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. In a practical application,
especially when using coolStep, a more precise measurement might be more important than an
update for each fullstep because the mechanical load never changes instantaneously from one step to
the next. For these applications, the sfilt bit enables a filtering function over four load measurements.
The filter should always be enabled when high-precision measurement is required. It compensates for
variations in motor construction, for example due to misalignment of the phase A to phase B
magnets. The filter should only be disabled when rapid response to increasing load is required, such
as for stall detection at high velocity.
10.3 Detecting a Motor Stall
For best stall detection, work without stallGuard filtering (sfilt=0). To safely detect a motor stall the
stall threshold must be determined using a specific SGT setting. Therefore, the maximum load needs
to be determined, which the motor can drive without stalling. At the same time, monitor the SG value
at this load, e.g. some value within the range 0 to 100. The stall threshold should be a value safely
within the operating limits, to allow for parameter stray. The response at an SGT setting at or near 0
gives some idea on the quality of the signal: Check the SG value without load and with maximum
load. They should show a difference of at least 100 or a few 100, which shall be large compared to
the offset. If you set the SGT value in a way, that a reading of 0 occurs at maximum motor load, the
stall can be automatically detected by the motion controller to issue a motor stop. In the moment of
the step resulting in a step loss, the lowest reading will be visible. After the step loss, the motor will
vibrate and show a higher SG reading.
10.4 Homing with stallGuard
The homing of a linear drive requires moving the motor into the direction of a hard stop. As
stallGuard needs a certain velocity to work, make sure that the start point is far enough away from
the hard stop to provide the distance required for the acceleration phase. After setting up SGT and
the ramp generator registers, start a motion into the direction of the hard stop and activate the stop
on stall function as soon as the target velocity has been reached (set sg_stop in SW_MODE). Once a
stall is detected, the ramp generator stops motion and sets VACTUAL zero, stopping the motor. The
stop condition also is indicated by the flag stallGuard in DRV_STATUS. After setting up new motion
parameters in order to prevent the motor from restarting right away, stallGuard can be disabled, or
the motor can be re-enabled by reading RAMP_STAT. The read and clear function of the event_stop_sg
flag in RAMP_STAT would restart the motor after TZEROWAIT in case the motion parameters have not
been modified.
10.5 Limits of stallGuard2 Operation
stallGuard2 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.). The automatic tuning
procedure described above will compensate for this. Other conditions will also lead to extreme
settings of SGT and poor response of the measurement value SG 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 reaching
the supply voltage.
www.trinamic.com