Add support for using the diag0 pin as an interrupt source. This
allows event detection via diag0 interrupts instead of polling rampstat.
The driver now:
- Configures diag0 when the GPIO is available
- Sets up GPIO interrupt handling for rising edge transitions for
rampstat reading
- Falls back to polling only when diag0 is not available
Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
Simplified by removing redundant options and
enabled automatic fallback to ramp status polling when
diag0 pin is unavailable for event detection.
Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
Fix issue where stepper callbacks were not being called when
using work_q. This was due to the steps being counted down before
the work_q was rescheduled.
Signed-off-by: Josselin Bunt <josselin@sensible.health>
print_status_byte is specific to tmc50xx and hence shoud not
be placeed in common tmc_spi.c which is supposed to be reused
by a variety of drivers
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Replace stall guard retry error log on EAGAIN with enable/disable info log.
Log position, sg result and sg status on each rampstat_work_handler() call.
Treat only negative return values from tmc_spi_write_register() and
tmc_spi_read_register() as an error. Only log actual velocity when not 0.
Use helper functions rampstat_work_reschedule() and read_vactual().
Signed-off-by: Anders Nielsen <anders.nielsen@prevas.dk>
Use rampstat_work_reschedule() and read_vactual().
Only log actual velocity when not 0.
Update log_stallguard() output.
Signed-off-by: Anders Nielsen <anders.nielsen@prevas.dk>
update remaining steps should just update the remaining steps, rescheduling
should happen after updating steps and hence is moved to position mode task
which is also in coherence with velocity mode task
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Refactored stepper move_to calls and move_by calls.
Now, relative movement required or absolute target position
is calculated and then redirected to move_by or move_to calls
respectively.
Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
Replace stall guard retry error log on EAGAIN with enable/disable info log.
Log position, sg result and sg status on each rampstat_work_handler() call.
Treat only negative return values from tmc_spi_write_register() and
tmc_spi_read_register() as an error.
Signed-off-by: Anders Nielsen <anders.nielsen@prevas.dk>
Renamed the drv8424 stepper driver to indicate its support of the drv8424,
drv8425, drv8426, drv8434 and drv8436 stepper controllors. Also made the
microstep pins optional. All test files are renamed as well.
Signed-off-by: Jan Behrens <jan.behrens@navimatix.de>
Renamed fault event to be more in line with other events and added it to
the stepper shell.
Makes the event callback trigger function of the step-dir implementation
non-static so that step-dir stepper drivers can use it to trigger events
themself.
Signed-off-by: Jan Behrens <jan.behrens@navimatix.de>
Introduce macro to check for valid microstep resolution in stepper api
Use this macro in tmc50xx driver. Stepper api tests adjusted in order to
accomodate the not implemented stepper api functions.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
refactoring enable function into enable and disable increasing readability
and increasing coherence with other stepper apis in terms of
nomenclature
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Adding a stepper driver implementation for allegro a4979
microstepping programmable stepper motor driver.
The implemenation was tested using the drv8424/api testsuite.
Signed-off-by: Verena Schweinstetter <verena.schweinstetter@zeiss.com>
unify error codes from all drivers based on stepper specification
add a generic test case for set_micro_step_interval and stop
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Add stop function to stepper shell. align the function order to match
the one in __subsystem stepper_driver_api struct
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Drop few redundant device_is_ready for functions that are only used as
argument to shell_device_filter, as shell_device_filter checks for that
alrady.
Suggested-by: Yishai Jaffe <yishai1999@gmail.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change the stepper API to instead of changing the stepper speed based on
the velocity in microsteps per second to use the delay in usec between
successive steps. Also remove the velocity from the `stepper_run` function
as typical API usage is enable -> set step interval -> run.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Address issue where the timing source is not stopped upon step completion
and not adjusting the actual position after performing a step.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Adds a fallback for the dual-edge-step property in the step dir common
code. Without this drivers using the common code would have to declare the
dual-edge-step property so it can default to false when not set, even if
the IC does not support adjusting it.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Adds a timing source api which is used by the step-dir stepper common code.
This allows the reusable common code to configure different timing sources,
since the initial delayable work implementation was inacurate for higher
maximum velocities.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Use the shell_device_filter utils method and leverage the new api classing
to only suggest stepper devices via tab-complete within the shell.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
- rename enable-gpios to en-gpios in adi,tmc2209
- place en-gpios in common stepper-controller.yaml
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
create rampstat Kconfig template to enable respective tmc drivers to
reuse the common configurations
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.
Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
for the brevity renaming direction_gpios to dir_gpios since STEP/DIR
interface is quite an established term in context of stepper controllers.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
The current implementation of tmc2209 driver does not allow instantiation
of the driver without configuring msx pins.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Adds a step direction binding that can be used with any stepper that
implements said control interface to cut down on boilerplate code.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This commit refactos set_actual_position to set_reference_position.
stepper_set_reference_position is more apt in regards to what this func
actually does
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>