Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement tmc2208 step+dir+step filter #2565

Merged
merged 4 commits into from
Mar 5, 2020

Conversation

KevinOConnor
Copy link
Collaborator

@KevinOConnor KevinOConnor commented Feb 26, 2020

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

The queue_append system predates the iterative solver - it was useful
when many different kinematic functions directly added steps to the
step compression queues.  With the iterative solver being the only
source of step generation, it is simpler to directly add steps from
the iterative solver code.

Signed-off-by: Kevin O'Connor <[email protected]>
Reorder the loop to try and make the code flow a little simpler.

Signed-off-by: Kevin O'Connor <[email protected]>
If the stepper changes direction then the average velocity since the
last step pulse isn't a good indicator of the next step pulse.
Instead, reset the bounds checking to use a low starting guess.

Signed-off-by: Kevin O'Connor <[email protected]>
Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events.  In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode.  Detect these events and remove them from the
generated step times.

Signed-off-by: Kevin O'Connor <[email protected]>
@KevinOConnor KevinOConnor force-pushed the work-stepdirstep-20200225 branch from f2a40ba to c9cb462 Compare March 5, 2020 00:45
@KevinOConnor KevinOConnor merged commit c9cb462 into master Mar 5, 2020
@github-pages github-pages bot temporarily deployed to github-pages March 5, 2020 00:48 Inactive
@KevinOConnor KevinOConnor deleted the work-stepdirstep-20200225 branch March 5, 2020 00:48
@ghost ghost mentioned this pull request Mar 5, 2020
@KevinOConnor
Copy link
Collaborator Author

Unfortunately, it looks like this PR could lead to timing errors due to the filter not flushing steps correctly. I've reverted it for now (as of commit e872290).

-Kevin

@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant