[2.0.x] TMC driver update (#8769)

This commit is contained in:
teemuatlut 2017-12-15 23:03:14 +02:00 committed by Scott Lahteine
parent 09d13f186f
commit 0cd1e91056
62 changed files with 4185 additions and 2051 deletions

View File

@ -312,7 +312,14 @@ script:
- use_example_configs SCARA - use_example_configs SCARA
- opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER - opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER
- opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130 - opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130
- opt_enable_adv AUTOMATIC_CURRENT_CONTROL STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING - opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING
- build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
#
# TMC2208 Config
#
- restore_configs
- opt_enable_adv HAVE_TMC2208 X_IS_TMC2208 Y_IS_TMC2208 Z_IS_TMC2208
- opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG
- build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
# #
# tvrrug Config need to check board type for sanguino atmega644p # tvrrug Config need to check board type for sanguino atmega644p

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -57,6 +57,10 @@
#include <TMC2130Stepper.h> #include <TMC2130Stepper.h>
#endif #endif
#if ENABLED(HAVE_TMC2208)
#include <TMC2208Stepper.h>
#endif
#if ENABLED(HAVE_L6470DRIVER) #if ENABLED(HAVE_L6470DRIVER)
#include <SPI.h> #include <SPI.h>
#include <L6470.h> #include <L6470.h>

View File

@ -99,8 +99,8 @@
#include "HAL/HAL_endstop_interrupts.h" #include "HAL/HAL_endstop_interrupts.h"
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#include "feature/tmc2130.h" #include "feature/tmc_util.h"
#endif #endif
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
@ -489,8 +489,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
handle_status_leds(); handle_status_leds();
#endif #endif
#if ENABLED(HAVE_TMC2130) #if ENABLED(MONITOR_DRIVER_STATUS)
tmc2130_checkOverTemp(); monitor_tmc_driver();
#endif #endif
// Limit check_axes_activity frequency to 10Hz // Limit check_axes_activity frequency to 10Hz

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -977,7 +977,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -991,7 +991,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1006,46 +1018,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1054,24 +1078,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1086,8 +1108,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1097,7 +1119,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1106,27 +1128,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E4_CURRENT 800
//#define E3_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -973,7 +973,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -987,7 +987,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1002,46 +1014,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1050,24 +1074,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1082,8 +1104,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1093,7 +1115,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1102,27 +1124,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -941,7 +941,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -955,7 +955,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -970,46 +982,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1018,24 +1042,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1050,8 +1072,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1061,7 +1083,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1070,27 +1092,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -977,7 +977,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -991,7 +991,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1006,46 +1018,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1054,24 +1078,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1086,8 +1108,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1097,7 +1119,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1106,27 +1128,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -984,7 +984,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -998,7 +998,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1013,46 +1025,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1061,24 +1085,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1093,8 +1115,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1104,7 +1126,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1113,27 +1135,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -965,7 +965,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -979,7 +979,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -994,46 +1006,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1042,24 +1066,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1074,8 +1096,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1085,7 +1107,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1094,27 +1116,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -988,63 +988,87 @@
* the hardware SPI interface on your board and define the required CS pins * 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.). * 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_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
#define X_IS_TMC2130 //#define X_IS_TMC2130
//#define X2_IS_TMC2130 //#define X2_IS_TMC2130
#define Y_IS_TMC2130 //#define Y_IS_TMC2130
//#define Y2_IS_TMC2130 //#define Y2_IS_TMC2130
#define Z_IS_TMC2130 //#define Z_IS_TMC2130
//#define Z2_IS_TMC2130 //#define Z2_IS_TMC2130
#define E0_IS_TMC2130 //#define E0_IS_TMC2130
//#define E1_IS_TMC2130 //#define E1_IS_TMC2130
//#define E2_IS_TMC2130 //#define E2_IS_TMC2130
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.22 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 900 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 900 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 900 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
#define E0_CURRENT 900 #define E0_CURRENT 800
#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -987,7 +987,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -1001,7 +1001,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1016,46 +1028,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1064,24 +1088,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1096,8 +1118,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1107,7 +1129,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1116,27 +1138,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -977,7 +977,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -991,7 +991,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1006,46 +1018,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1054,24 +1078,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1086,8 +1108,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1097,7 +1119,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1106,27 +1128,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -983,7 +983,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -997,7 +997,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1012,46 +1024,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1060,24 +1084,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1092,8 +1114,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1103,7 +1125,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1112,27 +1134,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -978,7 +978,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -992,7 +992,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1007,46 +1019,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1055,24 +1079,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1087,8 +1109,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1098,7 +1120,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1107,27 +1129,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -976,7 +976,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -990,7 +990,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1005,46 +1017,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1053,24 +1077,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1085,8 +1107,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1096,7 +1118,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1105,27 +1127,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -977,7 +977,7 @@
#endif #endif
// @section TMC2130 // @section TMC2130, TMC2208
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@ -991,7 +991,19 @@
*/ */
//#define HAVE_TMC2130 //#define HAVE_TMC2130
#if ENABLED(HAVE_TMC2130) /**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to #_SERIAL_TX_PIN with a 1K resistor.
* The drivers can also be used with hardware serial.
*
* You'll also need the TMC2208Stepper Arduino library
* (https://github.com/teemuatlut/TMC2208Stepper).
*/
//#define HAVE_TMC2208
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
// CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
//#define X_IS_TMC2130 //#define X_IS_TMC2130
@ -1006,46 +1018,58 @@
//#define E3_IS_TMC2130 //#define E3_IS_TMC2130
//#define E4_IS_TMC2130 //#define E4_IS_TMC2130
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
/** /**
* Stepper driver settings * Stepper driver settings
*/ */
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
#define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define Y_CURRENT 1000 #define Y_CURRENT 800
#define Y_MICROSTEPS 16 #define Y_MICROSTEPS 16
#define Z_CURRENT 1000 #define Z_CURRENT 800
#define Z_MICROSTEPS 16 #define Z_MICROSTEPS 16
//#define X2_CURRENT 1000 #define X2_CURRENT 800
//#define X2_MICROSTEPS 16 #define X2_MICROSTEPS 16
//#define Y2_CURRENT 1000 #define Y2_CURRENT 800
//#define Y2_MICROSTEPS 16 #define Y2_MICROSTEPS 16
//#define Z2_CURRENT 1000 #define Z2_CURRENT 800
//#define Z2_MICROSTEPS 16 #define Z2_MICROSTEPS 16
//#define E0_CURRENT 1000 #define E0_CURRENT 800
//#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
//#define E1_CURRENT 1000 #define E1_CURRENT 800
//#define E1_MICROSTEPS 16 #define E1_MICROSTEPS 16
//#define E2_CURRENT 1000 #define E2_CURRENT 800
//#define E2_MICROSTEPS 16 #define E2_MICROSTEPS 16
//#define E3_CURRENT 1000 #define E3_CURRENT 800
//#define E3_MICROSTEPS 16 #define E3_MICROSTEPS 16
//#define E4_CURRENT 1000 #define E4_CURRENT 800
//#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
@ -1054,24 +1078,22 @@
#define STEALTHCHOP #define STEALTHCHOP
/** /**
* Let Marlin automatically control stepper current. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
* This is still an experimental feature. * like overtemperature and short to ground. TMC2208 requires hardware serial.
* Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
* then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Other detected conditions can be used to stop the current print.
* Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
* Relevant g-codes: * Relevant g-codes:
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
* M906 S1 - Start adjusting current
* M906 S0 - Stop adjusting current
* M911 - Report stepper driver overtemperature pre-warn condition. * M911 - Report stepper driver overtemperature pre-warn condition.
* M912 - Clear stepper driver overtemperature pre-warn condition flag. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
* M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
*/ */
//#define AUTOMATIC_CURRENT_CONTROL //#define MONITOR_DRIVER_STATUS
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) #if ENABLED(MONITOR_DRIVER_STATUS)
#define CURRENT_STEP 50 // [mA] #define CURRENT_STEP_DOWN 50 // [mA]
#define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak
#define REPORT_CURRENT_CHANGE #define REPORT_CURRENT_CHANGE
#define STOP_ON_ERROR
#endif #endif
/** /**
@ -1086,8 +1108,8 @@
#define X2_HYBRID_THRESHOLD 100 #define X2_HYBRID_THRESHOLD 100
#define Y_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100
#define Y2_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100
#define Z_HYBRID_THRESHOLD 4 #define Z_HYBRID_THRESHOLD 3
#define Z2_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@ -1097,7 +1119,7 @@
/** /**
* Use stallGuard2 to sense an obstacle and trigger an endstop. * Use stallGuard2 to sense an obstacle and trigger an endstop.
* You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
* If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * X and Y homing will always be done in spreadCycle mode.
* *
* X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
* Higher values make the system LESS sensitive. * Higher values make the system LESS sensitive.
@ -1106,27 +1128,34 @@
* It is advised to set X/Y_HOME_BUMP_MM to 0. * It is advised to set X/Y_HOME_BUMP_MM to 0.
* M914 X/Y to live tune the setting * M914 X/Y to live tune the setting
*/ */
//#define SENSORLESS_HOMING //#define SENSORLESS_HOMING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define X_HOMING_SENSITIVITY 19 #define X_HOMING_SENSITIVITY 8
#define Y_HOMING_SENSITIVITY 19 #define Y_HOMING_SENSITIVITY 8
#endif #endif
/**
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
/** /**
* You can set your own advanced settings by filling in predefined functions. * You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page * A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper * https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* *
* Example: * Example:
* #define TMC2130_ADV() { \ * #define TMC_ADV() { \
* stepperX.diag0_temp_prewarn(1); \ * stepperX.diag0_temp_prewarn(1); \
* stepperX.interpolate(0); \ * stepperY.interpolate(0); \
* } * }
*/ */
#define TMC2130_ADV() { } #define TMC_ADV() { }
#endif // HAVE_TMC2130 #endif // TMC2130 || TMC2208
// @section L6470 // @section L6470

View File

