-
Notifications
You must be signed in to change notification settings - Fork 7.5k
drivers: stepper: seperate stepper_stop from stepper_disable #91909
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
base: main
Are you sure you want to change the base?
drivers: stepper: seperate stepper_stop from stepper_disable #91909
Conversation
Counterpoint: This is also more intuitive, that a device stops all actions on a disable instead of some components continuing to run. Only the tmc50xx, tmc51xx and tmc22xx drivers do not stop on disable. At this point it would be better to discuss the expected api behavior on disable. EDIT: My preference would be for tmc22xx to get the standard step-dir stop on disable, and for the tmc50xx/51xx (which by the way have no stop function at all) to decelerate towards 0 on |
They actually don't "stop" on disable, stopping is a motion control concern, disabling turns of the power stages, and this will help in separating the two apis in the future. If a user wants to stop with disable, then stepper_stop() and stepper_disable().
step signal generation is not a concern of a step-dir stepper driver, it's a concern of motion control part. If you want to stop generating step signals than stepper_stop() is there. Initially there was no stepper_stop function in the api and that's why we stopped the stepper using stepper_disable, this was done as a part of this RFC #86052. The reason I am taking 5xxx as a benchmark since it's the only driver upstream which actually is a motion_control + stepper_driver. Went through the data sheet what disable is actually supposed to, it just says that power stages shall be turned off. Moreover, dedicated motion controllers like the TMC429 do not have an en_pin, which shows its actually the concern of stepper driver. |
How is a disabling power stages going to achieve emergency stop? And as far as the stop is concerned, we have discussed this already. |
d083ab8
to
d5915fa
Compare
60cc1dd
to
66579c7
Compare
Drivers DRV84XX, A4979 and gpis-stepper-controller are updated and test cases have been also updated accordingly |
66579c7
to
2f3f616
Compare
2f3f616
to
c0862d6
Compare
If you want to remove stopping from enable/disable, I would rename the functions to clarify that they only affect power stages. A general enable/disables sounds like a device on/off (which is what I meant with stop being included was intuitive) where as Concerning the drv84xx tests, instead of removing them, it might be an idea to change at least some of them so that they check that movement actually continues, as this would be the new expected behavior that the drivers should have. |
Could you tell me what your exact use case with stepper motors is. I am not able to follow what you are trying to recommend here. What else would enable/disable for a stepper driver mean otherwise? |
c0862d6
to
0347c09
Compare
Basically an on/off switch. We are after all not dealing with stepper motors, but with (physical) stepper drivers. The drv8424 is an physical stepper driver, thus its software driver is an stepper driver driver. In this context enable/disable easily means enabling/disabling the drv8424, which has internal logic and settings. The tmc5xxx series is even more advanced. Enabling/disabling this kind of stepper driver (technically stepper controller, but that is a topic for the stepper api rework PRs) is significantly different from just enabling/disabling the power stages. Hence renaming the functions. |
I have corrected the documentation in an appropriate manner imo.
Okay perfect, good to know that you are on it. We can directly implement those tests than in stepper_api test suite. Thanks for your feedback :) |
While the documentation is indeed corrected, I fell that a rename would clarify this better and avoid confusion. As mentioned, a general enable/disable implies more than what it actually does. |
Hey, enable/disable seems to have a standard meaning when it comes to stepper drivers, below are the excerpts from trinamic & ti data sheet.
ti. drv8424
|
0347c09
to
fa8fc80
Compare
fa8fc80
to
3ce6d3e
Compare
Each stepper would automatically physically stop on disable because the coils get disengaged.
I would disagree here because there is no real intuitive way here. Depending on the application it is possible that some components should keep running for whatever reason (e.g. to track "lost" steps or redirect them to another device/component).
Since disabling a stepper is pretty much the same as pulling the plug (power supply) of this single component, i would expect everything else to keep running unless I tell the system not to do so (e.g. by calling emergency stop before disable). Application which use disable for an emergency stop with complete loss of any torque it would be harmful to wait for some motion related operations. Other applications would want to decelerate before disabling (e.g. for homing applications where you reach an endstop and want to gracefully stop your heavy rig after that following by a power off). Each application will have its own requirements and interpretations but they all have in common that disable is just a rudimentary powering off of the stepper. Some maybe do not even have any motion controller in between and they control the stepping manually.
This strongly contradicts the idea of an intuitive and consistent API and also reduces the freedom of the application to decide what it actually wants before turning off the hardware. Since "disable" is the software equivalent of pulling the plug, the only thing that should happen for all drivers out there is to disable all the coils completely. This is the only common logic which will be understood by API users regardless of the used stepper drivers or application requirements. |
Since the drivers i have seen before call this feature "enable"/"disable" and even have the EN pin for that in most cases, i would strongly recommend to stick with this naming because this would match the vendor documentation and also make it easy to predict the actual behavior behind these functions for API users. Introducing new names would automatically lead to the need of reading the documentation just to realizing that it is the commonly named "enable"/"disable" hardware feature. |
Disabling the stepper shall not cancel any active movements. stepper_stop() shall be used after disabling the stepper in order to explicitly cancel stepper movements. Signed-off-by: Jilay Pandya <[email protected]>
Removing stop functionality wrapped in stepper_disable since there is a dedicated function for it. Signed-off-by: Jilay Pandya <[email protected]>
Introduce stop function in tmc5xxx Signed-off-by: Jilay Pandya <[email protected]>
Add entry of stepper stop function in stepper.rst Signed-off-by: Jilay Pandya <[email protected]>
502e9c2
3ce6d3e
to
502e9c2
Compare
|
stepper_stop() shall be used be used explicitly to cancel stepper step counting.
stepper_disable() is responsible for turning off power stages.
Attached along with is the trace from tmc50xx stepper motion controller + driver.
It shows that disabling the stepper driver does not implicitly stop the motion control part.
Originally stepper_stop() was missing in the stepper api and hence while disabling the motor was stopped implicitly by stopping counter or work.
However, there is a dedicated stop() function now,
hence enable<->disable should be concerned with turning power stages on and off
while move<->stop should be concerned with setting the stepper in motion and stopping it