|
HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
|
StealthChop configuration structure. More...
#include <tmc51x0_types.hpp>
Public Member Functions | |
| StealthChopConfig ()=default | |
| Default constructor. | |
| StealthChopConfig (uint8_t pwm_frequency, uint8_t pwm_offset=30, uint8_t pwm_gradient=0, uint8_t regulation_speed=4, uint8_t jerk_reduction=12) | |
| Helper constructor for automatic tuning mode. | |
| StealthChopConfig (StealthChopPwmFreq pwm_frequency, StealthChopRegulationSpeed regulation_speed=StealthChopRegulationSpeed::MODERATE, StealthChopJerkReduction jerk_reduction=StealthChopJerkReduction::MODERATE, uint8_t pwm_offset=30, uint8_t pwm_gradient=0) | |
| Helper constructor using enums (most intuitive) | |
| StealthChopConfig (uint8_t pwm_frequency, uint8_t pwm_offset, uint8_t pwm_gradient) | |
| Helper constructor for manual mode. | |
Public Attributes | |
| uint8_t | pwm_ofs {30} |
| PWM amplitude offset. | |
| uint8_t | pwm_grad {0} |
| PWM amplitude gradient. | |
| uint8_t | pwm_freq {1} |
| PWM frequency selection. | |
| bool | pwm_autoscale {true} |
| Enable automatic current scaling. | |
| bool | pwm_autograd {true} |
| Enable automatic gradient adaptation. | |
| uint8_t | pwm_reg {4} |
| Regulation speed. | |
| uint8_t | pwm_lim {12} |
| Mode switching jerk reduction. | |
| PWMFreewheel | freewheel {PWMFreewheel::NORMAL} |
| Freewheeling mode when I_HOLD=0. | |
| float | velocity_threshold {0.0F} |
| StealthChop velocity threshold (TPWMTHRS) | |
| Unit | velocity_threshold_unit {Unit::Steps} |
| Unit for velocity threshold. | |
StealthChop configuration structure.
User-friendly configuration for StealthChop2 voltage PWM mode operation. StealthChop provides extremely quiet, noiseless operation for stepper motors, making it ideal for indoor or home use applications.
StealthChop2 features automatic tuning (AT) that adapts operating parameters to the motor automatically. Two tuning phases are required:
|
default |
Default constructor.
Initializes with recommended default values for automatic tuning mode:
|
inline |
Helper constructor for automatic tuning mode.
Creates a StealthChop configuration optimized for automatic tuning.
| pwm_frequency | PWM frequency (StealthChopPwmFreq enum or 0-3) |
| pwm_offset | Initial PWM offset (0=special mode, 1-255=normal, 30=typical) |
| pwm_gradient | Initial PWM gradient (0-255, 0=auto) |
| regulation_speed | Regulation speed (StealthChopRegulationSpeed enum or 1-15, 4=balanced) |
| jerk_reduction | Jerk reduction (StealthChopJerkReduction enum or 0-15, 12=balanced) |
|
inline |
Helper constructor using enums (most intuitive)
Creates a StealthChop configuration using intuitive enums.
| pwm_frequency | PWM frequency enum |
| regulation_speed | Regulation speed enum |
| jerk_reduction | Jerk reduction enum |
| pwm_offset | Initial PWM offset (0=special mode, 1-255=normal, 30=typical) |
| pwm_gradient | Initial PWM gradient (0-255, 0=auto) |
|
inline |
Helper constructor for manual mode.
Creates a StealthChop configuration for manual (non-automatic) mode. Requires well-known motor and operating conditions.
| pwm_frequency | PWM frequency (StealthChopPwmFreq enum or 0-3) |
| pwm_offset | PWM offset (calculated: 374 * R_COIL * I_COIL / V_M) |
| pwm_gradient | PWM gradient (calculated from back EMF constant) |
| PWMFreewheel tmc51x0::StealthChopConfig::freewheel {PWMFreewheel::NORMAL} |
Freewheeling mode when I_HOLD=0.
Standstill option when motor current setting is zero. Only available with StealthChop enabled.
Options:
| bool tmc51x0::StealthChopConfig::pwm_autograd {true} |
Enable automatic gradient adaptation.
Enables automatic tuning of PWM_GRAD_AUTO during AT#2 phase.
| bool tmc51x0::StealthChopConfig::pwm_autoscale {true} |
Enable automatic current scaling.
Enables automatic current regulation using current measurement feedback.
| uint8_t tmc51x0::StealthChopConfig::pwm_freq {1} |
PWM frequency selection.
Chopper frequency selection for StealthChop operation. Lower frequencies reduce current ripple but may limit high-velocity performance. Higher frequencies improve high-velocity performance but increase power dissipation.
Can be specified as:
Recommended: PWM_FREQ_1 (~35kHz @ 12MHz clock) for most applications Use lowest setting giving good results.
| uint8_t tmc51x0::StealthChopConfig::pwm_grad {0} |
PWM amplitude gradient.
Velocity-dependent factor to compensate for back EMF. Used as initialization value for automatic tuning (PWM_GRAD_AUTO).
Range: 0-255
Calculation (for manual mode, pwm_autoscale=0): PWM_GRAD = C_BEMF * 2π * f_CLK * 1.46 / (V_M * MSPR)
| uint8_t tmc51x0::StealthChopConfig::pwm_lim {12} |
Mode switching jerk reduction.
Controls current jerk reduction when switching from SpreadCycle to StealthChop. Limits PWM_SCALE_AUTO when switching back from SpreadCycle to StealthChop.
Can be specified as:
| uint8_t tmc51x0::StealthChopConfig::pwm_ofs {30} |
PWM amplitude offset.
Initial value for PWM amplitude (offset) for velocity-based scaling. Used as initialization value for automatic tuning (PWM_OFS_AUTO).
Range: 0-255
Calculation (for manual mode, pwm_autoscale=0): PWM_OFS = 374 * R_COIL * I_COIL / V_M
| uint8_t tmc51x0::StealthChopConfig::pwm_reg {4} |
Regulation speed.
Controls how fast the PWM amplitude regulation loop adapts to changes. Specifies maximum PWM amplitude change per half wave when using automatic scaling.
Can be specified as:
Lower values: Stable, soft regulation (slower response) Higher values: Faster adaptation (may be less stable)
| float tmc51x0::StealthChopConfig::velocity_threshold {0.0F} |
StealthChop velocity threshold (TPWMTHRS)
Velocity threshold below which StealthChop is active. Above this threshold, driver switches to SpreadCycle mode.
Range: 0.0 to maximum velocity (in steps/s or unit specified by velocity_threshold_unit)
| Unit tmc51x0::StealthChopConfig::velocity_threshold_unit {Unit::Steps} |
Unit for velocity threshold.
Specifies the unit used for velocity_threshold field. Unit for velocity threshold