@ -65,7 +65,7 @@ enum DebugFlags {
// For AVR only, define a serial interface based on configuration // For AVR only, define a serial interface based on configuration
#ifdef __AVR__ #ifdef __AVR__
#ifdef USBCON #ifdef USBCON
#include "HardwareSerial.h" #include <HardwareSerial.h>
#if ENABLED(BLUETOOTH) #if ENABLED(BLUETOOTH)
#define MYSERIAL bluetoothSerial #define MYSERIAL bluetoothSerial
#else #else

View File

@ -1,153 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "tmc2130.h"
#include "../Marlin.h"
#include "../module/stepper_indirection.h"
#include "../module/printcounter.h"
#include "../libs/duration_t.h"
#ifdef AUTOMATIC_CURRENT_CONTROL
bool auto_current_control = 0;
#endif
void automatic_current_control(TMC2130Stepper &st, String axisID) {
// Check otpw even if we don't use automatic control. Allows for flag inspection.
const bool is_otpw = st.checkOT();
// Report if a warning was triggered
static bool previous_otpw = false;
if (is_otpw && !previous_otpw) {
char timestamp[10];
duration_t elapsed = print_job_timer.duration();
const bool has_days = (elapsed.value > 60*60*24L);
(void)elapsed.toDigital(timestamp, has_days);
SERIAL_ECHO(timestamp);
SERIAL_ECHOPGM(": ");
SERIAL_ECHO(axisID);
SERIAL_ECHOLNPGM(" driver overtemperature warning!");
}
previous_otpw = is_otpw;
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) && CURRENT_STEP > 0
// Return if user has not enabled current control start with M906 S1.
if (!auto_current_control) return;
/**
* Decrease current if is_otpw is true.
* Bail out if driver is disabled.
* Increase current if OTPW has not been triggered yet.
*/
uint16_t current = st.getCurrent();
if (is_otpw) {
st.setCurrent(current - CURRENT_STEP, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE)
SERIAL_ECHO(axisID);
SERIAL_ECHOPAIR(" current decreased to ", st.getCurrent());
#endif
}
else if (!st.isEnabled())
return;
else if (!is_otpw && !st.getOTPW()) {
current += CURRENT_STEP;
if (current <= AUTO_ADJUST_MAX) {
st.setCurrent(current, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE)
SERIAL_ECHO(axisID);
SERIAL_ECHOPAIR(" current increased to ", st.getCurrent());
#endif
}
}
SERIAL_EOL();
#endif
}
void tmc2130_checkOverTemp(void) {
static millis_t next_cOT = 0;
if (ELAPSED(millis(), next_cOT)) {
next_cOT = millis() + 5000;
#if ENABLED(X_IS_TMC2130)
automatic_current_control(stepperX, "X");
#endif
#if ENABLED(Y_IS_TMC2130)
automatic_current_control(stepperY, "Y");
#endif
#if ENABLED(Z_IS_TMC2130)
automatic_current_control(stepperZ, "Z");
#endif
#if ENABLED(X2_IS_TMC2130)
automatic_current_control(stepperX2, "X2");
#endif
#if ENABLED(Y2_IS_TMC2130)
automatic_current_control(stepperY2, "Y2");
#endif
#if ENABLED(Z2_IS_TMC2130)
automatic_current_control(stepperZ2, "Z2");
#endif
#if ENABLED(E0_IS_TMC2130)
automatic_current_control(stepperE0, "E0");
#endif
#if ENABLED(E1_IS_TMC2130)
automatic_current_control(stepperE1, "E1");
#endif
#if ENABLED(E2_IS_TMC2130)
automatic_current_control(stepperE2, "E2");
#endif
#if ENABLED(E3_IS_TMC2130)
automatic_current_control(stepperE3, "E3");
#endif
#if ENABLED(E4_IS_TMC2130)
automatic_current_control(stepperE4, "E4");
#endif
}
}
/**
* TMC2130 specific sensorless homing using stallGuard2.
* stallGuard2 only works when in spreadCycle mode.
* spreadCycle and stealthChop are mutually exclusive.
*/
#if ENABLED(SENSORLESS_HOMING)
void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable/*=true*/) {
#if ENABLED(STEALTHCHOP)
if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL);
st.stealthChop(0);
}
else {
st.coolstep_min_speed(0);
st.stealthChop(1);
}
#endif
st.diag1_stall(enable ? 1 : 0);
}
#endif // SENSORLESS_HOMING
#endif // HAVE_TMC2130

View File

@ -1,38 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _TMC2130_H_
#define _TMC2130_H_
#include <TMC2130Stepper.h>
#include "../inc/MarlinConfig.h"
extern bool auto_current_control;
void tmc2130_checkOverTemp(void);
#if ENABLED(SENSORLESS_HOMING)
void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable=true);
#endif
#endif // _TMC2130_H_

View File

@ -0,0 +1,39 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TMC_MACROS_H
#define TMC_MACROS_H
// Trinamic Stepper Drivers
#define HAS_TRINAMIC (ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208) || ENABLED(IS_TRAMS))
#define X_IS_TRINAMIC (ENABLED( X_IS_TMC2130) || ENABLED( X_IS_TMC2208) || ENABLED(IS_TRAMS))
#define X2_IS_TRINAMIC (ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208))
#define Y_IS_TRINAMIC (ENABLED( Y_IS_TMC2130) || ENABLED( Y_IS_TMC2208) || ENABLED(IS_TRAMS))
#define Y2_IS_TRINAMIC (ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208))
#define Z_IS_TRINAMIC (ENABLED( Z_IS_TMC2130) || ENABLED( Z_IS_TMC2208) || ENABLED(IS_TRAMS))
#define Z2_IS_TRINAMIC (ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208))
#define E0_IS_TRINAMIC (ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208) || ENABLED(IS_TRAMS))
#define E1_IS_TRINAMIC (ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208))
#define E2_IS_TRINAMIC (ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208))
#define E3_IS_TRINAMIC (ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208))
#define E4_IS_TRINAMIC (ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208))
#endif

View File

@ -0,0 +1,266 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#include "tmc_util.h"
#include "../Marlin.h"
#include "../module/stepper_indirection.h"
#include "../module/printcounter.h"
#include "../libs/duration_t.h"
#include "../gcode/gcode.h"
template<typename TMC>
void tmc_get_current(TMC &st, const char name[]) {
SERIAL_ECHO(name);
SERIAL_ECHOPGM(" axis driver current: ");
SERIAL_ECHOLN(st.getCurrent());
}
template<typename TMC>
void tmc_set_current(TMC &st, const char name[], const int mA) {
st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
tmc_get_current(st, name);
}
template<typename TMC>
void tmc_report_otpw(TMC &st, const char name[]) {
SERIAL_ECHO(name);
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
SERIAL_EOL();
}
template<typename TMC>
void tmc_clear_otpw(TMC &st, const char name[]) {
st.clear_otpw();
SERIAL_ECHO(name);
SERIAL_ECHOLNPGM(" prewarn flag cleared");
}
template<typename TMC>
void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) {
SERIAL_ECHO(name);
SERIAL_ECHOPGM(" stealthChop max speed set to ");
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm));
}
template<typename TMC>
void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) {
st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm));
tmc_get_pwmthrs(st, name, spmm);
}
template<typename TMC>
void tmc_get_sgt(TMC &st, const char name[]) {
SERIAL_ECHO(name);
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
MYSERIAL.println(st.sgt(), DEC);
}
template<typename TMC>
void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) {
st.sgt(sgt_val);
tmc_get_sgt(st, name);
}
/*
* Check for over temperature or short to ground error flags.
* Report and log warning of overtemperature condition.
* Reduce driver current in a persistent otpw condition.
* Keep track of otpw counter so we don't reduce current on a single instance,
* and so we don't repeatedly report warning before the condition is cleared.
*/
#if ENABLED(MONITOR_DRIVER_STATUS)
struct TMC_driver_data {
uint32_t drv_status;
bool is_otpw;
bool is_ot;
bool is_error;
};
#if ENABLED(HAVE_TMC2130)
static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response&0xF; }
static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
constexpr uint32_t OTPW_bm = 0x4000000UL;
constexpr uint8_t OTPW_bp = 26;
constexpr uint32_t OT_bm = 0x2000000UL;
constexpr uint8_t OT_bp = 25;
constexpr uint8_t DRIVER_ERROR_bm = 0x2UL;
constexpr uint8_t DRIVER_ERROR_bp = 1;
TMC_driver_data data;
data.drv_status = st.DRV_STATUS();
data.is_otpw = (data.drv_status & OTPW_bm)>>OTPW_bp;
data.is_ot = (data.drv_status & OT_bm)>>OT_bp;
data.is_error = (st.status_response & DRIVER_ERROR_bm)>>DRIVER_ERROR_bp;
return data;
}
#endif
#if ENABLED(HAVE_TMC2208)
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
static uint8_t get_status_response(TMC2208Stepper &st) {
uint32_t drv_status = st.DRV_STATUS();
uint8_t gstat = st.GSTAT();
uint8_t response = 0;
response |= (drv_status >> (31-3)) & 0b1000;
response |= gstat & 0b11;
return response;
}
static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
constexpr uint32_t OTPW_bm = 0b1ul;
constexpr uint8_t OTPW_bp = 0;
constexpr uint32_t OT_bm = 0b10ul;
constexpr uint8_t OT_bp = 1;
TMC_driver_data data;
data.drv_status = st.DRV_STATUS();
data.is_otpw = (data.drv_status & OTPW_bm)>>OTPW_bp;
data.is_ot = (data.drv_status & OT_bm)>>OT_bp;
data.is_error = st.drv_err();
return data;
}
#endif
template<typename TMC>
uint8_t monitor_tmc_driver(TMC &st, const char axisID, uint8_t otpw_cnt) {
TMC_driver_data data = get_driver_data(st);
#if ENABLED(STOP_ON_ERROR)
if (data.is_error) {
SERIAL_EOL();
SERIAL_ECHO(axisID);
SERIAL_ECHO(" driver error detected:");
if (data.is_ot) SERIAL_ECHO("\novertemperature");
if (st.s2ga()) SERIAL_ECHO("\nshort to ground (coil A)");
if (st.s2gb()) SERIAL_ECHO("\nshort to ground (coil B)");
SERIAL_EOL();
#if ENABLED(TMC_DEBUG)
_M122();
#endif
kill(PSTR("Driver error"));
}
#endif
// Report if a warning was triggered
if (data.is_otpw && otpw_cnt==0) {
char timestamp[10];
duration_t elapsed = print_job_timer.duration();
const bool has_days = (elapsed.value > 60*60*24L);
(void)elapsed.toDigital(timestamp, has_days);
SERIAL_EOL();
SERIAL_ECHO(timestamp);
SERIAL_ECHOPGM(": ");
SERIAL_ECHO(axisID);
SERIAL_ECHOPGM(" driver overtemperature warning! (");
SERIAL_ECHO(st.getCurrent());
SERIAL_ECHOLN("mA)");
}
#if CURRENT_STEP_DOWN > 0
// Decrease current if is_otpw is true and driver is enabled and there's been more then 4 warnings
if (data.is_otpw && !st.isEnabled() && otpw_cnt > 4) {
st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE)
SERIAL_ECHO(axisID);
SERIAL_ECHOLNPAIR(" current decreased to ", st.getCurrent());
#endif
}
#endif
if (data.is_otpw) {
otpw_cnt++;
st.flag_otpw = true;
}
else if (otpw_cnt>0) otpw_cnt--;
if (report_tmc_status) {
const uint32_t pwm_scale = get_pwm_scale(st);
SERIAL_ECHO(axisID);
SERIAL_ECHOPAIR(":", pwm_scale);
SERIAL_ECHO(" |0b"); MYSERIAL.print(get_status_response(st), BIN);
SERIAL_ECHO("| ");
if (data.is_error) SERIAL_ECHO('E');
else if (data.is_ot) SERIAL_ECHO('O');
else if (data.is_otpw) SERIAL_ECHO('W');
else if (otpw_cnt>0) MYSERIAL.print(otpw_cnt, DEC);
else if (st.flag_otpw) SERIAL_ECHO('F');
SERIAL_ECHO("\t");
}
return otpw_cnt;
}
#define HAS_HW_COMMS(ST) ENABLED(ST##_IS_TMC2130)|| (ENABLED(ST##_IS_TMC2208) && defined(ST##_HARDWARE_SERIAL))
void monitor_tmc_driver() {
static millis_t next_cOT = 0;
if (ELAPSED(millis(), next_cOT)) {
next_cOT = millis() + 500;
#if HAS_HW_COMMS(X) || ENABLED(IS_TRAMS)
static uint8_t x_otpw_cnt = 0;
x_otpw_cnt = monitor_tmc_driver(stepperX, axis_codes[X_AXIS], x_otpw_cnt);
#endif
#if HAS_HW_COMMS(Y) || ENABLED(IS_TRAMS)
static uint8_t y_otpw_cnt = 0;
y_otpw_cnt = monitor_tmc_driver(stepperY, axis_codes[Y_AXIS], y_otpw_cnt);
#endif
#if HAS_HW_COMMS(Z) || ENABLED(IS_TRAMS)
static uint8_t z_otpw_cnt = 0;
z_otpw_cnt = monitor_tmc_driver(stepperZ, axis_codes[Z_AXIS], z_otpw_cnt);
#endif
#if HAS_HW_COMMS(X2)
static uint8_t x2_otpw_cnt = 0;
x2_otpw_cnt = monitor_tmc_driver(stepperX2, axis_codes[X_AXIS], x2_otpw_cnt);
#endif
#if HAS_HW_COMMS(Y2)
static uint8_t y2_otpw_cnt = 0;
y2_otpw_cnt = monitor_tmc_driver(stepperY2, axis_codes[Y_AXIS], y2_otpw_cnt);
#endif
#if HAS_HW_COMMS(Z2)
static uint8_t z2_otpw_cnt = 0;
z2_otpw_cnt = monitor_tmc_driver(stepperZ2, axis_codes[Z_AXIS], z2_otpw_cnt);
#endif
#if HAS_HW_COMMS(E0) || ENABLED(IS_TRAMS)
static uint8_t e0_otpw_cnt = 0;
e0_otpw_cnt = monitor_tmc_driver(stepperE0, axis_codes[E_AXIS], e0_otpw_cnt);
#endif
#if HAS_HW_COMMS(E1)
static uint8_t e1_otpw_cnt = 0;
e1_otpw_cnt = monitor_tmc_driver(stepperE1, axis_codes[E_AXIS], e1_otpw_cnt);
#endif
#if HAS_HW_COMMS(E2)
static uint8_t e2_otpw_cnt = 0;
e2_otpw_cnt = monitor_tmc_driver(stepperE2, axis_codes[E_AXIS], e2_otpw_cnt);
#endif
#if HAS_HW_COMMS(E3)
static uint8_t e3_otpw_cnt = 0;
e3_otpw_cnt = monitor_tmc_driver(stepperE3, axis_codes[E_AXIS], e3_otpw_cnt);
#endif
#if HAS_HW_COMMS(E4)
static uint8_t e4_otpw_cnt = 0;
e4_otpw_cnt = monitor_tmc_driver(stepperE4, axis_codes[E_AXIS], e4_otpw_cnt);
#endif
if (report_tmc_status) SERIAL_EOL();
}
}
#endif // MONITOR_DRIVER_STATUS
#endif // HAS_TRINAMIC

