HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0::DcStepConfig Struct Reference

DcStep configuration structure. More...

#include <tmc51x0_types.hpp>

Public Member Functions

 DcStepConfig ()=default
 Default constructor.
 
 DcStepConfig (float min_vel, Unit vel_unit=Unit::RevPerSec, float pwm_time_us=0.0F, DcStepStallSensitivity sensitivity=DcStepStallSensitivity::MODERATE)
 Helper constructor for quick setup.
 

Public Attributes

float min_velocity {0.0F}
 Minimum velocity threshold for DcStep activation.
 
Unit velocity_unit {Unit::Steps}
 Unit for velocity threshold.
 
float pwm_on_time_us {0.0F}
 PWM on-time limit for commutation (user-friendly)
 
DcStepStallSensitivity stall_sensitivity {DcStepStallSensitivity::MODERATE}
 Stall detection sensitivity.
 
bool stop_on_stall {false}
 Enable stop on stall.
 

Detailed Description

DcStep configuration structure.

User-friendly configuration for DcStep automatic commutation mode. DcStep allows the motor to run near its load limit without losing steps by automatically reducing velocity when overloaded. The motor operates in fullstep mode at the target velocity or at reduced velocity if overloaded.

Note
DcStep enable mechanism depends on the chip mode:
  • Internal ramp generator (SD_MODE=0): DcStep can be enabled above the VDCMIN threshold (register VDCMIN).
  • External STEP/DIR (SD_MODE=1): DcStep is enabled via the external DCEN pin (ENCB_DCEN_CFG4). VDCMIN does not enable DcStep in this mode.
DcStep automatically sets chopper to constant TOFF mode with slow decay only.
CHOPCONF.vhighfs and CHOPCONF.vhighchm must be set to 1 for DcStep (handled automatically).
CHOPCONF.TOFF should be >2, preferably 8-15 for DcStep operation.
See also
Datasheet section 17: DcStep

Constructor & Destructor Documentation

◆ DcStepConfig() [1/2]

tmc51x0::DcStepConfig::DcStepConfig ( )
default

Default constructor.

Initializes with DcStep disabled (min_velocity = 0). All fields use default member initializers.

◆ DcStepConfig() [2/2]

tmc51x0::DcStepConfig::DcStepConfig ( float min_vel,
Unit vel_unit = Unit::RevPerSec,
float pwm_time_us = 0.0F,
DcStepStallSensitivity sensitivity = DcStepStallSensitivity::MODERATE )
inline

Helper constructor for quick setup.

Creates a DcStep configuration with typical settings:

  • Moderate stall sensitivity
  • Auto-calculated PWM on-time
Parameters
min_velMinimum velocity for DcStep activation
vel_unitUnit for velocity threshold
pwm_time_usPWM on-time limit in microseconds (0 = auto-calculate)
sensitivityStall detection sensitivity

Member Data Documentation

◆ min_velocity

float tmc51x0::DcStepConfig::min_velocity {0.0F}

Minimum velocity threshold for DcStep activation.

Below this velocity, motor operates in normal microstep mode. In DcStep operation, motor operates at minimum this velocity even when blocked.

Set to the lowest operating velocity where DcStep gives reliable detection.

Note
Unit is specified by velocity_unit field.
Set to 0.0 to disable DcStep. Minimum velocity for DcStep (0 = disabled)

◆ pwm_on_time_us

float tmc51x0::DcStepConfig::pwm_on_time_us {0.0F}

PWM on-time limit for commutation (user-friendly)

Controls the reference pulse width for DcStep load measurement. Must be optimized for robust operation with maximum motor torque.

Higher value = higher torque and higher velocity capability Lower value = operation down to lower velocity (as set by min_velocity)

Should be set slightly above effective blank time (TBL from CHOPCONF). Lower limit: TBL clock cycles + n (where n = 1-100 for typical motor)

Range: 0.1-85.3µs (for 12MHz clock) or 0.1-42.7µs (for 24MHz clock)

Note
Automatically converted to DC_TIME register value (0-1023 clock cycles).
If 0, DcStep uses default value based on blank time. PWM on-time limit in microseconds (0 = auto-calculate)

◆ stall_sensitivity

DcStepStallSensitivity tmc51x0::DcStepConfig::stall_sensitivity {DcStepStallSensitivity::MODERATE}

Stall detection sensitivity.

Controls stall detection threshold in DcStep mode. Higher sensitivity detects stalls earlier but may trigger false positives.

Note
Automatically calculated from pwm_on_time_us if MODERATE/HIGH/LOW selected.
Set to DISABLED to disable stall detection. Stall detection sensitivity

◆ stop_on_stall

bool tmc51x0::DcStepConfig::stop_on_stall {false}

Enable stop on stall.

If true, motor stops (VACTUAL = 0) when stall is detected. Motor remains stopped until RAMP_STAT.event_stop_sg flag is read.

Note
Requires stall_sensitivity != DISABLED.
Requires StallGuard2 to be configured (TCOOLTHRS set). Stop motor when stall detected

◆ velocity_unit

Unit tmc51x0::DcStepConfig::velocity_unit {Unit::Steps}

Unit for velocity threshold.

Specifies the unit used for min_velocity field. Unit for velocity threshold


The documentation for this struct was generated from the following file: