From d67c1d825f831932667643ac63b676e6be3e5f32 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 14 Sep 2016 08:48:47 +0200 Subject: [PATCH] Add TMC2130 support --- Marlin/Configuration_adv.h | 213 +++++++++++++- Marlin/Marlin.ino | 5 + Marlin/Marlin_main.cpp | 45 +++ .../Cartesio/Configuration_adv.h | 219 +++++++++++++- .../Felix/Configuration_adv.h | 219 +++++++++++++- .../Hephestos/Configuration_adv.h | 219 +++++++++++++- .../Hephestos_2/Configuration_adv.h | 219 +++++++++++++- .../K8200/Configuration_adv.h | 219 +++++++++++++- .../K8400/Configuration_adv.h | 219 +++++++++++++- .../RigidBot/Configuration_adv.h | 219 +++++++++++++- .../SCARA/Configuration_adv.h | 219 +++++++++++++- .../TAZ4/Configuration_adv.h | 219 +++++++++++++- .../WITBOX/Configuration_adv.h | 218 +++++++++++++- .../delta/biv2.5/Configuration_adv.h | 219 +++++++++++++- .../delta/generic/Configuration_adv.h | 219 +++++++++++++- .../delta/kossel_mini/Configuration_adv.h | 219 +++++++++++++- .../delta/kossel_pro/Configuration_adv.h | 219 +++++++++++++- .../delta/kossel_xl/Configuration_adv.h | 219 +++++++++++++- .../makibox/Configuration_adv.h | 219 +++++++++++++- .../tvrrug/Round2/Configuration_adv.h | 219 +++++++++++++- Marlin/pins_RAMPS.h | 5 + Marlin/stepper.cpp | 5 + Marlin/stepper_indirection.cpp | 266 ++++++++++++++++++ Marlin/stepper_indirection.h | 37 +++ 24 files changed, 4226 insertions(+), 72 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9850d5570..293b207df 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -756,10 +756,215 @@ #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 diff --git a/Marlin/Marlin.ino b/Marlin/Marlin.ino index 70fd8adfc..c2654c09a 100644 --- a/Marlin/Marlin.ino +++ b/Marlin/Marlin.ino @@ -67,6 +67,11 @@ #include #endif +#if ENABLED(HAVE_TMC2130DRIVER) + #include + #include +#endif + #if ENABLED(HAVE_L6470DRIVER) #include #include diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index da54ce4d6..e9dba02e2 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5884,6 +5884,45 @@ inline void gcode_M117() { */ inline void gcode_M119() { endstops.M119(); } +#if ENABLED(HAVE_TMC2130DRIVER) + /** + * M122: Output Trinamic TMC2130 status to serial output. Very bad formatting. + */ + inline void gcode_M122() { + SERIAL_PROTOCOLLNPGM("REPORTING TMC2130 STATUS"); + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X_IS_TMC2130) + stepperX.read_STAT(); + SERIAL_PROTOCOLLN("X-AXIS: "); + SERIAL_PROTOCOLLN((stepperX.isReset() ? "RESET " : "----- ")); + SERIAL_PROTOCOLLN((stepperX.isError() ? "ERROR " : "----- ")); + SERIAL_PROTOCOLLN((stepperX.isStallguard() ? "SLGRD " : "----- ")); + SERIAL_PROTOCOLLN((stepperX.isStandstill() ? "STILL " : "----- ")); + SERIAL_PROTOCOLLN((stepperX.debug())); + SERIAL_PROTOCOLLN("-----"); + #endif + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y_IS_TMC2130) + stepperY.read_STAT(); + SERIAL_PROTOCOLLN("Y-AXIS: "); + SERIAL_PROTOCOLLN((stepperY.isReset() ? "RESET " : "----- ")); + SERIAL_PROTOCOLLN((stepperY.isError() ? "ERROR " : "----- ")); + SERIAL_PROTOCOLLN((stepperY.isStallguard() ? "SLGRD " : "----- ")); + SERIAL_PROTOCOLLN((stepperY.isStandstill() ? "STILL " : "----- ")); + SERIAL_PROTOCOLLN((stepperY.debug())); + SERIAL_PROTOCOLLN("-----"); + #endif + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z_IS_TMC2130) + stepperZ.read_STAT(); + SERIAL_PROTOCOLLN("Z-AXIS: "); + SERIAL_PROTOCOLLN((stepperZ.isReset() ? "RESET " : "----- ")); + SERIAL_PROTOCOLLN((stepperZ.isError() ? "ERROR " : "----- ")); + SERIAL_PROTOCOLLN((stepperZ.isStallguard() ? "SLGRD " : "----- ")); + SERIAL_PROTOCOLLN((stepperZ.isStandstill() ? "STILL " : "----- ")); + SERIAL_PROTOCOLLN((stepperZ.debug())); + SERIAL_PROTOCOLLN("-----"); + #endif + } +#endif // HAVE_TMC2130DRIVER + /** * M120: Enable endstops and set non-homing endstop state to "enabled" */ @@ -8057,6 +8096,12 @@ void process_next_command() { gcode_M119(); break; + #if ENABLED(HAVE_TMC2130DRIVER) + case 122: // M122: Diagnose, used to debug TMC2130 + gcode_M122(); + break; + #endif + #if ENABLED(ULTIPANEL) case 145: // M145: Set material heatup parameters diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 463254c04..b5ae2551c 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 80c52620b..887219f67 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 17c200ba3..02fbe6f5a 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 5f54de89e..333c5978f 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 4d4335bb3..ea8a90781 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -769,13 +769,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) diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index d2f3aea8b..fc4665c0d 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 2b45809ff..5de93ce42 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index e2b39c89c..22eb1e9e6 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index c8067fd6d..f10355a00 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -764,13 +764,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) diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 17c200ba3..475508b19 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -756,13 +756,223 @@ #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) diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 630b10060..7348140d8 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -758,13 +758,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) diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 703c42f26..20e3c250e 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -758,13 +758,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) diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 703c42f26..20e3c250e 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -758,13 +758,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) diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 0ccc9cf4b..ff34a99f1 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -763,13 +763,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) diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 35e119b49..b44f5fad4 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -758,13 +758,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) diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 150ed0f7d..f4b217fe2 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -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) diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 373a73d98..acb0297b9 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -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) diff --git a/Marlin/pins_RAMPS.h b/Marlin/pins_RAMPS.h index e1d9c877d..da14a6dab 100644 --- a/Marlin/pins_RAMPS.h +++ b/Marlin/pins_RAMPS.h @@ -93,22 +93,27 @@ #define X_STEP_PIN 54 #define X_DIR_PIN 55 #define X_ENABLE_PIN 38 +#define X_CS_PIN 53 #define Y_STEP_PIN 60 #define Y_DIR_PIN 61 #define Y_ENABLE_PIN 56 +#define Y_CS_PIN 49 #define Z_STEP_PIN 46 #define Z_DIR_PIN 48 #define Z_ENABLE_PIN 62 +#define Z_CS_PIN 40 #define E0_STEP_PIN 26 #define E0_DIR_PIN 28 #define E0_ENABLE_PIN 24 +#define E0_CS_PIN 42 #define E1_STEP_PIN 36 #define E1_DIR_PIN 34 #define E1_ENABLE_PIN 30 +#define E1_CS_PIN 44 // // Temperature Sensors diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 7e0c744f1..e1260f80e 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -784,6 +784,11 @@ void Stepper::init() { tmc_init(); #endif + // Init TMC2130 Steppers + #if ENABLED(HAVE_TMC2130DRIVER) + tmc2130_init(); + #endif + // Init L6470 Steppers #if ENABLED(HAVE_L6470DRIVER) L6470_init(); diff --git a/Marlin/stepper_indirection.cpp b/Marlin/stepper_indirection.cpp index 101249e3c..2300197f7 100644 --- a/Marlin/stepper_indirection.cpp +++ b/Marlin/stepper_indirection.cpp @@ -127,6 +127,272 @@ void tmc_init() { } #endif +#if ENABLED(HAVE_TMC2130DRIVER) + #include + #include +#endif + +// Stepper objects of TMC2310 steppers used +#if ENABLED(X_IS_TMC2130) + Trinamic_TMC2130 stepperX(X_CS_PIN); +#endif +#if ENABLED(X2_IS_TMC2130) + Trinamic_TMC2130 stepperX2(X2_CS_PIN); +#endif +#if ENABLED(Y_IS_TMC2130) + Trinamic_TMC2130 stepperY(Y_CS_PIN); +#endif +#if ENABLED(Y2_IS_TMC2130) + Trinamic_TMC2130 stepperY2(Y2_CS_PINR); +#endif +#if ENABLED(Z_IS_TMC2130) + Trinamic_TMC2130 stepperZ(Z_CS_PIN); +#endif +#if ENABLED(Z2_IS_TMC2130) + Trinamic_TMC2130 stepperZ2(Z2_CS_PIN); +#endif +#if ENABLED(E0_IS_TMC2130) + Trinamic_TMC2130 stepperE0(E0_CS_PIN); +#endif +#if ENABLED(E1_IS_TMC2130) + Trinamic_TMC2130 stepperE1(E1_CS_PIN); +#endif +#if ENABLED(E2_IS_TMC2130) + Trinamic_TMC2130 stepperE2(E2_CS_PIN); +#endif +#if ENABLED(E3_IS_TMC2130) + Trinamic_TMC2130 stepperE3(E3_CS_PIN); +#endif + +#if ENABLED(HAVE_TMC2130DRIVER) + + #if ENABLED(TMC2130_ADVANCED_CONFIGURATION) + + void tmc2130_init() { + + // If you've enabled TMC2130_ADVANCED_CONFIGURATION configure your + // steppers manually here. The ENABLED(XYZ_IS_TMC2130) is optional, + + #if ENABLED(X_IS_TMC2130) + stepperX.init(); + stepperX.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG); + //stepperX.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE); + stepperX.set_en_pwm_mode(GLOBAL_EN_PWM_MODE); + //stepperX.set_enc_commutation(GLOBAL_ENC_COMMUTATION); + stepperX.set_shaft(GLOBAL_SHAFT); + //stepperX.set_diag0_error(GLOBAL_DIAG0_ERROR); + //stepperX.set_diag0_otpw(GLOBAL_DIAG0_OTPW); + //stepperX.set_diag0_stall(GLOBAL_DIAG0_STALL); + //stepperX.set_diag1_stall(GLOBAL_DIAG1_STALL); + //stepperX.set_diag1_index(GLOBAL_DIAG1_INDEX); + //stepperX.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE); + //stepperX.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE); + //stepperX.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL); + //stepperX.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL); + //stepperX.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS); + //stepperX.set_stop_enable(GLOBAL_STOP_ENABLE); + //stepperX.set_direct_mode(GLOBAL_DIRECT_MODE); + + stepperX.set_IHOLD_IRUN(GLOBAL_IHOLD,GLOBAL_IRUN,GLOBAL_IHOLDDELAY); + //stepperX.set_TPOWERDOWN(GLOBAL_TPOWERDOWN); + //stepperX.set_TPWMTHRS(GLOBAL_TPWMTHRS); + //stepperX.set_TCOOLTHRS(GLOBAL_TCOOLTHRS); + stepperX.set_THIGH(GLOBAL_THIGH); + //stepperX.set_XDIRECT(GLOBAL_XDIRECT); + //stepperX.set_VDCMIN(GLOBAL_VDCMIN); + + //stepperX.set_dedge(GLOBAL_DEDGE); + //stepperX.set_diss2g(GLOBAL_DISS2G); + stepperX.set_intpol(GLOBAL_INTPOL); + stepperX.set_mres(GLOBAL_MRES); + stepperX.set_sync(GLOBAL_SYNC); + stepperX.set_vhighchm(GLOBAL_VHIGHCHM); + stepperX.set_vhighfs(GLOBAL_VHIGHFS); + //stepperX.set_vsense(GLOBAL_VSENSE); + stepperX.set_tbl(GLOBAL_TBL); + stepperX.set_chm(GLOBAL_CHM); + //stepperX.set_rndtf(GLOBAL_RNDTF); + //stepperX.set_disfdcc(GLOBAL_DISFDCC); + //stepperX.set_fd(GLOBAL_FD); + //stepperX.set_hend(GLOBAL_HEND); + //stepperX.set_hstrt(GLOBAL_HSTRT); + stepperX.set_toff(GLOBAL_TOFF); + + //stepperX.set_sfilt(GLOBAL_SFILT); + //stepperX.set_sgt(GLOBAL_SGT); + //stepperX.set_seimin(GLOBAL_SEIMIN); + //stepperX.set_sedn(GLOBAL_SEDN); + //stepperX.set_semax(GLOBAL_SEMAX); + //stepperX.set_seup(GLOBAL_SEUP); + //stepperX.set_semin(GLOBAL_SEMIN); + + //stepperX.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG); + + //stepperX.set_freewheel(GLOBAL_FREEWHEEL); + //stepperX.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC); + //stepperX.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE); + //stepperX.set_pwm_freq(GLOBAL_PWM_FREQ); + //stepperX.set_PWM_GRAD(GLOBAL_PWM_GRAD); + //stepperX.set_PWM_AMPL(GLOBAL_PWM_AMPL); + + //stepperX.set_ENCM_CTRL(GLOBAL_ENCM_CTRL); + #endif + + #if ENABLED(Y_IS_TMC2130) + stepperY.init(); + stepperY.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG); + //stepperY.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE); + stepperY.set_en_pwm_mode(GLOBAL_EN_PWM_MODE); + //stepperY.set_enc_commutation(GLOBAL_ENC_COMMUTATION); + stepperY.set_shaft(GLOBAL_SHAFT); + //stepperY.set_diag0_error(GLOBAL_DIAG0_ERROR); + //stepperY.set_diag0_otpw(GLOBAL_DIAG0_OTPW); + //stepperY.set_diag0_stall(GLOBAL_DIAG0_STALL); + //stepperY.set_diag1_stall(GLOBAL_DIAG1_STALL); + //stepperY.set_diag1_index(GLOBAL_DIAG1_INDEX); + //stepperY.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE); + //stepperY.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE); + //stepperY.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL); + //stepperY.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL); + //stepperY.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS); + //stepperY.set_stop_enable(GLOBAL_STOP_ENABLE); + //stepperY.set_direct_mode(GLOBAL_DIRECT_MODE); + + stepperY.set_IHOLD_IRUN(GLOBAL_IHOLD,GLOBAL_IRUN,GLOBAL_IHOLDDELAY); + //stepperY.set_TPOWERDOWN(GLOBAL_TPOWERDOWN); + //stepperY.set_TPWMTHRS(GLOBAL_TPWMTHRS); + //stepperY.set_TCOOLTHRS(GLOBAL_TCOOLTHRS); + stepperY.set_THIGH(GLOBAL_THIGH); + //stepperY.set_XDIRECT(GLOBAL_XDIRECT); + //stepperY.set_VDCMIN(GLOBAL_VDCMIN); + + //stepperY.set_dedge(GLOBAL_DEDGE); + //stepperY.set_diss2g(GLOBAL_DISS2G); + stepperY.set_intpol(GLOBAL_INTPOL); + stepperY.set_mres(GLOBAL_MRES); + stepperY.set_sync(GLOBAL_SYNC); + stepperY.set_vhighchm(GLOBAL_VHIGHCHM); + stepperY.set_vhighfs(GLOBAL_VHIGHFS); + //stepperY.set_vsense(GLOBAL_VSENSE); + stepperY.set_tbl(GLOBAL_TBL); + stepperY.set_chm(GLOBAL_CHM); + //stepperY.set_rndtf(GLOBAL_RNDTF); + //stepperY.set_disfdcc(GLOBAL_DISFDCC); + //stepperY.set_fd(GLOBAL_FD); + //stepperY.set_hend(GLOBAL_HEND); + //stepperY.set_hstrt(GLOBAL_HSTRT); + stepperY.set_toff(GLOBAL_TOFF); + + //stepperY.set_sfilt(GLOBAL_SFILT); + //stepperY.set_sgt(GLOBAL_SGT); + //stepperY.set_seimin(GLOBAL_SEIMIN); + //stepperY.set_sedn(GLOBAL_SEDN); + //stepperY.set_semax(GLOBAL_SEMAX); + //stepperY.set_seup(GLOBAL_SEUP); + //stepperY.set_semin(GLOBAL_SEMIN); + + //stepperY.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG); + + //stepperY.set_freewheel(GLOBAL_FREEWHEEL); + //stepperY.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC); + //stepperY.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE); + //stepperY.set_pwm_freq(GLOBAL_PWM_FREQ); + //stepperY.set_PWM_GRAD(GLOBAL_PWM_GRAD); + //stepperY.set_PWM_AMPL(GLOBAL_PWM_AMPL); + + //stepperY.set_ENCM_CTRL(GLOBAL_ENCM_CTRL); + #endif + } + + #else // !TMC2130_ADVANCED_CONFIGURATION + + void tmc2130_init() { + #if ENABLED(X_IS_TMC2130) + stepperX.init(); + stepperX.set_mres(X_MRES); + stepperX.set_IHOLD_IRUN(X_IHOLD,X_IRUN,X_IHOLDDELAY); + stepperX.set_I_scale_analog(X_ISCALE); + stepperX.set_tbl(X_TBL); + stepperX.set_toff(X_TOFF); + #endif + #if ENABLED(X2_IS_TMC2130) + stepperX2.init(); + stepperX2.set_mres(X2_MRES); + stepperX2.set_IHOLD_IRUN(X2_IHOLD,X2_IRUN,X2_IHOLDDELAY); + stepperX2.set_I_scale_analog(X2_ISCALE); + stepperX2.set_tbl(X2_TBL); + stepperX2.set_toff(X2_TOFF); + #endif + #if ENABLED(Y_IS_TMC2130) + stepperY.init(); + stepperY.set_mres(Y_MRES); + stepperY.set_IHOLD_IRUN(Y_IHOLD,Y_IRUN,Y_IHOLDDELAY); + stepperY.set_I_scale_analog(Y_ISCALE); + stepperY.set_tbl(Y_TBL); + stepperY.set_toff(Y_TOFF); + #endif + #if ENABLED(Y2_IS_TMC2130) + stepperY2.init(); + stepperY2.set_mres(Y2_MRES); + stepperY2.set_IHOLD_IRUN(Y2_IHOLD,Y2_IRUN,Y2_IHOLDDELAY); + stepperY2.set_I_scale_analog(Y2_ISCALE); + stepperY2.set_tbl(Y2_TBL); + stepperY2.set_toff(Y2_TOFF); + #endif + #if ENABLED(Z_IS_TMC2130) + stepperZ.init(); + stepperZ.set_mres(Z_MRES); + stepperZ.set_IHOLD_IRUN(Z_IHOLD,Z_IRUN,Z_IHOLDDELAY); + stepperZ.set_I_scale_analog(Z_ISCALE); + stepperZ.set_tbl(Z_TBL); + stepperZ.set_toff(Z_TOFF); + #endif + #if ENABLED(Z2_IS_TMC2130) + stepperZ2.init(); + stepperZ2.set_mres(Z2_MRES); + stepperZ2.set_IHOLD_IRUN(Z2_IHOLD,Z2_IRUN,Z2_IHOLDDELAY); + stepperZ2.set_I_scale_analog(Z2_ISCALE); + stepperZ2.set_tbl(Z2_TBL); + stepperZ2.set_toff(Z2_TOFF); + #endif + #if ENABLED(E0_IS_TMC2130) + stepperE0.init(); + stepperE0.set_mres(E0_MRES); + stepperE0.set_IHOLD_IRUN(E0_IHOLD,E0_IRUN,E0_IHOLDDELAY); + stepperE0.set_I_scale_analog(E0_ISCALE); + stepperE0.set_tbl(E0_TBL); + stepperE0.set_toff(E0_TOFF); + #endif + #if ENABLED(E1_IS_TMC2130) + stepperE1.init(); + stepperE1.set_mres(E1_MRES); + stepperE1.set_IHOLD_IRUN(E1_IHOLD,E1_IRUN,E1_IHOLDDELAY); + stepperE1.set_I_scale_analog(E1_ISCALE); + stepperE1.set_tbl(E1_TBL); + stepperE1.set_toff(E1_TOFF); + #endif + #if ENABLED(E2_IS_TMC2130) + stepperE2.init(); + stepperE2.set_mres(E2_MRES); + stepperE2.set_IHOLD_IRUN(E2_IHOLD,E2_IRUN,E2_IHOLDDELAY); + stepperE2.set_I_scale_analog(E2_ISCALE); + stepperE2.set_tbl(E2_TBL); + stepperE2.set_toff(E2_TOFF); + #endif + #if ENABLED(E3_IS_TMC2130) + stepperE3.init(); + stepperE3.set_mres(E3_MRES); + stepperE3.set_IHOLD_IRUN(E3_IHOLD,E3_IRUN,E3_IHOLDDELAY); + stepperE3.set_I_scale_analog(E3_ISCALE); + stepperE3.set_tbl(E3_TBL); + stepperE3.set_toff(E3_TOFF); + #endif + } + + #endif // TMC2130_ADVANCED_CONFIGURATION + +#endif // HAVE_TMC2130DRIVER + // L6470 Driver objects and inits #if ENABLED(HAVE_L6470DRIVER) diff --git a/Marlin/stepper_indirection.h b/Marlin/stepper_indirection.h index 6fd19dd4d..0dc941bd1 100644 --- a/Marlin/stepper_indirection.h +++ b/Marlin/stepper_indirection.h @@ -53,6 +53,13 @@ void tmc_init(); #endif +// TMC130 drivers have STEP/DIR/ENABLE on normal pins +#if ENABLED(HAVE_TMC2130DRIVER) + #include + #include + void tmc2130_init(); +#endif + // L6470 has STEP on normal pins, but DIR/ENABLE via SPI #if ENABLED(HAVE_L6470DRIVER) #include @@ -76,6 +83,9 @@ #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_READ stepperX.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X_IS_TMC2130) + extern Trinamic_TMC2130 stepperX; + #endif #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE) #define X_ENABLE_READ READ(X_ENABLE_PIN) @@ -104,6 +114,9 @@ #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_READ stepperY.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y_IS_TMC2130) + extern Trinamic_TMC2130 stepperY; + #endif #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE) #define Y_ENABLE_READ READ(Y_ENABLE_PIN) @@ -132,6 +145,9 @@ #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_READ stepperZ.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z_IS_TMC2130) + extern Trinamic_TMC2130 stepperZ; + #endif #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE) #define Z_ENABLE_READ READ(Z_ENABLE_PIN) @@ -161,6 +177,9 @@ #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_READ stepperX2.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X2_IS_TMC2130) + extern Trinamic_TMC2130 stepperX2; + #endif #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) #define X2_ENABLE_READ READ(X2_ENABLE_PIN) @@ -191,6 +210,9 @@ #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_READ stepperY2.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y2_IS_TMC2130) + extern Trinamic_TMC2130 stepperY2; + #endif #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN) @@ -221,6 +243,9 @@ #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_READ stepperZ2.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z2_IS_TMC2130) + extern Trinamic_TMC2130 stepperZ2; + #endif #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN) @@ -250,6 +275,9 @@ #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_READ stepperE0.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E0_IS_TMC2130) + extern Trinamic_TMC2130 stepperE0; + #endif #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE) #define E0_ENABLE_READ READ(E0_ENABLE_PIN) @@ -278,6 +306,9 @@ #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_READ stepperE1.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E1_IS_TMC2130) + extern Trinamic_TMC2130 stepperE1; + #endif #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE) #define E1_ENABLE_READ READ(E1_ENABLE_PIN) @@ -306,6 +337,9 @@ #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_READ stepperE2.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E2_IS_TMC2130) + extern Trinamic_TMC2130 stepperE2; + #endif #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE) #define E2_ENABLE_READ READ(E2_ENABLE_PIN) @@ -334,6 +368,9 @@ #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_READ stepperE3.isEnabled() #else + #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E3_IS_TMC2130) + extern Trinamic_TMC2130 stepperE3; + #endif #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE) #define E3_ENABLE_READ READ(E3_ENABLE_PIN)