Implement tmc2208 step+dir+step filter #2565
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is not currently valid to run the tmc2208 drivers in "standalone mode" with Klipper due to what appears to be an issue in how the tmc2208 handles direction changes. It is believed that a step followed by a direction change followed by a step in the opposite direction can cause it to experience an "over current" event if the two step pulses occur in a small time period. This is described in the FAQ at https://www.klipper3d.org/FAQ.html#my-tmc-motor-driver-turns-off-in-the-middle-of-a-print .
This PR adds code to filter out rapid step+dir+step sequences. This should, ideally, prevent issues with the tmc2208 - both when they are in standalone mode and in a "stealthchop" mode configured via the uart interface. Some other stepper drivers have been observed to not handle rapid direction changes particularly well and there should be no harm in filtering these events, so this support is enabled for all steppers.
-Kevin