View File

@ -0,0 +1,82 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _TMC_UTIL_H_
#define _TMC_UTIL_H_
#include <TMC2130Stepper.h>
#include "../inc/MarlinConfig.h"
static bool report_tmc_status = false;
const char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1", "E2", "E3", "E4" };
enum TMC_AxisEnum {
TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2,
TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4
};
template<typename TMC>
void tmc_get_current(TMC &st, const char name[]);
template<typename TMC>
void tmc_set_current(TMC &st, const char name[], const int mA);
template<typename TMC>
void tmc_report_otpw(TMC &st, const char name[]);
template<typename TMC>
void tmc_clear_otpw(TMC &st, const char name[]);
template<typename TMC>
void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm);
template<typename TMC>
void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm);
template<typename TMC>
void tmc_get_sgt(TMC &st, const char name[]);
template<typename TMC>
void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val);
void _M122();
void monitor_tmc_driver();
/**
* TMC2130 specific sensorless homing using stallGuard2.
* stallGuard2 only works when in spreadCycle mode.
* spreadCycle and stealthChop are mutually exclusive.
*
* Defined here because of limitations with templates and headers.
*/
#if ENABLED(SENSORLESS_HOMING)
template<typename TMC>
void tmc_sensorless_homing(TMC &st, bool enable=true) {
#if ENABLED(STEALTHCHOP)
if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL);
st.stealthChop(0);
}
else {
st.coolstep_min_speed(0);
st.stealthChop(1);
}
#endif
st.diag1_stall(enable ? 1 : 0);
}
#endif
#endif // _TMC_UTIL_H_

View File

