stepRocker Open Source TMCL
1.00
|
TMC262 library. More...
Go to the source code of this file.
Functions | |
void | InitMotorDrivers (void) |
Initialise all motor drivers. More... | |
void | Set262StepDirMStepRes (UCHAR Which262, UCHAR MicrostepResolution) |
Set the microstep resolution. More... | |
void | Set262StepDirInterpolation (UCHAR Which262, UCHAR Interpolation) |
Turn interpolation mode on or off. More... | |
void | Set262StepDirDoubleEdge (UCHAR Which262, UCHAR DoubleEdge) |
Set double step mode. More... | |
UCHAR | Get262StepDirMStepRes (UCHAR Which262) |
Get microstep resolution. More... | |
UCHAR | Get262StepDirInterpolation (UCHAR Which262) |
Get interpolation mode. More... | |
UCHAR | Get262StepDirDoubleEdge (UCHAR Which262) |
Get microstep resolution. More... | |
void | Set262ChopperBlankTime (UCHAR Which262, UCHAR BlankTime) |
Set chopper blank time. More... | |
void | Set262ChopperMode (UCHAR Which262, UCHAR Mode) |
Set chopper mode. More... | |
void | Set262ChopperRandomTOff (UCHAR Which262, UCHAR RandomTOff) |
Set random TOff mode. More... | |
void | Set262ChopperHysteresisDecay (UCHAR Which262, UCHAR HysteresisDecay) |
Set chopper hysteresis decay parameter (HDEC) More... | |
void | Set262ChopperHysteresisEnd (UCHAR Which262, UCHAR HysteresisEnd) |
Set chopper hysteresis end parameter (HEND) More... | |
void | Set262ChopperHysteresisStart (UCHAR Which262, UCHAR HysteresisStart) |
Set chopper hysteresis start parameter (HSTART) More... | |
void | Set262ChopperTOff (UCHAR Which262, UCHAR TOff) |
Set chopper off time (TOff) More... | |
UCHAR | Get262ChopperBlankTime (UCHAR Which262) |
Get chopper blank time. More... | |
UCHAR | Get262ChopperMode (UCHAR Which262) |
Get chopper mode. More... | |
UCHAR | Get262ChopperRandomTOff (UCHAR Which262) |
Get random TOff mode. More... | |
UCHAR | Get262ChopperHysteresisDecay (UCHAR Which262) |
Get chopper hysteresis decay (HDEC) More... | |
UCHAR | Get262ChopperHysteresisEnd (UCHAR Which262) |
Get chopper hysteresis end (HEND) More... | |
UCHAR | Get262ChopperHysteresisStart (UCHAR Which262) |
Get chopper hysteresis start (HSTART) More... | |
UCHAR | Get262ChopperTOff (UCHAR Which262) |
Get chopper off time value. More... | |
void | Set262SmartEnergyIMin (UCHAR Which262, UCHAR SmartIMin) |
Set smart energy minimum current. More... | |
void | Set262SmartEnergyDownStep (UCHAR Which262, UCHAR SmartDownStep) |
Set smart energy down step. More... | |
void | Set262SmartEnergyStallLevelMax (UCHAR Which262, UCHAR StallLevelMax) |
Set smart enery hysteresis width. More... | |
void | Set262SmartEnergyUpStep (UCHAR Which262, UCHAR SmartUpStep) |
Set smart energy up step. More... | |
void | Set262SmartEnergyStallLevelMin (UCHAR Which262, UCHAR StallLevelMin) |
Set smart energy hysteresis start. More... | |
UCHAR | Get262SmartEnergyIMin (UCHAR Which262) |
Get minimum current. More... | |
UCHAR | Get262SmartEnergyDownStep (UCHAR Which262) |
Get current down step speed. More... | |
UCHAR | Get262SmartEnergyStallLevelMax (UCHAR Which262) |
Get hystersis width. More... | |
UCHAR | Get262SmartEnergyUpStep (UCHAR Which262) |
Get current up step width. More... | |
UCHAR | Get262SmartEnergyStallLevelMin (UCHAR Which262) |
Get hysteresis start. More... | |
void | Set262StallGuardFilter (UCHAR Which262, UCHAR Enable) |
Set stallGuard filter. More... | |
void | Set262StallGuardThreshold (UCHAR Which262, signed char Threshold) |
Set stallGuard threshold value. More... | |
void | Set262StallGuardCurrentScale (UCHAR Which262, UCHAR CurrentScale) |
Set current scale value. More... | |
UCHAR | Get262StallGuardFilter (UCHAR Which262) |
Get stallGuard filter. More... | |
signed char | Get262StallGuardThreshold (UCHAR Which262) |
Get stallGuard threshold setting. More... | |
UCHAR | Get262StallGuardCurrentScale (UCHAR Which262) |
Get motor current setting. More... | |
void | Set262DriverSlopeHighSide (UCHAR Which262, UCHAR SlopeHighSide) |
Set slope high side value (SLPH) More... | |
void | Set262DriverSlopeLowSide (UCHAR Which262, UCHAR SlopeLowSide) |
Set slope low side value (SLPL) More... | |
void | Set262DriverDisableProtection (UCHAR Which262, UCHAR DisableProtection) |
Disable short to GND protection. More... | |
void | Set262DriverProtectionTimer (UCHAR Which262, UCHAR ProtectionTimer) |
Set protection timer value. More... | |
void | Set262DriverStepDirectionOff (UCHAR Which262, UCHAR SDOff) |
Disable/enable step direction input. More... | |
void | Set262DriverVSenseScale (UCHAR Which262, UCHAR Scale) |
Sets the sense voltage. More... | |
void | Set262DriverReadSelect (UCHAR Which262, UCHAR ReadSelect) |
Selects the values to be read. More... | |
UCHAR | Get262DriverSlopeHighSide (UCHAR Which262) |
Get slope high side value (SLPH) More... | |
UCHAR | Get262DriverSlopeLowSide (UCHAR Which262) |
Get slope high side value (SLPL) More... | |
UCHAR | Get262DriverDisableProtection (UCHAR Which262) |
Get driver protection disable setting. More... | |
UCHAR | Get262DriverProtectionTimer (UCHAR Which262) |
Get protection timer setting. More... | |
UCHAR | Get262DriverStepDirectionOff (UCHAR Which262) |
Get step direction input enable setting. More... | |
UCHAR | Get262DriverVSenseScale (UCHAR Which262) |
Get VSense scale setting. More... | |
UCHAR | Get262DriverReadSelect (UCHAR Which262) |
Get selected read back mode. More... | |
void | Disable262 (UCHAR Which262) |
Disable a motor driver. More... | |
void | Enable262 (UCHAR Which262) |
Enable a motor driver. More... | |
void | Read262State (UCHAR Which262, UCHAR *Phases, UCHAR *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags) |
Read the status register of a TMC26x. More... | |
void | Read262StateNoCoverData (UCHAR Which262, UCHAR *Phases, USHORT *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags) |
TMC262 library.
This file contains all macro and function definitions of the TMC26x library.
void Disable262 | ( | UCHAR | Which262 | ) |
Disable a motor driver.
Which262 | Axis number (always 0 on stepRocker) |
Completely switch off a motor driver (by setting its TOff value to zero).
void Enable262 | ( | UCHAR | Which262 | ) |
Enable a motor driver.
Which262 | Axis number (always 0 on stepRocker) |
Re-enable a motor driver (by setting its TOff value back to the original value).
Get chopper blank time.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the chopper blank time from the software copy of the TMC26x registers.
Get chopper hysteresis decay (HDEC)
Which262 | Axis number (with stepRocker always 0) |
This function reads back the chopper hysteresis decay value from the software copy of the TMC26x registers.
Get chopper hysteresis end (HEND)
Which262 | Axis number (with stepRocker always 0) |
This function reads back the chopper hysteresis end value from the software copy of the TMC26x registers.
Get chopper hysteresis start (HSTART)
Which262 | Axis number (with stepRocker always 0) |
This function reads back the chopper hysteresis start value from the software copy of the TMC26x registers.
Get chopper mode.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the chopper mode from the software copy of the TMC26x registers.
Get random TOff mode.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the random TOff mode from the software copy of the TMC26x registers.
Get chopper off time value.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the TOff value from the software copy of the TMC26x registers.
Get driver protection disable setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the protection disable setting value from the software copy of the TMC26x registers.
Get protection timer setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the protection timer setting from the software copy of the TMC26x registers.
Get selected read back mode.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the read back mode setting from the software copy of the TMC26x registers.
Get slope high side value (SLPH)
Which262 | Axis number (with stepRocker always 0) |
This function reads back the SLPH value from the software copy of the TMC26x registers.
Get slope high side value (SLPL)
Which262 | Axis number (with stepRocker always 0) |
This function reads back the SLPL value from the software copy of the TMC26x registers.
Get step direction input enable setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the step direction input setting from the software copy of the TMC26x registers.
Get VSense scale setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the VSense scale setting from the software copy of the TMC26x registers.
Get current down step speed.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the smart energy current down step speed setting from the software copy of the TMC26x registers.
Get minimum current.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the smart energy minimum current setting from the software copy of the TMC26x registers.
Get hystersis width.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the stall level maximum value (which is the coolStep hysteresis width9 from the software copy of the TMC26x registers.
Get hysteresis start.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the smart energy minimum stall level (which is the start of the coolStep hystetesis) from the software copy of the TMC26x registers.
Get current up step width.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the current up step setting from the software copy of the TMC26x registers.
Get motor current setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the motor current setting from the software copy of the TMC26x registers.
Get stallGuard filter.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the stallGuard filter settings from the software copy of the TMC26x registers.
signed char Get262StallGuardThreshold | ( | UCHAR | Which262 | ) |
Get stallGuard threshold setting.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the stallGuard thresholg value from the software copy of the TMC26x registers.
Get microstep resolution.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the double step mode from the software copy of the TMC26x registers.
Get interpolation mode.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the microstep interpolation mode from the software copy of the TMC26x registers.
Get microstep resolution.
Which262 | Axis number (with stepRocker always 0) |
This function reads back the microstep resolution value from the software copy of the TMC26x registers.
void InitMotorDrivers | ( | void | ) |
Initialise all motor drivers.
This function initalizes the software copies of all TMC26x registers and sends this basic initialization data to all TMC26x ICs.
void Read262State | ( | UCHAR | Which262, |
UCHAR * | Phases, | ||
UCHAR * | MStep, | ||
UINT * | StallGuard, | ||
UCHAR * | SmartEnergy, | ||
UCHAR * | Flags | ||
) |
Read the status register of a TMC26x.
Which262 | axis number (always 0 on stepRocker) |
Phases | pointer at variable for phase bits |
MStep | pointer at variable for microstep position |
StallGuard | pointer at variable for stallGuard load value |
SmartEnergy | pointer at variable for smartEnergy actual current |
Flags | pointer at variable for driver error flags |
This function reads out the actual status information of a TMC26x. The data will be decoded according to the read back mode that has been set using Set262DriverReadSelect(). For values that are not needed NULL pointers can be specified.
Set chopper blank time.
Which262 | Axis number (with stepRocker always 0) |
BlankTime | chopper blank time |
This function sets the chopper blank time.
Set chopper hysteresis decay parameter (HDEC)
Which262 | Axis number (with stepRocker always 0) |
HysteresisDecay | HDEC parameter |
This function sets the chopper hysteresis decrement parameter (HDEC).
Set chopper hysteresis end parameter (HEND)
Which262 | Axis number (with stepRocker always 0) |
HysteresisEnd | HEND parameter |
This function sets the chopper hysteresis end parameter (HEND).
Set chopper hysteresis start parameter (HSTART)
Which262 | Axis number (with stepRocker always 0) |
HysteresisStart | HSTART parameter |
This function sets the chopper hysteresis start parameter (HSTART).
Set chopper mode.
Which262 | Axis number (with stepRocker always 0) |
Mode | chopper mode (0=spread cycle mode, 1=classic mode) |
This function sets the chopper mode.
Set random TOff mode.
Which262 | Axis number (with stepRocker always 0) |
RandomTOff | Random TOff mode (0=off, 1=on) |
This function turns random TOff mode on or off.
Set chopper off time (TOff)
Which262 | Axis number (with stepRocker always 0) |
TOff | TOff parameter |
This function sets the chopper off time parameter (TOff).
Disable short to GND protection.
Which262 | Axis number (with stepRocker always 0) |
DisableProtection | 0=protection enabled 1=protection disabled |
This function disables or enables the short to ground protection.
Set protection timer value.
Which262 | Axis number (with stepRocker always 0) |
ProtectionTimer | Protection time (0..3) |
This function sets the short to ground protection timer value.
Selects the values to be read.
Which262 | Axis number (with stepRocker always 0) |
ReadSelect | readback mode (TMC262_RB_MSTEP, TMC262_RB_STALL_GUARD, TMC262_RB_SMART_ENERGY) |
This selects which values are to be read back from the TMC26x with every SPI datagram (important for the Read262State() function).
Set slope high side value (SLPH)
Which262 | Axis number (with stepRocker always 0) |
SlopeHighSide | Slope high side value |
This function sets the slope control high side value (SLPH).
Set slope low side value (SLPL)
Which262 | Axis number (with stepRocker always 0) |
SlopeLowSide | Slope low side value |
This function sets the slope control low side value (SLPL).
Disable/enable step direction input.
Which262 | Axis number (with stepRocker always 0) |
SDOff | 0=step direction input enable 1=step direction input disable |
This function turns the step direction input on or off.
Sets the sense voltage.
Which262 | Axis number (with stepRocker always 0) |
Scale | 0=300mV 1=160mV |
This function sets the sense voltage.
Set smart energy down step.
Which262 | Axis number (with stepRocker always 0) |
SmartDownStep | down step speed (0..3) |
This function sets the current down step speed used with coolStep, where 0 ist the highest and 3 is the lowest speed.
Set smart energy minimum current.
Which262 | Axis number (with stepRocker always 0) |
SmartIMin | Minimum current (0=1/2, 1=1/4 of current setting) |
This function sets the minimum current used with coolStep, which can be either 1/2 or 1/4 of the normal current setting.
Set smart enery hysteresis width.
Which262 | Axis number (with stepRocker always 0) |
StallLevelMax | hysteresis width (0..15) |
This function sets the SEMAX parameter which defines the width of the smart energy stall level hysteresis.
Set smart energy hysteresis start.
Which262 | Axis number (with stepRocker always 0) |
StallLevelMin | minimum stall level (0..15) |
This function sets the start point of the hysteresis used for coolStep. A value of 0 completely turns off coolStep.
Set smart energy up step.
Which262 | Axis number (with stepRocker always 0) |
SmartUpStep | up step width (0..3) |
This function sets the current up step width used with coolStep, where 0 ist the lowest and 3 is the highest up step width.
Set current scale value.
Which262 | Axis number (with stepRocker always 0) |
CurrentScale | Current scale value (0..31) |
This function sets the maximum motor current.
Set stallGuard filter.
Which262 | Axis number (with stepRocker always 0) |
Enable | stallGuard filter (0=off, 1=on) |
This function turns the stallGuard filter on or off.
void Set262StallGuardThreshold | ( | UCHAR | Which262, |
signed char | Threshold | ||
) |
Set stallGuard threshold value.
Which262 | Axis number (with stepRocker always 0) |
Threshold | stallGuard threshold (-63..+63) |
This function sets the stallGuard threshold value.
Set double step mode.
Which262 | Axis number (with stepRocker always 0) |
DoubleEdge | 0=double step off, 1=double step on |
This function sets the double step mode, so that with every step pulse two microsteps will be executed (one with the rising edge end one with the falling edge of every pulse).
Turn interpolation mode on or off.
Which262 | Axis number (with stepRocker always 0) |
Interpolation | Interpolation mode (0=off, 1=on) |
This function turns interpolation mode on or off. Interpolation mode only works with microstep resolution set to 16 microsteps.
Set the microstep resolution.
Which262 | Axis number (with stepRocker always 0) |
MicrostepResolution | micrstep resolution (0..8) |
This function sets the microstep resolution, where 0 selects the highest resolution (256 microsteps) and 8 the lowest (full step).