Add TMC2130 support

This commit is contained in:
Moritz
2016-09-14 08:48:47 +02:00
committed by Scott Lahteine
parent 79c8591192
commit d67c1d825f
24 changed files with 4226 additions and 72 deletions

View File

@ -756,13 +756,224 @@
#endif
/******************************************************************************\
* enable this section if you have L6470 motor drivers.
* you need to import the L6470 library into the Arduino IDE for this
******************************************************************************/
// @section TMC2130
/**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
*
* To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
* (https://github.com/makertum/Trinamic_TMC2130).
*
* To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
* the hardware SPI interface on your board and define the required CS pins
* in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
*/
//#define HAVE_TMC2130DRIVER
#if ENABLED(HAVE_TMC2130DRIVER)
//#define TMC2130_ADVANCED_CONFIGURATION
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130
//#define X2_IS_TMC2130
//#define Y_IS_TMC2130
//#define Y2_IS_TMC2130
//#define Z_IS_TMC2130
//#define Z2_IS_TMC2130
//#define E0_IS_TMC2130
//#define E1_IS_TMC2130
//#define E2_IS_TMC2130
//#define E3_IS_TMC2130
#if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
// If you have enabled TMC2130_ADVANCED_CONFIGURATION,
// you can define global settings here, but you still need
// to configure the tmc2130.init() method manually in the file
//
// stepper_indirection.cpp
//
// Please read the TMC2130 datasheet:
// http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
// All settings here have the same (sometimes cryptic) names as in the datasheet.
//
// The following, uncommented settings are only suggestion.
/* GENERAL CONFIGURATION */
//#define GLOBAL_EN_PWM_MODE 0
#define GLOBAL_I_SCALE_ANALOG 1 // [0,1] 0: Normal, 1: AIN
//#define GLOBAL_INTERNAL_RSENSE 0 // [0,1] 0: Normal, 1: Internal
#define GLOBAL_EN_PWM_MODE 0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
//#define GLOBAL_ENC_COMMUTATION 0 // [0,1]
#define GLOBAL_SHAFT 0 // [0,1] 0: normal, 1: invert
//#define GLOBAL_DIAG0_ERROR 0 // [0,1]
//#define GLOBAL_DIAG0_OTPW 0 // [0,1]
//#define GLOBAL_DIAG0_STALL 0 // [0,1]
//#define GLOBAL_DIAG1_STALL 0 // [0,1]
//#define GLOBAL_DIAG1_INDEX 0 // [0,1]
//#define GLOBAL_DIAG1_ONSTATE 0 // [0,1]
//#define GLOBAL_DIAG1_ONSTATE 0 // [0,1]
//#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
//#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
//#define GLOBAL_SMALL_HYSTERESIS 0 // [0,1]
//#define GLOBAL_STOP_ENABLE 0 // [0,1]
//#define GLOBAL_DIRECT_MODE 0 // [0,1]
/* VELOCITY-DEPENDENT DRIVE FEATURES */
#define GLOBAL_IHOLD 22 // [0-31] 0: min, 31: max
#define GLOBAL_IRUN 31 // [0-31] 0: min, 31: max
#define GLOBAL_IHOLDDELAY 15 // [0-15] 0: min, 15: about 4 seconds
//#define GLOBAL_TPOWERDOWN 0 // [0-255] 0: min, 255: about 4 seconds
//#define GLOBAL_TPWMTHRS 0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
//#define GLOBAL_TCOOLTHRS 0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
#define GLOBAL_THIGH 10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
/* SPI MODE CONFIGURATION */
//#define GLOBAL_XDIRECT 0
/* DCSTEP MINIMUM VELOCITY */
//#define GLOBAL_VDCMIN 0
/* MOTOR DRIVER CONFIGURATION*/
//#define GLOBAL_DEDGE 0
//#define GLOBAL_DISS2G 0
#define GLOBAL_INTPOL 1 // 0: off 1: 256 microstep interpolation
#define GLOBAL_MRES 16 // number of microsteps
#define GLOBAL_SYNC 1 // [0-15]
#define GLOBAL_VHIGHCHM 1 // [0,1] 0: normal, 1: high velocity stepper mode
#define GLOBAL_VHIGHFS 0 // [0,1] 0: normal, 1: switch to full steps for high velocities
// #define GLOBAL_VSENSE 0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
#define GLOBAL_TBL 1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
#define GLOBAL_CHM 0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
//#define GLOBAL_RNDTF 0
//#define GLOBAL_DISFDCC 0
//#define GLOBAL_FD 0
//#define GLOBAL_HEND 0
//#define GLOBAL_HSTRT 0
#define GLOBAL_TOFF 10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
//#define GLOBAL_SFILT 0
//#define GLOBAL_SGT 0
//#define GLOBAL_SEIMIN 0
//#define GLOBAL_SEDN 0
//#define GLOBAL_SEMAX 0
//#define GLOBAL_SEUP 0
//#define GLOBAL_SEMIN 0
//#define GLOBAL_DC_TIME 0
//#define GLOBAL_DC_SG 0
//#define GLOBAL_FREEWHEEL 0
//#define GLOBAL_PWM_SYMMETRIC 0
//#define GLOBAL_PWM_AUTOSCALE 0
//#define GLOBAL_PWM_FREQ 0
//#define GLOBAL_PWM_GRAD 0
//#define GLOBAL_PWM_AMPL 0
//#define GLOBAL_ENCM_CTRL 0
#else
#define X_IHOLD 31 // [0-31] 0: min, 31: max
#define X_IRUN 31 // [0-31] 0: min, 31: max
#define X_IHOLDDELAY 15 // [0-15] 0: min, 15: about 4 seconds
#define X_I_SCALE_ANALOG 1 // 0: Normal, 1: AIN
#define X_MRES 16 // number of microsteps
#define X_TBL 1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
#define X_TOFF 8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
#define X2_IHOLD 31
#define X2_IRUN 31
#define X2_IHOLDDELAY 15
#define X2_I_SCALE_ANALOG 1
#define X2_MRES 16
#define X2_TBL 1
#define X2_TOFF 8
#define Y_IHOLD 31
#define Y_IRUN 31
#define Y_IHOLDDELAY 15
#define Y_I_SCALE_ANALOG 1
#define Y_MRES 16
#define Y_TBL 1
#define Y_TOFF 8
#define Y2_IHOLD 31
#define Y2_IRUN 31
#define Y2_IHOLDDELAY 15
#define Y2_I_SCALE_ANALOG 1
#define Y2_MRES 16
#define Y2_TBL 1
#define Y2_TOFF 8
#define Z_IHOLD 31
#define Z_IRUN 31
#define Z_IHOLDDELAY 15
#define Z_I_SCALE_ANALOG 1
#define Z_MRES 16
#define Z_TBL 1
#define Z_TOFF 8
#define Z2_IHOLD 31
#define Z2_IRUN 31
#define Z2_IHOLDDELAY 15
#define Z2_I_SCALE_ANALOG 1
#define Z2_MRES 16
#define Z2_TBL 1
#define Z2_TOFF 8
#define E0_IHOLD 31
#define E0_IRUN 31
#define E0_IHOLDDELAY 15
#define E0_I_SCALE_ANALOG 1
#define E0_MRES 16
#define E0_TBL 1
#define E0_TOFF 8
#define E1_IHOLD 31
#define E1_IRUN 31
#define E1_IHOLDDELAY 15
#define E1_I_SCALE_ANALOG 1
#define E1_MRES 16
#define E1_TBL 1
#define E1_TOFF 8
#define E2_IHOLD 31
#define E2_IRUN 31
#define E2_IHOLDDELAY 15
#define E2_I_SCALE_ANALOG 1
#define E2_MRES 16
#define E2_TBL 1
#define E2_TOFF 8
#define E3_IHOLD 31
#define E3_IRUN 31
#define E3_IHOLDDELAY 15
#define E3_I_SCALE_ANALOG 1
#define E3_MRES 16
#define E3_TBL 1
#define E3_TOFF 8
#endif // TMC2130_ADVANCED_CONFIGURATION
#endif // HAVE_TMC2130DRIVER
// @section l6470
/**
* Enable this section if you have L6470 motor drivers.
* You need to import the L6470 library into the Arduino IDE for this.
* (https://github.com/ameyer/Arduino-L6470)
*/
//#define HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)