@ -45,8 +45,8 @@
#endif #endif
; ;
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#include "../../feature/tmc2130.h" #include "../../feature/tmc_util.h"
#endif #endif
/** /**
@ -77,6 +77,11 @@
tmc2130_init(); // Settings only stick when the driver has power tmc2130_init(); // Settings only stick when the driver has power
#endif #endif
#if ENABLED(HAVE_TMC2208)
delay(100);
tmc2208_init();
#endif
powersupply_on = true; powersupply_on = true;
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)

View File

@ -0,0 +1,342 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(TMC_DEBUG)
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
#include "../../../module/stepper_indirection.h"
#include "../../../module/planner.h"
enum TMC_debug_enum {
TMC_CODES,
TMC_ENABLED,
TMC_CURRENT,
TMC_RMS_CURRENT,
TMC_MAX_CURRENT,
TMC_IRUN,
TMC_IHOLD,
TMC_CS_ACTUAL,
TMC_PWM_SCALE,
TMC_VSENSE,
TMC_STEALTHCHOP,
TMC_MICROSTEPS,
TMC_TSTEP,
TMC_TPWMTHRS,
TMC_TPWMTHRS_MMS,
TMC_OTPW,
TMC_OTPW_TRIGGERED,
TMC_TOFF,
TMC_TBL,
TMC_HEND,
TMC_HSTRT,
TMC_SGT
};
enum TMC_drv_status_enum {
TMC_DRV_CODES,
TMC_STST,
TMC_OLB,
TMC_OLA,
TMC_S2GB,
TMC_S2GA,
TMC_DRV_OTPW,
TMC_OT,
TMC_STALLGUARD,
TMC_DRV_CS_ACTUAL,
TMC_FSACTIVE,
TMC_SG_RESULT,
TMC_DRV_STATUS_HEX,
TMC_T157,
TMC_T150,
TMC_T143,
TMC_T120,
TMC_STEALTH,
TMC_S2VSB,
TMC_S2VSA
};
static void drv_status_print_hex(const char name[], const uint32_t drv_status) {
SERIAL_ECHO(name);
SERIAL_ECHOPGM(" = 0x");
for(int B=24; B>=8; B-=8){
MYSERIAL.print((drv_status>>(B+4))&0xF, HEX);
MYSERIAL.print((drv_status>>B)&0xF, HEX);
MYSERIAL.print(':');
}
MYSERIAL.print((drv_status>>4)&0xF, HEX);
MYSERIAL.print((drv_status)&0xF, HEX);
SERIAL_EOL();
}
#if ENABLED(HAVE_TMC2130)
static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
switch(i) {
case TMC_PWM_SCALE: MYSERIAL.print(st.PWM_SCALE(), DEC); break;
case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break;
case TMC_SGT: MYSERIAL.print(st.sgt(), DEC); break;
case TMC_STEALTHCHOP: serialprintPGM(st.stealthChop() ? PSTR("true") : PSTR("false")); break;
default: break;
}
}
static void tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) {
switch(i) {
case TMC_STALLGUARD: if (st.stallguard()) SERIAL_ECHOPGM("X"); break;
case TMC_SG_RESULT: MYSERIAL.print(st.sg_result(), DEC); break;
case TMC_FSACTIVE: if (st.fsactive()) SERIAL_ECHOPGM("X"); break;
default: break;
}
}
#endif
#if ENABLED(HAVE_TMC2208)
static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
switch(i) {
case TMC_TSTEP:
{
uint32_t data = 0;
st.TSTEP(&data);
MYSERIAL.print(data);
break;
}
case TMC_PWM_SCALE: MYSERIAL.print(st.pwm_scale_sum(), DEC); break;
case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
case TMC_S2VSA: if (st.s2vsa()) SERIAL_ECHOPGM("X"); break;
case TMC_S2VSB: if (st.s2vsb()) SERIAL_ECHOPGM("X"); break;
default: break;
}
}
static void tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) {
switch(i) {
case TMC_T157: if (st.t157()) SERIAL_ECHOPGM("X"); break;
case TMC_T150: if (st.t150()) SERIAL_ECHOPGM("X"); break;
case TMC_T143: if (st.t143()) SERIAL_ECHOPGM("X"); break;
case TMC_T120: if (st.t120()) SERIAL_ECHOPGM("X"); break;
default: break;
}
}
#endif
template <typename TMC>
static void tmc_status(TMC &st, TMC_AxisEnum axis, const TMC_debug_enum i, const float spmm) {
SERIAL_ECHO('\t');
switch(i) {
case TMC_CODES: SERIAL_ECHO(extended_axis_codes[axis]); break;
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
case TMC_CURRENT: SERIAL_ECHO(st.getCurrent()); break;
case TMC_RMS_CURRENT: MYSERIAL.print(st.rms_current()); break;
case TMC_MAX_CURRENT: MYSERIAL.print((float)st.rms_current()*1.41, 0); break;
case TMC_IRUN:
MYSERIAL.print(st.irun(), DEC);
SERIAL_ECHOPGM("/31");
break;
case TMC_IHOLD:
MYSERIAL.print(st.ihold(), DEC);
SERIAL_ECHOPGM("/31");
break;
case TMC_CS_ACTUAL:
MYSERIAL.print(st.cs_actual(), DEC);
SERIAL_ECHOPGM("/31");
break;
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); break;
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
case TMC_TPWMTHRS:
{
uint32_t tpwmthrs_val = st.TPWMTHRS();
SERIAL_ECHO(tpwmthrs_val);
}
break;
case TMC_TPWMTHRS_MMS:
{
uint32_t tpwmthrs_val = st.TPWMTHRS();
tpwmthrs_val ? SERIAL_ECHO(12650000UL * st.microsteps() / (256 * tpwmthrs_val * spmm)) : SERIAL_ECHO('-');
}
break;
case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
case TMC_TOFF: MYSERIAL.print(st.toff(), DEC); break;
case TMC_TBL: MYSERIAL.print(st.blank_time(), DEC); break;
case TMC_HEND: MYSERIAL.print(st.hysterisis_end(), DEC); break;
case TMC_HSTRT: MYSERIAL.print(st.hysterisis_start(), DEC); break;
default: tmc_status(st, i); break;
}
}
template <typename TMC>
static void tmc_parse_drv_status(TMC &st, TMC_AxisEnum axis, const TMC_drv_status_enum i) {
SERIAL_ECHOPGM("\t");
switch(i) {
case TMC_DRV_CODES: SERIAL_ECHO(extended_axis_codes[axis]); break;
case TMC_STST: if (st.stst()) SERIAL_ECHOPGM("X"); break;
case TMC_OLB: if (st.olb()) SERIAL_ECHOPGM("X"); break;
case TMC_OLA: if (st.ola()) SERIAL_ECHOPGM("X"); break;
case TMC_S2GB: if (st.s2gb()) SERIAL_ECHOPGM("X"); break;
case TMC_S2GA: if (st.s2ga()) SERIAL_ECHOPGM("X"); break;
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_ECHOPGM("X"); break;
case TMC_OT: if (st.ot()) SERIAL_ECHOPGM("X"); break;
case TMC_DRV_CS_ACTUAL: MYSERIAL.print(st.cs_actual(), DEC); break;
case TMC_DRV_STATUS_HEX:drv_status_print_hex(extended_axis_codes[axis], st.DRV_STATUS()); break;
default: tmc_parse_drv_status(st, i); break;
}
}
static void tmc_debug_loop(const TMC_debug_enum i) {
#if X_IS_TRINAMIC
tmc_status(stepperX, TMC_X, i, planner.axis_steps_per_mm[X_AXIS]);
#endif
#if X2_IS_TRINAMIC
tmc_status(stepperX2, TMC_X2, i, planner.axis_steps_per_mm[X_AXIS]);
#endif
#if Y_IS_TRINAMIC
tmc_status(stepperY, TMC_Y, i, planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if Y2_IS_TRINAMIC
tmc_status(stepperY2, TMC_Y2, i, planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if Z_IS_TRINAMIC
tmc_status(stepperZ, TMC_Z, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if Z2_IS_TRINAMIC
tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if E0_IS_TRINAMIC
tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]);
#endif
#if E1_IS_TRINAMIC
tmc_status(stepperE1, TMC_E1, i, planner.axis_steps_per_mm[E_AXIS+1]);
#endif
#if E2_IS_TRINAMIC
tmc_status(stepperE2, TMC_E2, i, planner.axis_steps_per_mm[E_AXIS+2]);
#endif
#if E3_IS_TRINAMIC
tmc_status(stepperE3, TMC_E3, i, planner.axis_steps_per_mm[E_AXIS+3]);
#endif
#if E4_IS_TRINAMIC
tmc_status(stepperE4, TMC_E4, i, planner.axis_steps_per_mm[E_AXIS+4]);
#endif
SERIAL_EOL();
}
static void drv_status_loop(const TMC_drv_status_enum i) {
#if X_IS_TRINAMIC
tmc_parse_drv_status(stepperX, TMC_X, i);
#endif
#if X2_IS_TRINAMIC
tmc_parse_drv_status(stepperX2, TMC_X2, i);
#endif
#if Y_IS_TRINAMIC
tmc_parse_drv_status(stepperY, TMC_Y, i);
#endif
#if Y2_IS_TRINAMIC
tmc_parse_drv_status(stepperY2, TMC_Y2, i);
#endif
#if Z_IS_TRINAMIC
tmc_parse_drv_status(stepperZ, TMC_Z, i);
#endif
#if Z2_IS_TRINAMIC
tmc_parse_drv_status(stepperZ2, TMC_Z2, i);
#endif
#if E0_IS_TRINAMIC
tmc_parse_drv_status(stepperE0, TMC_E0, i);
#endif
#if E1_IS_TRINAMIC
tmc_parse_drv_status(stepperE1, TMC_E1, i);
#endif
#if E2_IS_TRINAMIC
tmc_parse_drv_status(stepperE2, TMC_E2, i);
#endif
#if E3_IS_TRINAMIC
tmc_parse_drv_status(stepperE3, TMC_E3, i);
#endif
#if E4_IS_TRINAMIC
tmc_parse_drv_status(stepperE4, TMC_E4, i);
#endif
SERIAL_EOL();
}
void _M122() {
if (parser.seen('S')) {
if (parser.value_bool()) {
SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|");
report_tmc_status = true;
} else
report_tmc_status = false;
} else {
SERIAL_ECHOPGM("\t"); tmc_debug_loop(TMC_CODES);
SERIAL_ECHOPGM("Enabled\t"); tmc_debug_loop(TMC_ENABLED);
SERIAL_ECHOPGM("Set current"); tmc_debug_loop(TMC_CURRENT);
SERIAL_ECHOPGM("RMS current"); tmc_debug_loop(TMC_RMS_CURRENT);
SERIAL_ECHOPGM("MAX current"); tmc_debug_loop(TMC_MAX_CURRENT);
SERIAL_ECHOPGM("Run current"); tmc_debug_loop(TMC_IRUN);
SERIAL_ECHOPGM("Hold current"); tmc_debug_loop(TMC_IHOLD);
SERIAL_ECHOPGM("CS actual\t"); tmc_debug_loop(TMC_CS_ACTUAL);
SERIAL_ECHOPGM("PWM scale"); tmc_debug_loop(TMC_PWM_SCALE);
SERIAL_ECHOPGM("vsense\t"); tmc_debug_loop(TMC_VSENSE);
SERIAL_ECHOPGM("stealthChop"); tmc_debug_loop(TMC_STEALTHCHOP);
SERIAL_ECHOPGM("msteps\t"); tmc_debug_loop(TMC_MICROSTEPS);
SERIAL_ECHOPGM("tstep\t"); tmc_debug_loop(TMC_TSTEP);
SERIAL_ECHOPGM("pwm\nthreshold\t"); tmc_debug_loop(TMC_TPWMTHRS);
SERIAL_ECHOPGM("[mm/s]\t"); tmc_debug_loop(TMC_TPWMTHRS_MMS);
SERIAL_ECHOPGM("OT prewarn"); tmc_debug_loop(TMC_OTPW);
SERIAL_ECHOPGM("OT prewarn has\nbeen triggered"); tmc_debug_loop(TMC_OTPW_TRIGGERED);
SERIAL_ECHOPGM("off time\t"); tmc_debug_loop(TMC_TOFF);
SERIAL_ECHOPGM("blank time"); tmc_debug_loop(TMC_TBL);
SERIAL_ECHOPGM("hysterisis\n-end\t"); tmc_debug_loop(TMC_HEND);
SERIAL_ECHOPGM("-start\t"); tmc_debug_loop(TMC_HSTRT);
SERIAL_ECHOPGM("Stallguard thrs"); tmc_debug_loop(TMC_SGT);
SERIAL_ECHOPGM("DRVSTATUS"); drv_status_loop(TMC_DRV_CODES);
#if ENABLED(HAVE_TMC2130)
SERIAL_ECHOPGM("stallguard\t"); drv_status_loop(TMC_STALLGUARD);
SERIAL_ECHOPGM("sg_result\t"); drv_status_loop(TMC_SG_RESULT);
SERIAL_ECHOPGM("fsactive\t"); drv_status_loop(TMC_FSACTIVE);
#endif
SERIAL_ECHOPGM("stst\t"); drv_status_loop(TMC_STST);
SERIAL_ECHOPGM("olb\t"); drv_status_loop(TMC_OLB);
SERIAL_ECHOPGM("ola\t"); drv_status_loop(TMC_OLA);
SERIAL_ECHOPGM("s2gb\t"); drv_status_loop(TMC_S2GB);
SERIAL_ECHOPGM("s2ga\t"); drv_status_loop(TMC_S2GA);
SERIAL_ECHOPGM("otpw\t"); drv_status_loop(TMC_DRV_OTPW);
SERIAL_ECHOPGM("ot\t"); drv_status_loop(TMC_OT);
#if ENABLED(HAVE_TMC2208)
SERIAL_ECHOPGM("157C\t"); drv_status_loop(TMC_T157);
SERIAL_ECHOPGM("150C\t"); drv_status_loop(TMC_T150);
SERIAL_ECHOPGM("143C\t"); drv_status_loop(TMC_T143);
SERIAL_ECHOPGM("120C\t"); drv_status_loop(TMC_T120);
SERIAL_ECHOPGM("s2vsa\t"); drv_status_loop(TMC_S2VSA);
SERIAL_ECHOPGM("s2vsb\t"); drv_status_loop(TMC_S2VSB);
#endif
SERIAL_ECHOLNPGM("Driver registers:");drv_status_loop(TMC_DRV_STATUS_HEX);
}
}
// We need to call M122 from monitor_tmc_driver() as well but GcodeSuite::M122 is private.
inline void GcodeSuite::M122() { _M122(); }
#endif // TMC_DEBUG

View File

@ -22,54 +22,67 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#include "../../gcode.h" #include "../../gcode.h"
#include "../../../feature/tmc2130.h" #include "../../../feature/tmc_util.h"
#include "../../../module/stepper_indirection.h" #include "../../../module/stepper_indirection.h"
#include "../../../module/planner.h"
inline void tmc2130_get_current(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" axis driver current: ");
SERIAL_ECHOLN(st.getCurrent());
}
inline void tmc2130_set_current(TMC2130Stepper &st, const char name, const int mA) {
st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
tmc2130_get_current(st, name);
}
/** /**
* M906: Set motor current in milliamps using axis codes X, Y, Z, E * M906: Set motor current in milliamps using axis codes X, Y, Z, E
* Report driver currents when no axis specified * Report driver currents when no axis specified
*
* S1: Enable automatic current control
* S0: Disable
*/ */
void GcodeSuite::M906() { inline void GcodeSuite::M906() {
uint16_t values[XYZE]; uint16_t values[XYZE];
LOOP_XYZE(i) LOOP_XYZE(i)
values[i] = parser.intval(axis_codes[i]); values[i] = parser.intval(axis_codes[i]);
#if ENABLED(X_IS_TMC2130) #if X_IS_TRINAMIC
if (values[X_AXIS]) tmc2130_set_current(stepperX, 'X', values[X_AXIS]); if (values[X_AXIS]) tmc_set_current(stepperX, extended_axis_codes[TMC_X], values[X_AXIS]);
else tmc2130_get_current(stepperX, 'X'); else tmc_get_current(stepperX, extended_axis_codes[TMC_X]);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if X2_IS_TRINAMIC
if (values[Y_AXIS]) tmc2130_set_current(stepperY, 'Y', values[Y_AXIS]); if (values[X_AXIS]) tmc_set_current(stepperX2, extended_axis_codes[TMC_X2], values[X_AXIS]);
else tmc2130_get_current(stepperY, 'Y'); else tmc_get_current(stepperX2, extended_axis_codes[TMC_X2]);
#endif #endif
#if ENABLED(Z_IS_TMC2130) #if Y_IS_TRINAMIC
if (values[Z_AXIS]) tmc2130_set_current(stepperZ, 'Z', values[Z_AXIS]); if (values[Y_AXIS]) tmc_set_current(stepperY, extended_axis_codes[TMC_Y], values[Y_AXIS]);
else tmc2130_get_current(stepperZ, 'Z'); else tmc_get_current(stepperY, extended_axis_codes[TMC_Y]);
#endif #endif
#if ENABLED(E0_IS_TMC2130) #if Y2_IS_TRINAMIC
if (values[E_AXIS]) tmc2130_set_current(stepperE0, 'E', values[E_AXIS]); if (values[Y_AXIS]) tmc_set_current(stepperY2, extended_axis_codes[TMC_Y2], values[Y_AXIS]);
else tmc2130_get_current(stepperE0, 'E'); else tmc_get_current(stepperY2, extended_axis_codes[TMC_Y2]);
#endif
#if Z_IS_TRINAMIC
if (values[Z_AXIS]) tmc_set_current(stepperZ, extended_axis_codes[TMC_Z], values[Z_AXIS]);
else tmc_get_current(stepperZ, extended_axis_codes[TMC_Z]);
#endif
#if Z2_IS_TRINAMIC
if (values[Z_AXIS]) tmc_set_current(stepperZ2, extended_axis_codes[TMC_Z2], values[Z_AXIS]);
else tmc_get_current(stepperZ2, extended_axis_codes[TMC_Z2]);
#endif
#if E0_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_current(stepperE0, extended_axis_codes[TMC_E0], values[E_AXIS]);
else tmc_get_current(stepperE0, extended_axis_codes[TMC_E0]);
#endif
#if E1_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_current(stepperE1, extended_axis_codes[TMC_E1], values[E_AXIS]);
else tmc_get_current(stepperE1, extended_axis_codes[TMC_E1]);
#endif
#if E2_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_current(stepperE2, extended_axis_codes[TMC_E2], values[E_AXIS]);
else tmc_get_current(stepperE2, extended_axis_codes[TMC_E2]);
#endif
#if E3_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_current(stepperE3, extended_axis_codes[TMC_E3], values[E_AXIS]);
else tmc_get_current(stepperE3, extended_axis_codes[TMC_E3]);
#endif
#if E4_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_current(stepperE4, extended_axis_codes[TMC_E4], values[E_AXIS]);
else tmc_get_current(stepperE4, extended_axis_codes[TMC_E4]);
#endif #endif
#if ENABLED(AUTOMATIC_CURRENT_CONTROL)
if (parser.seen('S')) auto_current_control = parser.value_bool();
#endif
} }
#endif // HAVE_TMC2130 #endif // HAS_TRINAMIC

