Skip to content

Commit

Permalink
drivers: stepper: adi: trinamic tmc5041
Browse files Browse the repository at this point in the history
This commit introduces initial structure for trinamic drivers
TMC5041 is implemented with following features:
- StallGuard
- RAMPSTAT_POLL
- RAMP_GEN

Signed-off-by: Dipak Shetty <[email protected]>
Signed-off-by: Jilay Pandya <[email protected]>
  • Loading branch information
jilaypandya authored and fabiobaltieri committed Oct 9, 2024
1 parent 42c43b9 commit 52c6a28
Show file tree
Hide file tree
Showing 15 changed files with 1,652 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/stepper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@

zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/stepper.h)

# zephyr-keep-sorted-start
add_subdirectory_ifdef(CONFIG_STEPPER_ADI_TMC adi_tmc)
# zephyr-keep-sorted-stop

zephyr_library()
zephyr_library_property(ALLOW_EMPTY TRUE)

zephyr_library_sources_ifdef(CONFIG_FAKE_STEPPER fake_stepper_controller.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_STEPPER gpio_stepper_controller.c)

zephyr_library_sources_ifdef(CONFIG_STEPPER_SHELL stepper_shell.c)
1 change: 1 addition & 0 deletions drivers/stepper/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ config STEPPER_SHELL_THREAD_PRIORITY

comment "Stepper Drivers"

rsource "adi_tmc/Kconfig"
rsource "Kconfig.fake"
rsource "Kconfig.gpio"

Expand Down
6 changes: 6 additions & 0 deletions drivers/stepper/adi_tmc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC_SPI adi_tmc_spi.c)
zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC5041 adi_tmc5041_stepper_controller.c)
56 changes: 56 additions & 0 deletions drivers/stepper/adi_tmc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG
# SPDX-License-Identifier: Apache-2.0

menuconfig STEPPER_ADI_TMC
bool "Trinamic Stepper Controller"
depends on STEPPER
default y
help
Enable trinamic stepper controller

if STEPPER_ADI_TMC

config STEPPER_ADI_TMC_RAMP_GEN
bool "Use Trinamic Stepper Controller with Ramp Generator"
depends on STEPPER_ADI_TMC
default y
help
Enable ramp generator for trinamic stepper controller

config STEPPER_ADI_TMC_SPI
bool "Use Trinamic Stepper Controller with SPI"
depends on STEPPER_ADI_TMC
select SPI
help
A Trinamic Stepper Controller with SPI is enabled

comment "Trinamic Stepper Drivers"

config STEPPER_ADI_TMC5041
bool "Activate trinamic tmc5041 stepper driver"
depends on DT_HAS_ADI_TMC5041_ENABLED && STEPPER_ADI_TMC
select STEPPER_ADI_TMC_SPI
default y
help
Stepper driver for TMC5041.

config STEPPER_ADI_TMC5041_RAMPSTAT_POLL
bool "TMC5041 poll ramp status"
depends on STEPPER_ADI_TMC5041
select POLL
default y
help
When enabled, the ramp status will be polled on TMC5041, to check for events:
- TMC5041_POS_REACHED_EVENT
- TMC5041_STOP_SG_EVENT
- TMC5041_STOP_LEFT_EVENT
- TMC5041_STOP_RIGHT_EVENT

config STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC
int "TMC5041 poll ramp status interval in ms"
depends on STEPPER_ADI_TMC5041_RAMPSTAT_POLL
default 100
help
The interval in ms to poll the ramp status on TMC5041.

endif # STEPPER_ADI_TMC
Loading

0 comments on commit 52c6a28

Please sign in to comment.