TMC5031 DATASHEET (Rev. 1.11 / 2016-APR-28)
48
4. Set AMAX to 65535 (0xFFFF) and set VMAX to zero to finally stop the motor. This will stop the
motor within a few microseconds.
5. Wait until the motor is actually stopped (vzero flag active) before starting a new motion.
Remember to set AMAX back to the original value before starting the next motion.
Step (3.) and (4.) are time critical:
Make sure that the delay between detection of the step execution by reading XACTUAL and setting
VMAX=0 is significantly lower than the time between each two steps. No additional step shall be
executed between (3.) and (4.). For example, when XACTUAL can be checked once each 5ms, use a
step frequency of max. 100Hz (10ms) for VMAX in step (1.). You can test the procedure by checking
that no further position change has been executed until step 5.
Do not switch between RAMPMODE 1 and 2 (velocity in positive direction and velocity in negative
direction), without stopping the motion as described above before changing the direction.
Second Software Workaround Avoiding Velocity Mode
Operate the device in positioning mode instead of velocity mode.
Use a target position far away to simulate a velocity mode movement, e.g. XTARGET:=XACTUAL+2^30 to
yield a positive motion direction, or XTARGET:=XACTUAL-2^30 for a negative direction. A smaller
increment down to the span of the deceleration ramp also can be used, depending on how often the
procedure is called. The target position this way can be increased in regular intervals in order to have
an infinite running (even longer than the 32 bit position range).
In order to stop the motor, cease incrementing XTARGET. The motor will continue turning and
decelerate in time to stop as commanded by the last increment.
In order to stop the motor at the next possible position:
1. Set VMAX to a low velocity, in the range of minimum equal to VSTOP or up to about 1000
(e.g. 100). Depending on the speed of execution of step 4 (mostly limited by communication
between MCU and TMC), higher values can be chosen to speed up the motor stop process.
2. Check the velocity_reached flag to become active. In case the position_reached flag becomes
active, exit the procedure as the motion has finished normally.
3. Read out XACTUAL. For a motion in positive direction, increase it by 2 (or more, e.g. 10 or 100,
if desired), and write it to XTARGET, for a motion in negative direction, decrease it
accordingly. Increase VSTOP to the same value which was selected for VMAX in step 1. This
will stop the motor within two steps (or 10, or 100) of the write access to XTARGET. (with
VMAX=100 this will need at maximum about 10-20ms, with VMAX=1000, about 1-2ms)
4. Wait until the motor is actually stopped (vzero flag active) before starting a new motion.
Remember to set VSTOP and VMAX back to the original values before starting the next
positioning move.
The read-modify-write access in step (3.) is time critical: Make sure that the delay between reading
XACTUAL and writing to XTARGET and VSTOP is significantly lower than the time required doing
the remaining 2 steps (or more, as decided for the increment in step (3.)). Otherwise the motor
might reverse before stopping). With VSTOP=10, the remaining motion ramp will need about
200ms (*), with VSTOP=100 it will need about 20ms.
(*) The time delays given relate to a clock frequency of about 16MHz. At 12MHz they are 25% longer.
www.trinamic.com