View File

@ -1,155 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
SERIAL_EOL();
}
/**
* M911: Report TMC2130 stepper driver overtemperature pre-warn flag
* The flag is held by the library and persist until manually cleared by M912
*/
void GcodeSuite::M911() {
const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
#if ENABLED(X_IS_TMC2130)
if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
#endif
}
inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
st.clear_otpw();
SERIAL_CHAR(name);
SERIAL_ECHOLNPGM(" prewarn flag cleared");
}
/**
* M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
*/
void GcodeSuite::M912() {
const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
#if ENABLED(X_IS_TMC2130)
if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
#endif
}
#if ENABLED(HYBRID_THRESHOLD)
#include "../../../module/planner.h"
inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" stealthChop max speed set to ");
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
}
inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
tmc2130_get_pwmthrs(st, name, spmm);
}
/**
* M913: Set HYBRID_THRESHOLD speed.
*/
void GcodeSuite::M913() {
uint16_t values[XYZE];
LOOP_XYZE(i)
values[i] = parser.intval(axis_codes[i]);
#if ENABLED(X_IS_TMC2130)
if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
#endif
#if ENABLED(Y_IS_TMC2130)
if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if ENABLED(Z_IS_TMC2130)
if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if ENABLED(E0_IS_TMC2130)
if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
#endif
}
#endif // HYBRID_THRESHOLD
#if ENABLED(SENSORLESS_HOMING)
inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
SERIAL_ECHOLN(st.sgt());
}
inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
st.sgt(sgt_val);
tmc2130_get_sgt(st, name);
}
/**
* M914: Set SENSORLESS_HOMING sensitivity.
*/
void GcodeSuite::M914() {
#if ENABLED(X_IS_TMC2130)
if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
else tmc2130_get_sgt(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
else tmc2130_get_sgt(stepperY, 'Y');
#endif
}
#endif // SENSORLESS_HOMING
#endif // HAVE_TMC2130

View File

@ -0,0 +1,195 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
#include "../../../module/stepper_indirection.h"
#include "../../../module/planner.h"
/**
* M911: Report TMC stepper driver overtemperature pre-warn flag
* The flag is held by the library and persist until manually cleared by M912
*/
inline void GcodeSuite::M911() {
#if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperX, extended_axis_codes[TMC_X]);
#endif
#if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperY, extended_axis_codes[TMC_Y]);
#endif
#if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperZ, extended_axis_codes[TMC_Z]);
#endif
#if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperE0, extended_axis_codes[TMC_E0]);
#endif
}
/**
* M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library
*/
inline void GcodeSuite::M912() {
const bool clearX = parser.seen(axis_codes[X_AXIS]), clearY = parser.seen(axis_codes[Y_AXIS]), clearZ = parser.seen(axis_codes[Z_AXIS]), clearE = parser.seen(axis_codes[E_AXIS]),
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
if (clearX || clearAll) tmc_clear_otpw(stepperX, extended_axis_codes[TMC_X]);
#endif
#if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
if (clearX || clearAll) tmc_clear_otpw(stepperX, extended_axis_codes[TMC_X]);
#endif
#if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX))
if (clearY || clearAll) tmc_clear_otpw(stepperY, extended_axis_codes[TMC_Y]);
#endif
#if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX))
if (clearZ || clearAll) tmc_clear_otpw(stepperZ, extended_axis_codes[TMC_Z]);
#endif
#if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX))
if (clearE || clearAll) tmc_clear_otpw(stepperE0, extended_axis_codes[TMC_E0]);
#endif
}
/**
* M913: Set HYBRID_THRESHOLD speed.
*/
#if ENABLED(HYBRID_THRESHOLD)
inline void GcodeSuite::M913() {
uint16_t values[XYZE];
LOOP_XYZE(i)
values[i] = parser.intval(axis_codes[i]);
#if X_IS_TRINAMIC
if (values[X_AXIS]) tmc_set_pwmthrs(stepperX, extended_axis_codes[TMC_X], values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
else tmc_get_pwmthrs(stepperX, extended_axis_codes[TMC_X], planner.axis_steps_per_mm[X_AXIS]);
#endif
#if X2_IS_TRINAMIC
if (values[X_AXIS]) tmc_set_pwmthrs(stepperX2, extended_axis_codes[TMC_X2], values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
else tmc_get_pwmthrs(stepperX, extended_axis_codes[TMC_X2], planner.axis_steps_per_mm[X_AXIS]);
#endif
#if Y_IS_TRINAMIC
if (values[Y_AXIS]) tmc_set_pwmthrs(stepperY, extended_axis_codes[TMC_Y], values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
else tmc_get_pwmthrs(stepperY, extended_axis_codes[TMC_Y], planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if Y2_IS_TRINAMIC
if (values[Y_AXIS]) tmc_set_pwmthrs(stepperY2, extended_axis_codes[TMC_Y2], values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
else tmc_get_pwmthrs(stepperY, extended_axis_codes[TMC_Y2], planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if Z_IS_TRINAMIC
if (values[Z_AXIS]) tmc_set_pwmthrs(stepperZ, extended_axis_codes[TMC_Z], values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
else tmc_get_pwmthrs(stepperZ, extended_axis_codes[TMC_Z], planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if Z2_IS_TRINAMIC
if (values[Z_AXIS]) tmc_set_pwmthrs(stepperZ2, extended_axis_codes[TMC_Z2], values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
else tmc_get_pwmthrs(stepperZ, extended_axis_codes[TMC_Z2], planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if E0_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_pwmthrs(stepperE0, extended_axis_codes[TMC_E0], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc_get_pwmthrs(stepperE0, extended_axis_codes[TMC_E0], planner.axis_steps_per_mm[E_AXIS]);
#endif
#if E1_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_pwmthrs(stepperE1, extended_axis_codes[TMC_E1], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc_get_pwmthrs(stepperE1, extended_axis_codes[TMC_E1], planner.axis_steps_per_mm[E_AXIS]);
#endif
#if E2_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_pwmthrs(stepperE2, extended_axis_codes[TMC_E2], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc_get_pwmthrs(stepperE2, extended_axis_codes[TMC_E2], planner.axis_steps_per_mm[E_AXIS]);
#endif
#if E3_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_pwmthrs(stepperE3, extended_axis_codes[TMC_E3], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc_get_pwmthrs(stepperE3, extended_axis_codes[TMC_E3], planner.axis_steps_per_mm[E_AXIS]);
#endif
#if E4_IS_TRINAMIC
if (values[E_AXIS]) tmc_set_pwmthrs(stepperE4, extended_axis_codes[TMC_E4], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc_get_pwmthrs(stepperE4, extended_axis_codes[TMC_E4], planner.axis_steps_per_mm[E_AXIS]);
#endif
}
#endif // HYBRID_THRESHOLD
/**
* M914: Set SENSORLESS_HOMING sensitivity.
*/
#if ENABLED(SENSORLESS_HOMING)
inline void GcodeSuite::M914() {
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX, extended_axis_codes[TMC_X], parser.value_int());
else tmc_get_sgt(stepperX, extended_axis_codes[TMC_X]);
#endif
#if ENABLED(X2_IS_TMC2130)
if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX2, extended_axis_codes[TMC_X2], parser.value_int());
else tmc_get_sgt(stepperX2, extended_axis_codes[TMC_X2]);
#endif
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
if (parser.seen(axis_codes[Y_AXIS])) tmc_set_sgt(stepperY, extended_axis_codes[TMC_Y], parser.value_int());
else tmc_get_sgt(stepperY, extended_axis_codes[TMC_Y]);
#endif
#if ENABLED(Y2_IS_TMC2130)
if (parser.seen(axis_codes[Y_AXIS])) tmc_set_sgt(stepperY2, extended_axis_codes[TMC_Y2], parser.value_int());
else tmc_get_sgt(stepperY2, extended_axis_codes[TMC_Y2]);
#endif
}
#endif // SENSORLESS_HOMING
/**
* TMC Z axis calibration routine
*/
#if ENABLED(TMC_Z_CALIBRATION) && (Z_IS_TRINAMIC || Z2_IS_TRINAMIC)
inline void GcodeSuite::M915() {
uint16_t _rms = parser.seenval('S') ? parser.value_int() : CALIBRATION_CURRENT;
uint16_t _z = parser.seenval('Z') ? parser.value_int() : CALIBRATION_EXTRA_HEIGHT;
if (!axis_known_position[Z_AXIS]) {
SERIAL_ECHOLNPGM("\nPlease home Z axis first");
return;
}
uint16_t Z_current_1 = stepperZ.getCurrent();
uint16_t Z2_current_1 = stepperZ.getCurrent();
stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
SERIAL_ECHOPAIR("\nCalibration current: Z", _rms);
soft_endstops_enabled = false;
do_blocking_move_to_z(Z_MAX_POS+_z);
stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER);
stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
do_blocking_move_to_z(Z_MAX_POS);
soft_endstops_enabled = true;
SERIAL_ECHOLNPGM("\nHoming Z because we lost steps");
home_z_safely();
}
#endif
#endif // HAS_TRINAMIC

View File

@ -657,7 +657,8 @@ void GcodeSuite::process_parsed_command() {
#endif #endif
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAVE_TRINAMIC
case 122: M122(); break;
case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E
case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags
case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags

View File

@ -130,6 +130,7 @@
* M119 - Report endstops status. * M119 - Report endstops status.
* M120 - Enable endstops detection. * M120 - Enable endstops detection.
* M121 - Disable endstops detection. * M121 - Disable endstops detection.
* M122 - Debug stepper (Requires HAVE_TMC2130 or HAVE_TMC2208)
* M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE) * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
* M126 - Solenoid Air Valve Open. (Requires BARICUDA) * M126 - Solenoid Air Valve Open. (Requires BARICUDA)
* M127 - Solenoid Air Valve Closed. (Requires BARICUDA) * M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
@ -218,8 +219,8 @@
* M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN) * M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
* M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT) * M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
* M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT) * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130) * M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130 or HAVE_TMC2208)
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130) * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130 or HAVE_TMC2208)
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD) * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
* M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING) * M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING)
* *
@ -727,7 +728,10 @@ private:
static void M900(); static void M900();
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#if ENABLED(TMC_DEBUG)
static void M122();
#endif
static void M906(); static void M906();
static void M911(); static void M911();
static void M912(); static void M912();
@ -737,6 +741,9 @@ private:
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
static void M914(); static void M914();
#endif #endif
#if ENABLED(TMC_Z_CALIBRATION)
static void M915();
#endif
#endif #endif
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)

