analogdevicesinc / PyTrinamic

TRINAMIC's Python Technology Access Package.
Other
60 stars 35 forks source link

TMC5160 v1.2 velocity - weird value #38

Closed basfari closed 2 years ago

basfari commented 3 years ago

Hi, first of all thank you very much for your work. This is more a question than an issue. It is about the velocity of TMC5160 which I did not fully understand it. In the datasheet, the unit of the velocity is [micro-steps / t]. Where t = 2^24 / f_FLK ; f_CLK is set to 12MHz (by default). --> t = 1.3981 sec. Thus, when we set for example the velocity to 1000, it is going to be 1000 microsteps per "at least" 1.3981 second (at least because there is still acceleration and deceleration during the first and end several steps as they will be slower than the max speed in the middle).

For example, with the following parameters: VSTART = 1 A1 = 25000 V1 = 250000 AMAX = 5000 VMAX = 1000 DMAX = 5000 D1 = 50000 VSTOP = 10 I get the time duration needed to move the stepper motor 1000 microsteps: 1.5 second (there is 0.1 second more than 1.3981 due to the accerelation and deceleration).

BUT when I set the parameters to the following values: VSTART = 950 V1 = 0 AMAX = 500 VMAX = 1000 DMAX = 500 D1 = 100 VSTOP = 970 I get the time duration to move the stepper motor 1000 microsteps: 1.3762 second (which is even less then the max velocity limit: 1000 micro-steps per 1.3981 second).

How can I understand this weird value?

Is there already a converting factor method to make the velocity moves per standard unit "1 second"?

trinamic-LH commented 2 years ago

Hello,

the default clock of the TMC5160 Evalboard is a 16 MHz clock supplied by the Landungsbruecke on the CLK16 Pin. With your calculation this gives you a lower bound of 1000µsteps in 1.048576s. That puts your measured time of 1.3762s above that lower bound.

Regards, Lenard