teemuatlut / TMCStepper

MIT License
501 stars 196 forks source link

TMC5161 Stepper direction change causes Microstep change; Address randomizes #110

Open XBrav opened 4 years ago

XBrav commented 4 years ago

As per https://github.com/MarlinFirmware/Marlin/issues/16365, the 5161 stepper drops out when issuing motion commands to other steppers, or when you attempt to change the direction.

The hw address randomly changes once the stepper(s) shut off, and the microsteps changes from 16 to 256.

chai-md commented 4 years ago

I have same probrems that SPI error comes randomly with the 5161.

I think delays of writeSCK_x is enough, https://github.com/teemuatlut/TMCStepper/commit/6753e524cbf40cbb166e0a96ee2d05f2423e5a0b. But sometime CSN high time sometime can be shortend with 32bit controllers, LPC1768/1769. the DataSheet says the time needs 250ns as minimum, longer than 510ns as typical.

This suggests the need for a delay after switchCSpin(HIGH). I'll try it next week.