HF-TMC9660 Driver
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
TMC9660::Ramp Struct Reference

Hardware 8-segment acceleration/dec-acc profile controller. More...

#include <TMC9660.hpp>

Collaboration diagram for TMC9660::Ramp:

Public Member Functions

bool enable (bool on) noexcept
 Enable or disable the ramp generator block.
 
bool setAcceleration (uint32_t a1, uint32_t a2, uint32_t aMax) noexcept
 Set acceleration segments A1, A2, Amax (µ units/s²).
 
bool setDeceleration (uint32_t d1, uint32_t d2, uint32_t dMax) noexcept
 Set deceleration segments D1, D2, Dmax (µ units/s²).
 
bool setVelocities (uint32_t vStart, uint32_t vStop, uint32_t v1, uint32_t v2, uint32_t vMax) noexcept
 Configure velocity thresholds and limits.
 
bool setTiming (uint16_t tVmaxCycles, uint16_t tZeroWaitCycles) noexcept
 Timing constraints at Vmax and between moves.
 
bool enableFeedForward (bool enableVelFF, bool enableAccelFF, uint16_t accelFFGain, tmc9660::tmcl::AccelerationFFShift accelFFShift) noexcept
 Enable hardware feed-forward terms and set gain/shift.
 
bool setDirectVelocityMode (bool enable) noexcept
 Direct-velocity mode instead of classic PI velocity loop.
 
bool getRampVelocity (int32_t &velocity) noexcept
 Get the current target velocity calculated by the ramp controller.
 
bool getRampPosition (int32_t &position) noexcept
 Get the current target position calculated by the ramp controller.
 

Private Member Functions

 Ramp (TMC9660 &parent) noexcept
 

Private Attributes

TMC9660driver
 

Friends

class TMC9660
 

Detailed Description

Hardware 8-segment acceleration/dec-acc profile controller.

Covers all ramp generator and feedforward parameters:

  • ACCELERATION_FF_GAIN (50)
  • ACCELERATION_FF_SHIFT (51)
  • RAMP_ENABLE (52)
  • DIRECT_VELOCITY_MODE (53)
  • RAMP_AMAX/A1/A2 (54/55/56)
  • RAMP_DMAX/D1/D2 (57/58/59)
  • RAMP_VMAX/V1/V2/VSTART/VSTOP (60/61/62/63/64)
  • RAMP_TVMAX/TZEROWAIT (65/66)
  • ACCELERATION_FEEDFORWARD_ENABLE (67)
  • VELOCITY_FEEDFORWARD_ENABLE (68)
  • RAMP_VELOCITY (69)
  • RAMP_POSITION (70)

Constructor & Destructor Documentation

◆ Ramp()

TMC9660::Ramp::Ramp ( TMC9660 parent)
inlineexplicitprivatenoexcept

Member Function Documentation

◆ enable()

bool TMC9660::Ramp::enable ( bool  on)
noexcept

Enable or disable the ramp generator block.

Parameters
onTrue to enable, false to disable (RAMP_ENABLE).

◆ enableFeedForward()

bool TMC9660::Ramp::enableFeedForward ( bool  enableVelFF,
bool  enableAccelFF,
uint16_t  accelFFGain,
tmc9660::tmcl::AccelerationFFShift  accelFFShift 
)
noexcept

Enable hardware feed-forward terms and set gain/shift.

This allows the ramp generator to use feed-forward terms for velocity and acceleration.

Parameters
enableVelFFEnable the VELOCITY_FEEDFORWARD feature (VELOCITY_FEEDFORWARD_ENABLE)
enableAccelFFEnable the ACCELERATION_FEEDFORWARD feature (ACCELERATION_FEEDFORWARD_ENABLE)
accelFFGainACCELERATION_FF_GAIN (0…65535)
accelFFShiftACCELERATION_FF_SHIFT enum (tmc9660::tmcl::AccelerationFFShift)

◆ getRampPosition()

bool TMC9660::Ramp::getRampPosition ( int32_t &  position)
noexcept

Get the current target position calculated by the ramp controller.

Parameters
[out]positionThe current ramp target position (RAMP_POSITION, param 70)
Returns
true if the value was read successfully.

◆ getRampVelocity()

bool TMC9660::Ramp::getRampVelocity ( int32_t &  velocity)
noexcept

Get the current target velocity calculated by the ramp controller.

Parameters
[out]velocityThe current ramp target velocity (RAMP_VELOCITY, param 69)
Returns
true if the value was read successfully.

◆ setAcceleration()

bool TMC9660::Ramp::setAcceleration ( uint32_t  a1,
uint32_t  a2,
uint32_t  aMax 
)
noexcept

Set acceleration segments A1, A2, Amax (µ units/s²).

Parameters
a1First acceleration (RAMP_A1)
a2Second acceleration (RAMP_A2)
aMaxTop acceleration (RAMP_AMAX)

◆ setDeceleration()

bool TMC9660::Ramp::setDeceleration ( uint32_t  d1,
uint32_t  d2,
uint32_t  dMax 
)
noexcept

Set deceleration segments D1, D2, Dmax (µ units/s²).

Parameters
d1Second deceleration (RAMP_D1)
d2First deceleration (RAMP_D2)
dMaxTop deceleration (RAMP_DMAX)

◆ setDirectVelocityMode()

bool TMC9660::Ramp::setDirectVelocityMode ( bool  enable)
noexcept

Direct-velocity mode instead of classic PI velocity loop.

Parameters
enableTrue to enable direct velocity mode (DIRECT_VELOCITY_MODE)

◆ setTiming()

bool TMC9660::Ramp::setTiming ( uint16_t  tVmaxCycles,
uint16_t  tZeroWaitCycles 
)
noexcept

Timing constraints at Vmax and between moves.

Parameters
tVmaxCyclesMinimum time at VMAX (RAMP_TVMAX)
tZeroWaitCyclesWait time at end of ramp (RAMP_TZEROWAIT)

◆ setVelocities()

bool TMC9660::Ramp::setVelocities ( uint32_t  vStart,
uint32_t  vStop,
uint32_t  v1,
uint32_t  v2,
uint32_t  vMax 
)
noexcept

Configure velocity thresholds and limits.

Parameters
vStartStart velocity (RAMP_VSTART)
vStopStop velocity (RAMP_VSTOP)
v1Velocity threshold 1 (RAMP_V1)
v2Velocity threshold 2 (RAMP_V2)
vMaxMaximum velocity (RAMP_VMAX)

Friends And Related Symbol Documentation

◆ TMC9660

friend class TMC9660
friend

Member Data Documentation

◆ driver

TMC9660& TMC9660::Ramp::driver
private

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