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

CoolStep configuration structure. More...

#include <tmc51x0_types.hpp>

Public Member Functions

 CoolStepConfig ()=default
 Default constructor.
 
 CoolStepConfig (uint16_t lower_sg, uint16_t upper_sg, float min_vel, float max_vel, Unit vel_unit=Unit::RevPerSec)
 Helper constructor for common configuration.
 

Public Attributes

uint16_t lower_threshold_sg {0}
 Lower StallGuard2 threshold for current increase.
 
uint16_t upper_threshold_sg {0}
 Upper StallGuard2 threshold for current decrease.
 
CoolStepIncrementStep increment_step {CoolStepIncrementStep::STEP_2}
 Current increment step width.
 
CoolStepDecrementSpeed decrement_speed {CoolStepDecrementSpeed::EVERY_8}
 Current decrement speed.
 
CoolStepMinCurrent min_current {CoolStepMinCurrent::HALF_IRUN}
 Minimum current percentage.
 
bool enable_filter {false}
 Enable StallGuard2 filter (reduces measurement rate by 4x)
 
float min_velocity {0.0F}
 Lower velocity threshold for CoolStep activation.
 
float max_velocity {0.0F}
 Upper velocity threshold for CoolStep activation.
 
Unit velocity_unit {Unit::Steps}
 Unit for velocity thresholds.
 

Detailed Description

CoolStep configuration structure.

User-friendly configuration for CoolStep automatic current reduction feature. CoolStep automatically reduces motor current when load is low, saving energy and reducing heat.

Note
CoolStep requires SpreadCycle mode (StealthChop must be disabled).
CoolStep uses StallGuard2 to measure motor load, so StallGuard2 must be properly tuned.
See also
Datasheet section 14: CoolStep Operation

Constructor & Destructor Documentation

◆ CoolStepConfig() [1/2]

tmc51x0::CoolStepConfig::CoolStepConfig ( )
default

Default constructor.

Initializes with CoolStep disabled (semin=0). All fields use default member initializers.

◆ CoolStepConfig() [2/2]

tmc51x0::CoolStepConfig::CoolStepConfig ( uint16_t lower_sg,
uint16_t upper_sg,
float min_vel,
float max_vel,
Unit vel_unit = Unit::RevPerSec )
inline

Helper constructor for common configuration.

Creates a CoolStep configuration with typical settings:

  • Lower threshold: 64 (increases current when SG < 64)
  • Upper threshold: 256 (decreases current when SG >= 256)
  • Moderate increment/decrement speeds
  • 50% minimum current
Parameters
lower_sgLower SG threshold (0-1023, 0 to disable CoolStep)
upper_sgUpper SG threshold (0-1023, must be > lower_sg)
min_velMinimum velocity for CoolStep activation
max_velMaximum velocity for CoolStep activation
vel_unitUnit for velocity thresholds

Member Data Documentation

◆ decrement_speed

CoolStepDecrementSpeed tmc51x0::CoolStepConfig::decrement_speed {CoolStepDecrementSpeed::EVERY_8}

Current decrement speed.

◆ enable_filter

bool tmc51x0::CoolStepConfig::enable_filter {false}

Enable StallGuard2 filter (reduces measurement rate by 4x)

◆ increment_step

CoolStepIncrementStep tmc51x0::CoolStepConfig::increment_step {CoolStepIncrementStep::STEP_2}

Current increment step width.

◆ lower_threshold_sg

uint16_t tmc51x0::CoolStepConfig::lower_threshold_sg {0}

Lower StallGuard2 threshold for current increase.

When SG_RESULT falls below this value, CoolStep increases current. Range: 0-1023 (actual SG_RESULT values)

Set to 0 to disable CoolStep.

Note
Automatically converted to SEMIN register value internally: SEMIN = lower_threshold_sg / 32 Lower threshold in SG units (0-1023, 0 = CoolStep disabled)

◆ max_velocity

float tmc51x0::CoolStepConfig::max_velocity {0.0F}

Upper velocity threshold for CoolStep activation.

CoolStep is disabled above this velocity. Set to match the upper limit of velocity range where StallGuard2 gives stable results.

Note
Unit is specified by velocity_unit field. Maximum velocity for CoolStep (0 = no upper limit)

◆ min_current

CoolStepMinCurrent tmc51x0::CoolStepConfig::min_current {CoolStepMinCurrent::HALF_IRUN}

Minimum current percentage.

◆ min_velocity

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

Lower velocity threshold for CoolStep activation.

CoolStep is disabled below this velocity. Set to match the lower limit of velocity range where StallGuard2 gives stable results.

Note
Unit is specified by velocity_unit field.
Setting equal to max_velocity disables CoolStep during acceleration/deceleration. Minimum velocity for CoolStep (0 = disabled)

◆ upper_threshold_sg

uint16_t tmc51x0::CoolStepConfig::upper_threshold_sg {0}

Upper StallGuard2 threshold for current decrease.

When SG_RESULT is equal to or above this value enough times, CoolStep decreases current. Range: 0-1023 (actual SG_RESULT values)

Must be greater than lower_threshold_sg for CoolStep to function properly.

Note
Automatically converted to SEMAX register value internally based on lower_threshold_sg Upper threshold in SG units (0-1023)

◆ velocity_unit

Unit tmc51x0::CoolStepConfig::velocity_unit {Unit::Steps}

Unit for velocity thresholds.

Specifies the unit used for min_velocity and max_velocity fields. Unit for velocity thresholds


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