View File

@ -28,6 +28,7 @@
#include "Version.h" #include "Version.h"
#include "../../Configuration.h" #include "../../Configuration.h"
#include "Conditionals_LCD.h" #include "Conditionals_LCD.h"
#include "../feature/tmc_macros.h"
#include "../../Configuration_adv.h" #include "../../Configuration_adv.h"
#include "Conditionals_adv.h" #include "Conditionals_adv.h"

View File

@ -1434,14 +1434,37 @@ static_assert(1 >= 0
|| ENABLED( E1_IS_TMC2130 ) \ || ENABLED( E1_IS_TMC2130 ) \
|| ENABLED( E2_IS_TMC2130 ) \ || ENABLED( E2_IS_TMC2130 ) \
|| ENABLED( E3_IS_TMC2130 ) \ || ENABLED( E3_IS_TMC2130 ) \
|| ENABLED( E4_IS_TMC2130 ) \ || ENABLED( E4_IS_TMC2130 ) )
)
#error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set." #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
#elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) #elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#elif defined(AUTOMATIC_CURRENT_CONTROL)
#error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration."
#endif #endif
#endif #endif
/**
* Make sure HAVE_TMC2208 is warranted
*/
#if ENABLED(HAVE_TMC2208) && !( \
ENABLED( X_IS_TMC2208 ) \
|| ENABLED( X2_IS_TMC2208 ) \
|| ENABLED( Y_IS_TMC2208 ) \
|| ENABLED( Y2_IS_TMC2208 ) \
|| ENABLED( Z_IS_TMC2208 ) \
|| ENABLED( Z2_IS_TMC2208 ) \
|| ENABLED( E0_IS_TMC2208 ) \
|| ENABLED( E1_IS_TMC2208 ) \
|| ENABLED( E2_IS_TMC2208 ) \
|| ENABLED( E3_IS_TMC2208 ) )
#error "Choose at least one TMC2208 stepper."
#endif
#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif
/** /**
* Make sure HAVE_L6470DRIVER is warranted * Make sure HAVE_L6470DRIVER is warranted
*/ */

View File

@ -36,13 +36,13 @@
* *
*/ */
#define EEPROM_VERSION "V46" #define EEPROM_VERSION "V47"
// Change EEPROM version if these are changed: // Change EEPROM version if these are changed:
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
/** /**
* V46 EEPROM Layout: * V47 EEPROM Layout:
* *
* 100 Version (char x4) * 100 Version (char x4)
* 104 EEPROM CRC16 (uint16_t) * 104 EEPROM CRC16 (uint16_t)
@ -154,6 +154,10 @@
* 578 M906 E3 Stepper E3 current (uint16_t) * 578 M906 E3 Stepper E3 current (uint16_t)
* 580 M906 E4 Stepper E4 current (uint16_t) * 580 M906 E4 Stepper E4 current (uint16_t)
* *
* SENSORLESS HOMING 4 bytes
* 580 M914 X Stepper X and X2 threshold (int16_t)
* 582 M914 Y Stepper Y and Y2 threshold (int16_t)
*
* LIN_ADVANCE: 8 bytes * LIN_ADVANCE: 8 bytes
* 582 M900 K extruder_advance_k (float) * 582 M900 K extruder_advance_k (float)
* 586 M900 WHD advance_ed_ratio (float) * 586 M900 WHD advance_ed_ratio (float)
@ -542,70 +546,70 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy); EEPROM_WRITE(dummy);
} }
// Save TMC2130 Configuration, and placeholder values // Save TMC2130 or TMC2208 Configuration, and placeholder values
uint16_t val; uint16_t val;
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#if ENABLED(X_IS_TMC2130) #if X_IS_TRINAMIC
val = stepperX.getCurrent(); val = stepperX.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(Y_IS_TMC2130) #if Y_IS_TRINAMIC
val = stepperY.getCurrent(); val = stepperY.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(Z_IS_TMC2130) #if Z_IS_TRINAMIC
val = stepperZ.getCurrent(); val = stepperZ.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(X2_IS_TMC2130) #if X2_IS_TRINAMIC
val = stepperX2.getCurrent(); val = stepperX2.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(Y2_IS_TMC2130) #if Y2_IS_TRINAMIC
val = stepperY2.getCurrent(); val = stepperY2.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(Z2_IS_TMC2130) #if Z2_IS_TRINAMIC
val = stepperZ2.getCurrent(); val = stepperZ2.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(E0_IS_TMC2130) #if E0_IS_TRINAMIC
val = stepperE0.getCurrent(); val = stepperE0.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(E1_IS_TMC2130) #if E1_IS_TRINAMIC
val = stepperE1.getCurrent(); val = stepperE1.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(E2_IS_TMC2130) #if E2_IS_TRINAMIC
val = stepperE2.getCurrent(); val = stepperE2.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(E3_IS_TMC2130) #if E3_IS_TRINAMIC
val = stepperE3.getCurrent(); val = stepperE3.getCurrent();
#else #else
val = 0; val = 0;
#endif #endif
EEPROM_WRITE(val); EEPROM_WRITE(val);
#if ENABLED(E4_IS_TMC2130) #if E4_IS_TRINAMIC
val = stepperE4.getCurrent(); val = stepperE4.getCurrent();
#else #else
val = 0; val = 0;
@ -616,6 +620,28 @@ void MarlinSettings::postprocess() {
for (uint8_t q = 11; q--;) EEPROM_WRITE(val); for (uint8_t q = 11; q--;) EEPROM_WRITE(val);
#endif #endif
//
// TMC2130 Sensorless homing threshold
//
int16_t thrs;
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130)
thrs = stepperX.sgt();
#else
thrs = 0;
#endif
EEPROM_WRITE(thrs);
#if ENABLED(Y_IS_TMC2130)
thrs = stepperY.sgt();
#else
thrs = 0;
#endif
EEPROM_WRITE(thrs);
#else
thrs = 0;
for (uint8_t q = 2; q--;) EEPROM_WRITE(thrs);
#endif
// //
// Linear Advance // Linear Advance
// //
@ -1014,55 +1040,80 @@ void MarlinSettings::postprocess() {
// //
uint16_t val; uint16_t val;
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(X_IS_TMC2130) #if X_IS_TRINAMIC
stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(Y_IS_TMC2130) #if Y_IS_TRINAMIC
stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(Z_IS_TMC2130) #if Z_IS_TRINAMIC
stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(X2_IS_TMC2130) #if X2_IS_TRINAMIC
stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(Y2_IS_TMC2130) #if Y2_IS_TRINAMIC
stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(Z2_IS_TMC2130) #if Z2_IS_TRINAMIC
stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(E0_IS_TMC2130) #if E0_IS_TRINAMIC
stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(E1_IS_TMC2130) #if E1_IS_TRINAMIC
stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(E2_IS_TMC2130) #if E2_IS_TRINAMIC
stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(E3_IS_TMC2130) #if E3_IS_TRINAMIC
stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
EEPROM_READ(val); EEPROM_READ(val);
#if ENABLED(E4_IS_TMC2130) #if E4_IS_TRINAMIC
stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
#else #else
for (uint8_t q = 11; q--;) EEPROM_READ(val); for (uint8_t q = 11; q--;) EEPROM_READ(val);
#endif #endif
/*
* TMC2130 Sensorless homing threshold.
* X and X2 use the same value
* Y and Y2 use the same value
*/
int16_t thrs;
#if ENABLED(SENSORLESS_HOMING)
EEPROM_READ(thrs);
#if ENABLED(X_IS_TMC2130)
stepperX.sgt(thrs);
#endif
#if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(thrs);
#endif
EEPROM_READ(thrs);
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt(thrs);
#endif
#if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(thrs);
#endif
#else
for (uint8_t q = 0; q < 2; q++) EEPROM_READ(thrs);
#endif
// //
// Linear Advance // Linear Advance
// //
@ -1451,36 +1502,52 @@ void MarlinSettings::reset() {
#endif #endif
); );
#if ENABLED(HAVE_TMC2130) #if X_IS_TRINAMIC
stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if Y_IS_TRINAMIC
stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if Z_IS_TRINAMIC
stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if X2_IS_TRINAMIC
stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if Y2_IS_TRINAMIC
stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if Z2_IS_TRINAMIC
stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if E0_IS_TRINAMIC
stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if E1_IS_TRINAMIC
stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if E2_IS_TRINAMIC
stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if E3_IS_TRINAMIC
stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if E4_IS_TRINAMIC
stepperE4.setCurrent(E4_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER); stepperX.sgt(X_HOMING_SENSITIVITY);
#endif
#if ENABLED(Y_IS_TMC2130)
stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(Z_IS_TMC2130)
stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER); stepperX2.sgt(X_HOMING_SENSITIVITY);
#endif
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt(Y_HOMING_SENSITIVITY);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y2_IS_TMC2130)
stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER); stepperY2.sgt(Y_HOMING_SENSITIVITY);
#endif
#if ENABLED(Z2_IS_TMC2130)
stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(E0_IS_TMC2130)
stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(E1_IS_TMC2130)
stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(E2_IS_TMC2130)
stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif
#if ENABLED(E3_IS_TMC2130)
stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
#endif #endif
@ -1959,35 +2026,63 @@ void MarlinSettings::reset() {
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHO(" M906"); SERIAL_ECHO(" M906");
#if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208)
SERIAL_ECHOPAIR(" X ", stepperX.getCurrent());
#endif
#if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208)
SERIAL_ECHOPAIR(" Y ", stepperY.getCurrent());
#endif
#if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208)
SERIAL_ECHOPAIR(" Z ", stepperZ.getCurrent());
#endif
#if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208)
SERIAL_ECHOPAIR(" X2 ", stepperX2.getCurrent());
#endif
#if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208)
SERIAL_ECHOPAIR(" Y2 ", stepperY2.getCurrent());
#endif
#if ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208)
SERIAL_ECHOPAIR(" Z2 ", stepperZ2.getCurrent());
#endif
#if ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208)
SERIAL_ECHOPAIR(" E0 ", stepperE0.getCurrent());
#endif
#if ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208)
SERIAL_ECHOPAIR(" E1 ", stepperE1.getCurrent());
#endif
#if ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208)
SERIAL_ECHOPAIR(" E2 ", stepperE2.getCurrent());
#endif
#if ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208)
SERIAL_ECHOPAIR(" E3 ", stepperE3.getCurrent());
#endif
#if ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208)
SERIAL_ECHOPAIR(" E4 ", stepperE4.getCurrent());
#endif
SERIAL_EOL();
#endif
/**
* TMC2130 Sensorless homing thresholds
*/
#if ENABLED(HAVE_TMC2130) && ENABLED(SENSORLESS_HOMING)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Sensorless homing threshold:");
}
CONFIG_ECHO_START;
SERIAL_ECHO(" M914");
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
SERIAL_ECHOPAIR(" X", stepperX.getCurrent()); SERIAL_ECHOPAIR(" X", stepperX.sgt());
#endif
#if ENABLED(Y_IS_TMC2130)
SERIAL_ECHOPAIR(" Y", stepperY.getCurrent());
#endif
#if ENABLED(Z_IS_TMC2130)
SERIAL_ECHOPAIR(" Z", stepperZ.getCurrent());
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
SERIAL_ECHOPAIR(" X2", stepperX2.getCurrent()); SERIAL_ECHOPAIR(" X2 ", stepperX2.sgt());
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y_IS_TMC2130)
SERIAL_ECHOPAIR(" Y2", stepperY2.getCurrent()); SERIAL_ECHOPAIR(" Y", stepperY.sgt());
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
SERIAL_ECHOPAIR(" Z2", stepperZ2.getCurrent()); SERIAL_ECHOPAIR(" Y2 ", stepperY2.sgt());
#endif
#if ENABLED(E0_IS_TMC2130)
SERIAL_ECHOPAIR(" E0", stepperE0.getCurrent());
#endif
#if ENABLED(E1_IS_TMC2130)
SERIAL_ECHOPAIR(" E1", stepperE1.getCurrent());
#endif
#if ENABLED(E2_IS_TMC2130)
SERIAL_ECHOPAIR(" E2", stepperE2.getCurrent());
#endif
#if ENABLED(E3_IS_TMC2130)
SERIAL_ECHOPAIR(" E3", stepperE3.getCurrent());
#endif #endif
SERIAL_EOL(); SERIAL_EOL();
#endif #endif

