Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
stepper_trinamic.h
Go to the documentation of this file.
1
7
8/*
9 * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG
10 * SPDX-FileCopyrightText: Copyright (c) 2025 Prevas A/S
11 *
12 * SPDX-License-Identifier: Apache-2.0
13 */
14
15#ifndef ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_
16#define ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_
17
26
27#include <stdint.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#define TMC_RAMP_VACTUAL_SHIFT 22
35#define TMC_RAMP_XACTUAL_SHIFT 31
36
52
82
90#define TMC_RAMP_DT_SPEC_GET_COMMON(node) \
91 .vstart = DT_PROP(node, vstart), \
92 .v1 = DT_PROP(node, v1), \
93 .vmax = DT_PROP(node, vmax), \
94 .a1 = DT_PROP(node, a1), \
95 .amax = DT_PROP(node, amax), \
96 .d1 = DT_PROP(node, d1), \
97 .dmax = DT_PROP(node, dmax), \
98 .vstop = DT_PROP(node, vstop), \
99 .tzerowait = DT_PROP(node, tzerowait), \
100 .iholdrun = (TMC5XXX_IRUN(DT_PROP(node, irun)) | \
101 TMC5XXX_IHOLD(DT_PROP(node, ihold)) | \
102 TMC5XXX_IHOLDDELAY(DT_PROP(node, iholddelay))),
103
104#define TMC_RAMP_DT_SPEC_GET_TMC50XX(node) \
105 { \
106 TMC_RAMP_DT_SPEC_GET_COMMON(node) \
107 .vhigh = DT_PROP(node, vhigh), \
108 .vcoolthrs = DT_PROP(node, vcoolthrs), \
109 }
110
111#define TMC_RAMP_DT_SPEC_GET_TMC51XX(node) \
112 { \
113 TMC_RAMP_DT_SPEC_GET_COMMON(DT_DRV_INST(node)) \
114 .tpowerdown = DT_INST_PROP(node, tpowerdown), \
115 .tpwmthrs = DT_INST_PROP(node, tpwmthrs), \
116 .tcoolthrs = DT_INST_PROP(node, tcoolthrs), \
117 .thigh = DT_INST_PROP(node, thigh), \
118 }
119
131 const struct tmc_ramp_generator_data *ramp_data);
132
143
152 const struct tmc_stallguard_settings *sg_settings);
153
161 const struct tmc_stallguard_settings *sg_settings);
162
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif /* ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_ */
void tmc51xx_stepper_ctrl_configure_stallguard(const struct device *dev, const struct tmc_stallguard_settings *sg_settings)
Configure TMC51XX Stepper StallGuard settings.
int tmc50xx_stepper_ctrl_set_ramp(const struct device *dev, const struct tmc_ramp_generator_data *ramp_data)
Configure Trinamic Stepper Ramp Generator.
int tmc50xx_stepper_ctrl_set_max_velocity(const struct device *dev, uint32_t velocity)
Set the maximum velocity of the stepper motor.
void tmc50xx_stepper_ctrl_configure_stallguard(const struct device *dev, const struct tmc_stallguard_settings *sg_settings)
Configure TMC50XX Stepper StallGuard settings.
int tmc51xx_stepper_ctrl_set_max_velocity(const struct device *dev, uint32_t velocity)
Set the maximum velocity of the stepper motor.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Main header file for stepper hardware driver API.
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
Trinamic Stepper Ramp Generator data.
Definition stepper_trinamic.h:56
uint16_t amax
Definition stepper_trinamic.h:61
uint16_t dmax
Definition stepper_trinamic.h:63
uint32_t tpowerdown
Definition stepper_trinamic.h:75
uint32_t vcoolthrs
Definition stepper_trinamic.h:70
uint32_t vmax
Definition stepper_trinamic.h:59
uint32_t vhigh
Definition stepper_trinamic.h:71
uint32_t vstop
Definition stepper_trinamic.h:64
uint32_t vstart
Definition stepper_trinamic.h:57
uint32_t thigh
Definition stepper_trinamic.h:78
uint16_t d1
Definition stepper_trinamic.h:62
uint32_t tcoolthrs
Definition stepper_trinamic.h:77
uint32_t tpwmthrs
Definition stepper_trinamic.h:76
uint32_t iholdrun
Definition stepper_trinamic.h:66
uint16_t tzerowait
Definition stepper_trinamic.h:65
uint32_t v1
Definition stepper_trinamic.h:58
uint16_t a1
Definition stepper_trinamic.h:60
Trinamic Stepper StallGuard Settings.
Definition stepper_trinamic.h:40
bool is_sg_enabled
Enable StallGuard2 feature.
Definition stepper_trinamic.h:42
uint16_t sg_velocity_check_interval_ms
Stallguard should not be enabled during motor spin-up.
Definition stepper_trinamic.h:48
uint32_t sg_threshold_velocity
StallGuard2 threshold velocity.
Definition stepper_trinamic.h:50