AN-029: Ramp Parameter Setup for TMC429
Setting the Velocity
The target motion velocity is the basic setting for a motion controller. Its choice depends on the application, the motor type, and its load. The choice of microstep resolution additionally influences the required pulse frequencies for a certain RPM velocity. The basic TMC429 velocity parameter is V_MAX. It provides a 12-bit resolution. In order to cover a wider range, an additional parameter PULSE_DIV works as electronic gear shifting. It provides 14 gears by setting a value between 0 and 13. Each increment of PULSE_DIV halves the effective velocity. This way an overall velocity range corresponding to a 26-bit setting is achieved. The gear shifting parameter PULSE_DIV normally remains stable within an application or at least within each motion ramp.
Step-by-step instruction for setting up V_MAX and PULSE_DIV:
- Imagine V_MAX = 2047. This is the maximum setting for V_MAX. For this value, PULSE_DIV needs to be determined, because this velocity will act as the upper limit possible during any motion sequence. Use the step frequency formula from the datasheet (copied below) to determine the lowest setting for PULSE_DIV giving a step frequency equal to or above your target.
- Now you have determined PULSE_DIV in a way that you satisfy your desired maximum
system velocity with V_MAX as high as possible, i.e., in the range 1024 to 2047. This way,
you get the best resolution for the velocity setting (V_ACTUAL) of at least 1024 different
velocity steps when accelerating from 0 to V_MAX. You can now determine the exact V_MAX.
where
R[Hz] is the desired microstep rate, i.e. 200*16*1/s when operating a 1.8° motor with 16 microsteps at 1 rotation per second.
fCLK[Hz] is the frequency of the external clock source feeding the TMC429, i.e., 16MHz.
V_MAX is in range 0 to 2047.
Setting up the Acceleration Phase
The procedure for setting up the acceleration phase is very similar to the procedure for the velocity setting. The choice for the acceleration setting depends on the application, the motor type, and its load, especially dynamic load (flywheel load). A higher dynamic load requires a lower acceleration. The basic parameter is the acceleration setting A_MAX. It provides a 12-bit resolution. In order to cover a wider range, an additional parameter RAMP_DIV works as electronic gear shifting for the acceleration. It provides 14 gears by setting a value between 0 and 13. Each increment of RAMP_DIV halves the effective acceleration. This way an effective acceleration range corresponding to a 26-bit setting is achieved. The gear shifting parameter RAMP_DIV normally remains stable within an application or at least within each motion ramp. While the actual velocity V_ACTUAL is ramped from 0 to V_MAX and back to 0 for each complete motion ramp, A_ACTUAL normally is switched on to +A_MAX or -A_MAX for acceleration or deceleration. Due to this, the choice of RAMP_DIV is not critical.
Step-bystep instruction for setting up A_MAX and RAMP_DIV:
- As a starting point, set RAMP_DIV equal to PULSE_DIV. This will allow relatively quick acceleration ramps. Imagine A_MAX at a medium setting, i.e., 250. For this value, use the acceleration formula from the datasheet (copied below) to determine the number of steps for acceleration from 0 to V_MAX. This will give you an idea on the extent of the acceleration ramp.
- Now, you can increase (or decrease) PULSE_DIV until you satisfy your desired length of the
acceleration ramp. This is best tested interactively in the application. Fine tuning is possible
by modifying A_MAX. In case you end up with RAMP_DIV higher than PULSE_DIV+2, please
make sure to choose A_MAX in a way that the number of acceleration steps S does not
exceed 2 million, because the length of the deceleration ramp is limited by 221.
where
S = number of steps during the linear acceleration phase from 0 to V_MAX
A_MAX = linear acceleration setting
V_MAX = velocity setting
Determining the Deceleration Settings
In order to allow the TMC429 to properly calculate automatic linear ramps, it requires the additional parameters PMUL and PDIV. These parameters depend on the settings for A_MAX, RAMP_DIV and PULSE_DIV.
- Choose PMUL and PDIV in a way that the formula
becomes satisfied. This is easily done using the spreadsheet calculation or the algorithm from the TMC429 datasheet.
Value range for PMUL: 128… 255
Value range for PDIV: one out of {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
Overview
- Set V_MAX = 2047. Determine PULSE_DIV to give a step frequency equal to or above your
target.
- You can now determine the exact V_MAX to match your desired velocity.
- As a starting point, set RAMP_DIV equal to PULSE_DIV and A_MAX at a medium setting, i.e., 250. Now, use the acceleration formula to determine the number of steps for acceleration
from 0 to V_MAX. This will give you an idea on the extent of the acceleration ramp.
- Now, you can increase (or decrease) PULSE_DIV, until you satisfy your desired length of the acceleration ramp. Fine tuning the acceleration by modifying A_MAX.
- Choose PMUL and PDIV in a way that the formula
becomes satisfied. This is easily done using the spreadsheet calculation or the algorithm from the TMC429 datasheet.