-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Is your enhancement proposal related to a problem? Please describe.
Currently Stepper API combines Motion Controller and Stepper Driver under a single api with following functions.
Linked PR: #91979
However, as one can see in the block diagram of TMC5041(Dual controller/driver for up to two 2-phase bipolar stepper motors with Integrated motion controller with SPI interface) is a controller with MotionController + Stepper Driver.
Additionally all the STEP/DIR Drivers such as the tmc2209 are just stepper drivers which has a "Software Motion Controller" integrated within them.
TMC5041 Split between motion_controller and stepper_driver
As one can see there is one motion_controller pe stepper_driver
Describe the solution you'd like
Hence the cleaner approach would be to seperate "Motion Controller" from the actual "Stepper Driver" with the following API structure.
Proposed Split
#define X_AXIS 0
#define Y_AXIS 1
stepper_move_to(tmc50xx_motion_controller, X_AXIS, 200);
stepper_stop(tmc50xx_motion_controller, Y_AXIS);
stepper_drv_disable(tmc50xx_stepper_driver_x_axis@0);
stepper_drv_disable(tmc50xx_stepper_driver_y_axis@1);
spi {
/* Implements stepper motion control api */
tmc50xx_motion_controller {
compatible = "adi,tmc50xx"
/* Implements stepper driver api */
tmc50xx_stepper_driver_x_axis@0 {
};
/* Implements stepper driver api */
tmc50xx_stepper_driver_y_axis@1 {
};
};
};
Describe alternatives you've considered
Additional context
Further context can be understood by the following image, here TMC429 is a Stepper Motion Controller Driver, whereas TMC2660 Stepper Driver.
| Stepper Motion Controller | Stepper Driver | Notes |
|---|---|---|
| TMC429 | TMC2660 | TMC2209 and other step/dir driver might be compatible as well |
| zephyr,stepper-control (workqueue/counter/ramp) | TMC22xx, DRV84xx, A4979 | zephyr stepper control driver is a sw driver |
| TMC50XX Stepper Motion Controller | TMC5XXX Stepper Driver | TMC5XXX Series are a combined packagage (something like TMC429 + TMC2660 packed together) |
DTS
There are two Approaches as how the DTS could look like
spi {
/* Implements stepper motion control api */
tmc50xx_motion_controller {
compatible = "adi,tmc50xx"
/* Implements stepper driver api */
tmc50xx_stepper_driver_x_axis@0 {
};
/* Implements stepper driver api */
tmc50xx_stepper_driver_y_axis@1 {
};
};
};
/ {
gpio_stepper: gpio_stepper {
compatible = "zephyr,gpio-stepper";
status = "okay";
micro-step-res = <2>;
gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, /* D8 */
<&gpioc 7 GPIO_ACTIVE_HIGH>, /* D9 */
<&gpiob 0 GPIO_ACTIVE_HIGH>, /* D10 */
<&gpioa 7 GPIO_ACTIVE_HIGH>; /* D11 */
};
};
/ {
stepper_control: stepper_control {
compatible = "zephyr,stepper-control";
status = "okay";
counter = <&counter0>;
stepper = <&gpio_stepper>;
};
};
Metadata
Metadata
Assignees
Labels
Type
Projects
Status