terjeio / Trinamic-library

Plain C library for Trinamic TMC2130 stepper drivers
Other
54 stars 21 forks source link

Possible bug. Stallguard not functioning without pwm_autoscale on tmc2209 #6

Open wakass opened 1 year ago

wakass commented 1 year ago

Stallguard does not function properly (or as expected?) on a 2209 driver. The following line is relevant, and setting autoscale to true recovers proper stallguard behaviour on my system: https://github.com/terjeio/Trinamic-library/blob/9eae92beab071f00d188f9da25672ab9f2aaa116/tmc2209hal.c#L162

I'm not sure how this works in other driver modules, but I can't find any reference on stallguard requiring disabling pwm_autoscaling. Just tcoolthrs < tstep < tpwmthres

troth530 commented 1 year ago

@wakass I tend to agree, in fact it seems the drivers will operate in open loop with velocity based current scaling (requiring motor specific settings) with pwm_autoscale set to false. In this context the motors will stall during jogging regardless of stallguard threshold. On the other hand when pwm_autoscale is set to true stalling is only occurring during homing with reasonable stallguard threshold settings that work with my motors.

philletourneau commented 1 year ago

👀 I've been trying to get stallguard working for days! I'll give this a try too.

Otherwise I'm having trouble with are setting the tCoolThrs and TPWMThrs to any value other than 0, and the driver status is always reporting stealth as 0 (meaning spreadcycle and not stealthchop)