janelia-arduino / TMC2209

The TMC2209 is an ultra-silent motor driver IC for two phase stepper motors with both UART serial and step and direction interfaces.
Other
189 stars 30 forks source link

AutoTuning #42

Open danielschlingmeier opened 1 year ago

danielschlingmeier commented 1 year ago

Hey! I played around with your lib (thank a lot for the great job btw!) and nearly fried my stepper motor. When reading again you mentioned at several point to reduce the max current, when necessary, and better use voltage control etc.

I think I found out the reason for this "safety issue" with the current: One has to activcate the internal current sensing first and AFTERWARDS activate the tuning/current control, otherwise the TMC2209 auto tuning does, as I guess, not get a proper current signal for the tuning and does some nonsense leading to far to high actuation, which then fries the stepper.

By doing so: stepper_driver.useInternalSenseResistors(); stepper_driver.enableAutomaticCurrentScaling();

It work beautifully, no overheating anymore. Maybe you want to try it out and consider this. I guess activating the internal sense before sensing the request for autotuning to the TMC2209 would fix this.

Best regards Daniel

peterpolidoro commented 1 year ago

Oh that is a good idea! I am wondering how I can enforce this behavior within the library to make it safer. What happens if you disable the driver before setting the sense resistors and then reenable the driver?

danielschlingmeier commented 1 year ago

Well, I guess it would be sufficient to call *".useInternalSenseResistors();" internally in the ".enableAutomaticCurrentScaling();" method. Not?