stepRocker Open Source TMCL  1.00
 All Data Structures Files Functions Variables Typedefs Enumerations Macros
TMC262.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Project: stepRocker Mini-TMCL (for stepRocker V2.2)
3 
4  Module: TMC262.h
5  Definitions of TMC262 library functions
6 
7  Copyright (C) 2016 TRINAMIC Motion Control GmbH & Co KG
8  Waterloohain 5
9  D - 22769 Hamburg, Germany
10  http://www.trinamic.com/
11 
12  This program is free software; you can redistribute it and/or modify it
13  freely.
14 
15  This program is distributed "as is" in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17  or FITNESS FOR A PARTICULAR PURPOSE.
18 *******************************************************************************/
19 
30 #ifndef __TMCM262_H
31 #define __TMCM262_H
32 
33 #define TMC262_RB_MSTEP 0
34 #define TMC262_RB_STALL_GUARD 1
35 #define TMC262_RB_SMART_ENERGY 2
36 #define TMC262_RB_ENCODER 3
37 
38 #define TMC262_FLAG_STST 0x80
39 #define TMC262_FLAG_OLB 0x40
40 #define TMC262_FLAG_OLA 0x20
41 #define TMC262_FLAG_S2GB 0x10
42 #define TMC262_FLAG_S2GA 0x08
43 #define TMC262_FLAG_OTPW 0x04
44 #define TMC262_FLAG_OT 0x02
45 #define TMC262_FLAG_SG 0x01
46 
47 //Funktionen für den Zugriff auf den TMC262
48 void InitMotorDrivers(void);
49 void Set262StepDirMStepRes(UCHAR Which262, UCHAR MicrostepResolution);
50 void Set262StepDirInterpolation(UCHAR Which262, UCHAR Interpolation);
51 void Set262StepDirDoubleEdge(UCHAR Which262, UCHAR DoubleEdge);
55 
56 void Set262ChopperBlankTime(UCHAR Which262, UCHAR BlankTime);
57 void Set262ChopperMode(UCHAR Which262, UCHAR Mode);
58 void Set262ChopperRandomTOff(UCHAR Which262, UCHAR RandomTOff);
59 void Set262ChopperHysteresisDecay(UCHAR Which262, UCHAR HysteresisDecay);
60 void Set262ChopperHysteresisEnd(UCHAR Which262, UCHAR HysteresisEnd);
61 void Set262ChopperHysteresisStart(UCHAR Which262, UCHAR HysteresisStart);
62 void Set262ChopperTOff(UCHAR Which262, UCHAR TOff);
64 UCHAR Get262ChopperMode(UCHAR Which262);
69 UCHAR Get262ChopperTOff(UCHAR Which262);
70 
71 void Set262SmartEnergyIMin(UCHAR Which262, UCHAR SmartIMin);
72 void Set262SmartEnergyDownStep(UCHAR Which262, UCHAR SmartDownStep);
73 void Set262SmartEnergyStallLevelMax(UCHAR Which262, UCHAR StallLevelMax);
74 void Set262SmartEnergyUpStep(UCHAR Which262, UCHAR SmartUpStep);
75 void Set262SmartEnergyStallLevelMin(UCHAR Which262, UCHAR StallLevelMin);
81 
82 void Set262StallGuardFilter(UCHAR Which262, UCHAR Enable);
83 void Set262StallGuardThreshold(UCHAR Which262, signed char Threshold);
84 void Set262StallGuardCurrentScale(UCHAR Which262, UCHAR CurrentScale);
86 signed char Get262StallGuardThreshold(UCHAR Which262);
88 
89 void Set262DriverSlopeHighSide(UCHAR Which262, UCHAR SlopeHighSide);
90 void Set262DriverSlopeLowSide(UCHAR Which262, UCHAR SlopeLowSide);
91 void Set262DriverDisableProtection(UCHAR Which262, UCHAR DisableProtection);
92 void Set262DriverProtectionTimer(UCHAR Which262, UCHAR ProtectionTimer);
93 void Set262DriverStepDirectionOff(UCHAR Which262, UCHAR SDOff);
94 void Set262DriverVSenseScale(UCHAR Which262, UCHAR Scale);
95 void Set262DriverReadSelect(UCHAR Which262, UCHAR ReadSelect);
103 
104 void Disable262(UCHAR Which262);
105 void Enable262(UCHAR Which262);
106 
107 void Read262State(UCHAR Which262, UCHAR *Phases, UCHAR *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags);
108 void Read262StateNoCoverData(UCHAR Which262, UCHAR *Phases, USHORT *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags);
109 #endif
UCHAR Get262StallGuardFilter(UCHAR Which262)
Get stallGuard filter.
Definition: TMC262.c:889
UCHAR Get262DriverProtectionTimer(UCHAR Which262)
Get protection timer setting.
Definition: TMC262.c:1089
UCHAR Get262StallGuardCurrentScale(UCHAR Which262)
Get motor current setting.
Definition: TMC262.c:919
UCHAR Get262DriverDisableProtection(UCHAR Which262)
Get driver protection disable setting.
Definition: TMC262.c:1074
void Enable262(UCHAR Which262)
Enable a motor driver.
Definition: TMC262.c:1246
void Set262DriverProtectionTimer(UCHAR Which262, UCHAR ProtectionTimer)
Set protection timer value.
Definition: TMC262.c:979
UCHAR Get262StepDirInterpolation(UCHAR Which262)
Get interpolation mode.
Definition: TMC262.c:449
void Set262StepDirDoubleEdge(UCHAR Which262, UCHAR DoubleEdge)
Set double step mode.
Definition: TMC262.c:417
UCHAR Get262DriverSlopeLowSide(UCHAR Which262)
Get slope high side value (SLPL)
Definition: TMC262.c:1059
void Set262StallGuardThreshold(UCHAR Which262, signed char Threshold)
Set stallGuard threshold value.
Definition: TMC262.c:858
void Set262StepDirInterpolation(UCHAR Which262, UCHAR Interpolation)
Turn interpolation mode on or off.
Definition: TMC262.c:398
UCHAR Get262DriverSlopeHighSide(UCHAR Which262)
Get slope high side value (SLPH)
Definition: TMC262.c:1044
void Set262SmartEnergyDownStep(UCHAR Which262, UCHAR SmartDownStep)
Set smart energy down step.
Definition: TMC262.c:704
void Set262DriverSlopeLowSide(UCHAR Which262, UCHAR SlopeLowSide)
Set slope low side value (SLPL)
Definition: TMC262.c:948
void Set262StallGuardCurrentScale(UCHAR Which262, UCHAR CurrentScale)
Set current scale value.
Definition: TMC262.c:873
UCHAR Get262ChopperHysteresisEnd(UCHAR Which262)
Get chopper hysteresis end (HEND)
Definition: TMC262.c:643
void Set262SmartEnergyUpStep(UCHAR Which262, UCHAR SmartUpStep)
Set smart energy up step.
Definition: TMC262.c:736
UCHAR Get262DriverVSenseScale(UCHAR Which262)
Get VSense scale setting.
Definition: TMC262.c:1119
void Set262ChopperTOff(UCHAR Which262, UCHAR TOff)
Set chopper off time (TOff)
Definition: TMC262.c:567
UCHAR Get262ChopperBlankTime(UCHAR Which262)
Get chopper blank time.
Definition: TMC262.c:583
void Set262ChopperHysteresisStart(UCHAR Which262, UCHAR HysteresisStart)
Set chopper hysteresis start parameter (HSTART)
Definition: TMC262.c:552
void Set262DriverSlopeHighSide(UCHAR Which262, UCHAR SlopeHighSide)
Set slope high side value (SLPH)
Definition: TMC262.c:933
UCHAR Get262ChopperHysteresisStart(UCHAR Which262)
Get chopper hysteresis start (HSTART)
Definition: TMC262.c:658
void Set262SmartEnergyStallLevelMin(UCHAR Which262, UCHAR StallLevelMin)
Set smart energy hysteresis start.
Definition: TMC262.c:752
void Read262State(UCHAR Which262, UCHAR *Phases, UCHAR *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags)
Read the status register of a TMC26x.
Definition: TMC262.c:1154
void Set262SmartEnergyIMin(UCHAR Which262, UCHAR SmartIMin)
Set smart energy minimum current.
Definition: TMC262.c:688
UCHAR Get262ChopperTOff(UCHAR Which262)
Get chopper off time value.
Definition: TMC262.c:673
void Set262StepDirMStepRes(UCHAR Which262, UCHAR MicrostepResolution)
Set the microstep resolution.
Definition: TMC262.c:380
UCHAR Get262SmartEnergyStallLevelMin(UCHAR Which262)
Get hysteresis start.
Definition: TMC262.c:829
unsigned int UINT
32 bits unsigned
Definition: stepRocker.h:33
void Set262ChopperBlankTime(UCHAR Which262, UCHAR BlankTime)
Set chopper blank time.
Definition: TMC262.c:477
signed char Get262StallGuardThreshold(UCHAR Which262)
Get stallGuard threshold setting.
Definition: TMC262.c:904
void Set262DriverStepDirectionOff(UCHAR Which262, UCHAR SDOff)
Disable/enable step direction input.
Definition: TMC262.c:995
void Set262ChopperMode(UCHAR Which262, UCHAR Mode)
Set chopper mode.
Definition: TMC262.c:492
UCHAR Get262DriverReadSelect(UCHAR Which262)
Get selected read back mode.
Definition: TMC262.c:1133
UCHAR Get262StepDirMStepRes(UCHAR Which262)
Get microstep resolution.
Definition: TMC262.c:434
UCHAR Get262SmartEnergyIMin(UCHAR Which262)
Get minimum current.
Definition: TMC262.c:768
void Set262ChopperRandomTOff(UCHAR Which262, UCHAR RandomTOff)
Set random TOff mode.
Definition: TMC262.c:507
void InitMotorDrivers(void)
Initialise all motor drivers.
Definition: TMC262.c:318
UCHAR Get262SmartEnergyStallLevelMax(UCHAR Which262)
Get hystersis width.
Definition: TMC262.c:798
void Disable262(UCHAR Which262)
Disable a motor driver.
Definition: TMC262.c:1228
UCHAR Get262ChopperHysteresisDecay(UCHAR Which262)
Get chopper hysteresis decay (HDEC)
Definition: TMC262.c:628
void Set262DriverReadSelect(UCHAR Which262, UCHAR ReadSelect)
Selects the values to be read.
Definition: TMC262.c:1028
UCHAR Get262SmartEnergyUpStep(UCHAR Which262)
Get current up step width.
Definition: TMC262.c:813
UCHAR Get262DriverStepDirectionOff(UCHAR Which262)
Get step direction input enable setting.
Definition: TMC262.c:1104
UCHAR Get262SmartEnergyDownStep(UCHAR Which262)
Get current down step speed.
Definition: TMC262.c:783
UCHAR Get262ChopperRandomTOff(UCHAR Which262)
Get random TOff mode.
Definition: TMC262.c:613
void Set262ChopperHysteresisDecay(UCHAR Which262, UCHAR HysteresisDecay)
Set chopper hysteresis decay parameter (HDEC)
Definition: TMC262.c:522
UCHAR SmartEnergy[N_O_MOTORS]
actual smartEnergy values
Definition: Globals.c:98
UCHAR Get262ChopperMode(UCHAR Which262)
Get chopper mode.
Definition: TMC262.c:598
void Set262StallGuardFilter(UCHAR Which262, UCHAR Enable)
Set stallGuard filter.
Definition: TMC262.c:843
UCHAR Get262StepDirDoubleEdge(UCHAR Which262)
Get microstep resolution.
Definition: TMC262.c:463
void Set262ChopperHysteresisEnd(UCHAR Which262, UCHAR HysteresisEnd)
Set chopper hysteresis end parameter (HEND)
Definition: TMC262.c:537
void Set262DriverVSenseScale(UCHAR Which262, UCHAR Scale)
Sets the sense voltage.
Definition: TMC262.c:1011
unsigned char UCHAR
8 bits unsigned
Definition: stepRocker.h:31
void Set262DriverDisableProtection(UCHAR Which262, UCHAR DisableProtection)
Disable short to GND protection.
Definition: TMC262.c:964
unsigned short USHORT
16 bits unsigned
Definition: stepRocker.h:32
void Set262SmartEnergyStallLevelMax(UCHAR Which262, UCHAR StallLevelMax)
Set smart enery hysteresis width.
Definition: TMC262.c:720