stepRocker servo 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 #endif
UCHAR Get262StallGuardFilter(UCHAR Which262)
Get stallGuard filter.
Definition: TMC262.c:834
UCHAR Get262DriverProtectionTimer(UCHAR Which262)
Get protection timer setting.
Definition: TMC262.c:1034
UCHAR Get262StallGuardCurrentScale(UCHAR Which262)
Get motor current setting.
Definition: TMC262.c:864
UCHAR Get262DriverDisableProtection(UCHAR Which262)
Get driver protection disable setting.
Definition: TMC262.c:1019
void Enable262(UCHAR Which262)
Enable a motor driver.
Definition: TMC262.c:1191
void Set262DriverProtectionTimer(UCHAR Which262, UCHAR ProtectionTimer)
Set protection timer value.
Definition: TMC262.c:924
UCHAR Get262StepDirInterpolation(UCHAR Which262)
Get interpolation mode.
Definition: TMC262.c:394
void Set262StepDirDoubleEdge(UCHAR Which262, UCHAR DoubleEdge)
Set double step mode.
Definition: TMC262.c:362
UCHAR Get262DriverSlopeLowSide(UCHAR Which262)
Get slope high side value (SLPL)
Definition: TMC262.c:1004
void Set262StallGuardThreshold(UCHAR Which262, signed char Threshold)
Set stallGuard threshold value.
Definition: TMC262.c:803
void Set262StepDirInterpolation(UCHAR Which262, UCHAR Interpolation)
Turn interpolation mode on or off.
Definition: TMC262.c:343
UCHAR Get262DriverSlopeHighSide(UCHAR Which262)
Get slope high side value (SLPH)
Definition: TMC262.c:989
void Set262SmartEnergyDownStep(UCHAR Which262, UCHAR SmartDownStep)
Set smart energy down step.
Definition: TMC262.c:649
void Set262DriverSlopeLowSide(UCHAR Which262, UCHAR SlopeLowSide)
Set slope low side value (SLPL)
Definition: TMC262.c:893
void Set262StallGuardCurrentScale(UCHAR Which262, UCHAR CurrentScale)
Set current scale value.
Definition: TMC262.c:818
UCHAR Get262ChopperHysteresisEnd(UCHAR Which262)
Get chopper hysteresis end (HEND)
Definition: TMC262.c:588
void Set262SmartEnergyUpStep(UCHAR Which262, UCHAR SmartUpStep)
Set smart energy up step.
Definition: TMC262.c:681
UCHAR Get262DriverVSenseScale(UCHAR Which262)
Get VSense scale setting.
Definition: TMC262.c:1064
void Set262ChopperTOff(UCHAR Which262, UCHAR TOff)
Set chopper off time (TOff)
Definition: TMC262.c:512
UCHAR Get262ChopperBlankTime(UCHAR Which262)
Get chopper blank time.
Definition: TMC262.c:528
void Set262ChopperHysteresisStart(UCHAR Which262, UCHAR HysteresisStart)
Set chopper hysteresis start parameter (HSTART)
Definition: TMC262.c:497
void Set262DriverSlopeHighSide(UCHAR Which262, UCHAR SlopeHighSide)
Set slope high side value (SLPH)
Definition: TMC262.c:878
UCHAR Get262ChopperHysteresisStart(UCHAR Which262)
Get chopper hysteresis start (HSTART)
Definition: TMC262.c:603
void Set262SmartEnergyStallLevelMin(UCHAR Which262, UCHAR StallLevelMin)
Set smart energy hysteresis start.
Definition: TMC262.c:697
void Read262State(UCHAR Which262, UCHAR *Phases, UCHAR *MStep, UINT *StallGuard, UCHAR *SmartEnergy, UCHAR *Flags)
Read the status register of a TMC26x.
Definition: TMC262.c:1099
void Set262SmartEnergyIMin(UCHAR Which262, UCHAR SmartIMin)
Set smart energy minimum current.
Definition: TMC262.c:633
UCHAR Get262ChopperTOff(UCHAR Which262)
Get chopper off time value.
Definition: TMC262.c:618
void Set262StepDirMStepRes(UCHAR Which262, UCHAR MicrostepResolution)
Set the microstep resolution.
Definition: TMC262.c:325
UCHAR Get262SmartEnergyStallLevelMin(UCHAR Which262)
Get hysteresis start.
Definition: TMC262.c:774
unsigned int UINT
32 bits unsigned
Definition: stepRocker.h:33
void Set262ChopperBlankTime(UCHAR Which262, UCHAR BlankTime)
Set chopper blank time.
Definition: TMC262.c:422
signed char Get262StallGuardThreshold(UCHAR Which262)
Get stallGuard threshold setting.
Definition: TMC262.c:849
void Set262DriverStepDirectionOff(UCHAR Which262, UCHAR SDOff)
Disable/enable step direction input.
Definition: TMC262.c:940
void Set262ChopperMode(UCHAR Which262, UCHAR Mode)
Set chopper mode.
Definition: TMC262.c:437
UCHAR Get262DriverReadSelect(UCHAR Which262)
Get selected read back mode.
Definition: TMC262.c:1078
UCHAR Get262StepDirMStepRes(UCHAR Which262)
Get microstep resolution.
Definition: TMC262.c:379
UCHAR Get262SmartEnergyIMin(UCHAR Which262)
Get minimum current.
Definition: TMC262.c:713
void Set262ChopperRandomTOff(UCHAR Which262, UCHAR RandomTOff)
Set random TOff mode.
Definition: TMC262.c:452
void InitMotorDrivers(void)
Initialise all motor drivers.
Definition: TMC262.c:263
UCHAR Get262SmartEnergyStallLevelMax(UCHAR Which262)
Get hystersis width.
Definition: TMC262.c:743
void Disable262(UCHAR Which262)
Disable a motor driver.
Definition: TMC262.c:1173
UCHAR Get262ChopperHysteresisDecay(UCHAR Which262)
Get chopper hysteresis decay (HDEC)
Definition: TMC262.c:573
void Set262DriverReadSelect(UCHAR Which262, UCHAR ReadSelect)
Selects the values to be read.
Definition: TMC262.c:973
UCHAR Get262SmartEnergyUpStep(UCHAR Which262)
Get current up step width.
Definition: TMC262.c:758
UCHAR Get262DriverStepDirectionOff(UCHAR Which262)
Get step direction input enable setting.
Definition: TMC262.c:1049
UCHAR Get262SmartEnergyDownStep(UCHAR Which262)
Get current down step speed.
Definition: TMC262.c:728
UCHAR Get262ChopperRandomTOff(UCHAR Which262)
Get random TOff mode.
Definition: TMC262.c:558
void Set262ChopperHysteresisDecay(UCHAR Which262, UCHAR HysteresisDecay)
Set chopper hysteresis decay parameter (HDEC)
Definition: TMC262.c:467
UCHAR SmartEnergy[N_O_MOTORS]
actual smartEnergy values
Definition: Globals.c:59
UCHAR Get262ChopperMode(UCHAR Which262)
Get chopper mode.
Definition: TMC262.c:543
void Set262StallGuardFilter(UCHAR Which262, UCHAR Enable)
Set stallGuard filter.
Definition: TMC262.c:788
UCHAR Get262StepDirDoubleEdge(UCHAR Which262)
Get microstep resolution.
Definition: TMC262.c:408
void Set262ChopperHysteresisEnd(UCHAR Which262, UCHAR HysteresisEnd)
Set chopper hysteresis end parameter (HEND)
Definition: TMC262.c:482
void Set262DriverVSenseScale(UCHAR Which262, UCHAR Scale)
Sets the sense voltage.
Definition: TMC262.c:956
unsigned char UCHAR
8 bits unsigned
Definition: stepRocker.h:31
void Set262DriverDisableProtection(UCHAR Which262, UCHAR DisableProtection)
Disable short to GND protection.
Definition: TMC262.c:909
void Set262SmartEnergyStallLevelMax(UCHAR Which262, UCHAR StallLevelMax)
Set smart enery hysteresis width.
Definition: TMC262.c:665