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

Ramp configuration structure. More...

#include <tmc51x0_types.hpp>

Collaboration diagram for tmc51x0::RampConfig:
[legend]

Public Member Functions

 RampConfig ()=default
 Default constructor.
 

Public Attributes

VelocityValue vstart {0.0f, Unit::Steps}
 Start velocity (0 = can be set to zero if not used)
 
VelocityValue vstop {10.0f, Unit::Steps}
 Stop velocity (must be >= VSTART, minimum 1 recommended)
 
VelocityValue vmax {0.0f, Unit::Steps}
 Maximum velocity (0 = must be set via SetMaxSpeed() before motion)
 
VelocityValue v1 {0.0f, Unit::Steps}
 Transition velocity (switches between A1/AMAX and D1/DMAX, 0 = disabled)
 
AccelerationValue amax {0.0f, Unit::Steps}
 Maximum acceleration (used above V1, 0 = must be set via SetAcceleration() before motion)
 
AccelerationValue a1 {0.0f, Unit::Steps}
 First acceleration (used between VSTART and V1, 0 = use AMAX)
 
AccelerationValue dmax {0.0f, Unit::Steps}
 Maximum deceleration (used above V1, 0 = uses AMAX value)
 
AccelerationValue d1 {100.0f, Unit::Steps}
 First deceleration (used between VSTOP and V1, must not be 0 in positioning mode)
 
float tpowerdown_ms {437.0F}
 
float tzerowait_ms
 Velocity-zero wait time (TZEROWAIT)
 

Detailed Description

Ramp configuration structure.

Configuration parameters for the TMC51x0 ramp generator. The ramp generator provides two-phase acceleration and deceleration with programmable start/stop velocities and transition speed (V1) for optimal motor torque utilization.

Note
All velocity and acceleration parameters now use self-describing types (VelocityValue, AccelerationValue) that explicitly carry their units, eliminating ambiguity.
Parameters set to 0.0 will use driver defaults or be auto-calculated where applicable.
VSTOP must be >= VSTART to ensure successful motion termination.
D1 must not be 0 in positioning mode (defaults to 100 if not set).
See also
Datasheet section 12: Ramp Generator

Constructor & Destructor Documentation

◆ RampConfig()

tmc51x0::RampConfig::RampConfig ( )
default

Default constructor.

Initializes with recommended default values:

  • VSTART: {0, Unit::Steps} (can be zero if not used)
  • VSTOP: {10, Unit::Steps} (minimum recommended, ensures successful motion termination)
  • VMAX: {0, Unit::Steps} (must be set before motion)
  • V1: {0, Unit::Steps} (disabled, uses single acceleration/deceleration)
  • AMAX: {0, Unit::Steps} (must be set before motion)
  • A1: {0, Unit::Steps} (uses AMAX)
  • DMAX: {0, Unit::Steps} (uses AMAX value)
  • D1: {100, Unit::Steps} (required for positioning mode)
  • TPOWERDOWN: 437ms (~0.44s at 12MHz, equivalent to register value 20)
  • TZEROWAIT: 0ms (no delay)

Member Data Documentation

◆ a1

AccelerationValue tmc51x0::RampConfig::a1 {0.0f, Unit::Steps}

First acceleration (used between VSTART and V1, 0 = use AMAX)

◆ amax

AccelerationValue tmc51x0::RampConfig::amax {0.0f, Unit::Steps}

Maximum acceleration (used above V1, 0 = must be set via SetAcceleration() before motion)

◆ d1

AccelerationValue tmc51x0::RampConfig::d1 {100.0f, Unit::Steps}

First deceleration (used between VSTOP and V1, must not be 0 in positioning mode)

◆ dmax

AccelerationValue tmc51x0::RampConfig::dmax {0.0f, Unit::Steps}

Maximum deceleration (used above V1, 0 = uses AMAX value)

◆ tpowerdown_ms

float tmc51x0::RampConfig::tpowerdown_ms {437.0F}

Power down delay in milliseconds (0-5600ms at 12MHz, automatically converted) Time before motor power down after standstill. Conversion: tpowerdown_register = time_ms * fCLK / (2^18 * 1000)

Note
Actual time depends on clock frequency (fCLK). At 12MHz: ~0-5.6s range.

◆ tzerowait_ms

float tmc51x0::RampConfig::tzerowait_ms
Initial value:
{
0.0F}

Velocity-zero wait time (TZEROWAIT)

Defines the time the internal ramp generator waits when velocity reaches zero before continuing with the next acceleration or deceleration phase.

This allows precise stop-and-go motion, mechanical settle time, and synchronization at standstill. Useful for accurate positioning moves, step-accurate cornering in CNC applications, and ensuring mechanical settle time.

Units:

  • 1 unit = (2^18 / f_clk) seconds
  • Example @ 12 MHz: 1 unit ≈ 21.85 ms
  • Example @ 24 MHz: 1 unit ≈ 10.92 ms

Range:

  • 0 to 65535 (0 = no waiting, instant continuation)
  • Maximum wait time @ 12 MHz: 65535 × 21.85 ms ≈ 1430 seconds (~23.8 minutes)
  • Maximum wait time @ 24 MHz: 65535 × 10.92 ms ≈ 715 seconds (~11.9 minutes)

Total wait time calculation:

  • t_wait = TZEROWAIT × (2^18 / f_clk) seconds
  • t_wait_ms = TZEROWAIT × (2^18 / f_clk) × 1000 milliseconds

Conversion from milliseconds:

  • TZEROWAIT = round((time_ms × f_clk) / (1000 × 2^18))
  • Constrained to range 0-65535

Important Notes:

  • Used only with the internal ramp generator (positioning / velocity mode)
  • Has no effect in external Step/Dir mode (SD_MODE=1)
  • Similar time base to IHOLDDELAY, but unrelated functionally
  • IHOLDDELAY is for current control (motor power down), TZEROWAIT is for motion profile timing
  • The wait occurs when velocity == 0 AND ramp generator requires switching direction/phase

Typical Usage:

  • 0 ms: No waiting (instant continuation) - fastest, may cause mechanical issues
  • 20-100 ms: Typical range for most applications (allows mechanical settle)
  • 100-500 ms: For applications requiring precise synchronization or longer settle time
  • >500 ms: Rarely needed, only for special applications requiring extended standstill
Note
This value specifies total wait time in milliseconds, automatically converted to register value (0-65535)
The wait time is quantized to discrete register values - actual time may differ slightly from desired value
Default: 0.0 (no waiting, instant continuation) Velocity-zero wait time in milliseconds (0 = no waiting, auto-calculated to register value 0-65535)

◆ v1

VelocityValue tmc51x0::RampConfig::v1 {0.0f, Unit::Steps}

Transition velocity (switches between A1/AMAX and D1/DMAX, 0 = disabled)

◆ vmax

VelocityValue tmc51x0::RampConfig::vmax {0.0f, Unit::Steps}

Maximum velocity (0 = must be set via SetMaxSpeed() before motion)

◆ vstart

VelocityValue tmc51x0::RampConfig::vstart {0.0f, Unit::Steps}

Start velocity (0 = can be set to zero if not used)

◆ vstop

VelocityValue tmc51x0::RampConfig::vstop {10.0f, Unit::Steps}

Stop velocity (must be >= VSTART, minimum 1 recommended)


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