View File

@ -52,7 +52,7 @@
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#include "../feature/tmc2130.h" #include "../feature/tmc_util.h"
#endif #endif
#define XYZ_CONSTS(type, array, CONFIG) const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG } #define XYZ_CONSTS(type, array, CONFIG) const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }
@ -1172,10 +1172,10 @@ void homeaxis(const AxisEnum axis) {
// Disable stealthChop if used. Enable diag1 pin on driver. // Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
if (axis == X_AXIS) tmc2130_sensorless_homing(stepperX); if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if ENABLED(Y_IS_TMC2130)
if (axis == Y_AXIS) tmc2130_sensorless_homing(stepperY); if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
#endif #endif
#endif #endif
@ -1282,10 +1282,10 @@ void homeaxis(const AxisEnum axis) {
// Re-enable stealthChop if used. Disable diag1 pin on driver. // Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
if (axis == X_AXIS) tmc2130_sensorless_homing(stepperX, false); if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if ENABLED(Y_IS_TMC2130)
if (axis == Y_AXIS) tmc2130_sensorless_homing(stepperY, false); if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
#endif #endif
#endif #endif

View File

@ -954,6 +954,16 @@ void Stepper::init() {
tmc2130_init(); tmc2130_init();
#endif #endif
// Init TMC2208 Steppers
#if ENABLED(HAVE_TMC2208)
tmc2208_init();
#endif
// TRAMS, TMC2130 and TMC2208 advanced settings
#if HAS_TRINAMIC
TMC_ADV()
#endif
// Init L6470 Steppers // Init L6470 Steppers
#if ENABLED(HAVE_L6470DRIVER) #if ENABLED(HAVE_L6470DRIVER)
L6470_init(); L6470_init();

View File

@ -129,6 +129,7 @@
#include <SPI.h> #include <SPI.h>
#include <TMC2130Stepper.h> #include <TMC2130Stepper.h>
#include "planner.h"
#include "../core/enum.h" #include "../core/enum.h"
#define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN) #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)
@ -171,17 +172,17 @@
// Use internal reference voltage for current calculations. This is the default. // Use internal reference voltage for current calculations. This is the default.
// Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609) // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
// https://www.trinamic.com/products/integrated-circuits/details/tmc2130/ // https://www.trinamic.com/products/integrated-circuits/details/tmc2130/
void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float &spmm) { void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
st.begin(); st.begin();
st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER); st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
st.microsteps(microsteps); st.microsteps(microsteps);
st.blank_time(36); st.blank_time(24);
st.off_time(5); // Only enables the driver if used with stealthChop st.off_time(5); // Only enables the driver if used with stealthChop
st.interpolate(INTERPOLATE); st.interpolate(INTERPOLATE);
st.power_down_delay(128); // ~2s until driver lowers to hold current st.power_down_delay(128); // ~2s until driver lowers to hold current
st.hysterisis_start(0); // HSTRT = 1 st.hysterisis_start(3);
st.hysterisis_low(1); // HEND = -2 st.hysterisis_end(2);
st.diag1_active_high(0); // For sensorless homing st.diag1_active_high(1); // For sensorless homing
#if ENABLED(STEALTHCHOP) #if ENABLED(STEALTHCHOP)
st.stealth_freq(1); // f_pwm = 2/683 f_clk st.stealth_freq(1); // f_pwm = 2/683 f_clk
st.stealth_autoscale(1); st.stealth_autoscale(1);
@ -189,61 +190,261 @@
st.stealth_amplitude(255); st.stealth_amplitude(255);
st.stealthChop(1); st.stealthChop(1);
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
st.stealth_max_speed(12650000UL*st.microsteps()/(256*thrs*spmm)); st.stealth_max_speed(12650000UL*microsteps/(256*thrs*spmm));
#else
UNUSED(thrs);
UNUSED(spmm);
#endif #endif
#elif ENABLED(SENSORLESS_HOMING) #elif ENABLED(SENSORLESS_HOMING)
st.coolstep_min_speed(1024UL * 1024UL - 1UL); st.coolstep_min_speed(1024UL * 1024UL - 1UL);
#endif #endif
st.GSTAT(); // Clear GSTAT
} }
#define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
void tmc2130_init() { void tmc2130_init() {
constexpr float steps_per_mm[] = DEFAULT_AXIS_STEPS_PER_UNIT;
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
_TMC2130_INIT( X, steps_per_mm[X_AXIS]); _TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]);
#if ENABLED(SENSORLESS_HOMING)
stepperX.sg_stall_value(X_HOMING_SENSITIVITY);
#endif
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
_TMC2130_INIT(X2, steps_per_mm[X_AXIS]); _TMC2130_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if ENABLED(Y_IS_TMC2130)
_TMC2130_INIT( Y, steps_per_mm[Y_AXIS]); _TMC2130_INIT( Y, planner.axis_steps_per_mm[Y_AXIS]);
#if ENABLED(SENSORLESS_HOMING)
stepperY.sg_stall_value(Y_HOMING_SENSITIVITY);
#endif
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y2_IS_TMC2130)
_TMC2130_INIT(Y2, steps_per_mm[Y_AXIS]); _TMC2130_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if ENABLED(Z_IS_TMC2130) #if ENABLED(Z_IS_TMC2130)
_TMC2130_INIT( Z, steps_per_mm[Z_AXIS]); _TMC2130_INIT( Z, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if ENABLED(Z2_IS_TMC2130)
_TMC2130_INIT(Z2, steps_per_mm[Z_AXIS]); _TMC2130_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(E0_IS_TMC2130) #if ENABLED(E0_IS_TMC2130)
_TMC2130_INIT(E0, steps_per_mm[E_AXIS]); _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
#endif #endif
#if ENABLED(E1_IS_TMC2130) #if ENABLED(E1_IS_TMC2130)
{ constexpr int extruder = 1; _TMC2130_INIT(E1, steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E2_IS_TMC2130) #if ENABLED(E2_IS_TMC2130)
{ constexpr int extruder = 2; _TMC2130_INIT(E2, steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E3_IS_TMC2130) #if ENABLED(E3_IS_TMC2130)
{ constexpr int extruder = 3; _TMC2130_INIT(E3, steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E4_IS_TMC2130) #if ENABLED(E4_IS_TMC2130)
{ constexpr int extruder = 4; _TMC2130_INIT(E4, steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
TMC2130_ADV()
} }
#endif // HAVE_TMC2130 #endif // HAVE_TMC2130
//
// TMC2208 Driver objects and inits
//
#if ENABLED(HAVE_TMC2208)
#include <SoftwareSerial.h>
#include <HardwareSerial.h>
#include <TMC2208Stepper.h>
#include "planner.h"
#define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL)
#define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial stepper##ST##_serial = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \
TMC2208Stepper stepper##ST(&stepper##ST##_serial, ST##_SERIAL_RX_PIN > -1)
// Stepper objects of TMC2208 steppers used
#if ENABLED(X_IS_TMC2208)
#if defined(X_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(X);
#else
_TMC2208_DEFINE_SOFTWARE(X);
#endif
#endif
#if ENABLED(X2_IS_TMC2208)
#if defined(X2_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(X2);
#else
_TMC2208_DEFINE_SOFTWARE(X2);
#endif
#endif
#if ENABLED(Y_IS_TMC2208)
#if defined(Y_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(Y);
#else
_TMC2208_DEFINE_SOFTWARE(Y);
#endif
#endif
#if ENABLED(Y2_IS_TMC2208)
#if defined(Y2_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(Y2);
#else
_TMC2208_DEFINE_SOFTWARE(Y2);
#endif
#endif
#if ENABLED(Z_IS_TMC2208)
#if defined(Z_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(Z);
#else
_TMC2208_DEFINE_SOFTWARE(Z);
#endif
#endif
#if ENABLED(Z2_IS_TMC2208)
#if defined(Z2_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(Z2);
#else
_TMC2208_DEFINE_SOFTWARE(Z2);
#endif
#endif
#if ENABLED(E0_IS_TMC2208)
#if defined(E0_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(E0);
#else
_TMC2208_DEFINE_SOFTWARE(E0);
#endif
#endif
#if ENABLED(E1_IS_TMC2208)
#if defined(E1_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(E1);
#else
_TMC2208_DEFINE_SOFTWARE(E1);
#endif
#endif
#if ENABLED(E2_IS_TMC2208)
#if defined(E2_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(E2);
#else
_TMC2208_DEFINE_SOFTWARE(E2);
#endif
#endif
#if ENABLED(E3_IS_TMC2208)
#if defined(E3_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(E3);
#else
_TMC2208_DEFINE_SOFTWARE(E3);
#endif
#endif
#if ENABLED(E4_IS_TMC2208)
#if defined(E4_HARDWARE_SERIAL)
_TMC2208_DEFINE_HARDWARE(E4);
#else
_TMC2208_DEFINE_SOFTWARE(E4);
#endif
#endif
void tmc2208_serial_begin() {
#if ENABLED(X_IS_TMC2208) && defined(X_HARDWARE_SERIAL)
X_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(X2_IS_TMC2208) && defined(X2_HARDWARE_SERIAL)
X2_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(Y_IS_TMC2208) && defined(Y_HARDWARE_SERIAL)
Y_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(Y2_IS_TMC2208) && defined(Y2_HARDWARE_SERIAL)
Y2_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(Z_IS_TMC2208) && defined(Z_HARDWARE_SERIAL)
Z_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(Z2_IS_TMC2208) && defined(Z2_HARDWARE_SERIAL)
Z2_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(E0_IS_TMC2208) && defined(E0_HARDWARE_SERIAL)
E0_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(E1_IS_TMC2208) && defined(E1_HARDWARE_SERIAL)
E1_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(E2_IS_TMC2208) && defined(E2_HARDWARE_SERIAL)
E2_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(E3_IS_TMC2208) && defined(E3_HARDWARE_SERIAL)
E3_HARDWARE_SERIAL.begin(250000);
#endif
#if ENABLED(E4_IS_TMC2208) && defined(E4_HARDWARE_SERIAL)
E4_HARDWARE_SERIAL.begin(250000);
#endif
}
// Use internal reference voltage for current calculations. This is the default.
// Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
void tmc2208_init(TMC2208Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
st.pdn_disable(true); // Use UART
st.mstep_reg_select(true); // Select microsteps with UART
st.I_scale_analog(false);
st.rms_current(st.getCurrent(), HOLD_MULTIPLIER, R_SENSE);
st.microsteps(microsteps);
st.blank_time(24);
st.toff(5);
st.intpol(INTERPOLATE);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
st.hysterisis_start(3);
st.hysterisis_end(2);
#if ENABLED(STEALTHCHOP)
st.pwm_lim(12);
st.pwm_reg(8);
st.pwm_autograd(1);
st.pwm_autoscale(1);
st.pwm_freq(1);
st.pwm_grad(14);
st.pwm_ofs(36);
st.en_spreadCycle(false);
#if ENABLED(HYBRID_THRESHOLD)
st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm));
#else
UNUSED(thrs);
UNUSED(spmm);
#endif
#else
st.en_spreadCycle(true);
#endif
st.GSTAT(0b111); // Clear
delay(200);
}
#define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
void tmc2208_init() {
#if ENABLED(X_IS_TMC2208)
_TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]);
#endif
#if ENABLED(X2_IS_TMC2208)
_TMC2208_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
#endif
#if ENABLED(Y_IS_TMC2208)
_TMC2208_INIT(Y, planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if ENABLED(Y2_IS_TMC2208)
_TMC2208_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if ENABLED(Z_IS_TMC2208)
_TMC2208_INIT(Z, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if ENABLED(Z2_IS_TMC2208)
_TMC2208_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if ENABLED(E0_IS_TMC2208)
_TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
#endif
#if ENABLED(E1_IS_TMC2208)
{ constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif
#if ENABLED(E2_IS_TMC2208)
{ constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif
#if ENABLED(E3_IS_TMC2208)
{ constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif
#if ENABLED(E4_IS_TMC2208)
{ constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif
}
#endif // HAVE_TMC2208
// //
// L6470 Driver objects and inits // L6470 Driver objects and inits

View File

@ -58,6 +58,12 @@
void tmc2130_init(); void tmc2130_init();
#endif #endif
#if ENABLED(HAVE_TMC2208)
#include <TMC2208Stepper.h>
void tmc2208_serial_begin();
void tmc2208_init();
#endif
// L6470 has STEP on normal pins, but DIR/ENABLE via SPI // L6470 has STEP on normal pins, but DIR/ENABLE via SPI
#if ENABLED(HAVE_L6470DRIVER) #if ENABLED(HAVE_L6470DRIVER)
#include <SPI.h> #include <SPI.h>
@ -83,6 +89,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
extern TMC2130Stepper stepperX; extern TMC2130Stepper stepperX;
#elif ENABLED(HAVE_TMC2208) && ENABLED(X_IS_TMC2208)
extern TMC2208Stepper stepperX;
#endif #endif
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE) #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
@ -114,6 +122,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
extern TMC2130Stepper stepperY; extern TMC2130Stepper stepperY;
#elif ENABLED(HAVE_TMC2208) && ENABLED(Y_IS_TMC2208)
extern TMC2208Stepper stepperY;
#endif #endif
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE) #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
@ -145,6 +155,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
extern TMC2130Stepper stepperZ; extern TMC2130Stepper stepperZ;
#elif ENABLED(HAVE_TMC2208) && ENABLED(Z_IS_TMC2208)
extern TMC2208Stepper stepperZ;
#endif #endif
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE) #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
@ -177,6 +189,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
extern TMC2130Stepper stepperX2; extern TMC2130Stepper stepperX2;
#elif ENABLED(HAVE_TMC2208) && ENABLED(X2_IS_TMC2208)
extern TMC2208Stepper stepperX2;
#endif #endif
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
@ -210,6 +224,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
extern TMC2130Stepper stepperY2; extern TMC2130Stepper stepperY2;
#elif ENABLED(HAVE_TMC2208) && ENABLED(Y2_IS_TMC2208)
extern TMC2208Stepper stepperY2;
#endif #endif
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
@ -243,6 +259,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
extern TMC2130Stepper stepperZ2; extern TMC2130Stepper stepperZ2;
#elif ENABLED(HAVE_TMC2208) && ENABLED(Z2_IS_TMC2208)
extern TMC2208Stepper stepperZ2;
#endif #endif
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
@ -275,6 +293,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
extern TMC2130Stepper stepperE0; extern TMC2130Stepper stepperE0;
#elif ENABLED(HAVE_TMC2208) && ENABLED(E0_IS_TMC2208)
extern TMC2208Stepper stepperE0;
#endif #endif
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE) #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
@ -306,6 +326,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
extern TMC2130Stepper stepperE1; extern TMC2130Stepper stepperE1;
#elif ENABLED(HAVE_TMC2208) && ENABLED(E1_IS_TMC2208)
extern TMC2208Stepper stepperE1;
#endif #endif
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
#define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE) #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
@ -337,6 +359,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
extern TMC2130Stepper stepperE2; extern TMC2130Stepper stepperE2;
#elif ENABLED(HAVE_TMC2208) && ENABLED(E2_IS_TMC2208)
extern TMC2208Stepper stepperE2;
#endif #endif
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
#define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE) #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
@ -368,6 +392,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
extern TMC2130Stepper stepperE3; extern TMC2130Stepper stepperE3;
#elif ENABLED(HAVE_TMC2208) && ENABLED(E3_IS_TMC2208)
extern TMC2208Stepper stepperE3;
#endif #endif
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
#define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE) #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
@ -399,6 +425,8 @@
#else #else
#if ENABLED(HAVE_TMC2130) && ENABLED(E4_IS_TMC2130) #if ENABLED(HAVE_TMC2130) && ENABLED(E4_IS_TMC2130)
extern TMC2130Stepper stepperE4; extern TMC2130Stepper stepperE4;
#elif ENABLED(HAVE_TMC2208) && ENABLED(E4_IS_TMC2208)
extern TMC2208Stepper stepperE4;
#endif #endif
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
#define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE) #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)

View File

@ -839,3 +839,69 @@
#if PIN_EXISTS(ZRIB_V20_D9) #if PIN_EXISTS(ZRIB_V20_D9)
REPORT_NAME_DIGITAL(ZRIB_V20_D9_PIN, __LINE__ ) REPORT_NAME_DIGITAL(ZRIB_V20_D9_PIN, __LINE__ )
#endif #endif
#if PIN_EXISTS(X_SERIAL_TX)
REPORT_NAME_DIGITAL(X_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(X_SERIAL_RX)
REPORT_NAME_DIGITAL(X_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(X2_SERIAL_TX)
REPORT_NAME_DIGITAL(X2_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(X2_SERIAL_RX)
REPORT_NAME_DIGITAL(X2_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Y_SERIAL_TX)
REPORT_NAME_DIGITAL(Y_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Y_SERIAL_RX)
REPORT_NAME_DIGITAL(Y_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Y2_SERIAL_TX)
REPORT_NAME_DIGITAL(Y2_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Y2_SERIAL_RX)
REPORT_NAME_DIGITAL(Y2_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Z_SERIAL_TX)
REPORT_NAME_DIGITAL(Z_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Z_SERIAL_RX)
REPORT_NAME_DIGITAL(Z_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Z2_SERIAL_TX)
REPORT_NAME_DIGITAL(Z2_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(Z2_SERIAL_RX)
REPORT_NAME_DIGITAL(Z2_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E0_SERIAL_TX)
REPORT_NAME_DIGITAL(E0_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E0_SERIAL_RX)
REPORT_NAME_DIGITAL(E0_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E1_SERIAL_TX)
REPORT_NAME_DIGITAL(E1_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E1_SERIAL_RX)
REPORT_NAME_DIGITAL(E1_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E2_SERIAL_TX)
REPORT_NAME_DIGITAL(E2_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E2_SERIAL_RX)
REPORT_NAME_DIGITAL(E2_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E3_SERIAL_TX)
REPORT_NAME_DIGITAL(E3_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E3_SERIAL_RX)
REPORT_NAME_DIGITAL(E3_SERIAL_RX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E4_SERIAL_TX)
REPORT_NAME_DIGITAL(E4_SERIAL_TX_PIN, __LINE__ )
#endif
#if PIN_EXISTS(E4_SERIAL_RX)
REPORT_NAME_DIGITAL(E4_SERIAL_RX_PIN, __LINE__ )
#endif

View File

@ -119,6 +119,56 @@
#define E1_ENABLE_PIN 30 #define E1_ENABLE_PIN 30
#define E1_CS_PIN 44 #define E1_CS_PIN 44
#if ENABLED(HAVE_TMC2208)
/*
* TMC2208 stepper drivers
*
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
#define Z_HARDWARE_SERIAL Serial3
#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
/*
* Software serial
*/
#define X_SERIAL_TX_PIN 59
#define X_SERIAL_RX_PIN 63
#define X2_SERIAL_TX_PIN -1
#define X2_SERIAL_RX_PIN -1
#define Y_SERIAL_TX_PIN 64
#define Y_SERIAL_RX_PIN 40
#define Y2_SERIAL_TX_PIN -1
#define Y2_SERIAL_RX_PIN -1
#define Z_SERIAL_TX_PIN 44
#define Z_SERIAL_RX_PIN 42
#define Z2_SERIAL_TX_PIN -1
#define Z2_SERIAL_RX_PIN -1
#define E0_SERIAL_TX_PIN 66
#define E0_SERIAL_RX_PIN 65
#define E1_SERIAL_TX_PIN -1
#define E1_SERIAL_RX_PIN -1
#define E2_SERIAL_TX_PIN -1
#define E2_SERIAL_RX_PIN -1
#define E3_SERIAL_TX_PIN -1
#define E3_SERIAL_RX_PIN -1
#define E4_SERIAL_TX_PIN -1
#define E4_SERIAL_RX_PIN -1
#endif
// //
// Temperature Sensors // Temperature Sensors
// //

View File

@ -22,6 +22,7 @@ lib_deps =
U8glib-HAL U8glib-HAL
LiquidCrystal_I2C@1.1.2 LiquidCrystal_I2C@1.1.2
TMC2130Stepper TMC2130Stepper
https://github.com/teemuatlut/TMC2208Stepper.git
Adafruit NeoPixel Adafruit NeoPixel
https://github.com/lincomatic/LiquidTWI2.git https://github.com/lincomatic/LiquidTWI2.git
https://github.com/trinamic/TMC26XStepper.git https://github.com/trinamic/TMC26XStepper.git