teemuatlut пре 6 година
родитељ
комит
0cd1e91056
62 измењених фајлова са 4181 додато и 2047 уклоњено
  1. 8
    1
      .travis.yml
  2. 72
    43
      Marlin/Configuration_adv.h
  3. 4
    0
      Marlin/Marlin.ino
  4. 4
    4
      Marlin/src/Marlin.cpp
  5. 72
    43
      Marlin/src/config/default/Configuration_adv.h
  6. 72
    43
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
  7. 72
    43
      Marlin/src/config/examples/Anet/A6/Configuration_adv.h
  8. 72
    43
      Marlin/src/config/examples/Anet/A8/Configuration_adv.h
  9. 72
    43
      Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h
  10. 72
    43
      Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
  11. 72
    43
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
  12. 72
    43
      Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
  13. 72
    43
      Marlin/src/config/examples/Cartesio/Configuration_adv.h
  14. 72
    43
      Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
  15. 72
    43
      Marlin/src/config/examples/Felix/Configuration_adv.h
  16. 72
    43
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
  17. 72
    43
      Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
  18. 72
    43
      Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
  19. 72
    43
      Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
  20. 72
    43
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
  21. 72
    43
      Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
  22. 72
    43
      Marlin/src/config/examples/RigidBot/Configuration_adv.h
  23. 72
    43
      Marlin/src/config/examples/SCARA/Configuration_adv.h
  24. 72
    43
      Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
  25. 72
    43
      Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
  26. 77
    48
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
  27. 72
    43
      Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
  28. 72
    43
      Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
  29. 72
    43
      Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
  30. 72
    43
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
  31. 72
    43
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
  32. 72
    43
      Marlin/src/config/examples/delta/generic/Configuration_adv.h
  33. 72
    43
      Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
  34. 72
    43
      Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h
  35. 72
    43
      Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
  36. 72
    43
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
  37. 72
    43
      Marlin/src/config/examples/makibox/Configuration_adv.h
  38. 72
    43
      Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
  39. 72
    43
      Marlin/src/config/examples/wt150/Configuration_adv.h
  40. 1
    1
      Marlin/src/core/serial.h
  41. 0
    153
      Marlin/src/feature/tmc2130.cpp
  42. 0
    38
      Marlin/src/feature/tmc2130.h
  43. 39
    0
      Marlin/src/feature/tmc_macros.h
  44. 266
    0
      Marlin/src/feature/tmc_util.cpp
  45. 82
    0
      Marlin/src/feature/tmc_util.h
  46. 7
    2
      Marlin/src/gcode/control/M80_M81.cpp
  47. 342
    0
      Marlin/src/gcode/feature/trinamic/M122.cpp
  48. 45
    32
      Marlin/src/gcode/feature/trinamic/M906.cpp
  49. 0
    155
      Marlin/src/gcode/feature/trinamic/M911-M914.cpp
  50. 195
    0
      Marlin/src/gcode/feature/trinamic/M911-M915.cpp
  51. 2
    1
      Marlin/src/gcode/gcode.cpp
  52. 10
    3
      Marlin/src/gcode/gcode.h
  53. 1
    0
      Marlin/src/inc/MarlinConfigPre.h
  54. 25
    2
      Marlin/src/inc/SanityCheck.h
  55. 167
    72
      Marlin/src/module/configuration_store.cpp
  56. 5
    5
      Marlin/src/module/motion.cpp
  57. 10
    0
      Marlin/src/module/stepper.cpp
  58. 226
    25
      Marlin/src/module/stepper_indirection.cpp
  59. 28
    0
      Marlin/src/module/stepper_indirection.h
  60. 66
    0
      Marlin/src/pins/pinsDebug_list.h
  61. 50
    0
      Marlin/src/pins/pins_RAMPS.h
  62. 1
    0
      platformio.ini

+ 8
- 1
.travis.yml Прегледај датотеку

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

+ 72
- 43
Marlin/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 4
- 0
Marlin/Marlin.ino Прегледај датотеку

@@ -57,6 +57,10 @@
57 57
   #include <TMC2130Stepper.h>
58 58
 #endif
59 59
 
60
+#if ENABLED(HAVE_TMC2208)
61
+  #include <TMC2208Stepper.h>
62
+#endif
63
+
60 64
 #if ENABLED(HAVE_L6470DRIVER)
61 65
   #include <SPI.h>
62 66
   #include <L6470.h>

+ 4
- 4
Marlin/src/Marlin.cpp Прегледај датотеку

@@ -99,8 +99,8 @@
99 99
   #include "HAL/HAL_endstop_interrupts.h"
100 100
 #endif
101 101
 
102
-#if ENABLED(HAVE_TMC2130)
103
-  #include "feature/tmc2130.h"
102
+#if HAS_TRINAMIC
103
+  #include "feature/tmc_util.h"
104 104
 #endif
105 105
 
106 106
 #if ENABLED(SDSUPPORT)
@@ -489,8 +489,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
489 489
     handle_status_leds();
490 490
   #endif
491 491
 
492
-  #if ENABLED(HAVE_TMC2130)
493
-    tmc2130_checkOverTemp();
492
+  #if ENABLED(MONITOR_DRIVER_STATUS)
493
+    monitor_tmc_driver();
494 494
   #endif
495 495
 
496 496
   // Limit check_axes_activity frequency to 10Hz

+ 72
- 43
Marlin/src/config/default/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Anet/A6/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Anet/A8/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h Прегледај датотеку

@@ -977,7 +977,7 @@
977 977
 
978 978
 #endif
979 979
 
980
-// @section TMC2130
980
+// @section TMC2130, TMC2208
981 981
 
982 982
 /**
983 983
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -991,7 +991,19 @@
991 991
  */
992 992
 //#define HAVE_TMC2130
993 993
 
994
-#if ENABLED(HAVE_TMC2130)
994
+/**
995
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
996
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
997
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
998
+ * to #_SERIAL_TX_PIN with a 1K resistor.
999
+ * The drivers can also be used with hardware serial.
1000
+ *
1001
+ * You'll also need the TMC2208Stepper Arduino library
1002
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1003
+ */
1004
+//#define HAVE_TMC2208
1005
+
1006
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
995 1007
 
996 1008
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
997 1009
   //#define X_IS_TMC2130
@@ -1006,46 +1018,58 @@
1006 1018
   //#define E3_IS_TMC2130
1007 1019
   //#define E4_IS_TMC2130
1008 1020
 
1021
+  //#define X_IS_TMC2208
1022
+  //#define X2_IS_TMC2208
1023
+  //#define Y_IS_TMC2208
1024
+  //#define Y2_IS_TMC2208
1025
+  //#define Z_IS_TMC2208
1026
+  //#define Z2_IS_TMC2208
1027
+  //#define E0_IS_TMC2208
1028
+  //#define E1_IS_TMC2208
1029
+  //#define E2_IS_TMC2208
1030
+  //#define E3_IS_TMC2208
1031
+  //#define E4_IS_TMC2208
1032
+
1009 1033
   /**
1010 1034
    * Stepper driver settings
1011 1035
    */
1012 1036
 
1013 1037
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1014 1038
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1015
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1039
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1016 1040
 
1017
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1041
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1018 1042
   #define X_MICROSTEPS        16  // 0..256
1019 1043
 
1020
-  #define Y_CURRENT         1000
1044
+  #define Y_CURRENT          800
1021 1045
   #define Y_MICROSTEPS        16
1022 1046
 
1023
-  #define Z_CURRENT         1000
1047
+  #define Z_CURRENT          800
1024 1048
   #define Z_MICROSTEPS        16
1025 1049
 
1026
-  //#define X2_CURRENT      1000
1027
-  //#define X2_MICROSTEPS     16
1050
+  #define X2_CURRENT         800
1051
+  #define X2_MICROSTEPS       16
1028 1052
 
1029
-  //#define Y2_CURRENT      1000
1030
-  //#define Y2_MICROSTEPS     16
1053
+  #define Y2_CURRENT         800
1054
+  #define Y2_MICROSTEPS       16
1031 1055
 
1032
-  //#define Z2_CURRENT      1000
1033
-  //#define Z2_MICROSTEPS     16
1056
+  #define Z2_CURRENT         800
1057
+  #define Z2_MICROSTEPS       16
1034 1058
 
1035
-  //#define E0_CURRENT      1000
1036
-  //#define E0_MICROSTEPS     16
1059
+  #define E0_CURRENT         800
1060
+  #define E0_MICROSTEPS       16
1037 1061
 
1038
-  //#define E1_CURRENT      1000
1039
-  //#define E1_MICROSTEPS     16
1062
+  #define E1_CURRENT         800
1063
+  #define E1_MICROSTEPS       16
1040 1064
 
1041
-  //#define E2_CURRENT      1000
1042
-  //#define E2_MICROSTEPS     16
1065
+  #define E2_CURRENT         800
1066
+  #define E2_MICROSTEPS       16
1043 1067
 
1044
-  //#define E3_CURRENT      1000
1045
-  //#define E3_MICROSTEPS     16
1068
+  #define E3_CURRENT         800
1069
+  #define E3_MICROSTEPS       16
1046 1070
 
1047
-  //#define E4_CURRENT      1000
1048
-  //#define E4_MICROSTEPS     16
1071
+  #define E4_CURRENT         800
1072
+  #define E4_MICROSTEPS       16
1049 1073
 
1050 1074
   /**
1051 1075
    * Use Trinamic's ultra quiet stepping mode.
@@ -1054,24 +1078,22 @@
1054 1078
   #define STEALTHCHOP
1055 1079
 
1056 1080
   /**
1057
-   * Let Marlin automatically control stepper current.
1058
-   * This is still an experimental feature.
1059
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1060
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1061
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1081
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1082
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1083
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1084
+   * Other detected conditions can be used to stop the current print.
1062 1085
    * Relevant g-codes:
1063 1086
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1064
-   * M906 S1 - Start adjusting current
1065
-   * M906 S0 - Stop adjusting current
1066 1087
    * M911 - Report stepper driver overtemperature pre-warn condition.
1067 1088
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1089
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1068 1090
    */
1069
-  //#define AUTOMATIC_CURRENT_CONTROL
1091
+  //#define MONITOR_DRIVER_STATUS
1070 1092
 
1071
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1072
-    #define CURRENT_STEP          50  // [mA]
1073
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1093
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1094
+    #define CURRENT_STEP_DOWN     50  // [mA]
1074 1095
     #define REPORT_CURRENT_CHANGE
1096
+    #define STOP_ON_ERROR
1075 1097
   #endif
1076 1098
 
1077 1099
   /**
@@ -1086,8 +1108,8 @@
1086 1108
   #define X2_HYBRID_THRESHOLD    100
1087 1109
   #define Y_HYBRID_THRESHOLD     100
1088 1110
   #define Y2_HYBRID_THRESHOLD    100
1089
-  #define Z_HYBRID_THRESHOLD       4
1090
-  #define Z2_HYBRID_THRESHOLD      4
1111
+  #define Z_HYBRID_THRESHOLD       3
1112
+  #define Z2_HYBRID_THRESHOLD      3
1091 1113
   #define E0_HYBRID_THRESHOLD     30
1092 1114
   #define E1_HYBRID_THRESHOLD     30
1093 1115
   #define E2_HYBRID_THRESHOLD     30
@@ -1097,7 +1119,7 @@
1097 1119
   /**
1098 1120
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1099 1121
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1100
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1122
+   * X and Y homing will always be done in spreadCycle mode.
1101 1123
    *
1102 1124
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1103 1125
    * Higher values make the system LESS sensitive.
@@ -1106,27 +1128,34 @@
1106 1128
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1107 1129
    * M914 X/Y to live tune the setting
1108 1130
    */
1109
-  //#define SENSORLESS_HOMING
1131
+  //#define SENSORLESS_HOMING // TMC2130 only
1110 1132
 
1111 1133
   #if ENABLED(SENSORLESS_HOMING)
1112
-    #define X_HOMING_SENSITIVITY  19
1113
-    #define Y_HOMING_SENSITIVITY  19
1134
+    #define X_HOMING_SENSITIVITY  8
1135
+    #define Y_HOMING_SENSITIVITY  8
1114 1136
   #endif
1115 1137
 
1116 1138
   /**
1139
+   * Enable M122 debugging command for TMC stepper drivers.
1140
+   * M122 S0/1 will enable continous reporting.
1141
+   */
1142
+  //#define TMC_DEBUG
1143
+
1144
+  /**
1117 1145
    * You can set your own advanced settings by filling in predefined functions.
1118 1146
    * A list of available functions can be found on the library github page
1119 1147
    * https://github.com/teemuatlut/TMC2130Stepper
1148
+   * https://github.com/teemuatlut/TMC2208Stepper
1120 1149
    *
1121 1150
    * Example:
1122
-   * #define TMC2130_ADV() { \
1151
+   * #define TMC_ADV() { \
1123 1152
    *   stepperX.diag0_temp_prewarn(1); \
1124
-   *   stepperX.interpolate(0); \
1153
+   *   stepperY.interpolate(0); \
1125 1154
    * }
1126 1155
    */
1127
-  #define  TMC2130_ADV() {  }
1156
+  #define  TMC_ADV() {  }
1128 1157
 
1129
-#endif // HAVE_TMC2130
1158
+#endif // TMC2130 || TMC2208
1130 1159
 
1131 1160
 // @section L6470
1132 1161
 

+ 72
- 43
Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E3_CURRENT      1000
1047
-  //#define E3_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Cartesio/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Felix/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Malyan/M150/Configuration_adv.h Прегледај датотеку

@@ -973,7 +973,7 @@
973 973
 
974 974
 #endif
975 975
 
976
-// @section TMC2130
976
+// @section TMC2130, TMC2208
977 977
 
978 978
 /**
979 979
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -987,7 +987,19 @@
987 987
  */
988 988
 //#define HAVE_TMC2130
989 989
 
990
-#if ENABLED(HAVE_TMC2130)
990
+/**
991
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
992
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
993
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
994
+ * to #_SERIAL_TX_PIN with a 1K resistor.
995
+ * The drivers can also be used with hardware serial.
996
+ *
997
+ * You'll also need the TMC2208Stepper Arduino library
998
+ * (https://github.com/teemuatlut/TMC2208Stepper).
999
+ */
1000
+//#define HAVE_TMC2208
1001
+
1002
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
991 1003
 
992 1004
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
993 1005
   //#define X_IS_TMC2130
@@ -1002,46 +1014,58 @@
1002 1014
   //#define E3_IS_TMC2130
1003 1015
   //#define E4_IS_TMC2130
1004 1016
 
1017
+  //#define X_IS_TMC2208
1018
+  //#define X2_IS_TMC2208
1019
+  //#define Y_IS_TMC2208
1020
+  //#define Y2_IS_TMC2208
1021
+  //#define Z_IS_TMC2208
1022
+  //#define Z2_IS_TMC2208
1023
+  //#define E0_IS_TMC2208
1024
+  //#define E1_IS_TMC2208
1025
+  //#define E2_IS_TMC2208
1026
+  //#define E3_IS_TMC2208
1027
+  //#define E4_IS_TMC2208
1028
+
1005 1029
   /**
1006 1030
    * Stepper driver settings
1007 1031
    */
1008 1032
 
1009 1033
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1010 1034
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1011
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1035
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1012 1036
 
1013
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1037
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1014 1038
   #define X_MICROSTEPS        16  // 0..256
1015 1039
 
1016
-  #define Y_CURRENT         1000
1040
+  #define Y_CURRENT          800
1017 1041
   #define Y_MICROSTEPS        16
1018 1042
 
1019
-  #define Z_CURRENT         1000
1043
+  #define Z_CURRENT          800
1020 1044
   #define Z_MICROSTEPS        16
1021 1045
 
1022
-  //#define X2_CURRENT      1000
1023
-  //#define X2_MICROSTEPS     16
1046
+  #define X2_CURRENT         800
1047
+  #define X2_MICROSTEPS       16
1024 1048
 
1025
-  //#define Y2_CURRENT      1000
1026
-  //#define Y2_MICROSTEPS     16
1049
+  #define Y2_CURRENT         800
1050
+  #define Y2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Z2_CURRENT      1000
1029
-  //#define Z2_MICROSTEPS     16
1052
+  #define Z2_CURRENT         800
1053
+  #define Z2_MICROSTEPS       16
1030 1054
 
1031
-  //#define E0_CURRENT      1000
1032
-  //#define E0_MICROSTEPS     16
1055
+  #define E0_CURRENT         800
1056
+  #define E0_MICROSTEPS       16
1033 1057
 
1034
-  //#define E1_CURRENT      1000
1035
-  //#define E1_MICROSTEPS     16
1058
+  #define E1_CURRENT         800
1059
+  #define E1_MICROSTEPS       16
1036 1060
 
1037
-  //#define E2_CURRENT      1000
1038
-  //#define E2_MICROSTEPS     16
1061
+  #define E2_CURRENT         800
1062
+  #define E2_MICROSTEPS       16
1039 1063
 
1040
-  //#define E3_CURRENT      1000
1041
-  //#define E3_MICROSTEPS     16
1064
+  #define E3_CURRENT         800
1065
+  #define E3_MICROSTEPS       16
1042 1066
 
1043
-  //#define E4_CURRENT      1000
1044
-  //#define E4_MICROSTEPS     16
1067
+  #define E4_CURRENT         800
1068
+  #define E4_MICROSTEPS       16
1045 1069
 
1046 1070
   /**
1047 1071
    * Use Trinamic's ultra quiet stepping mode.
@@ -1050,24 +1074,22 @@
1050 1074
   #define STEALTHCHOP
1051 1075
 
1052 1076
   /**
1053
-   * Let Marlin automatically control stepper current.
1054
-   * This is still an experimental feature.
1055
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1056
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1057
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1077
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1078
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1079
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1080
+   * Other detected conditions can be used to stop the current print.
1058 1081
    * Relevant g-codes:
1059 1082
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1060
-   * M906 S1 - Start adjusting current
1061
-   * M906 S0 - Stop adjusting current
1062 1083
    * M911 - Report stepper driver overtemperature pre-warn condition.
1063 1084
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1085
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1064 1086
    */
1065
-  //#define AUTOMATIC_CURRENT_CONTROL
1087
+  //#define MONITOR_DRIVER_STATUS
1066 1088
 
1067
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1068
-    #define CURRENT_STEP          50  // [mA]
1069
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1089
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1090
+    #define CURRENT_STEP_DOWN     50  // [mA]
1070 1091
     #define REPORT_CURRENT_CHANGE
1092
+    #define STOP_ON_ERROR
1071 1093
   #endif
1072 1094
 
1073 1095
   /**
@@ -1082,8 +1104,8 @@
1082 1104
   #define X2_HYBRID_THRESHOLD    100
1083 1105
   #define Y_HYBRID_THRESHOLD     100
1084 1106
   #define Y2_HYBRID_THRESHOLD    100
1085
-  #define Z_HYBRID_THRESHOLD       4
1086
-  #define Z2_HYBRID_THRESHOLD      4
1107
+  #define Z_HYBRID_THRESHOLD       3
1108
+  #define Z2_HYBRID_THRESHOLD      3
1087 1109
   #define E0_HYBRID_THRESHOLD     30
1088 1110
   #define E1_HYBRID_THRESHOLD     30
1089 1111
   #define E2_HYBRID_THRESHOLD     30
@@ -1093,7 +1115,7 @@
1093 1115
   /**
1094 1116
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1095 1117
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1096
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1118
+   * X and Y homing will always be done in spreadCycle mode.
1097 1119
    *
1098 1120
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1099 1121
    * Higher values make the system LESS sensitive.
@@ -1102,27 +1124,34 @@
1102 1124
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1103 1125
    * M914 X/Y to live tune the setting
1104 1126
    */
1105
-  //#define SENSORLESS_HOMING
1127
+  //#define SENSORLESS_HOMING // TMC2130 only
1106 1128
 
1107 1129
   #if ENABLED(SENSORLESS_HOMING)
1108
-    #define X_HOMING_SENSITIVITY  19
1109
-    #define Y_HOMING_SENSITIVITY  19
1130
+    #define X_HOMING_SENSITIVITY  8
1131
+    #define Y_HOMING_SENSITIVITY  8
1110 1132
   #endif
1111 1133
 
1112 1134
   /**
1135
+   * Enable M122 debugging command for TMC stepper drivers.
1136
+   * M122 S0/1 will enable continous reporting.
1137
+   */
1138
+  //#define TMC_DEBUG
1139
+
1140
+  /**
1113 1141
    * You can set your own advanced settings by filling in predefined functions.
1114 1142
    * A list of available functions can be found on the library github page
1115 1143
    * https://github.com/teemuatlut/TMC2130Stepper
1144
+   * https://github.com/teemuatlut/TMC2208Stepper
1116 1145
    *
1117 1146
    * Example:
1118
-   * #define TMC2130_ADV() { \
1147
+   * #define TMC_ADV() { \
1119 1148
    *   stepperX.diag0_temp_prewarn(1); \
1120
-   *   stepperX.interpolate(0); \
1149
+   *   stepperY.interpolate(0); \
1121 1150
    * }
1122 1151
    */
1123
-  #define  TMC2130_ADV() {  }
1152
+  #define  TMC_ADV() {  }
1124 1153
 
1125
-#endif // HAVE_TMC2130
1154
+#endif // TMC2130 || TMC2208
1126 1155
 
1127 1156
 // @section L6470
1128 1157
 

+ 72
- 43
Marlin/src/config/examples/Malyan/M200/Configuration_adv.h Прегледај датотеку

@@ -941,7 +941,7 @@
941 941
 
942 942
 #endif
943 943
 
944
-// @section TMC2130
944
+// @section TMC2130, TMC2208
945 945
 
946 946
 /**
947 947
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -955,7 +955,19 @@
955 955
  */
956 956
 //#define HAVE_TMC2130
957 957
 
958
-#if ENABLED(HAVE_TMC2130)
958
+/**
959
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
960
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
961
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
962
+ * to #_SERIAL_TX_PIN with a 1K resistor.
963
+ * The drivers can also be used with hardware serial.
964
+ *
965
+ * You'll also need the TMC2208Stepper Arduino library
966
+ * (https://github.com/teemuatlut/TMC2208Stepper).
967
+ */
968
+//#define HAVE_TMC2208
969
+
970
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
959 971
 
960 972
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
961 973
   //#define X_IS_TMC2130
@@ -970,46 +982,58 @@
970 982
   //#define E3_IS_TMC2130
971 983
   //#define E4_IS_TMC2130
972 984
 
985
+  //#define X_IS_TMC2208
986
+  //#define X2_IS_TMC2208
987
+  //#define Y_IS_TMC2208
988
+  //#define Y2_IS_TMC2208
989
+  //#define Z_IS_TMC2208
990
+  //#define Z2_IS_TMC2208
991
+  //#define E0_IS_TMC2208
992
+  //#define E1_IS_TMC2208
993
+  //#define E2_IS_TMC2208
994
+  //#define E3_IS_TMC2208
995
+  //#define E4_IS_TMC2208
996
+
973 997
   /**
974 998
    * Stepper driver settings
975 999
    */
976 1000
 
977 1001
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
978 1002
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
979
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1003
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
980 1004
 
981
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1005
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
982 1006
   #define X_MICROSTEPS        16  // 0..256
983 1007
 
984
-  #define Y_CURRENT         1000
1008
+  #define Y_CURRENT          800
985 1009
   #define Y_MICROSTEPS        16
986 1010
 
987
-  #define Z_CURRENT         1000
1011
+  #define Z_CURRENT          800
988 1012
   #define Z_MICROSTEPS        16
989 1013
 
990
-  //#define X2_CURRENT      1000
991
-  //#define X2_MICROSTEPS     16
1014
+  #define X2_CURRENT         800
1015
+  #define X2_MICROSTEPS       16
992 1016
 
993
-  //#define Y2_CURRENT      1000
994
-  //#define Y2_MICROSTEPS     16
1017
+  #define Y2_CURRENT         800
1018
+  #define Y2_MICROSTEPS       16
995 1019
 
996
-  //#define Z2_CURRENT      1000
997
-  //#define Z2_MICROSTEPS     16
1020
+  #define Z2_CURRENT         800
1021
+  #define Z2_MICROSTEPS       16
998 1022
 
999
-  //#define E0_CURRENT      1000
1000
-  //#define E0_MICROSTEPS     16
1023
+  #define E0_CURRENT         800
1024
+  #define E0_MICROSTEPS       16
1001 1025
 
1002
-  //#define E1_CURRENT      1000
1003
-  //#define E1_MICROSTEPS     16
1026
+  #define E1_CURRENT         800
1027
+  #define E1_MICROSTEPS       16
1004 1028
 
1005
-  //#define E2_CURRENT      1000
1006
-  //#define E2_MICROSTEPS     16
1029
+  #define E2_CURRENT         800
1030
+  #define E2_MICROSTEPS       16
1007 1031
 
1008
-  //#define E3_CURRENT      1000
1009
-  //#define E3_MICROSTEPS     16
1032
+  #define E3_CURRENT         800
1033
+  #define E3_MICROSTEPS       16
1010 1034
 
1011
-  //#define E4_CURRENT      1000
1012
-  //#define E4_MICROSTEPS     16
1035
+  #define E4_CURRENT         800
1036
+  #define E4_MICROSTEPS       16
1013 1037
 
1014 1038
   /**
1015 1039
    * Use Trinamic's ultra quiet stepping mode.
@@ -1018,24 +1042,22 @@
1018 1042
   #define STEALTHCHOP
1019 1043
 
1020 1044
   /**
1021
-   * Let Marlin automatically control stepper current.
1022
-   * This is still an experimental feature.
1023
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1024
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1025
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1045
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1046
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1047
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1048
+   * Other detected conditions can be used to stop the current print.
1026 1049
    * Relevant g-codes:
1027 1050
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1028
-   * M906 S1 - Start adjusting current
1029
-   * M906 S0 - Stop adjusting current
1030 1051
    * M911 - Report stepper driver overtemperature pre-warn condition.
1031 1052
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1053
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1032 1054
    */
1033
-  //#define AUTOMATIC_CURRENT_CONTROL
1055
+  //#define MONITOR_DRIVER_STATUS
1034 1056
 
1035
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1036
-    #define CURRENT_STEP          50  // [mA]
1037
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1057
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1058
+    #define CURRENT_STEP_DOWN     50  // [mA]
1038 1059
     #define REPORT_CURRENT_CHANGE
1060
+    #define STOP_ON_ERROR
1039 1061
   #endif
1040 1062
 
1041 1063
   /**
@@ -1050,8 +1072,8 @@
1050 1072
   #define X2_HYBRID_THRESHOLD    100
1051 1073
   #define Y_HYBRID_THRESHOLD     100
1052 1074
   #define Y2_HYBRID_THRESHOLD    100
1053
-  #define Z_HYBRID_THRESHOLD       4
1054
-  #define Z2_HYBRID_THRESHOLD      4
1075
+  #define Z_HYBRID_THRESHOLD       3
1076
+  #define Z2_HYBRID_THRESHOLD      3
1055 1077
   #define E0_HYBRID_THRESHOLD     30
1056 1078
   #define E1_HYBRID_THRESHOLD     30
1057 1079
   #define E2_HYBRID_THRESHOLD     30
@@ -1061,7 +1083,7 @@
1061 1083
   /**
1062 1084
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1063 1085
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1064
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1086
+   * X and Y homing will always be done in spreadCycle mode.
1065 1087
    *
1066 1088
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1067 1089
    * Higher values make the system LESS sensitive.
@@ -1070,27 +1092,34 @@
1070 1092
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1071 1093
    * M914 X/Y to live tune the setting
1072 1094
    */
1073
-  //#define SENSORLESS_HOMING
1095
+  //#define SENSORLESS_HOMING // TMC2130 only
1074 1096
 
1075 1097
   #if ENABLED(SENSORLESS_HOMING)
1076
-    #define X_HOMING_SENSITIVITY  19
1077
-    #define Y_HOMING_SENSITIVITY  19
1098
+    #define X_HOMING_SENSITIVITY  8
1099
+    #define Y_HOMING_SENSITIVITY  8
1078 1100
   #endif
1079 1101
 
1080 1102
   /**
1103
+   * Enable M122 debugging command for TMC stepper drivers.
1104
+   * M122 S0/1 will enable continous reporting.
1105
+   */
1106
+  //#define TMC_DEBUG
1107
+
1108
+  /**
1081 1109
    * You can set your own advanced settings by filling in predefined functions.
1082 1110
    * A list of available functions can be found on the library github page
1083 1111
    * https://github.com/teemuatlut/TMC2130Stepper
1112
+   * https://github.com/teemuatlut/TMC2208Stepper
1084 1113
    *
1085 1114
    * Example:
1086
-   * #define TMC2130_ADV() { \
1115
+   * #define TMC_ADV() { \
1087 1116
    *   stepperX.diag0_temp_prewarn(1); \
1088
-   *   stepperX.interpolate(0); \
1117
+   *   stepperY.interpolate(0); \
1089 1118
    * }
1090 1119
    */
1091
-  #define  TMC2130_ADV() {  }
1120
+  #define  TMC_ADV() {  }
1092 1121
 
1093
-#endif // HAVE_TMC2130
1122
+#endif // TMC2130 || TMC2208
1094 1123
 
1095 1124
 // @section L6470
1096 1125
 

+ 72
- 43
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h Прегледај датотеку

@@ -977,7 +977,7 @@
977 977
 
978 978
 #endif
979 979
 
980
-// @section TMC2130
980
+// @section TMC2130, TMC2208
981 981
 
982 982
 /**
983 983
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -991,7 +991,19 @@
991 991
  */
992 992
 //#define HAVE_TMC2130
993 993
 
994
-#if ENABLED(HAVE_TMC2130)
994
+/**
995
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
996
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
997
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
998
+ * to #_SERIAL_TX_PIN with a 1K resistor.
999
+ * The drivers can also be used with hardware serial.
1000
+ *
1001
+ * You'll also need the TMC2208Stepper Arduino library
1002
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1003
+ */
1004
+//#define HAVE_TMC2208
1005
+
1006
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
995 1007
 
996 1008
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
997 1009
   //#define X_IS_TMC2130
@@ -1006,46 +1018,58 @@
1006 1018
   //#define E3_IS_TMC2130
1007 1019
   //#define E4_IS_TMC2130
1008 1020
 
1021
+  //#define X_IS_TMC2208
1022
+  //#define X2_IS_TMC2208
1023
+  //#define Y_IS_TMC2208
1024
+  //#define Y2_IS_TMC2208
1025
+  //#define Z_IS_TMC2208
1026
+  //#define Z2_IS_TMC2208
1027
+  //#define E0_IS_TMC2208
1028
+  //#define E1_IS_TMC2208
1029
+  //#define E2_IS_TMC2208
1030
+  //#define E3_IS_TMC2208
1031
+  //#define E4_IS_TMC2208
1032
+
1009 1033
   /**
1010 1034
    * Stepper driver settings
1011 1035
    */
1012 1036
 
1013 1037
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1014 1038
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1015
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1039
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1016 1040
 
1017
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1041
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1018 1042
   #define X_MICROSTEPS        16  // 0..256
1019 1043
 
1020
-  #define Y_CURRENT         1000
1044
+  #define Y_CURRENT          800
1021 1045
   #define Y_MICROSTEPS        16
1022 1046
 
1023
-  #define Z_CURRENT         1000
1047
+  #define Z_CURRENT          800
1024 1048
   #define Z_MICROSTEPS        16
1025 1049
 
1026
-  //#define X2_CURRENT      1000
1027
-  //#define X2_MICROSTEPS     16
1050
+  #define X2_CURRENT         800
1051
+  #define X2_MICROSTEPS       16
1028 1052
 
1029
-  //#define Y2_CURRENT      1000
1030
-  //#define Y2_MICROSTEPS     16
1053
+  #define Y2_CURRENT         800
1054
+  #define Y2_MICROSTEPS       16
1031 1055
 
1032
-  //#define Z2_CURRENT      1000
1033
-  //#define Z2_MICROSTEPS     16
1056
+  #define Z2_CURRENT         800
1057
+  #define Z2_MICROSTEPS       16
1034 1058
 
1035
-  //#define E0_CURRENT      1000
1036
-  //#define E0_MICROSTEPS     16
1059
+  #define E0_CURRENT         800
1060
+  #define E0_MICROSTEPS       16
1037 1061
 
1038
-  //#define E1_CURRENT      1000
1039
-  //#define E1_MICROSTEPS     16
1062
+  #define E1_CURRENT         800
1063
+  #define E1_MICROSTEPS       16
1040 1064
 
1041
-  //#define E2_CURRENT      1000
1042
-  //#define E2_MICROSTEPS     16
1065
+  #define E2_CURRENT         800
1066
+  #define E2_MICROSTEPS       16
1043 1067
 
1044
-  //#define E3_CURRENT      1000
1045
-  //#define E3_MICROSTEPS     16
1068
+  #define E3_CURRENT         800
1069
+  #define E3_MICROSTEPS       16
1046 1070
 
1047
-  //#define E4_CURRENT      1000
1048
-  //#define E4_MICROSTEPS     16
1071
+  #define E4_CURRENT         800
1072
+  #define E4_MICROSTEPS       16
1049 1073
 
1050 1074
   /**
1051 1075
    * Use Trinamic's ultra quiet stepping mode.
@@ -1054,24 +1078,22 @@
1054 1078
   #define STEALTHCHOP
1055 1079
 
1056 1080
   /**
1057
-   * Let Marlin automatically control stepper current.
1058
-   * This is still an experimental feature.
1059
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1060
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1061
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1081
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1082
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1083
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1084
+   * Other detected conditions can be used to stop the current print.
1062 1085
    * Relevant g-codes:
1063 1086
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1064
-   * M906 S1 - Start adjusting current
1065
-   * M906 S0 - Stop adjusting current
1066 1087
    * M911 - Report stepper driver overtemperature pre-warn condition.
1067 1088
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1089
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1068 1090
    */
1069
-  //#define AUTOMATIC_CURRENT_CONTROL
1091
+  //#define MONITOR_DRIVER_STATUS
1070 1092
 
1071
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1072
-    #define CURRENT_STEP          50  // [mA]
1073
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1093
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1094
+    #define CURRENT_STEP_DOWN     50  // [mA]
1074 1095
     #define REPORT_CURRENT_CHANGE
1096
+    #define STOP_ON_ERROR
1075 1097
   #endif
1076 1098
 
1077 1099
   /**
@@ -1086,8 +1108,8 @@
1086 1108
   #define X2_HYBRID_THRESHOLD    100
1087 1109
   #define Y_HYBRID_THRESHOLD     100
1088 1110
   #define Y2_HYBRID_THRESHOLD    100
1089
-  #define Z_HYBRID_THRESHOLD       4
1090
-  #define Z2_HYBRID_THRESHOLD      4
1111
+  #define Z_HYBRID_THRESHOLD       3
1112
+  #define Z2_HYBRID_THRESHOLD      3
1091 1113
   #define E0_HYBRID_THRESHOLD     30
1092 1114
   #define E1_HYBRID_THRESHOLD     30
1093 1115
   #define E2_HYBRID_THRESHOLD     30
@@ -1097,7 +1119,7 @@
1097 1119
   /**
1098 1120
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1099 1121
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1100
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1122
+   * X and Y homing will always be done in spreadCycle mode.
1101 1123
    *
1102 1124
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1103 1125
    * Higher values make the system LESS sensitive.
@@ -1106,27 +1128,34 @@
1106 1128
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1107 1129
    * M914 X/Y to live tune the setting
1108 1130
    */
1109
-  //#define SENSORLESS_HOMING
1131
+  //#define SENSORLESS_HOMING // TMC2130 only
1110 1132
 
1111 1133
   #if ENABLED(SENSORLESS_HOMING)
1112
-    #define X_HOMING_SENSITIVITY  19
1113
-    #define Y_HOMING_SENSITIVITY  19
1134
+    #define X_HOMING_SENSITIVITY  8
1135
+    #define Y_HOMING_SENSITIVITY  8
1114 1136
   #endif
1115 1137
 
1116 1138
   /**
1139
+   * Enable M122 debugging command for TMC stepper drivers.
1140
+   * M122 S0/1 will enable continous reporting.
1141
+   */
1142
+  //#define TMC_DEBUG
1143
+
1144
+  /**
1117 1145
    * You can set your own advanced settings by filling in predefined functions.
1118 1146
    * A list of available functions can be found on the library github page
1119 1147
    * https://github.com/teemuatlut/TMC2130Stepper
1148
+   * https://github.com/teemuatlut/TMC2208Stepper
1120 1149
    *
1121 1150
    * Example:
1122
-   * #define TMC2130_ADV() { \
1151
+   * #define TMC_ADV() { \
1123 1152
    *   stepperX.diag0_temp_prewarn(1); \
1124
-   *   stepperX.interpolate(0); \
1153
+   *   stepperY.interpolate(0); \
1125 1154
    * }
1126 1155
    */
1127
-  #define  TMC2130_ADV() {  }
1156
+  #define  TMC_ADV() {  }
1128 1157
 
1129
-#endif // HAVE_TMC2130
1158
+#endif // TMC2130 || TMC2208
1130 1159
 
1131 1160
 // @section L6470
1132 1161
 

+ 72
- 43
Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h Прегледај датотеку

@@ -984,7 +984,7 @@
984 984
 
985 985
 #endif
986 986
 
987
-// @section TMC2130
987
+// @section TMC2130, TMC2208
988 988
 
989 989
 /**
990 990
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -998,7 +998,19 @@
998 998
  */
999 999
 //#define HAVE_TMC2130
1000 1000
 
1001
-#if ENABLED(HAVE_TMC2130)
1001
+/**
1002
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
1003
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
1004
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
1005
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1006
+ * The drivers can also be used with hardware serial.
1007
+ *
1008
+ * You'll also need the TMC2208Stepper Arduino library
1009
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1010
+ */
1011
+//#define HAVE_TMC2208
1012
+
1013
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
1002 1014
 
1003 1015
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
1004 1016
   //#define X_IS_TMC2130
@@ -1013,46 +1025,58 @@
1013 1025
   //#define E3_IS_TMC2130
1014 1026
   //#define E4_IS_TMC2130
1015 1027
 
1028
+  //#define X_IS_TMC2208
1029
+  //#define X2_IS_TMC2208
1030
+  //#define Y_IS_TMC2208
1031
+  //#define Y2_IS_TMC2208
1032
+  //#define Z_IS_TMC2208
1033
+  //#define Z2_IS_TMC2208
1034
+  //#define E0_IS_TMC2208
1035
+  //#define E1_IS_TMC2208
1036
+  //#define E2_IS_TMC2208
1037
+  //#define E3_IS_TMC2208
1038
+  //#define E4_IS_TMC2208
1039
+
1016 1040
   /**
1017 1041
    * Stepper driver settings
1018 1042
    */
1019 1043
 
1020 1044
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1021 1045
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1022
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1046
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1023 1047
 
1024
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1048
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1025 1049
   #define X_MICROSTEPS        16  // 0..256
1026 1050
 
1027
-  #define Y_CURRENT         1000
1051
+  #define Y_CURRENT          800
1028 1052
   #define Y_MICROSTEPS        16
1029 1053
 
1030
-  #define Z_CURRENT         1000
1054
+  #define Z_CURRENT          800
1031 1055
   #define Z_MICROSTEPS        16
1032 1056
 
1033
-  //#define X2_CURRENT      1000
1034
-  //#define X2_MICROSTEPS     16
1057
+  #define X2_CURRENT         800
1058
+  #define X2_MICROSTEPS       16
1035 1059
 
1036
-  //#define Y2_CURRENT      1000
1037
-  //#define Y2_MICROSTEPS     16
1060
+  #define Y2_CURRENT         800
1061
+  #define Y2_MICROSTEPS       16
1038 1062
 
1039
-  //#define Z2_CURRENT      1000
1040
-  //#define Z2_MICROSTEPS     16
1063
+  #define Z2_CURRENT         800
1064
+  #define Z2_MICROSTEPS       16
1041 1065
 
1042
-  //#define E0_CURRENT      1000
1043
-  //#define E0_MICROSTEPS     16
1066
+  #define E0_CURRENT         800
1067
+  #define E0_MICROSTEPS       16
1044 1068
 
1045
-  //#define E1_CURRENT      1000
1046
-  //#define E1_MICROSTEPS     16
1069
+  #define E1_CURRENT         800
1070
+  #define E1_MICROSTEPS       16
1047 1071
 
1048
-  //#define E2_CURRENT      1000
1049
-  //#define E2_MICROSTEPS     16
1072
+  #define E2_CURRENT         800
1073
+  #define E2_MICROSTEPS       16
1050 1074
 
1051
-  //#define E3_CURRENT      1000
1052
-  //#define E3_MICROSTEPS     16
1075
+  #define E3_CURRENT         800
1076
+  #define E3_MICROSTEPS       16
1053 1077
 
1054
-  //#define E4_CURRENT      1000
1055
-  //#define E4_MICROSTEPS     16
1078
+  #define E4_CURRENT         800
1079
+  #define E4_MICROSTEPS       16
1056 1080
 
1057 1081
   /**
1058 1082
    * Use Trinamic's ultra quiet stepping mode.
@@ -1061,24 +1085,22 @@
1061 1085
   #define STEALTHCHOP
1062 1086
 
1063 1087
   /**
1064
-   * Let Marlin automatically control stepper current.
1065
-   * This is still an experimental feature.
1066
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1067
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1068
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1088
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1089
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1090
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1091
+   * Other detected conditions can be used to stop the current print.
1069 1092
    * Relevant g-codes:
1070 1093
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1071
-   * M906 S1 - Start adjusting current
1072
-   * M906 S0 - Stop adjusting current
1073 1094
    * M911 - Report stepper driver overtemperature pre-warn condition.
1074 1095
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1096
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1075 1097
    */
1076
-  //#define AUTOMATIC_CURRENT_CONTROL
1098
+  //#define MONITOR_DRIVER_STATUS
1077 1099
 
1078
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1079
-    #define CURRENT_STEP          50  // [mA]
1080
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1100
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1101
+    #define CURRENT_STEP_DOWN     50  // [mA]
1081 1102
     #define REPORT_CURRENT_CHANGE
1103
+    #define STOP_ON_ERROR
1082 1104
   #endif
1083 1105
 
1084 1106
   /**
@@ -1093,8 +1115,8 @@
1093 1115
   #define X2_HYBRID_THRESHOLD    100
1094 1116
   #define Y_HYBRID_THRESHOLD     100
1095 1117
   #define Y2_HYBRID_THRESHOLD    100
1096
-  #define Z_HYBRID_THRESHOLD       4
1097
-  #define Z2_HYBRID_THRESHOLD      4
1118
+  #define Z_HYBRID_THRESHOLD       3
1119
+  #define Z2_HYBRID_THRESHOLD      3
1098 1120
   #define E0_HYBRID_THRESHOLD     30
1099 1121
   #define E1_HYBRID_THRESHOLD     30
1100 1122
   #define E2_HYBRID_THRESHOLD     30
@@ -1104,7 +1126,7 @@
1104 1126
   /**
1105 1127
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1106 1128
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1107
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1129
+   * X and Y homing will always be done in spreadCycle mode.
1108 1130
    *
1109 1131
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1110 1132
    * Higher values make the system LESS sensitive.
@@ -1113,27 +1135,34 @@
1113 1135
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1114 1136
    * M914 X/Y to live tune the setting
1115 1137
    */
1116
-  //#define SENSORLESS_HOMING
1138
+  //#define SENSORLESS_HOMING // TMC2130 only
1117 1139
 
1118 1140
   #if ENABLED(SENSORLESS_HOMING)
1119
-    #define X_HOMING_SENSITIVITY  19
1120
-    #define Y_HOMING_SENSITIVITY  19
1141
+    #define X_HOMING_SENSITIVITY  8
1142
+    #define Y_HOMING_SENSITIVITY  8
1121 1143
   #endif
1122 1144
 
1123 1145
   /**
1146
+   * Enable M122 debugging command for TMC stepper drivers.
1147
+   * M122 S0/1 will enable continous reporting.
1148
+   */
1149
+  //#define TMC_DEBUG
1150
+
1151
+  /**
1124 1152
    * You can set your own advanced settings by filling in predefined functions.
1125 1153
    * A list of available functions can be found on the library github page
1126 1154
    * https://github.com/teemuatlut/TMC2130Stepper
1155
+   * https://github.com/teemuatlut/TMC2208Stepper
1127 1156
    *
1128 1157
    * Example:
1129
-   * #define TMC2130_ADV() { \
1158
+   * #define TMC_ADV() { \
1130 1159
    *   stepperX.diag0_temp_prewarn(1); \
1131
-   *   stepperX.interpolate(0); \
1160
+   *   stepperY.interpolate(0); \
1132 1161
    * }
1133 1162
    */
1134
-  #define  TMC2130_ADV() {  }
1163
+  #define  TMC_ADV() {  }
1135 1164
 
1136
-#endif // HAVE_TMC2130
1165
+#endif // TMC2130 || TMC2208
1137 1166
 
1138 1167
 // @section L6470
1139 1168
 

+ 72
- 43
Marlin/src/config/examples/RigidBot/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/SCARA/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Sanguinololu/Configuration_adv.h Прегледај датотеку

@@ -965,7 +965,7 @@
965 965
 
966 966
 #endif
967 967
 
968
-// @section TMC2130
968
+// @section TMC2130, TMC2208
969 969
 
970 970
 /**
971 971
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -979,7 +979,19 @@
979 979
  */
980 980
 //#define HAVE_TMC2130
981 981
 
982
-#if ENABLED(HAVE_TMC2130)
982
+/**
983
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
984
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
985
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
986
+ * to #_SERIAL_TX_PIN with a 1K resistor.
987
+ * The drivers can also be used with hardware serial.
988
+ *
989
+ * You'll also need the TMC2208Stepper Arduino library
990
+ * (https://github.com/teemuatlut/TMC2208Stepper).
991
+ */
992
+//#define HAVE_TMC2208
993
+
994
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
983 995
 
984 996
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
985 997
   //#define X_IS_TMC2130
@@ -994,46 +1006,58 @@
994 1006
   //#define E3_IS_TMC2130
995 1007
   //#define E4_IS_TMC2130
996 1008
 
1009
+  //#define X_IS_TMC2208
1010
+  //#define X2_IS_TMC2208
1011
+  //#define Y_IS_TMC2208
1012
+  //#define Y2_IS_TMC2208
1013
+  //#define Z_IS_TMC2208
1014
+  //#define Z2_IS_TMC2208
1015
+  //#define E0_IS_TMC2208
1016
+  //#define E1_IS_TMC2208
1017
+  //#define E2_IS_TMC2208
1018
+  //#define E3_IS_TMC2208
1019
+  //#define E4_IS_TMC2208
1020
+
997 1021
   /**
998 1022
    * Stepper driver settings
999 1023
    */
1000 1024
 
1001 1025
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1002 1026
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1003
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1027
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1004 1028
 
1005
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1029
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1006 1030
   #define X_MICROSTEPS        16  // 0..256
1007 1031
 
1008
-  #define Y_CURRENT         1000
1032
+  #define Y_CURRENT          800
1009 1033
   #define Y_MICROSTEPS        16
1010 1034
 
1011
-  #define Z_CURRENT         1000
1035
+  #define Z_CURRENT          800
1012 1036
   #define Z_MICROSTEPS        16
1013 1037
 
1014
-  //#define X2_CURRENT      1000
1015
-  //#define X2_MICROSTEPS     16
1038
+  #define X2_CURRENT         800
1039
+  #define X2_MICROSTEPS       16
1016 1040
 
1017
-  //#define Y2_CURRENT      1000
1018
-  //#define Y2_MICROSTEPS     16
1041
+  #define Y2_CURRENT         800
1042
+  #define Y2_MICROSTEPS       16
1019 1043
 
1020
-  //#define Z2_CURRENT      1000
1021
-  //#define Z2_MICROSTEPS     16
1044
+  #define Z2_CURRENT         800
1045
+  #define Z2_MICROSTEPS       16
1022 1046
 
1023
-  //#define E0_CURRENT      1000
1024
-  //#define E0_MICROSTEPS     16
1047
+  #define E0_CURRENT         800
1048
+  #define E0_MICROSTEPS       16
1025 1049
 
1026
-  //#define E1_CURRENT      1000
1027
-  //#define E1_MICROSTEPS     16
1050
+  #define E1_CURRENT         800
1051
+  #define E1_MICROSTEPS       16
1028 1052
 
1029
-  //#define E2_CURRENT      1000
1030
-  //#define E2_MICROSTEPS     16
1053
+  #define E2_CURRENT         800
1054
+  #define E2_MICROSTEPS       16
1031 1055
 
1032
-  //#define E3_CURRENT      1000
1033
-  //#define E3_MICROSTEPS     16
1056
+  #define E3_CURRENT         800
1057
+  #define E3_MICROSTEPS       16
1034 1058
 
1035
-  //#define E4_CURRENT      1000
1036
-  //#define E4_MICROSTEPS     16
1059
+  #define E4_CURRENT         800
1060
+  #define E4_MICROSTEPS       16
1037 1061
 
1038 1062
   /**
1039 1063
    * Use Trinamic's ultra quiet stepping mode.
@@ -1042,24 +1066,22 @@
1042 1066
   #define STEALTHCHOP
1043 1067
 
1044 1068
   /**
1045
-   * Let Marlin automatically control stepper current.
1046
-   * This is still an experimental feature.
1047
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1048
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1049
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1069
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1070
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1071
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1072
+   * Other detected conditions can be used to stop the current print.
1050 1073
    * Relevant g-codes:
1051 1074
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1052
-   * M906 S1 - Start adjusting current
1053
-   * M906 S0 - Stop adjusting current
1054 1075
    * M911 - Report stepper driver overtemperature pre-warn condition.
1055 1076
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1077
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1056 1078
    */
1057
-  //#define AUTOMATIC_CURRENT_CONTROL
1079
+  //#define MONITOR_DRIVER_STATUS
1058 1080
 
1059
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1060
-    #define CURRENT_STEP          50  // [mA]
1061
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1081
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1082
+    #define CURRENT_STEP_DOWN     50  // [mA]
1062 1083
     #define REPORT_CURRENT_CHANGE
1084
+    #define STOP_ON_ERROR
1063 1085
   #endif
1064 1086
 
1065 1087
   /**
@@ -1074,8 +1096,8 @@
1074 1096
   #define X2_HYBRID_THRESHOLD    100
1075 1097
   #define Y_HYBRID_THRESHOLD     100
1076 1098
   #define Y2_HYBRID_THRESHOLD    100
1077
-  #define Z_HYBRID_THRESHOLD       4
1078
-  #define Z2_HYBRID_THRESHOLD      4
1099
+  #define Z_HYBRID_THRESHOLD       3
1100
+  #define Z2_HYBRID_THRESHOLD      3
1079 1101
   #define E0_HYBRID_THRESHOLD     30
1080 1102
   #define E1_HYBRID_THRESHOLD     30
1081 1103
   #define E2_HYBRID_THRESHOLD     30
@@ -1085,7 +1107,7 @@
1085 1107
   /**
1086 1108
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1087 1109
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1088
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1110
+   * X and Y homing will always be done in spreadCycle mode.
1089 1111
    *
1090 1112
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1091 1113
    * Higher values make the system LESS sensitive.
@@ -1094,27 +1116,34 @@
1094 1116
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1095 1117
    * M914 X/Y to live tune the setting
1096 1118
    */
1097
-  //#define SENSORLESS_HOMING
1119
+  //#define SENSORLESS_HOMING // TMC2130 only
1098 1120
 
1099 1121
   #if ENABLED(SENSORLESS_HOMING)
1100
-    #define X_HOMING_SENSITIVITY  19
1101
-    #define Y_HOMING_SENSITIVITY  19
1122
+    #define X_HOMING_SENSITIVITY  8
1123
+    #define Y_HOMING_SENSITIVITY  8
1102 1124
   #endif
1103 1125
 
1104 1126
   /**
1127
+   * Enable M122 debugging command for TMC stepper drivers.
1128
+   * M122 S0/1 will enable continous reporting.
1129
+   */
1130
+  //#define TMC_DEBUG
1131
+
1132
+  /**
1105 1133
    * You can set your own advanced settings by filling in predefined functions.
1106 1134
    * A list of available functions can be found on the library github page
1107 1135
    * https://github.com/teemuatlut/TMC2130Stepper
1136
+   * https://github.com/teemuatlut/TMC2208Stepper
1108 1137
    *
1109 1138
    * Example:
1110
-   * #define TMC2130_ADV() { \
1139
+   * #define TMC_ADV() { \
1111 1140
    *   stepperX.diag0_temp_prewarn(1); \
1112
-   *   stepperX.interpolate(0); \
1141
+   *   stepperY.interpolate(0); \
1113 1142
    * }
1114 1143
    */
1115
-  #define  TMC2130_ADV() {  }
1144
+  #define  TMC_ADV() {  }
1116 1145
 
1117
-#endif // HAVE_TMC2130
1146
+#endif // TMC2130 || TMC2208
1118 1147
 
1119 1148
 // @section L6470
1120 1149
 

+ 72
- 43
Marlin/src/config/examples/TinyBoy2/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 77
- 48
Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -988,63 +988,87 @@
988 988
  * the hardware SPI interface on your board and define the required CS pins
989 989
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
990 990
  */
991
-#define HAVE_TMC2130
991
+//#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996
-  #define X_IS_TMC2130
1008
+  //#define X_IS_TMC2130
997 1009
   //#define X2_IS_TMC2130
998
-  #define Y_IS_TMC2130
1010
+  //#define Y_IS_TMC2130
999 1011
   //#define Y2_IS_TMC2130
1000
-  #define Z_IS_TMC2130
1012
+  //#define Z_IS_TMC2130
1001 1013
   //#define Z2_IS_TMC2130
1002
-  #define E0_IS_TMC2130
1014
+  //#define E0_IS_TMC2130
1003 1015
   //#define E1_IS_TMC2130
1004 1016
   //#define E2_IS_TMC2130
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012
-  #define R_SENSE           0.22  // R_sense resistor for SilentStepStick2130
1036
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT          900  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT          900
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT          900
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  #define E0_CURRENT         900
1058
+  #define E0_CURRENT         800
1035 1059
   #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h Прегледај датотеку

@@ -987,7 +987,7 @@
987 987
 
988 988
 #endif
989 989
 
990
-// @section TMC2130
990
+// @section TMC2130, TMC2208
991 991
 
992 992
 /**
993 993
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -1001,7 +1001,19 @@
1001 1001
  */
1002 1002
 //#define HAVE_TMC2130
1003 1003
 
1004
-#if ENABLED(HAVE_TMC2130)
1004
+/**
1005
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
1006
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
1007
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
1008
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1009
+ * The drivers can also be used with hardware serial.
1010
+ *
1011
+ * You'll also need the TMC2208Stepper Arduino library
1012
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1013
+ */
1014
+//#define HAVE_TMC2208
1015
+
1016
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
1005 1017
 
1006 1018
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
1007 1019
   //#define X_IS_TMC2130
@@ -1016,46 +1028,58 @@
1016 1028
   //#define E3_IS_TMC2130
1017 1029
   //#define E4_IS_TMC2130
1018 1030
 
1031
+  //#define X_IS_TMC2208
1032
+  //#define X2_IS_TMC2208
1033
+  //#define Y_IS_TMC2208
1034
+  //#define Y2_IS_TMC2208
1035
+  //#define Z_IS_TMC2208
1036
+  //#define Z2_IS_TMC2208
1037
+  //#define E0_IS_TMC2208
1038
+  //#define E1_IS_TMC2208
1039
+  //#define E2_IS_TMC2208
1040
+  //#define E3_IS_TMC2208
1041
+  //#define E4_IS_TMC2208
1042
+
1019 1043
   /**
1020 1044
    * Stepper driver settings
1021 1045
    */
1022 1046
 
1023 1047
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1024 1048
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1025
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1049
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1026 1050
 
1027
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1051
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1028 1052
   #define X_MICROSTEPS        16  // 0..256
1029 1053
 
1030
-  #define Y_CURRENT         1000
1054
+  #define Y_CURRENT          800
1031 1055
   #define Y_MICROSTEPS        16
1032 1056
 
1033
-  #define Z_CURRENT         1000
1057
+  #define Z_CURRENT          800
1034 1058
   #define Z_MICROSTEPS        16
1035 1059
 
1036
-  //#define X2_CURRENT      1000
1037
-  //#define X2_MICROSTEPS     16
1060
+  #define X2_CURRENT         800
1061
+  #define X2_MICROSTEPS       16
1038 1062
 
1039
-  //#define Y2_CURRENT      1000
1040
-  //#define Y2_MICROSTEPS     16
1063
+  #define Y2_CURRENT         800
1064
+  #define Y2_MICROSTEPS       16
1041 1065
 
1042
-  //#define Z2_CURRENT      1000
1043
-  //#define Z2_MICROSTEPS     16
1066
+  #define Z2_CURRENT         800
1067
+  #define Z2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E0_CURRENT      1000
1046
-  //#define E0_MICROSTEPS     16
1069
+  #define E0_CURRENT         800
1070
+  #define E0_MICROSTEPS       16
1047 1071
 
1048
-  //#define E1_CURRENT      1000
1049
-  //#define E1_MICROSTEPS     16
1072
+  #define E1_CURRENT         800
1073
+  #define E1_MICROSTEPS       16
1050 1074
 
1051
-  //#define E2_CURRENT      1000
1052
-  //#define E2_MICROSTEPS     16
1075
+  #define E2_CURRENT         800
1076
+  #define E2_MICROSTEPS       16
1053 1077
 
1054
-  //#define E3_CURRENT      1000
1055
-  //#define E3_MICROSTEPS     16
1078
+  #define E3_CURRENT         800
1079
+  #define E3_MICROSTEPS       16
1056 1080
 
1057
-  //#define E4_CURRENT      1000
1058
-  //#define E4_MICROSTEPS     16
1081
+  #define E4_CURRENT         800
1082
+  #define E4_MICROSTEPS       16
1059 1083
 
1060 1084
   /**
1061 1085
    * Use Trinamic's ultra quiet stepping mode.
@@ -1064,24 +1088,22 @@
1064 1088
   #define STEALTHCHOP
1065 1089
 
1066 1090
   /**
1067
-   * Let Marlin automatically control stepper current.
1068
-   * This is still an experimental feature.
1069
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1070
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1071
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1091
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1092
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1093
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1094
+   * Other detected conditions can be used to stop the current print.
1072 1095
    * Relevant g-codes:
1073 1096
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1074
-   * M906 S1 - Start adjusting current
1075
-   * M906 S0 - Stop adjusting current
1076 1097
    * M911 - Report stepper driver overtemperature pre-warn condition.
1077 1098
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1099
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1078 1100
    */
1079
-  //#define AUTOMATIC_CURRENT_CONTROL
1101
+  //#define MONITOR_DRIVER_STATUS
1080 1102
 
1081
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1082
-    #define CURRENT_STEP          50  // [mA]
1083
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1103
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1104
+    #define CURRENT_STEP_DOWN     50  // [mA]
1084 1105
     #define REPORT_CURRENT_CHANGE
1106
+    #define STOP_ON_ERROR
1085 1107
   #endif
1086 1108
 
1087 1109
   /**
@@ -1096,8 +1118,8 @@
1096 1118
   #define X2_HYBRID_THRESHOLD    100
1097 1119
   #define Y_HYBRID_THRESHOLD     100
1098 1120
   #define Y2_HYBRID_THRESHOLD    100
1099
-  #define Z_HYBRID_THRESHOLD       4
1100
-  #define Z2_HYBRID_THRESHOLD      4
1121
+  #define Z_HYBRID_THRESHOLD       3
1122
+  #define Z2_HYBRID_THRESHOLD      3
1101 1123
   #define E0_HYBRID_THRESHOLD     30
1102 1124
   #define E1_HYBRID_THRESHOLD     30
1103 1125
   #define E2_HYBRID_THRESHOLD     30
@@ -1107,7 +1129,7 @@
1107 1129
   /**
1108 1130
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1109 1131
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1110
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1132
+   * X and Y homing will always be done in spreadCycle mode.
1111 1133
    *
1112 1134
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1113 1135
    * Higher values make the system LESS sensitive.
@@ -1116,27 +1138,34 @@
1116 1138
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1117 1139
    * M914 X/Y to live tune the setting
1118 1140
    */
1119
-  //#define SENSORLESS_HOMING
1141
+  //#define SENSORLESS_HOMING // TMC2130 only
1120 1142
 
1121 1143
   #if ENABLED(SENSORLESS_HOMING)
1122
-    #define X_HOMING_SENSITIVITY  19
1123
-    #define Y_HOMING_SENSITIVITY  19
1144
+    #define X_HOMING_SENSITIVITY  8
1145
+    #define Y_HOMING_SENSITIVITY  8
1124 1146
   #endif
1125 1147
 
1126 1148
   /**
1149
+   * Enable M122 debugging command for TMC stepper drivers.
1150
+   * M122 S0/1 will enable continous reporting.
1151
+   */
1152
+  //#define TMC_DEBUG
1153
+
1154
+  /**
1127 1155
    * You can set your own advanced settings by filling in predefined functions.
1128 1156
    * A list of available functions can be found on the library github page
1129 1157
    * https://github.com/teemuatlut/TMC2130Stepper
1158
+   * https://github.com/teemuatlut/TMC2208Stepper
1130 1159
    *
1131 1160
    * Example:
1132
-   * #define TMC2130_ADV() { \
1161
+   * #define TMC_ADV() { \
1133 1162
    *   stepperX.diag0_temp_prewarn(1); \
1134
-   *   stepperX.interpolate(0); \
1163
+   *   stepperY.interpolate(0); \
1135 1164
    * }
1136 1165
    */
1137
-  #define  TMC2130_ADV() {  }
1166
+  #define  TMC_ADV() {  }
1138 1167
 
1139
-#endif // HAVE_TMC2130
1168
+#endif // TMC2130 || TMC2208
1140 1169
 
1141 1170
 // @section L6470
1142 1171
 

+ 72
- 43
Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h Прегледај датотеку

@@ -977,7 +977,7 @@
977 977
 
978 978
 #endif
979 979
 
980
-// @section TMC2130
980
+// @section TMC2130, TMC2208
981 981
 
982 982
 /**
983 983
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -991,7 +991,19 @@
991 991
  */
992 992
 //#define HAVE_TMC2130
993 993
 
994
-#if ENABLED(HAVE_TMC2130)
994
+/**
995
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
996
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
997
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
998
+ * to #_SERIAL_TX_PIN with a 1K resistor.
999
+ * The drivers can also be used with hardware serial.
1000
+ *
1001
+ * You'll also need the TMC2208Stepper Arduino library
1002
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1003
+ */
1004
+//#define HAVE_TMC2208
1005
+
1006
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
995 1007
 
996 1008
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
997 1009
   //#define X_IS_TMC2130
@@ -1006,46 +1018,58 @@
1006 1018
   //#define E3_IS_TMC2130
1007 1019
   //#define E4_IS_TMC2130
1008 1020
 
1021
+  //#define X_IS_TMC2208
1022
+  //#define X2_IS_TMC2208
1023
+  //#define Y_IS_TMC2208
1024
+  //#define Y2_IS_TMC2208
1025
+  //#define Z_IS_TMC2208
1026
+  //#define Z2_IS_TMC2208
1027
+  //#define E0_IS_TMC2208
1028
+  //#define E1_IS_TMC2208
1029
+  //#define E2_IS_TMC2208
1030
+  //#define E3_IS_TMC2208
1031
+  //#define E4_IS_TMC2208
1032
+
1009 1033
   /**
1010 1034
    * Stepper driver settings
1011 1035
    */
1012 1036
 
1013 1037
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1014 1038
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1015
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1039
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1016 1040
 
1017
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1041
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1018 1042
   #define X_MICROSTEPS        16  // 0..256
1019 1043
 
1020
-  #define Y_CURRENT         1000
1044
+  #define Y_CURRENT          800
1021 1045
   #define Y_MICROSTEPS        16
1022 1046
 
1023
-  #define Z_CURRENT         1000
1047
+  #define Z_CURRENT          800
1024 1048
   #define Z_MICROSTEPS        16
1025 1049
 
1026
-  //#define X2_CURRENT      1000
1027
-  //#define X2_MICROSTEPS     16
1050
+  #define X2_CURRENT         800
1051
+  #define X2_MICROSTEPS       16
1028 1052
 
1029
-  //#define Y2_CURRENT      1000
1030
-  //#define Y2_MICROSTEPS     16
1053
+  #define Y2_CURRENT         800
1054
+  #define Y2_MICROSTEPS       16
1031 1055
 
1032
-  //#define Z2_CURRENT      1000
1033
-  //#define Z2_MICROSTEPS     16
1056
+  #define Z2_CURRENT         800
1057
+  #define Z2_MICROSTEPS       16
1034 1058
 
1035
-  //#define E0_CURRENT      1000
1036
-  //#define E0_MICROSTEPS     16
1059
+  #define E0_CURRENT         800
1060
+  #define E0_MICROSTEPS       16
1037 1061
 
1038
-  //#define E1_CURRENT      1000
1039
-  //#define E1_MICROSTEPS     16
1062
+  #define E1_CURRENT         800
1063
+  #define E1_MICROSTEPS       16
1040 1064
 
1041
-  //#define E2_CURRENT      1000
1042
-  //#define E2_MICROSTEPS     16
1065
+  #define E2_CURRENT         800
1066
+  #define E2_MICROSTEPS       16
1043 1067
 
1044
-  //#define E3_CURRENT      1000
1045
-  //#define E3_MICROSTEPS     16
1068
+  #define E3_CURRENT         800
1069
+  #define E3_MICROSTEPS       16
1046 1070
 
1047
-  //#define E4_CURRENT      1000
1048
-  //#define E4_MICROSTEPS     16
1071
+  #define E4_CURRENT         800
1072
+  #define E4_MICROSTEPS       16
1049 1073
 
1050 1074
   /**
1051 1075
    * Use Trinamic's ultra quiet stepping mode.
@@ -1054,24 +1078,22 @@
1054 1078
   #define STEALTHCHOP
1055 1079
 
1056 1080
   /**
1057
-   * Let Marlin automatically control stepper current.
1058
-   * This is still an experimental feature.
1059
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1060
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1061
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1081
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1082
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1083
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1084
+   * Other detected conditions can be used to stop the current print.
1062 1085
    * Relevant g-codes:
1063 1086
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1064
-   * M906 S1 - Start adjusting current
1065
-   * M906 S0 - Stop adjusting current
1066 1087
    * M911 - Report stepper driver overtemperature pre-warn condition.
1067 1088
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1089
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1068 1090
    */
1069
-  //#define AUTOMATIC_CURRENT_CONTROL
1091
+  //#define MONITOR_DRIVER_STATUS
1070 1092
 
1071
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1072
-    #define CURRENT_STEP          50  // [mA]
1073
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1093
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1094
+    #define CURRENT_STEP_DOWN     50  // [mA]
1074 1095
     #define REPORT_CURRENT_CHANGE
1096
+    #define STOP_ON_ERROR
1075 1097
   #endif
1076 1098
 
1077 1099
   /**
@@ -1086,8 +1108,8 @@
1086 1108
   #define X2_HYBRID_THRESHOLD    100
1087 1109
   #define Y_HYBRID_THRESHOLD     100
1088 1110
   #define Y2_HYBRID_THRESHOLD    100
1089
-  #define Z_HYBRID_THRESHOLD       4
1090
-  #define Z2_HYBRID_THRESHOLD      4
1111
+  #define Z_HYBRID_THRESHOLD       3
1112
+  #define Z2_HYBRID_THRESHOLD      3
1091 1113
   #define E0_HYBRID_THRESHOLD     30
1092 1114
   #define E1_HYBRID_THRESHOLD     30
1093 1115
   #define E2_HYBRID_THRESHOLD     30
@@ -1097,7 +1119,7 @@
1097 1119
   /**
1098 1120
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1099 1121
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1100
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1122
+   * X and Y homing will always be done in spreadCycle mode.
1101 1123
    *
1102 1124
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1103 1125
    * Higher values make the system LESS sensitive.
@@ -1106,27 +1128,34 @@
1106 1128
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1107 1129
    * M914 X/Y to live tune the setting
1108 1130
    */
1109
-  //#define SENSORLESS_HOMING
1131
+  //#define SENSORLESS_HOMING // TMC2130 only
1110 1132
 
1111 1133
   #if ENABLED(SENSORLESS_HOMING)
1112
-    #define X_HOMING_SENSITIVITY  19
1113
-    #define Y_HOMING_SENSITIVITY  19
1134
+    #define X_HOMING_SENSITIVITY  8
1135
+    #define Y_HOMING_SENSITIVITY  8
1114 1136
   #endif
1115 1137
 
1116 1138
   /**
1139
+   * Enable M122 debugging command for TMC stepper drivers.
1140
+   * M122 S0/1 will enable continous reporting.
1141
+   */
1142
+  //#define TMC_DEBUG
1143
+
1144
+  /**
1117 1145
    * You can set your own advanced settings by filling in predefined functions.
1118 1146
    * A list of available functions can be found on the library github page
1119 1147
    * https://github.com/teemuatlut/TMC2130Stepper
1148
+   * https://github.com/teemuatlut/TMC2208Stepper
1120 1149
    *
1121 1150
    * Example:
1122
-   * #define TMC2130_ADV() { \
1151
+   * #define TMC_ADV() { \
1123 1152
    *   stepperX.diag0_temp_prewarn(1); \
1124
-   *   stepperX.interpolate(0); \
1153
+   *   stepperY.interpolate(0); \
1125 1154
    * }
1126 1155
    */
1127
-  #define  TMC2130_ADV() {  }
1156
+  #define  TMC_ADV() {  }
1128 1157
 
1129
-#endif // HAVE_TMC2130
1158
+#endif // TMC2130 || TMC2208
1130 1159
 
1131 1160
 // @section L6470
1132 1161
 

+ 72
- 43
Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/delta/generic/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h Прегледај датотеку

@@ -983,7 +983,7 @@
983 983
 
984 984
 #endif
985 985
 
986
-// @section TMC2130
986
+// @section TMC2130, TMC2208
987 987
 
988 988
 /**
989 989
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -997,7 +997,19 @@
997 997
  */
998 998
 //#define HAVE_TMC2130
999 999
 
1000
-#if ENABLED(HAVE_TMC2130)
1000
+/**
1001
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
1002
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
1003
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
1004
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1005
+ * The drivers can also be used with hardware serial.
1006
+ *
1007
+ * You'll also need the TMC2208Stepper Arduino library
1008
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1009
+ */
1010
+//#define HAVE_TMC2208
1011
+
1012
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
1001 1013
 
1002 1014
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
1003 1015
   //#define X_IS_TMC2130
@@ -1012,46 +1024,58 @@
1012 1024
   //#define E3_IS_TMC2130
1013 1025
   //#define E4_IS_TMC2130
1014 1026
 
1027
+  //#define X_IS_TMC2208
1028
+  //#define X2_IS_TMC2208
1029
+  //#define Y_IS_TMC2208
1030
+  //#define Y2_IS_TMC2208
1031
+  //#define Z_IS_TMC2208
1032
+  //#define Z2_IS_TMC2208
1033
+  //#define E0_IS_TMC2208
1034
+  //#define E1_IS_TMC2208
1035
+  //#define E2_IS_TMC2208
1036
+  //#define E3_IS_TMC2208
1037
+  //#define E4_IS_TMC2208
1038
+
1015 1039
   /**
1016 1040
    * Stepper driver settings
1017 1041
    */
1018 1042
 
1019 1043
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1020 1044
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1021
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1045
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1022 1046
 
1023
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1047
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1024 1048
   #define X_MICROSTEPS        16  // 0..256
1025 1049
 
1026
-  #define Y_CURRENT         1000
1050
+  #define Y_CURRENT          800
1027 1051
   #define Y_MICROSTEPS        16
1028 1052
 
1029
-  #define Z_CURRENT         1000
1053
+  #define Z_CURRENT          800
1030 1054
   #define Z_MICROSTEPS        16
1031 1055
 
1032
-  //#define X2_CURRENT      1000
1033
-  //#define X2_MICROSTEPS     16
1056
+  #define X2_CURRENT         800
1057
+  #define X2_MICROSTEPS       16
1034 1058
 
1035
-  //#define Y2_CURRENT      1000
1036
-  //#define Y2_MICROSTEPS     16
1059
+  #define Y2_CURRENT         800
1060
+  #define Y2_MICROSTEPS       16
1037 1061
 
1038
-  //#define Z2_CURRENT      1000
1039
-  //#define Z2_MICROSTEPS     16
1062
+  #define Z2_CURRENT         800
1063
+  #define Z2_MICROSTEPS       16
1040 1064
 
1041
-  //#define E0_CURRENT      1000
1042
-  //#define E0_MICROSTEPS     16
1065
+  #define E0_CURRENT         800
1066
+  #define E0_MICROSTEPS       16
1043 1067
 
1044
-  //#define E1_CURRENT      1000
1045
-  //#define E1_MICROSTEPS     16
1068
+  #define E1_CURRENT         800
1069
+  #define E1_MICROSTEPS       16
1046 1070
 
1047
-  //#define E2_CURRENT      1000
1048
-  //#define E2_MICROSTEPS     16
1071
+  #define E2_CURRENT         800
1072
+  #define E2_MICROSTEPS       16
1049 1073
 
1050
-  //#define E3_CURRENT      1000
1051
-  //#define E3_MICROSTEPS     16
1074
+  #define E3_CURRENT         800
1075
+  #define E3_MICROSTEPS       16
1052 1076
 
1053
-  //#define E4_CURRENT      1000
1054
-  //#define E4_MICROSTEPS     16
1077
+  #define E4_CURRENT         800
1078
+  #define E4_MICROSTEPS       16
1055 1079
 
1056 1080
   /**
1057 1081
    * Use Trinamic's ultra quiet stepping mode.
@@ -1060,24 +1084,22 @@
1060 1084
   #define STEALTHCHOP
1061 1085
 
1062 1086
   /**
1063
-   * Let Marlin automatically control stepper current.
1064
-   * This is still an experimental feature.
1065
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1066
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1067
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1087
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1088
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1089
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1090
+   * Other detected conditions can be used to stop the current print.
1068 1091
    * Relevant g-codes:
1069 1092
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1070
-   * M906 S1 - Start adjusting current
1071
-   * M906 S0 - Stop adjusting current
1072 1093
    * M911 - Report stepper driver overtemperature pre-warn condition.
1073 1094
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1095
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1074 1096
    */
1075
-  //#define AUTOMATIC_CURRENT_CONTROL
1097
+  //#define MONITOR_DRIVER_STATUS
1076 1098
 
1077
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1078
-    #define CURRENT_STEP          50  // [mA]
1079
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1099
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1100
+    #define CURRENT_STEP_DOWN     50  // [mA]
1080 1101
     #define REPORT_CURRENT_CHANGE
1102
+    #define STOP_ON_ERROR
1081 1103
   #endif
1082 1104
 
1083 1105
   /**
@@ -1092,8 +1114,8 @@
1092 1114
   #define X2_HYBRID_THRESHOLD    100
1093 1115
   #define Y_HYBRID_THRESHOLD     100
1094 1116
   #define Y2_HYBRID_THRESHOLD    100
1095
-  #define Z_HYBRID_THRESHOLD       4
1096
-  #define Z2_HYBRID_THRESHOLD      4
1117
+  #define Z_HYBRID_THRESHOLD       3
1118
+  #define Z2_HYBRID_THRESHOLD      3
1097 1119
   #define E0_HYBRID_THRESHOLD     30
1098 1120
   #define E1_HYBRID_THRESHOLD     30
1099 1121
   #define E2_HYBRID_THRESHOLD     30
@@ -1103,7 +1125,7 @@
1103 1125
   /**
1104 1126
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1105 1127
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1106
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1128
+   * X and Y homing will always be done in spreadCycle mode.
1107 1129
    *
1108 1130
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1109 1131
    * Higher values make the system LESS sensitive.
@@ -1112,27 +1134,34 @@
1112 1134
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1113 1135
    * M914 X/Y to live tune the setting
1114 1136
    */
1115
-  //#define SENSORLESS_HOMING
1137
+  //#define SENSORLESS_HOMING // TMC2130 only
1116 1138
 
1117 1139
   #if ENABLED(SENSORLESS_HOMING)
1118
-    #define X_HOMING_SENSITIVITY  19
1119
-    #define Y_HOMING_SENSITIVITY  19
1140
+    #define X_HOMING_SENSITIVITY  8
1141
+    #define Y_HOMING_SENSITIVITY  8
1120 1142
   #endif
1121 1143
 
1122 1144
   /**
1145
+   * Enable M122 debugging command for TMC stepper drivers.
1146
+   * M122 S0/1 will enable continous reporting.
1147
+   */
1148
+  //#define TMC_DEBUG
1149
+
1150
+  /**
1123 1151
    * You can set your own advanced settings by filling in predefined functions.
1124 1152
    * A list of available functions can be found on the library github page
1125 1153
    * https://github.com/teemuatlut/TMC2130Stepper
1154
+   * https://github.com/teemuatlut/TMC2208Stepper
1126 1155
    *
1127 1156
    * Example:
1128
-   * #define TMC2130_ADV() { \
1157
+   * #define TMC_ADV() { \
1129 1158
    *   stepperX.diag0_temp_prewarn(1); \
1130
-   *   stepperX.interpolate(0); \
1159
+   *   stepperY.interpolate(0); \
1131 1160
    * }
1132 1161
    */
1133
-  #define  TMC2130_ADV() {  }
1162
+  #define  TMC_ADV() {  }
1134 1163
 
1135
-#endif // HAVE_TMC2130
1164
+#endif // TMC2130 || TMC2208
1136 1165
 
1137 1166
 // @section L6470
1138 1167
 

+ 72
- 43
Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h Прегледај датотеку

@@ -978,7 +978,7 @@
978 978
 
979 979
 #endif
980 980
 
981
-// @section TMC2130
981
+// @section TMC2130, TMC2208
982 982
 
983 983
 /**
984 984
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -992,7 +992,19 @@
992 992
  */
993 993
 //#define HAVE_TMC2130
994 994
 
995
-#if ENABLED(HAVE_TMC2130)
995
+/**
996
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
997
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
998
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
999
+ * to #_SERIAL_TX_PIN with a 1K resistor.
1000
+ * The drivers can also be used with hardware serial.
1001
+ *
1002
+ * You'll also need the TMC2208Stepper Arduino library
1003
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1004
+ */
1005
+//#define HAVE_TMC2208
1006
+
1007
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
996 1008
 
997 1009
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
998 1010
   //#define X_IS_TMC2130
@@ -1007,46 +1019,58 @@
1007 1019
   //#define E3_IS_TMC2130
1008 1020
   //#define E4_IS_TMC2130
1009 1021
 
1022
+  //#define X_IS_TMC2208
1023
+  //#define X2_IS_TMC2208
1024
+  //#define Y_IS_TMC2208
1025
+  //#define Y2_IS_TMC2208
1026
+  //#define Z_IS_TMC2208
1027
+  //#define Z2_IS_TMC2208
1028
+  //#define E0_IS_TMC2208
1029
+  //#define E1_IS_TMC2208
1030
+  //#define E2_IS_TMC2208
1031
+  //#define E3_IS_TMC2208
1032
+  //#define E4_IS_TMC2208
1033
+
1010 1034
   /**
1011 1035
    * Stepper driver settings
1012 1036
    */
1013 1037
 
1014 1038
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1015 1039
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1016
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1040
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1017 1041
 
1018
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1042
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1019 1043
   #define X_MICROSTEPS        16  // 0..256
1020 1044
 
1021
-  #define Y_CURRENT         1000
1045
+  #define Y_CURRENT          800
1022 1046
   #define Y_MICROSTEPS        16
1023 1047
 
1024
-  #define Z_CURRENT         1000
1048
+  #define Z_CURRENT          800
1025 1049
   #define Z_MICROSTEPS        16
1026 1050
 
1027
-  //#define X2_CURRENT      1000
1028
-  //#define X2_MICROSTEPS     16
1051
+  #define X2_CURRENT         800
1052
+  #define X2_MICROSTEPS       16
1029 1053
 
1030
-  //#define Y2_CURRENT      1000
1031
-  //#define Y2_MICROSTEPS     16
1054
+  #define Y2_CURRENT         800
1055
+  #define Y2_MICROSTEPS       16
1032 1056
 
1033
-  //#define Z2_CURRENT      1000
1034
-  //#define Z2_MICROSTEPS     16
1057
+  #define Z2_CURRENT         800
1058
+  #define Z2_MICROSTEPS       16
1035 1059
 
1036
-  //#define E0_CURRENT      1000
1037
-  //#define E0_MICROSTEPS     16
1060
+  #define E0_CURRENT         800
1061
+  #define E0_MICROSTEPS       16
1038 1062
 
1039
-  //#define E1_CURRENT      1000
1040
-  //#define E1_MICROSTEPS     16
1063
+  #define E1_CURRENT         800
1064
+  #define E1_MICROSTEPS       16
1041 1065
 
1042
-  //#define E2_CURRENT      1000
1043
-  //#define E2_MICROSTEPS     16
1066
+  #define E2_CURRENT         800
1067
+  #define E2_MICROSTEPS       16
1044 1068
 
1045
-  //#define E3_CURRENT      1000
1046
-  //#define E3_MICROSTEPS     16
1069
+  #define E3_CURRENT         800
1070
+  #define E3_MICROSTEPS       16
1047 1071
 
1048
-  //#define E4_CURRENT      1000
1049
-  //#define E4_MICROSTEPS     16
1072
+  #define E4_CURRENT         800
1073
+  #define E4_MICROSTEPS       16
1050 1074
 
1051 1075
   /**
1052 1076
    * Use Trinamic's ultra quiet stepping mode.
@@ -1055,24 +1079,22 @@
1055 1079
   #define STEALTHCHOP
1056 1080
 
1057 1081
   /**
1058
-   * Let Marlin automatically control stepper current.
1059
-   * This is still an experimental feature.
1060
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1061
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1062
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1082
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1083
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1084
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1085
+   * Other detected conditions can be used to stop the current print.
1063 1086
    * Relevant g-codes:
1064 1087
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1065
-   * M906 S1 - Start adjusting current
1066
-   * M906 S0 - Stop adjusting current
1067 1088
    * M911 - Report stepper driver overtemperature pre-warn condition.
1068 1089
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1090
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1069 1091
    */
1070
-  //#define AUTOMATIC_CURRENT_CONTROL
1092
+  //#define MONITOR_DRIVER_STATUS
1071 1093
 
1072
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1073
-    #define CURRENT_STEP          50  // [mA]
1074
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1094
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1095
+    #define CURRENT_STEP_DOWN     50  // [mA]
1075 1096
     #define REPORT_CURRENT_CHANGE
1097
+    #define STOP_ON_ERROR
1076 1098
   #endif
1077 1099
 
1078 1100
   /**
@@ -1087,8 +1109,8 @@
1087 1109
   #define X2_HYBRID_THRESHOLD    100
1088 1110
   #define Y_HYBRID_THRESHOLD     100
1089 1111
   #define Y2_HYBRID_THRESHOLD    100
1090
-  #define Z_HYBRID_THRESHOLD       4
1091
-  #define Z2_HYBRID_THRESHOLD      4
1112
+  #define Z_HYBRID_THRESHOLD       3
1113
+  #define Z2_HYBRID_THRESHOLD      3
1092 1114
   #define E0_HYBRID_THRESHOLD     30
1093 1115
   #define E1_HYBRID_THRESHOLD     30
1094 1116
   #define E2_HYBRID_THRESHOLD     30
@@ -1098,7 +1120,7 @@
1098 1120
   /**
1099 1121
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1100 1122
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1101
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1123
+   * X and Y homing will always be done in spreadCycle mode.
1102 1124
    *
1103 1125
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1104 1126
    * Higher values make the system LESS sensitive.
@@ -1107,27 +1129,34 @@
1107 1129
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1108 1130
    * M914 X/Y to live tune the setting
1109 1131
    */
1110
-  //#define SENSORLESS_HOMING
1132
+  //#define SENSORLESS_HOMING // TMC2130 only
1111 1133
 
1112 1134
   #if ENABLED(SENSORLESS_HOMING)
1113
-    #define X_HOMING_SENSITIVITY  19
1114
-    #define Y_HOMING_SENSITIVITY  19
1135
+    #define X_HOMING_SENSITIVITY  8
1136
+    #define Y_HOMING_SENSITIVITY  8
1115 1137
   #endif
1116 1138
 
1117 1139
   /**
1140
+   * Enable M122 debugging command for TMC stepper drivers.
1141
+   * M122 S0/1 will enable continous reporting.
1142
+   */
1143
+  //#define TMC_DEBUG
1144
+
1145
+  /**
1118 1146
    * You can set your own advanced settings by filling in predefined functions.
1119 1147
    * A list of available functions can be found on the library github page
1120 1148
    * https://github.com/teemuatlut/TMC2130Stepper
1149
+   * https://github.com/teemuatlut/TMC2208Stepper
1121 1150
    *
1122 1151
    * Example:
1123
-   * #define TMC2130_ADV() { \
1152
+   * #define TMC_ADV() { \
1124 1153
    *   stepperX.diag0_temp_prewarn(1); \
1125
-   *   stepperX.interpolate(0); \
1154
+   *   stepperY.interpolate(0); \
1126 1155
    * }
1127 1156
    */
1128
-  #define  TMC2130_ADV() {  }
1157
+  #define  TMC_ADV() {  }
1129 1158
 
1130
-#endif // HAVE_TMC2130
1159
+#endif // TMC2130 || TMC2208
1131 1160
 
1132 1161
 // @section L6470
1133 1162
 

+ 72
- 43
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/makibox/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h Прегледај датотеку

@@ -976,7 +976,7 @@
976 976
 
977 977
 #endif
978 978
 
979
-// @section TMC2130
979
+// @section TMC2130, TMC2208
980 980
 
981 981
 /**
982 982
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -990,7 +990,19 @@
990 990
  */
991 991
 //#define HAVE_TMC2130
992 992
 
993
-#if ENABLED(HAVE_TMC2130)
993
+/**
994
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
995
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
996
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
997
+ * to #_SERIAL_TX_PIN with a 1K resistor.
998
+ * The drivers can also be used with hardware serial.
999
+ *
1000
+ * You'll also need the TMC2208Stepper Arduino library
1001
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1002
+ */
1003
+//#define HAVE_TMC2208
1004
+
1005
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
994 1006
 
995 1007
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
996 1008
   //#define X_IS_TMC2130
@@ -1005,46 +1017,58 @@
1005 1017
   //#define E3_IS_TMC2130
1006 1018
   //#define E4_IS_TMC2130
1007 1019
 
1020
+  //#define X_IS_TMC2208
1021
+  //#define X2_IS_TMC2208
1022
+  //#define Y_IS_TMC2208
1023
+  //#define Y2_IS_TMC2208
1024
+  //#define Z_IS_TMC2208
1025
+  //#define Z2_IS_TMC2208
1026
+  //#define E0_IS_TMC2208
1027
+  //#define E1_IS_TMC2208
1028
+  //#define E2_IS_TMC2208
1029
+  //#define E3_IS_TMC2208
1030
+  //#define E4_IS_TMC2208
1031
+
1008 1032
   /**
1009 1033
    * Stepper driver settings
1010 1034
    */
1011 1035
 
1012 1036
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1013 1037
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1014
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1038
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1015 1039
 
1016
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1040
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1017 1041
   #define X_MICROSTEPS        16  // 0..256
1018 1042
 
1019
-  #define Y_CURRENT         1000
1043
+  #define Y_CURRENT          800
1020 1044
   #define Y_MICROSTEPS        16
1021 1045
 
1022
-  #define Z_CURRENT         1000
1046
+  #define Z_CURRENT          800
1023 1047
   #define Z_MICROSTEPS        16
1024 1048
 
1025
-  //#define X2_CURRENT      1000
1026
-  //#define X2_MICROSTEPS     16
1049
+  #define X2_CURRENT         800
1050
+  #define X2_MICROSTEPS       16
1027 1051
 
1028
-  //#define Y2_CURRENT      1000
1029
-  //#define Y2_MICROSTEPS     16
1052
+  #define Y2_CURRENT         800
1053
+  #define Y2_MICROSTEPS       16
1030 1054
 
1031
-  //#define Z2_CURRENT      1000
1032
-  //#define Z2_MICROSTEPS     16
1055
+  #define Z2_CURRENT         800
1056
+  #define Z2_MICROSTEPS       16
1033 1057
 
1034
-  //#define E0_CURRENT      1000
1035
-  //#define E0_MICROSTEPS     16
1058
+  #define E0_CURRENT         800
1059
+  #define E0_MICROSTEPS       16
1036 1060
 
1037
-  //#define E1_CURRENT      1000
1038
-  //#define E1_MICROSTEPS     16
1061
+  #define E1_CURRENT         800
1062
+  #define E1_MICROSTEPS       16
1039 1063
 
1040
-  //#define E2_CURRENT      1000
1041
-  //#define E2_MICROSTEPS     16
1064
+  #define E2_CURRENT         800
1065
+  #define E2_MICROSTEPS       16
1042 1066
 
1043
-  //#define E3_CURRENT      1000
1044
-  //#define E3_MICROSTEPS     16
1067
+  #define E3_CURRENT         800
1068
+  #define E3_MICROSTEPS       16
1045 1069
 
1046
-  //#define E4_CURRENT      1000
1047
-  //#define E4_MICROSTEPS     16
1070
+  #define E4_CURRENT         800
1071
+  #define E4_MICROSTEPS       16
1048 1072
 
1049 1073
   /**
1050 1074
    * Use Trinamic's ultra quiet stepping mode.
@@ -1053,24 +1077,22 @@
1053 1077
   #define STEALTHCHOP
1054 1078
 
1055 1079
   /**
1056
-   * Let Marlin automatically control stepper current.
1057
-   * This is still an experimental feature.
1058
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1059
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1060
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1080
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1081
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1082
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1083
+   * Other detected conditions can be used to stop the current print.
1061 1084
    * Relevant g-codes:
1062 1085
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1063
-   * M906 S1 - Start adjusting current
1064
-   * M906 S0 - Stop adjusting current
1065 1086
    * M911 - Report stepper driver overtemperature pre-warn condition.
1066 1087
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1088
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1067 1089
    */
1068
-  //#define AUTOMATIC_CURRENT_CONTROL
1090
+  //#define MONITOR_DRIVER_STATUS
1069 1091
 
1070
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1071
-    #define CURRENT_STEP          50  // [mA]
1072
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1092
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1093
+    #define CURRENT_STEP_DOWN     50  // [mA]
1073 1094
     #define REPORT_CURRENT_CHANGE
1095
+    #define STOP_ON_ERROR
1074 1096
   #endif
1075 1097
 
1076 1098
   /**
@@ -1085,8 +1107,8 @@
1085 1107
   #define X2_HYBRID_THRESHOLD    100
1086 1108
   #define Y_HYBRID_THRESHOLD     100
1087 1109
   #define Y2_HYBRID_THRESHOLD    100
1088
-  #define Z_HYBRID_THRESHOLD       4
1089
-  #define Z2_HYBRID_THRESHOLD      4
1110
+  #define Z_HYBRID_THRESHOLD       3
1111
+  #define Z2_HYBRID_THRESHOLD      3
1090 1112
   #define E0_HYBRID_THRESHOLD     30
1091 1113
   #define E1_HYBRID_THRESHOLD     30
1092 1114
   #define E2_HYBRID_THRESHOLD     30
@@ -1096,7 +1118,7 @@
1096 1118
   /**
1097 1119
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1098 1120
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1099
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1121
+   * X and Y homing will always be done in spreadCycle mode.
1100 1122
    *
1101 1123
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1102 1124
    * Higher values make the system LESS sensitive.
@@ -1105,27 +1127,34 @@
1105 1127
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1106 1128
    * M914 X/Y to live tune the setting
1107 1129
    */
1108
-  //#define SENSORLESS_HOMING
1130
+  //#define SENSORLESS_HOMING // TMC2130 only
1109 1131
 
1110 1132
   #if ENABLED(SENSORLESS_HOMING)
1111
-    #define X_HOMING_SENSITIVITY  19
1112
-    #define Y_HOMING_SENSITIVITY  19
1133
+    #define X_HOMING_SENSITIVITY  8
1134
+    #define Y_HOMING_SENSITIVITY  8
1113 1135
   #endif
1114 1136
 
1115 1137
   /**
1138
+   * Enable M122 debugging command for TMC stepper drivers.
1139
+   * M122 S0/1 will enable continous reporting.
1140
+   */
1141
+  //#define TMC_DEBUG
1142
+
1143
+  /**
1116 1144
    * You can set your own advanced settings by filling in predefined functions.
1117 1145
    * A list of available functions can be found on the library github page
1118 1146
    * https://github.com/teemuatlut/TMC2130Stepper
1147
+   * https://github.com/teemuatlut/TMC2208Stepper
1119 1148
    *
1120 1149
    * Example:
1121
-   * #define TMC2130_ADV() { \
1150
+   * #define TMC_ADV() { \
1122 1151
    *   stepperX.diag0_temp_prewarn(1); \
1123
-   *   stepperX.interpolate(0); \
1152
+   *   stepperY.interpolate(0); \
1124 1153
    * }
1125 1154
    */
1126
-  #define  TMC2130_ADV() {  }
1155
+  #define  TMC_ADV() {  }
1127 1156
 
1128
-#endif // HAVE_TMC2130
1157
+#endif // TMC2130 || TMC2208
1129 1158
 
1130 1159
 // @section L6470
1131 1160
 

+ 72
- 43
Marlin/src/config/examples/wt150/Configuration_adv.h Прегледај датотеку

@@ -977,7 +977,7 @@
977 977
 
978 978
 #endif
979 979
 
980
-// @section TMC2130
980
+// @section TMC2130, TMC2208
981 981
 
982 982
 /**
983 983
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
@@ -991,7 +991,19 @@
991 991
  */
992 992
 //#define HAVE_TMC2130
993 993
 
994
-#if ENABLED(HAVE_TMC2130)
994
+/**
995
+ * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
996
+ * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
997
+ * To use the reading capabilities, also connect #_SERIAL_RX_PIN
998
+ * to #_SERIAL_TX_PIN with a 1K resistor.
999
+ * The drivers can also be used with hardware serial.
1000
+ *
1001
+ * You'll also need the TMC2208Stepper Arduino library
1002
+ * (https://github.com/teemuatlut/TMC2208Stepper).
1003
+ */
1004
+//#define HAVE_TMC2208
1005
+
1006
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
995 1007
 
996 1008
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
997 1009
   //#define X_IS_TMC2130
@@ -1006,46 +1018,58 @@
1006 1018
   //#define E3_IS_TMC2130
1007 1019
   //#define E4_IS_TMC2130
1008 1020
 
1021
+  //#define X_IS_TMC2208
1022
+  //#define X2_IS_TMC2208
1023
+  //#define Y_IS_TMC2208
1024
+  //#define Y2_IS_TMC2208
1025
+  //#define Z_IS_TMC2208
1026
+  //#define Z2_IS_TMC2208
1027
+  //#define E0_IS_TMC2208
1028
+  //#define E1_IS_TMC2208
1029
+  //#define E2_IS_TMC2208
1030
+  //#define E3_IS_TMC2208
1031
+  //#define E4_IS_TMC2208
1032
+
1009 1033
   /**
1010 1034
    * Stepper driver settings
1011 1035
    */
1012 1036
 
1013 1037
   #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
1014 1038
   #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
1015
-  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
1039
+  #define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256
1016 1040
 
1017
-  #define X_CURRENT         1000  // rms current in mA. Multiply by 1.41 for peak current.
1041
+  #define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
1018 1042
   #define X_MICROSTEPS        16  // 0..256
1019 1043
 
1020
-  #define Y_CURRENT         1000
1044
+  #define Y_CURRENT          800
1021 1045
   #define Y_MICROSTEPS        16
1022 1046
 
1023
-  #define Z_CURRENT         1000
1047
+  #define Z_CURRENT          800
1024 1048
   #define Z_MICROSTEPS        16
1025 1049
 
1026
-  //#define X2_CURRENT      1000
1027
-  //#define X2_MICROSTEPS     16
1050
+  #define X2_CURRENT         800
1051
+  #define X2_MICROSTEPS       16
1028 1052
 
1029
-  //#define Y2_CURRENT      1000
1030
-  //#define Y2_MICROSTEPS     16
1053
+  #define Y2_CURRENT         800
1054
+  #define Y2_MICROSTEPS       16
1031 1055
 
1032
-  //#define Z2_CURRENT      1000
1033
-  //#define Z2_MICROSTEPS     16
1056
+  #define Z2_CURRENT         800
1057
+  #define Z2_MICROSTEPS       16
1034 1058
 
1035
-  //#define E0_CURRENT      1000
1036
-  //#define E0_MICROSTEPS     16
1059
+  #define E0_CURRENT         800
1060
+  #define E0_MICROSTEPS       16
1037 1061
 
1038
-  //#define E1_CURRENT      1000
1039
-  //#define E1_MICROSTEPS     16
1062
+  #define E1_CURRENT         800
1063
+  #define E1_MICROSTEPS       16
1040 1064
 
1041
-  //#define E2_CURRENT      1000
1042
-  //#define E2_MICROSTEPS     16
1065
+  #define E2_CURRENT         800
1066
+  #define E2_MICROSTEPS       16
1043 1067
 
1044
-  //#define E3_CURRENT      1000
1045
-  //#define E3_MICROSTEPS     16
1068
+  #define E3_CURRENT         800
1069
+  #define E3_MICROSTEPS       16
1046 1070
 
1047
-  //#define E4_CURRENT      1000
1048
-  //#define E4_MICROSTEPS     16
1071
+  #define E4_CURRENT         800
1072
+  #define E4_MICROSTEPS       16
1049 1073
 
1050 1074
   /**
1051 1075
    * Use Trinamic's ultra quiet stepping mode.
@@ -1054,24 +1078,22 @@
1054 1078
   #define STEALTHCHOP
1055 1079
 
1056 1080
   /**
1057
-   * Let Marlin automatically control stepper current.
1058
-   * This is still an experimental feature.
1059
-   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
1060
-   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
1061
-   * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX
1081
+   * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
1082
+   * like overtemperature and short to ground. TMC2208 requires hardware serial.
1083
+   * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
1084
+   * Other detected conditions can be used to stop the current print.
1062 1085
    * Relevant g-codes:
1063 1086
    * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
1064
-   * M906 S1 - Start adjusting current
1065
-   * M906 S0 - Stop adjusting current
1066 1087
    * M911 - Report stepper driver overtemperature pre-warn condition.
1067 1088
    * M912 - Clear stepper driver overtemperature pre-warn condition flag.
1089
+   * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
1068 1090
    */
1069
-  //#define AUTOMATIC_CURRENT_CONTROL
1091
+  //#define MONITOR_DRIVER_STATUS
1070 1092
 
1071
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
1072
-    #define CURRENT_STEP          50  // [mA]
1073
-    #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
1093
+  #if ENABLED(MONITOR_DRIVER_STATUS)
1094
+    #define CURRENT_STEP_DOWN     50  // [mA]
1074 1095
     #define REPORT_CURRENT_CHANGE
1096
+    #define STOP_ON_ERROR
1075 1097
   #endif
1076 1098
 
1077 1099
   /**
@@ -1086,8 +1108,8 @@
1086 1108
   #define X2_HYBRID_THRESHOLD    100
1087 1109
   #define Y_HYBRID_THRESHOLD     100
1088 1110
   #define Y2_HYBRID_THRESHOLD    100
1089
-  #define Z_HYBRID_THRESHOLD       4
1090
-  #define Z2_HYBRID_THRESHOLD      4
1111
+  #define Z_HYBRID_THRESHOLD       3
1112
+  #define Z2_HYBRID_THRESHOLD      3
1091 1113
   #define E0_HYBRID_THRESHOLD     30
1092 1114
   #define E1_HYBRID_THRESHOLD     30
1093 1115
   #define E2_HYBRID_THRESHOLD     30
@@ -1097,7 +1119,7 @@
1097 1119
   /**
1098 1120
    * Use stallGuard2 to sense an obstacle and trigger an endstop.
1099 1121
    * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
1100
-   * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal.
1122
+   * X and Y homing will always be done in spreadCycle mode.
1101 1123
    *
1102 1124
    * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
1103 1125
    * Higher values make the system LESS sensitive.
@@ -1106,27 +1128,34 @@
1106 1128
    * It is advised to set X/Y_HOME_BUMP_MM to 0.
1107 1129
    * M914 X/Y to live tune the setting
1108 1130
    */
1109
-  //#define SENSORLESS_HOMING
1131
+  //#define SENSORLESS_HOMING // TMC2130 only
1110 1132
 
1111 1133
   #if ENABLED(SENSORLESS_HOMING)
1112
-    #define X_HOMING_SENSITIVITY  19
1113
-    #define Y_HOMING_SENSITIVITY  19
1134
+    #define X_HOMING_SENSITIVITY  8
1135
+    #define Y_HOMING_SENSITIVITY  8
1114 1136
   #endif
1115 1137
 
1116 1138
   /**
1139
+   * Enable M122 debugging command for TMC stepper drivers.
1140
+   * M122 S0/1 will enable continous reporting.
1141
+   */
1142
+  //#define TMC_DEBUG
1143
+
1144
+  /**
1117 1145
    * You can set your own advanced settings by filling in predefined functions.
1118 1146
    * A list of available functions can be found on the library github page
1119 1147
    * https://github.com/teemuatlut/TMC2130Stepper
1148
+   * https://github.com/teemuatlut/TMC2208Stepper
1120 1149
    *
1121 1150
    * Example:
1122
-   * #define TMC2130_ADV() { \
1151
+   * #define TMC_ADV() { \
1123 1152
    *   stepperX.diag0_temp_prewarn(1); \
1124
-   *   stepperX.interpolate(0); \
1153
+   *   stepperY.interpolate(0); \
1125 1154
    * }
1126 1155
    */
1127
-  #define  TMC2130_ADV() {  }
1156
+  #define  TMC_ADV() {  }
1128 1157
 
1129
-#endif // HAVE_TMC2130
1158
+#endif // TMC2130 || TMC2208
1130 1159
 
1131 1160
 // @section L6470
1132 1161
 

+ 1
- 1
Marlin/src/core/serial.h Прегледај датотеку

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

+ 0
- 153
Marlin/src/feature/tmc2130.cpp Прегледај датотеку

@@ -1,153 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#include "../inc/MarlinConfig.h"
24
-
25
-#if ENABLED(HAVE_TMC2130)
26
-
27
-#include "tmc2130.h"
28
-#include "../Marlin.h"
29
-
30
-#include "../module/stepper_indirection.h"
31
-#include "../module/printcounter.h"
32
-#include "../libs/duration_t.h"
33
-
34
-#ifdef AUTOMATIC_CURRENT_CONTROL
35
-  bool auto_current_control = 0;
36
-#endif
37
-
38
-void automatic_current_control(TMC2130Stepper &st, String axisID) {
39
-  // Check otpw even if we don't use automatic control. Allows for flag inspection.
40
-  const bool is_otpw = st.checkOT();
41
-
42
-  // Report if a warning was triggered
43
-  static bool previous_otpw = false;
44
-  if (is_otpw && !previous_otpw) {
45
-    char timestamp[10];
46
-    duration_t elapsed = print_job_timer.duration();
47
-    const bool has_days = (elapsed.value > 60*60*24L);
48
-    (void)elapsed.toDigital(timestamp, has_days);
49
-    SERIAL_ECHO(timestamp);
50
-    SERIAL_ECHOPGM(": ");
51
-    SERIAL_ECHO(axisID);
52
-    SERIAL_ECHOLNPGM(" driver overtemperature warning!");
53
-  }
54
-  previous_otpw = is_otpw;
55
-
56
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL) && CURRENT_STEP > 0
57
-    // Return if user has not enabled current control start with M906 S1.
58
-    if (!auto_current_control) return;
59
-
60
-    /**
61
-     * Decrease current if is_otpw is true.
62
-     * Bail out if driver is disabled.
63
-     * Increase current if OTPW has not been triggered yet.
64
-     */
65
-    uint16_t current = st.getCurrent();
66
-    if (is_otpw) {
67
-      st.setCurrent(current - CURRENT_STEP, R_SENSE, HOLD_MULTIPLIER);
68
-      #if ENABLED(REPORT_CURRENT_CHANGE)
69
-        SERIAL_ECHO(axisID);
70
-        SERIAL_ECHOPAIR(" current decreased to ", st.getCurrent());
71
-      #endif
72
-    }
73
-
74
-    else if (!st.isEnabled())
75
-      return;
76
-
77
-    else if (!is_otpw && !st.getOTPW()) {
78
-      current += CURRENT_STEP;
79
-      if (current <= AUTO_ADJUST_MAX) {
80
-        st.setCurrent(current, R_SENSE, HOLD_MULTIPLIER);
81
-        #if ENABLED(REPORT_CURRENT_CHANGE)
82
-          SERIAL_ECHO(axisID);
83
-          SERIAL_ECHOPAIR(" current increased to ", st.getCurrent());
84
-        #endif
85
-      }
86
-    }
87
-    SERIAL_EOL();
88
-  #endif
89
-}
90
-
91
-void tmc2130_checkOverTemp(void) {
92
-  static millis_t next_cOT = 0;
93
-  if (ELAPSED(millis(), next_cOT)) {
94
-    next_cOT = millis() + 5000;
95
-    #if ENABLED(X_IS_TMC2130)
96
-      automatic_current_control(stepperX, "X");
97
-    #endif
98
-    #if ENABLED(Y_IS_TMC2130)
99
-      automatic_current_control(stepperY, "Y");
100
-    #endif
101
-    #if ENABLED(Z_IS_TMC2130)
102
-      automatic_current_control(stepperZ, "Z");
103
-    #endif
104
-    #if ENABLED(X2_IS_TMC2130)
105
-      automatic_current_control(stepperX2, "X2");
106
-    #endif
107
-    #if ENABLED(Y2_IS_TMC2130)
108
-      automatic_current_control(stepperY2, "Y2");
109
-    #endif
110
-    #if ENABLED(Z2_IS_TMC2130)
111
-      automatic_current_control(stepperZ2, "Z2");
112
-    #endif
113
-    #if ENABLED(E0_IS_TMC2130)
114
-      automatic_current_control(stepperE0, "E0");
115
-    #endif
116
-    #if ENABLED(E1_IS_TMC2130)
117
-      automatic_current_control(stepperE1, "E1");
118
-    #endif
119
-    #if ENABLED(E2_IS_TMC2130)
120
-      automatic_current_control(stepperE2, "E2");
121
-    #endif
122
-    #if ENABLED(E3_IS_TMC2130)
123
-      automatic_current_control(stepperE3, "E3");
124
-    #endif
125
-    #if ENABLED(E4_IS_TMC2130)
126
-      automatic_current_control(stepperE4, "E4");
127
-    #endif
128
-  }
129
-}
130
-
131
-/**
132
- * TMC2130 specific sensorless homing using stallGuard2.
133
- * stallGuard2 only works when in spreadCycle mode.
134
- * spreadCycle and stealthChop are mutually exclusive.
135
- */
136
-#if ENABLED(SENSORLESS_HOMING)
137
-  void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable/*=true*/) {
138
-    #if ENABLED(STEALTHCHOP)
139
-      if (enable) {
140
-        st.coolstep_min_speed(1024UL * 1024UL - 1UL);
141
-        st.stealthChop(0);
142
-      }
143
-      else {
144
-        st.coolstep_min_speed(0);
145
-        st.stealthChop(1);
146
-      }
147
-    #endif
148
-
149
-    st.diag1_stall(enable ? 1 : 0);
150
-  }
151
-#endif // SENSORLESS_HOMING
152
-
153
-#endif // HAVE_TMC2130

+ 0
- 38
Marlin/src/feature/tmc2130.h Прегледај датотеку

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

+ 39
- 0
Marlin/src/feature/tmc_macros.h Прегледај датотеку

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

+ 266
- 0
Marlin/src/feature/tmc_util.cpp Прегледај датотеку

@@ -0,0 +1,266 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../inc/MarlinConfig.h"
24
+
25
+#if HAS_TRINAMIC
26
+
27
+#include "tmc_util.h"
28
+#include "../Marlin.h"
29
+
30
+#include "../module/stepper_indirection.h"
31
+#include "../module/printcounter.h"
32
+#include "../libs/duration_t.h"
33
+#include "../gcode/gcode.h"
34
+
35
+template<typename TMC>
36
+void tmc_get_current(TMC &st, const char name[]) {
37
+  SERIAL_ECHO(name);
38
+  SERIAL_ECHOPGM(" axis driver current: ");
39
+  SERIAL_ECHOLN(st.getCurrent());
40
+}
41
+template<typename TMC>
42
+void tmc_set_current(TMC &st, const char name[], const int mA) {
43
+  st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
44
+  tmc_get_current(st, name);
45
+}
46
+
47
+template<typename TMC>
48
+void tmc_report_otpw(TMC &st, const char name[]) {
49
+  SERIAL_ECHO(name);
50
+  SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
51
+  serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
52
+  SERIAL_EOL();
53
+}
54
+template<typename TMC>
55
+void tmc_clear_otpw(TMC &st, const char name[]) {
56
+  st.clear_otpw();
57
+  SERIAL_ECHO(name);
58
+  SERIAL_ECHOLNPGM(" prewarn flag cleared");
59
+}
60
+
61
+template<typename TMC>
62
+void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) {
63
+  SERIAL_ECHO(name);
64
+  SERIAL_ECHOPGM(" stealthChop max speed set to ");
65
+  SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm));
66
+}
67
+template<typename TMC>
68
+void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) {
69
+  st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm));
70
+  tmc_get_pwmthrs(st, name, spmm);
71
+}
72
+
73
+template<typename TMC>
74
+void tmc_get_sgt(TMC &st, const char name[]) {
75
+  SERIAL_ECHO(name);
76
+  SERIAL_ECHOPGM(" driver homing sensitivity set to ");
77
+  MYSERIAL.println(st.sgt(), DEC);
78
+}
79
+template<typename TMC>
80
+void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) {
81
+  st.sgt(sgt_val);
82
+  tmc_get_sgt(st, name);
83
+}
84
+
85
+/*
86
+ * Check for over temperature or short to ground error flags.
87
+ * Report and log warning of overtemperature condition.
88
+ * Reduce driver current in a persistent otpw condition.
89
+ * Keep track of otpw counter so we don't reduce current on a single instance,
90
+ * and so we don't repeatedly report warning before the condition is cleared.
91
+ */
92
+#if ENABLED(MONITOR_DRIVER_STATUS)
93
+  struct TMC_driver_data {
94
+    uint32_t drv_status;
95
+    bool is_otpw;
96
+    bool is_ot;
97
+    bool is_error;
98
+  };
99
+  #if ENABLED(HAVE_TMC2130)
100
+    static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
101
+    static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response&0xF; }
102
+    static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
103
+      constexpr uint32_t OTPW_bm = 0x4000000UL;
104
+      constexpr uint8_t OTPW_bp = 26;
105
+      constexpr uint32_t OT_bm = 0x2000000UL;
106
+      constexpr uint8_t OT_bp = 25;
107
+      constexpr uint8_t DRIVER_ERROR_bm = 0x2UL;
108
+      constexpr uint8_t DRIVER_ERROR_bp = 1;
109
+      TMC_driver_data data;
110
+      data.drv_status = st.DRV_STATUS();
111
+      data.is_otpw = (data.drv_status & OTPW_bm)>>OTPW_bp;
112
+      data.is_ot = (data.drv_status & OT_bm)>>OT_bp;
113
+      data.is_error = (st.status_response & DRIVER_ERROR_bm)>>DRIVER_ERROR_bp;
114
+      return data;
115
+    }
116
+  #endif
117
+  #if ENABLED(HAVE_TMC2208)
118
+    static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
119
+    static uint8_t get_status_response(TMC2208Stepper &st) {
120
+      uint32_t drv_status = st.DRV_STATUS();
121
+      uint8_t gstat = st.GSTAT();
122
+      uint8_t response = 0;
123
+      response |= (drv_status >> (31-3)) & 0b1000;
124
+      response |= gstat & 0b11;
125
+      return response;
126
+    }
127
+    static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
128
+      constexpr uint32_t OTPW_bm = 0b1ul;
129
+      constexpr uint8_t OTPW_bp = 0;
130
+      constexpr uint32_t OT_bm = 0b10ul;
131
+      constexpr uint8_t OT_bp = 1;
132
+      TMC_driver_data data;
133
+      data.drv_status = st.DRV_STATUS();
134
+      data.is_otpw = (data.drv_status & OTPW_bm)>>OTPW_bp;
135
+      data.is_ot = (data.drv_status & OT_bm)>>OT_bp;
136
+      data.is_error = st.drv_err();
137
+      return data;
138
+    }
139
+  #endif
140
+
141
+  template<typename TMC>
142
+  uint8_t monitor_tmc_driver(TMC &st, const char axisID, uint8_t otpw_cnt) {
143
+    TMC_driver_data data = get_driver_data(st);
144
+
145
+    #if ENABLED(STOP_ON_ERROR)
146
+      if (data.is_error) {
147
+        SERIAL_EOL();
148
+        SERIAL_ECHO(axisID);
149
+        SERIAL_ECHO(" driver error detected:");
150
+        if (data.is_ot) SERIAL_ECHO("\novertemperature");
151
+        if (st.s2ga()) SERIAL_ECHO("\nshort to ground (coil A)");
152
+        if (st.s2gb()) SERIAL_ECHO("\nshort to ground (coil B)");
153
+        SERIAL_EOL();
154
+        #if ENABLED(TMC_DEBUG)
155
+          _M122();
156
+        #endif
157
+        kill(PSTR("Driver error"));
158
+      }
159
+    #endif
160
+
161
+    // Report if a warning was triggered
162
+    if (data.is_otpw && otpw_cnt==0) {
163
+      char timestamp[10];
164
+      duration_t elapsed = print_job_timer.duration();
165
+      const bool has_days = (elapsed.value > 60*60*24L);
166
+      (void)elapsed.toDigital(timestamp, has_days);
167
+      SERIAL_EOL();
168
+      SERIAL_ECHO(timestamp);
169
+      SERIAL_ECHOPGM(": ");
170
+      SERIAL_ECHO(axisID);
171
+      SERIAL_ECHOPGM(" driver overtemperature warning! (");
172
+      SERIAL_ECHO(st.getCurrent());
173
+      SERIAL_ECHOLN("mA)");
174
+    }
175
+    #if CURRENT_STEP_DOWN > 0
176
+      // Decrease current if is_otpw is true and driver is enabled and there's been more then 4 warnings
177
+      if (data.is_otpw && !st.isEnabled() && otpw_cnt > 4) {
178
+        st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER);
179
+        #if ENABLED(REPORT_CURRENT_CHANGE)
180
+          SERIAL_ECHO(axisID);
181
+          SERIAL_ECHOLNPAIR(" current decreased to ", st.getCurrent());
182
+        #endif
183
+      }
184
+    #endif
185
+
186
+    if (data.is_otpw) {
187
+      otpw_cnt++;
188
+      st.flag_otpw = true;
189
+    }
190
+    else if (otpw_cnt>0) otpw_cnt--;
191
+
192
+    if (report_tmc_status) {
193
+      const uint32_t pwm_scale = get_pwm_scale(st);
194
+      SERIAL_ECHO(axisID);
195
+      SERIAL_ECHOPAIR(":", pwm_scale);
196
+      SERIAL_ECHO(" |0b"); MYSERIAL.print(get_status_response(st), BIN);
197
+      SERIAL_ECHO("| ");
198
+      if (data.is_error) SERIAL_ECHO('E');
199
+      else if (data.is_ot) SERIAL_ECHO('O');
200
+      else if (data.is_otpw) SERIAL_ECHO('W');
201
+      else if (otpw_cnt>0) MYSERIAL.print(otpw_cnt, DEC);
202
+      else if (st.flag_otpw) SERIAL_ECHO('F');
203
+      SERIAL_ECHO("\t");
204
+    }
205
+
206
+    return otpw_cnt;
207
+  }
208
+
209
+  #define HAS_HW_COMMS(ST) ENABLED(ST##_IS_TMC2130)|| (ENABLED(ST##_IS_TMC2208) && defined(ST##_HARDWARE_SERIAL))
210
+
211
+  void monitor_tmc_driver() {
212
+    static millis_t next_cOT = 0;
213
+    if (ELAPSED(millis(), next_cOT)) {
214
+      next_cOT = millis() + 500;
215
+      #if HAS_HW_COMMS(X) || ENABLED(IS_TRAMS)
216
+        static uint8_t x_otpw_cnt = 0;
217
+        x_otpw_cnt = monitor_tmc_driver(stepperX, axis_codes[X_AXIS], x_otpw_cnt);
218
+      #endif
219
+      #if HAS_HW_COMMS(Y) || ENABLED(IS_TRAMS)
220
+        static uint8_t y_otpw_cnt = 0;
221
+        y_otpw_cnt = monitor_tmc_driver(stepperY, axis_codes[Y_AXIS], y_otpw_cnt);
222
+      #endif
223
+      #if HAS_HW_COMMS(Z) || ENABLED(IS_TRAMS)
224
+        static uint8_t z_otpw_cnt = 0;
225
+        z_otpw_cnt = monitor_tmc_driver(stepperZ, axis_codes[Z_AXIS], z_otpw_cnt);
226
+      #endif
227
+      #if HAS_HW_COMMS(X2)
228
+        static uint8_t x2_otpw_cnt = 0;
229
+        x2_otpw_cnt = monitor_tmc_driver(stepperX2, axis_codes[X_AXIS], x2_otpw_cnt);
230
+      #endif
231
+      #if HAS_HW_COMMS(Y2)
232
+        static uint8_t y2_otpw_cnt = 0;
233
+        y2_otpw_cnt = monitor_tmc_driver(stepperY2, axis_codes[Y_AXIS], y2_otpw_cnt);
234
+      #endif
235
+      #if HAS_HW_COMMS(Z2)
236
+        static uint8_t z2_otpw_cnt = 0;
237
+        z2_otpw_cnt = monitor_tmc_driver(stepperZ2, axis_codes[Z_AXIS], z2_otpw_cnt);
238
+      #endif
239
+      #if HAS_HW_COMMS(E0) || ENABLED(IS_TRAMS)
240
+        static uint8_t e0_otpw_cnt = 0;
241
+        e0_otpw_cnt = monitor_tmc_driver(stepperE0, axis_codes[E_AXIS], e0_otpw_cnt);
242
+      #endif
243
+      #if HAS_HW_COMMS(E1)
244
+        static uint8_t e1_otpw_cnt = 0;
245
+        e1_otpw_cnt = monitor_tmc_driver(stepperE1, axis_codes[E_AXIS], e1_otpw_cnt);
246
+      #endif
247
+      #if HAS_HW_COMMS(E2)
248
+        static uint8_t e2_otpw_cnt = 0;
249
+        e2_otpw_cnt = monitor_tmc_driver(stepperE2, axis_codes[E_AXIS], e2_otpw_cnt);
250
+      #endif
251
+      #if HAS_HW_COMMS(E3)
252
+        static uint8_t e3_otpw_cnt = 0;
253
+        e3_otpw_cnt = monitor_tmc_driver(stepperE3, axis_codes[E_AXIS], e3_otpw_cnt);
254
+      #endif
255
+      #if HAS_HW_COMMS(E4)
256
+        static uint8_t e4_otpw_cnt = 0;
257
+        e4_otpw_cnt = monitor_tmc_driver(stepperE4, axis_codes[E_AXIS], e4_otpw_cnt);
258
+      #endif
259
+
260
+      if (report_tmc_status) SERIAL_EOL();
261
+    }
262
+  }
263
+
264
+#endif // MONITOR_DRIVER_STATUS
265
+
266
+#endif // HAS_TRINAMIC

+ 82
- 0
Marlin/src/feature/tmc_util.h Прегледај датотеку

@@ -0,0 +1,82 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef _TMC_UTIL_H_
24
+#define _TMC_UTIL_H_
25
+
26
+#include <TMC2130Stepper.h>
27
+
28
+#include "../inc/MarlinConfig.h"
29
+
30
+static bool report_tmc_status = false;
31
+const char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1", "E2", "E3", "E4" };
32
+enum TMC_AxisEnum {
33
+  TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2,
34
+  TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4
35
+};
36
+
37
+template<typename TMC>
38
+void tmc_get_current(TMC &st, const char name[]);
39
+template<typename TMC>
40
+void tmc_set_current(TMC &st, const char name[], const int mA);
41
+template<typename TMC>
42
+void tmc_report_otpw(TMC &st, const char name[]);
43
+template<typename TMC>
44
+void tmc_clear_otpw(TMC &st, const char name[]);
45
+template<typename TMC>
46
+void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm);
47
+template<typename TMC>
48
+void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm);
49
+template<typename TMC>
50
+void tmc_get_sgt(TMC &st, const char name[]);
51
+template<typename TMC>
52
+void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val);
53
+
54
+void _M122();
55
+void monitor_tmc_driver();
56
+
57
+/**
58
+ * TMC2130 specific sensorless homing using stallGuard2.
59
+ * stallGuard2 only works when in spreadCycle mode.
60
+ * spreadCycle and stealthChop are mutually exclusive.
61
+ *
62
+ * Defined here because of limitations with templates and headers.
63
+ */
64
+#if ENABLED(SENSORLESS_HOMING)
65
+  template<typename TMC>
66
+  void tmc_sensorless_homing(TMC &st, bool enable=true) {
67
+    #if ENABLED(STEALTHCHOP)
68
+      if (enable) {
69
+        st.coolstep_min_speed(1024UL * 1024UL - 1UL);
70
+        st.stealthChop(0);
71
+      }
72
+      else {
73
+        st.coolstep_min_speed(0);
74
+        st.stealthChop(1);
75
+      }
76
+    #endif
77
+
78
+    st.diag1_stall(enable ? 1 : 0);
79
+  }
80
+#endif
81
+
82
+#endif // _TMC_UTIL_H_

+ 7
- 2
Marlin/src/gcode/control/M80_M81.cpp Прегледај датотеку

@@ -45,8 +45,8 @@
45 45
     #endif
46 46
   ;
47 47
 
48
-  #if ENABLED(HAVE_TMC2130)
49
-    #include "../../feature/tmc2130.h"
48
+  #if HAS_TRINAMIC
49
+    #include "../../feature/tmc_util.h"
50 50
   #endif
51 51
 
52 52
   /**
@@ -77,6 +77,11 @@
77 77
       tmc2130_init(); // Settings only stick when the driver has power
78 78
     #endif
79 79
 
80
+    #if ENABLED(HAVE_TMC2208)
81
+      delay(100);
82
+      tmc2208_init();
83
+    #endif
84
+
80 85
     powersupply_on = true;
81 86
 
82 87
     #if ENABLED(ULTIPANEL)

+ 342
- 0
Marlin/src/gcode/feature/trinamic/M122.cpp Прегледај датотеку

@@ -0,0 +1,342 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(TMC_DEBUG)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../feature/tmc_util.h"
29
+#include "../../../module/stepper_indirection.h"
30
+#include "../../../module/planner.h"
31
+
32
+enum TMC_debug_enum {
33
+  TMC_CODES,
34
+  TMC_ENABLED,
35
+  TMC_CURRENT,
36
+  TMC_RMS_CURRENT,
37
+  TMC_MAX_CURRENT,
38
+  TMC_IRUN,
39
+  TMC_IHOLD,
40
+  TMC_CS_ACTUAL,
41
+  TMC_PWM_SCALE,
42
+  TMC_VSENSE,
43
+  TMC_STEALTHCHOP,
44
+  TMC_MICROSTEPS,
45
+  TMC_TSTEP,
46
+  TMC_TPWMTHRS,
47
+  TMC_TPWMTHRS_MMS,
48
+  TMC_OTPW,
49
+  TMC_OTPW_TRIGGERED,
50
+  TMC_TOFF,
51
+  TMC_TBL,
52
+  TMC_HEND,
53
+  TMC_HSTRT,
54
+  TMC_SGT
55
+};
56
+enum TMC_drv_status_enum {
57
+  TMC_DRV_CODES,
58
+  TMC_STST,
59
+  TMC_OLB,
60
+  TMC_OLA,
61
+  TMC_S2GB,
62
+  TMC_S2GA,
63
+  TMC_DRV_OTPW,
64
+  TMC_OT,
65
+  TMC_STALLGUARD,
66
+  TMC_DRV_CS_ACTUAL,
67
+  TMC_FSACTIVE,
68
+  TMC_SG_RESULT,
69
+  TMC_DRV_STATUS_HEX,
70
+  TMC_T157,
71
+  TMC_T150,
72
+  TMC_T143,
73
+  TMC_T120,
74
+  TMC_STEALTH,
75
+  TMC_S2VSB,
76
+  TMC_S2VSA
77
+};
78
+static void drv_status_print_hex(const char name[], const uint32_t drv_status) {
79
+  SERIAL_ECHO(name);
80
+  SERIAL_ECHOPGM(" = 0x");
81
+  for(int B=24; B>=8; B-=8){
82
+    MYSERIAL.print((drv_status>>(B+4))&0xF, HEX);
83
+    MYSERIAL.print((drv_status>>B)&0xF, HEX);
84
+    MYSERIAL.print(':');
85
+  }
86
+  MYSERIAL.print((drv_status>>4)&0xF, HEX);
87
+  MYSERIAL.print((drv_status)&0xF, HEX);
88
+  SERIAL_EOL();
89
+}
90
+
91
+#if ENABLED(HAVE_TMC2130)
92
+  static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
93
+    switch(i) {
94
+      case TMC_PWM_SCALE: MYSERIAL.print(st.PWM_SCALE(), DEC); break;
95
+      case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break;
96
+      case TMC_SGT: MYSERIAL.print(st.sgt(), DEC); break;
97
+      case TMC_STEALTHCHOP: serialprintPGM(st.stealthChop() ? PSTR("true") : PSTR("false")); break;
98
+      default: break;
99
+    }
100
+  }
101
+  static void tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) {
102
+    switch(i) {
103
+      case TMC_STALLGUARD: if (st.stallguard()) SERIAL_ECHOPGM("X"); break;
104
+      case TMC_SG_RESULT:  MYSERIAL.print(st.sg_result(), DEC);      break;
105
+      case TMC_FSACTIVE:   if (st.fsactive())   SERIAL_ECHOPGM("X"); break;
106
+      default: break;
107
+    }
108
+  }
109
+#endif
110
+#if ENABLED(HAVE_TMC2208)
111
+  static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
112
+    switch(i) {
113
+      case TMC_TSTEP:
114
+        {
115
+          uint32_t data = 0;
116
+          st.TSTEP(&data);
117
+          MYSERIAL.print(data);
118
+          break;
119
+        }
120
+      case TMC_PWM_SCALE: MYSERIAL.print(st.pwm_scale_sum(), DEC); break;
121
+      case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
122
+      case TMC_S2VSA: if (st.s2vsa()) SERIAL_ECHOPGM("X"); break;
123
+      case TMC_S2VSB: if (st.s2vsb()) SERIAL_ECHOPGM("X"); break;
124
+      default: break;
125
+    }
126
+  }
127
+  static void tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) {
128
+    switch(i) {
129
+      case TMC_T157: if (st.t157()) SERIAL_ECHOPGM("X"); break;
130
+      case TMC_T150: if (st.t150()) SERIAL_ECHOPGM("X"); break;
131
+      case TMC_T143: if (st.t143()) SERIAL_ECHOPGM("X"); break;
132
+      case TMC_T120: if (st.t120()) SERIAL_ECHOPGM("X"); break;
133
+      default: break;
134
+    }
135
+  }
136
+#endif
137
+template <typename TMC>
138
+static void tmc_status(TMC &st, TMC_AxisEnum axis, const TMC_debug_enum i, const float spmm) {
139
+  SERIAL_ECHO('\t');
140
+  switch(i) {
141
+    case TMC_CODES: SERIAL_ECHO(extended_axis_codes[axis]); break;
142
+    case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
143
+    case TMC_CURRENT: SERIAL_ECHO(st.getCurrent()); break;
144
+    case TMC_RMS_CURRENT: MYSERIAL.print(st.rms_current()); break;
145
+    case TMC_MAX_CURRENT: MYSERIAL.print((float)st.rms_current()*1.41, 0); break;
146
+    case TMC_IRUN:
147
+      MYSERIAL.print(st.irun(), DEC);
148
+      SERIAL_ECHOPGM("/31");
149
+      break;
150
+    case TMC_IHOLD:
151
+      MYSERIAL.print(st.ihold(), DEC);
152
+      SERIAL_ECHOPGM("/31");
153
+      break;
154
+    case TMC_CS_ACTUAL:
155
+      MYSERIAL.print(st.cs_actual(), DEC);
156
+      SERIAL_ECHOPGM("/31");
157
+      break;
158
+
159
+    case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); break;
160
+
161
+    case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
162
+    case TMC_TPWMTHRS:
163
+      {
164
+        uint32_t tpwmthrs_val = st.TPWMTHRS();
165
+        SERIAL_ECHO(tpwmthrs_val);
166
+      }
167
+      break;
168
+    case TMC_TPWMTHRS_MMS:
169
+      {
170
+        uint32_t tpwmthrs_val = st.TPWMTHRS();
171
+        tpwmthrs_val ? SERIAL_ECHO(12650000UL * st.microsteps() / (256 * tpwmthrs_val * spmm)) : SERIAL_ECHO('-');
172
+      }
173
+      break;
174
+    case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
175
+    case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
176
+    case TMC_TOFF: MYSERIAL.print(st.toff(), DEC); break;
177
+    case TMC_TBL: MYSERIAL.print(st.blank_time(), DEC); break;
178
+    case TMC_HEND: MYSERIAL.print(st.hysterisis_end(), DEC); break;
179
+    case TMC_HSTRT: MYSERIAL.print(st.hysterisis_start(), DEC); break;
180
+    default: tmc_status(st, i); break;
181
+  }
182
+}
183
+template <typename TMC>
184
+static void tmc_parse_drv_status(TMC &st, TMC_AxisEnum axis, const TMC_drv_status_enum i) {
185
+  SERIAL_ECHOPGM("\t");
186
+  switch(i) {
187
+    case TMC_DRV_CODES:     SERIAL_ECHO(extended_axis_codes[axis]);  break;
188
+    case TMC_STST:          if (st.stst())         SERIAL_ECHOPGM("X"); break;
189
+    case TMC_OLB:           if (st.olb())          SERIAL_ECHOPGM("X"); break;
190
+    case TMC_OLA:           if (st.ola())          SERIAL_ECHOPGM("X"); break;
191
+    case TMC_S2GB:          if (st.s2gb())         SERIAL_ECHOPGM("X"); break;
192
+    case TMC_S2GA:          if (st.s2ga())         SERIAL_ECHOPGM("X"); break;
193
+    case TMC_DRV_OTPW:      if (st.otpw())         SERIAL_ECHOPGM("X"); break;
194
+    case TMC_OT:            if (st.ot())           SERIAL_ECHOPGM("X"); break;
195
+    case TMC_DRV_CS_ACTUAL: MYSERIAL.print(st.cs_actual(), DEC);        break;
196
+    case TMC_DRV_STATUS_HEX:drv_status_print_hex(extended_axis_codes[axis], st.DRV_STATUS()); break;
197
+    default: tmc_parse_drv_status(st, i); break;
198
+  }
199
+}
200
+
201
+static void tmc_debug_loop(const TMC_debug_enum i) {
202
+  #if X_IS_TRINAMIC
203
+    tmc_status(stepperX, TMC_X, i, planner.axis_steps_per_mm[X_AXIS]);
204
+  #endif
205
+  #if X2_IS_TRINAMIC
206
+    tmc_status(stepperX2, TMC_X2, i, planner.axis_steps_per_mm[X_AXIS]);
207
+  #endif
208
+
209
+  #if Y_IS_TRINAMIC
210
+    tmc_status(stepperY, TMC_Y, i, planner.axis_steps_per_mm[Y_AXIS]);
211
+  #endif
212
+  #if Y2_IS_TRINAMIC
213
+    tmc_status(stepperY2, TMC_Y2, i, planner.axis_steps_per_mm[Y_AXIS]);
214
+  #endif
215
+
216
+  #if Z_IS_TRINAMIC
217
+    tmc_status(stepperZ, TMC_Z, i, planner.axis_steps_per_mm[Z_AXIS]);
218
+  #endif
219
+  #if Z2_IS_TRINAMIC
220
+    tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]);
221
+  #endif
222
+
223
+  #if E0_IS_TRINAMIC
224
+    tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]);
225
+  #endif
226
+  #if E1_IS_TRINAMIC
227
+    tmc_status(stepperE1, TMC_E1, i, planner.axis_steps_per_mm[E_AXIS+1]);
228
+  #endif
229
+  #if E2_IS_TRINAMIC
230
+    tmc_status(stepperE2, TMC_E2, i, planner.axis_steps_per_mm[E_AXIS+2]);
231
+  #endif
232
+  #if E3_IS_TRINAMIC
233
+    tmc_status(stepperE3, TMC_E3, i, planner.axis_steps_per_mm[E_AXIS+3]);
234
+  #endif
235
+  #if E4_IS_TRINAMIC
236
+    tmc_status(stepperE4, TMC_E4, i, planner.axis_steps_per_mm[E_AXIS+4]);
237
+  #endif
238
+
239
+  SERIAL_EOL();
240
+}
241
+
242
+static void drv_status_loop(const TMC_drv_status_enum i) {
243
+  #if X_IS_TRINAMIC
244
+    tmc_parse_drv_status(stepperX, TMC_X, i);
245
+  #endif
246
+  #if X2_IS_TRINAMIC
247
+    tmc_parse_drv_status(stepperX2, TMC_X2, i);
248
+  #endif
249
+
250
+  #if Y_IS_TRINAMIC
251
+    tmc_parse_drv_status(stepperY, TMC_Y, i);
252
+  #endif
253
+  #if Y2_IS_TRINAMIC
254
+    tmc_parse_drv_status(stepperY2, TMC_Y2, i);
255
+  #endif
256
+
257
+  #if Z_IS_TRINAMIC
258
+    tmc_parse_drv_status(stepperZ, TMC_Z, i);
259
+  #endif
260
+  #if Z2_IS_TRINAMIC
261
+    tmc_parse_drv_status(stepperZ2, TMC_Z2, i);
262
+  #endif
263
+
264
+  #if E0_IS_TRINAMIC
265
+    tmc_parse_drv_status(stepperE0, TMC_E0, i);
266
+  #endif
267
+  #if E1_IS_TRINAMIC
268
+    tmc_parse_drv_status(stepperE1, TMC_E1, i);
269
+  #endif
270
+  #if E2_IS_TRINAMIC
271
+    tmc_parse_drv_status(stepperE2, TMC_E2, i);
272
+  #endif
273
+  #if E3_IS_TRINAMIC
274
+    tmc_parse_drv_status(stepperE3, TMC_E3, i);
275
+  #endif
276
+  #if E4_IS_TRINAMIC
277
+    tmc_parse_drv_status(stepperE4, TMC_E4, i);
278
+  #endif
279
+
280
+  SERIAL_EOL();
281
+}
282
+
283
+void _M122() {
284
+  if (parser.seen('S')) {
285
+    if (parser.value_bool()) {
286
+      SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|");
287
+      report_tmc_status = true;
288
+    } else
289
+      report_tmc_status = false;
290
+  } else {
291
+    SERIAL_ECHOPGM("\t");                 tmc_debug_loop(TMC_CODES);
292
+    SERIAL_ECHOPGM("Enabled\t");          tmc_debug_loop(TMC_ENABLED);
293
+    SERIAL_ECHOPGM("Set current");        tmc_debug_loop(TMC_CURRENT);
294
+    SERIAL_ECHOPGM("RMS current");        tmc_debug_loop(TMC_RMS_CURRENT);
295
+    SERIAL_ECHOPGM("MAX current");        tmc_debug_loop(TMC_MAX_CURRENT);
296
+    SERIAL_ECHOPGM("Run current");        tmc_debug_loop(TMC_IRUN);
297
+    SERIAL_ECHOPGM("Hold current");       tmc_debug_loop(TMC_IHOLD);
298
+    SERIAL_ECHOPGM("CS actual\t");        tmc_debug_loop(TMC_CS_ACTUAL);
299
+    SERIAL_ECHOPGM("PWM scale");          tmc_debug_loop(TMC_PWM_SCALE);
300
+    SERIAL_ECHOPGM("vsense\t");           tmc_debug_loop(TMC_VSENSE);
301
+    SERIAL_ECHOPGM("stealthChop");        tmc_debug_loop(TMC_STEALTHCHOP);
302
+    SERIAL_ECHOPGM("msteps\t");           tmc_debug_loop(TMC_MICROSTEPS);
303
+    SERIAL_ECHOPGM("tstep\t");            tmc_debug_loop(TMC_TSTEP);
304
+    SERIAL_ECHOPGM("pwm\nthreshold\t");   tmc_debug_loop(TMC_TPWMTHRS);
305
+    SERIAL_ECHOPGM("[mm/s]\t");           tmc_debug_loop(TMC_TPWMTHRS_MMS);
306
+    SERIAL_ECHOPGM("OT prewarn");         tmc_debug_loop(TMC_OTPW);
307
+    SERIAL_ECHOPGM("OT prewarn has\nbeen triggered"); tmc_debug_loop(TMC_OTPW_TRIGGERED);
308
+    SERIAL_ECHOPGM("off time\t");         tmc_debug_loop(TMC_TOFF);
309
+    SERIAL_ECHOPGM("blank time");         tmc_debug_loop(TMC_TBL);
310
+    SERIAL_ECHOPGM("hysterisis\n-end\t"); tmc_debug_loop(TMC_HEND);
311
+    SERIAL_ECHOPGM("-start\t");           tmc_debug_loop(TMC_HSTRT);
312
+    SERIAL_ECHOPGM("Stallguard thrs");    tmc_debug_loop(TMC_SGT);
313
+
314
+    SERIAL_ECHOPGM("DRVSTATUS");          drv_status_loop(TMC_DRV_CODES);
315
+    #if ENABLED(HAVE_TMC2130)
316
+      SERIAL_ECHOPGM("stallguard\t");     drv_status_loop(TMC_STALLGUARD);
317
+      SERIAL_ECHOPGM("sg_result\t");      drv_status_loop(TMC_SG_RESULT);
318
+      SERIAL_ECHOPGM("fsactive\t");       drv_status_loop(TMC_FSACTIVE);
319
+    #endif
320
+    SERIAL_ECHOPGM("stst\t");             drv_status_loop(TMC_STST);
321
+    SERIAL_ECHOPGM("olb\t");              drv_status_loop(TMC_OLB);
322
+    SERIAL_ECHOPGM("ola\t");              drv_status_loop(TMC_OLA);
323
+    SERIAL_ECHOPGM("s2gb\t");             drv_status_loop(TMC_S2GB);
324
+    SERIAL_ECHOPGM("s2ga\t");             drv_status_loop(TMC_S2GA);
325
+    SERIAL_ECHOPGM("otpw\t");             drv_status_loop(TMC_DRV_OTPW);
326
+    SERIAL_ECHOPGM("ot\t");               drv_status_loop(TMC_OT);
327
+    #if ENABLED(HAVE_TMC2208)
328
+      SERIAL_ECHOPGM("157C\t");           drv_status_loop(TMC_T157);
329
+      SERIAL_ECHOPGM("150C\t");           drv_status_loop(TMC_T150);
330
+      SERIAL_ECHOPGM("143C\t");           drv_status_loop(TMC_T143);
331
+      SERIAL_ECHOPGM("120C\t");           drv_status_loop(TMC_T120);
332
+      SERIAL_ECHOPGM("s2vsa\t");          drv_status_loop(TMC_S2VSA);
333
+      SERIAL_ECHOPGM("s2vsb\t");          drv_status_loop(TMC_S2VSB);
334
+    #endif
335
+    SERIAL_ECHOLNPGM("Driver registers:");drv_status_loop(TMC_DRV_STATUS_HEX);
336
+  }
337
+}
338
+
339
+// We need to call M122 from monitor_tmc_driver() as well but GcodeSuite::M122 is private.
340
+inline void GcodeSuite::M122() { _M122(); }
341
+
342
+#endif // TMC_DEBUG

+ 45
- 32
Marlin/src/gcode/feature/trinamic/M906.cpp Прегледај датотеку

@@ -22,54 +22,67 @@
22 22
 
23 23
 #include "../../../inc/MarlinConfig.h"
24 24
 
25
-#if ENABLED(HAVE_TMC2130)
25
+#if HAS_TRINAMIC
26 26
 
27 27
 #include "../../gcode.h"
28
-#include "../../../feature/tmc2130.h"
28
+#include "../../../feature/tmc_util.h"
29 29
 #include "../../../module/stepper_indirection.h"
30
-
31
-inline void tmc2130_get_current(TMC2130Stepper &st, const char name) {
32
-  SERIAL_CHAR(name);
33
-  SERIAL_ECHOPGM(" axis driver current: ");
34
-  SERIAL_ECHOLN(st.getCurrent());
35
-}
36
-inline void tmc2130_set_current(TMC2130Stepper &st, const char name, const int mA) {
37
-  st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
38
-  tmc2130_get_current(st, name);
39
-}
30
+#include "../../../module/planner.h"
40 31
 
41 32
 /**
42 33
  * M906: Set motor current in milliamps using axis codes X, Y, Z, E
43 34
  * Report driver currents when no axis specified
44
- *
45
- * S1: Enable automatic current control
46
- * S0: Disable
47 35
  */
48
-void GcodeSuite::M906() {
36
+inline void GcodeSuite::M906() {
49 37
   uint16_t values[XYZE];
50 38
   LOOP_XYZE(i)
51 39
     values[i] = parser.intval(axis_codes[i]);
52 40
 
53
-  #if ENABLED(X_IS_TMC2130)
54
-    if (values[X_AXIS]) tmc2130_set_current(stepperX, 'X', values[X_AXIS]);
55
-    else tmc2130_get_current(stepperX, 'X');
41
+  #if X_IS_TRINAMIC
42
+    if (values[X_AXIS]) tmc_set_current(stepperX, extended_axis_codes[TMC_X], values[X_AXIS]);
43
+    else tmc_get_current(stepperX, extended_axis_codes[TMC_X]);
56 44
   #endif
57
-  #if ENABLED(Y_IS_TMC2130)
58
-    if (values[Y_AXIS]) tmc2130_set_current(stepperY, 'Y', values[Y_AXIS]);
59
-    else tmc2130_get_current(stepperY, 'Y');
45
+  #if X2_IS_TRINAMIC
46
+    if (values[X_AXIS]) tmc_set_current(stepperX2, extended_axis_codes[TMC_X2], values[X_AXIS]);
47
+    else tmc_get_current(stepperX2, extended_axis_codes[TMC_X2]);
60 48
   #endif
61
-  #if ENABLED(Z_IS_TMC2130)
62
-    if (values[Z_AXIS]) tmc2130_set_current(stepperZ, 'Z', values[Z_AXIS]);
63
-    else tmc2130_get_current(stepperZ, 'Z');
49
+  #if Y_IS_TRINAMIC
50
+    if (values[Y_AXIS]) tmc_set_current(stepperY, extended_axis_codes[TMC_Y], values[Y_AXIS]);
51
+    else tmc_get_current(stepperY, extended_axis_codes[TMC_Y]);
64 52
   #endif
65
-  #if ENABLED(E0_IS_TMC2130)
66
-    if (values[E_AXIS]) tmc2130_set_current(stepperE0, 'E', values[E_AXIS]);
67
-    else tmc2130_get_current(stepperE0, 'E');
53
+  #if Y2_IS_TRINAMIC
54
+    if (values[Y_AXIS]) tmc_set_current(stepperY2, extended_axis_codes[TMC_Y2], values[Y_AXIS]);
55
+    else tmc_get_current(stepperY2, extended_axis_codes[TMC_Y2]);
68 56
   #endif
69
-
70
-  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
71
-    if (parser.seen('S')) auto_current_control = parser.value_bool();
57
+  #if Z_IS_TRINAMIC
58
+    if (values[Z_AXIS]) tmc_set_current(stepperZ, extended_axis_codes[TMC_Z], values[Z_AXIS]);
59
+    else tmc_get_current(stepperZ, extended_axis_codes[TMC_Z]);
60
+  #endif
61
+  #if Z2_IS_TRINAMIC
62
+    if (values[Z_AXIS]) tmc_set_current(stepperZ2, extended_axis_codes[TMC_Z2], values[Z_AXIS]);
63
+    else tmc_get_current(stepperZ2, extended_axis_codes[TMC_Z2]);
72 64
   #endif
65
+  #if E0_IS_TRINAMIC
66
+    if (values[E_AXIS]) tmc_set_current(stepperE0, extended_axis_codes[TMC_E0], values[E_AXIS]);
67
+    else tmc_get_current(stepperE0, extended_axis_codes[TMC_E0]);
68
+  #endif
69
+  #if E1_IS_TRINAMIC
70
+    if (values[E_AXIS]) tmc_set_current(stepperE1, extended_axis_codes[TMC_E1], values[E_AXIS]);
71
+    else tmc_get_current(stepperE1, extended_axis_codes[TMC_E1]);
72
+  #endif
73
+  #if E2_IS_TRINAMIC
74
+    if (values[E_AXIS]) tmc_set_current(stepperE2, extended_axis_codes[TMC_E2], values[E_AXIS]);
75
+    else tmc_get_current(stepperE2, extended_axis_codes[TMC_E2]);
76
+  #endif
77
+  #if E3_IS_TRINAMIC
78
+    if (values[E_AXIS]) tmc_set_current(stepperE3, extended_axis_codes[TMC_E3], values[E_AXIS]);
79
+    else tmc_get_current(stepperE3, extended_axis_codes[TMC_E3]);
80
+  #endif
81
+  #if E4_IS_TRINAMIC
82
+    if (values[E_AXIS]) tmc_set_current(stepperE4, extended_axis_codes[TMC_E4], values[E_AXIS]);
83
+    else tmc_get_current(stepperE4, extended_axis_codes[TMC_E4]);
84
+  #endif
85
+
73 86
 }
74 87
 
75
-#endif // HAVE_TMC2130
88
+#endif // HAS_TRINAMIC

+ 0
- 155
Marlin/src/gcode/feature/trinamic/M911-M914.cpp Прегледај датотеку

@@ -1,155 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-#include "../../../inc/MarlinConfig.h"
24
-
25
-#if ENABLED(HAVE_TMC2130)
26
-
27
-#include "../../gcode.h"
28
-#include "../../../feature/tmc2130.h"
29
-#include "../../../module/stepper_indirection.h"
30
-
31
-inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
32
-  SERIAL_CHAR(name);
33
-  SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
34
-  serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
35
-  SERIAL_EOL();
36
-}
37
-
38
-/**
39
- * M911: Report TMC2130 stepper driver overtemperature pre-warn flag
40
- * The flag is held by the library and persist until manually cleared by M912
41
- */
42
-void GcodeSuite::M911() {
43
-  const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
44
-           reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
45
-  #if ENABLED(X_IS_TMC2130)
46
-    if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
47
-  #endif
48
-  #if ENABLED(Y_IS_TMC2130)
49
-    if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
50
-  #endif
51
-  #if ENABLED(Z_IS_TMC2130)
52
-    if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
53
-  #endif
54
-  #if ENABLED(E0_IS_TMC2130)
55
-    if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
56
-  #endif
57
-}
58
-
59
-inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
60
-  st.clear_otpw();
61
-  SERIAL_CHAR(name);
62
-  SERIAL_ECHOLNPGM(" prewarn flag cleared");
63
-}
64
-
65
-/**
66
- * M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
67
- */
68
-void GcodeSuite::M912() {
69
-  const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
70
-           clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
71
-  #if ENABLED(X_IS_TMC2130)
72
-    if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
73
-  #endif
74
-  #if ENABLED(Y_IS_TMC2130)
75
-    if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
76
-  #endif
77
-  #if ENABLED(Z_IS_TMC2130)
78
-    if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
79
-  #endif
80
-  #if ENABLED(E0_IS_TMC2130)
81
-    if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
82
-  #endif
83
-}
84
-
85
-#if ENABLED(HYBRID_THRESHOLD)
86
-
87
-  #include "../../../module/planner.h"
88
-
89
-  inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
90
-    SERIAL_CHAR(name);
91
-    SERIAL_ECHOPGM(" stealthChop max speed set to ");
92
-    SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
93
-  }
94
-  inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
95
-    st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
96
-    tmc2130_get_pwmthrs(st, name, spmm);
97
-  }
98
-
99
-  /**
100
-   * M913: Set HYBRID_THRESHOLD speed.
101
-   */
102
-  void GcodeSuite::M913() {
103
-    uint16_t values[XYZE];
104
-    LOOP_XYZE(i)
105
-      values[i] = parser.intval(axis_codes[i]);
106
-
107
-    #if ENABLED(X_IS_TMC2130)
108
-      if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
109
-      else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
110
-    #endif
111
-    #if ENABLED(Y_IS_TMC2130)
112
-      if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
113
-      else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
114
-    #endif
115
-    #if ENABLED(Z_IS_TMC2130)
116
-      if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
117
-      else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
118
-    #endif
119
-    #if ENABLED(E0_IS_TMC2130)
120
-      if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
121
-      else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
122
-    #endif
123
-  }
124
-
125
-#endif // HYBRID_THRESHOLD
126
-
127
-#if ENABLED(SENSORLESS_HOMING)
128
-
129
-  inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
130
-    SERIAL_CHAR(name);
131
-    SERIAL_ECHOPGM(" driver homing sensitivity set to ");
132
-    SERIAL_ECHOLN(st.sgt());
133
-  }
134
-  inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
135
-    st.sgt(sgt_val);
136
-    tmc2130_get_sgt(st, name);
137
-  }
138
-
139
-  /**
140
-   * M914: Set SENSORLESS_HOMING sensitivity.
141
-   */
142
-  void GcodeSuite::M914() {
143
-    #if ENABLED(X_IS_TMC2130)
144
-      if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
145
-      else tmc2130_get_sgt(stepperX, 'X');
146
-    #endif
147
-    #if ENABLED(Y_IS_TMC2130)
148
-      if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
149
-      else tmc2130_get_sgt(stepperY, 'Y');
150
-    #endif
151
-  }
152
-
153
-#endif // SENSORLESS_HOMING
154
-
155
-#endif // HAVE_TMC2130

+ 195
- 0
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Прегледај датотеку

@@ -0,0 +1,195 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if HAS_TRINAMIC
26
+
27
+#include "../../gcode.h"
28
+#include "../../../feature/tmc_util.h"
29
+#include "../../../module/stepper_indirection.h"
30
+#include "../../../module/planner.h"
31
+
32
+/**
33
+ * M911: Report TMC stepper driver overtemperature pre-warn flag
34
+ * The flag is held by the library and persist until manually cleared by M912
35
+ */
36
+inline void GcodeSuite::M911() {
37
+  #if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
38
+    tmc_report_otpw(stepperX, extended_axis_codes[TMC_X]);
39
+  #endif
40
+  #if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS)
41
+    tmc_report_otpw(stepperY, extended_axis_codes[TMC_Y]);
42
+  #endif
43
+  #if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS)
44
+    tmc_report_otpw(stepperZ, extended_axis_codes[TMC_Z]);
45
+  #endif
46
+  #if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS)
47
+    tmc_report_otpw(stepperE0, extended_axis_codes[TMC_E0]);
48
+  #endif
49
+}
50
+
51
+/**
52
+ * M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library
53
+ */
54
+inline void GcodeSuite::M912() {
55
+  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]),
56
+           clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
57
+  #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
58
+    if (clearX || clearAll) tmc_clear_otpw(stepperX, extended_axis_codes[TMC_X]);
59
+  #endif
60
+  #if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
61
+    if (clearX || clearAll) tmc_clear_otpw(stepperX, extended_axis_codes[TMC_X]);
62
+  #endif
63
+
64
+  #if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX))
65
+    if (clearY || clearAll) tmc_clear_otpw(stepperY, extended_axis_codes[TMC_Y]);
66
+  #endif
67
+
68
+  #if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX))
69
+    if (clearZ || clearAll) tmc_clear_otpw(stepperZ, extended_axis_codes[TMC_Z]);
70
+  #endif
71
+
72
+  #if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX))
73
+    if (clearE || clearAll) tmc_clear_otpw(stepperE0, extended_axis_codes[TMC_E0]);
74
+  #endif
75
+}
76
+
77
+/**
78
+ * M913: Set HYBRID_THRESHOLD speed.
79
+ */
80
+#if ENABLED(HYBRID_THRESHOLD)
81
+  inline void GcodeSuite::M913() {
82
+    uint16_t values[XYZE];
83
+    LOOP_XYZE(i)
84
+      values[i] = parser.intval(axis_codes[i]);
85
+
86
+    #if X_IS_TRINAMIC
87
+      if (values[X_AXIS]) tmc_set_pwmthrs(stepperX, extended_axis_codes[TMC_X], values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
88
+      else tmc_get_pwmthrs(stepperX, extended_axis_codes[TMC_X], planner.axis_steps_per_mm[X_AXIS]);
89
+    #endif
90
+    #if X2_IS_TRINAMIC
91
+      if (values[X_AXIS]) tmc_set_pwmthrs(stepperX2, extended_axis_codes[TMC_X2], values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
92
+      else tmc_get_pwmthrs(stepperX, extended_axis_codes[TMC_X2], planner.axis_steps_per_mm[X_AXIS]);
93
+    #endif
94
+
95
+    #if Y_IS_TRINAMIC
96
+      if (values[Y_AXIS]) tmc_set_pwmthrs(stepperY, extended_axis_codes[TMC_Y], values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
97
+      else tmc_get_pwmthrs(stepperY, extended_axis_codes[TMC_Y], planner.axis_steps_per_mm[Y_AXIS]);
98
+    #endif
99
+    #if Y2_IS_TRINAMIC
100
+      if (values[Y_AXIS]) tmc_set_pwmthrs(stepperY2, extended_axis_codes[TMC_Y2], values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
101
+      else tmc_get_pwmthrs(stepperY, extended_axis_codes[TMC_Y2], planner.axis_steps_per_mm[Y_AXIS]);
102
+    #endif
103
+
104
+    #if Z_IS_TRINAMIC
105
+      if (values[Z_AXIS]) tmc_set_pwmthrs(stepperZ, extended_axis_codes[TMC_Z], values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
106
+      else tmc_get_pwmthrs(stepperZ, extended_axis_codes[TMC_Z], planner.axis_steps_per_mm[Z_AXIS]);
107
+    #endif
108
+    #if Z2_IS_TRINAMIC
109
+      if (values[Z_AXIS]) tmc_set_pwmthrs(stepperZ2, extended_axis_codes[TMC_Z2], values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
110
+      else tmc_get_pwmthrs(stepperZ, extended_axis_codes[TMC_Z2], planner.axis_steps_per_mm[Z_AXIS]);
111
+    #endif
112
+
113
+    #if E0_IS_TRINAMIC
114
+      if (values[E_AXIS]) tmc_set_pwmthrs(stepperE0, extended_axis_codes[TMC_E0], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
115
+      else tmc_get_pwmthrs(stepperE0, extended_axis_codes[TMC_E0], planner.axis_steps_per_mm[E_AXIS]);
116
+    #endif
117
+    #if E1_IS_TRINAMIC
118
+      if (values[E_AXIS]) tmc_set_pwmthrs(stepperE1, extended_axis_codes[TMC_E1], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
119
+      else tmc_get_pwmthrs(stepperE1, extended_axis_codes[TMC_E1], planner.axis_steps_per_mm[E_AXIS]);
120
+    #endif
121
+    #if E2_IS_TRINAMIC
122
+      if (values[E_AXIS]) tmc_set_pwmthrs(stepperE2, extended_axis_codes[TMC_E2], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
123
+      else tmc_get_pwmthrs(stepperE2, extended_axis_codes[TMC_E2], planner.axis_steps_per_mm[E_AXIS]);
124
+    #endif
125
+    #if E3_IS_TRINAMIC
126
+      if (values[E_AXIS]) tmc_set_pwmthrs(stepperE3, extended_axis_codes[TMC_E3], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
127
+      else tmc_get_pwmthrs(stepperE3, extended_axis_codes[TMC_E3], planner.axis_steps_per_mm[E_AXIS]);
128
+    #endif
129
+    #if E4_IS_TRINAMIC
130
+      if (values[E_AXIS]) tmc_set_pwmthrs(stepperE4, extended_axis_codes[TMC_E4], values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
131
+      else tmc_get_pwmthrs(stepperE4, extended_axis_codes[TMC_E4], planner.axis_steps_per_mm[E_AXIS]);
132
+    #endif
133
+  }
134
+#endif // HYBRID_THRESHOLD
135
+
136
+/**
137
+ * M914: Set SENSORLESS_HOMING sensitivity.
138
+ */
139
+#if ENABLED(SENSORLESS_HOMING)
140
+  inline void GcodeSuite::M914() {
141
+    #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
142
+      if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX, extended_axis_codes[TMC_X], parser.value_int());
143
+      else tmc_get_sgt(stepperX, extended_axis_codes[TMC_X]);
144
+    #endif
145
+    #if ENABLED(X2_IS_TMC2130)
146
+      if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX2, extended_axis_codes[TMC_X2], parser.value_int());
147
+      else tmc_get_sgt(stepperX2, extended_axis_codes[TMC_X2]);
148
+    #endif
149
+    #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
150
+      if (parser.seen(axis_codes[Y_AXIS])) tmc_set_sgt(stepperY, extended_axis_codes[TMC_Y], parser.value_int());
151
+      else tmc_get_sgt(stepperY, extended_axis_codes[TMC_Y]);
152
+    #endif
153
+    #if ENABLED(Y2_IS_TMC2130)
154
+      if (parser.seen(axis_codes[Y_AXIS])) tmc_set_sgt(stepperY2, extended_axis_codes[TMC_Y2], parser.value_int());
155
+      else tmc_get_sgt(stepperY2, extended_axis_codes[TMC_Y2]);
156
+    #endif
157
+  }
158
+#endif // SENSORLESS_HOMING
159
+
160
+/**
161
+ * TMC Z axis calibration routine
162
+ */
163
+#if ENABLED(TMC_Z_CALIBRATION) && (Z_IS_TRINAMIC || Z2_IS_TRINAMIC)
164
+  inline void GcodeSuite::M915() {
165
+    uint16_t _rms = parser.seenval('S') ? parser.value_int() : CALIBRATION_CURRENT;
166
+    uint16_t _z = parser.seenval('Z') ? parser.value_int() : CALIBRATION_EXTRA_HEIGHT;
167
+
168
+    if (!axis_known_position[Z_AXIS]) {
169
+      SERIAL_ECHOLNPGM("\nPlease home Z axis first");
170
+      return;
171
+    }
172
+
173
+    uint16_t Z_current_1 = stepperZ.getCurrent();
174
+    uint16_t Z2_current_1 = stepperZ.getCurrent();
175
+
176
+    stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
177
+    stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
178
+    SERIAL_ECHOPAIR("\nCalibration current: Z", _rms);
179
+
180
+    soft_endstops_enabled = false;
181
+
182
+    do_blocking_move_to_z(Z_MAX_POS+_z);
183
+
184
+    stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER);
185
+    stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
186
+
187
+    do_blocking_move_to_z(Z_MAX_POS);
188
+    soft_endstops_enabled = true;
189
+
190
+    SERIAL_ECHOLNPGM("\nHoming Z because we lost steps");
191
+    home_z_safely();
192
+  }
193
+#endif
194
+
195
+#endif // HAS_TRINAMIC

+ 2
- 1
Marlin/src/gcode/gcode.cpp Прегледај датотеку

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

+ 10
- 3
Marlin/src/gcode/gcode.h Прегледај датотеку

@@ -130,6 +130,7 @@
130 130
  * M119 - Report endstops status.
131 131
  * M120 - Enable endstops detection.
132 132
  * M121 - Disable endstops detection.
133
+ * M122 - Debug stepper (Requires HAVE_TMC2130 or HAVE_TMC2208)
133 134
  * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
134 135
  * M126 - Solenoid Air Valve Open. (Requires BARICUDA)
135 136
  * M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
@@ -218,8 +219,8 @@
218 219
  * M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
219 220
  * M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
220 221
  * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
221
- * M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130)
222
- * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130)
222
+ * M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130 or HAVE_TMC2208)
223
+ * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130 or HAVE_TMC2208)
223 224
  * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
224 225
  * M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING)
225 226
  *
@@ -727,7 +728,10 @@ private:
727 728
     static void M900();
728 729
   #endif
729 730
 
730
-  #if ENABLED(HAVE_TMC2130)
731
+  #if HAS_TRINAMIC
732
+    #if ENABLED(TMC_DEBUG)
733
+      static void M122();
734
+    #endif
731 735
     static void M906();
732 736
     static void M911();
733 737
     static void M912();
@@ -737,6 +741,9 @@ private:
737 741
     #if ENABLED(SENSORLESS_HOMING)
738 742
       static void M914();
739 743
     #endif
744
+    #if ENABLED(TMC_Z_CALIBRATION)
745
+      static void M915();
746
+    #endif
740 747
   #endif
741 748
 
742 749
   #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)

+ 1
- 0
Marlin/src/inc/MarlinConfigPre.h Прегледај датотеку

@@ -28,6 +28,7 @@
28 28
 #include "Version.h"
29 29
 #include "../../Configuration.h"
30 30
 #include "Conditionals_LCD.h"
31
+#include "../feature/tmc_macros.h"
31 32
 #include "../../Configuration_adv.h"
32 33
 #include "Conditionals_adv.h"
33 34
 

+ 25
- 2
Marlin/src/inc/SanityCheck.h Прегледај датотеку

@@ -1434,15 +1434,38 @@ static_assert(1 >= 0
1434 1434
       || ENABLED( E1_IS_TMC2130 ) \
1435 1435
       || ENABLED( E2_IS_TMC2130 ) \
1436 1436
       || ENABLED( E3_IS_TMC2130 ) \
1437
-      || ENABLED( E4_IS_TMC2130 ) \
1438
-  )
1437
+      || ENABLED( E4_IS_TMC2130 ) )
1439 1438
     #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
1440 1439
   #elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1441 1440
     #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
1441
+  #elif defined(AUTOMATIC_CURRENT_CONTROL)
1442
+    #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration."
1442 1443
   #endif
1443 1444
 #endif
1444 1445
 
1445 1446
 /**
1447
+ * Make sure HAVE_TMC2208 is warranted
1448
+ */
1449
+
1450
+#if ENABLED(HAVE_TMC2208) && !( \
1451
+       ENABLED(  X_IS_TMC2208 ) \
1452
+    || ENABLED( X2_IS_TMC2208 ) \
1453
+    || ENABLED(  Y_IS_TMC2208 ) \
1454
+    || ENABLED( Y2_IS_TMC2208 ) \
1455
+    || ENABLED(  Z_IS_TMC2208 ) \
1456
+    || ENABLED( Z2_IS_TMC2208 ) \
1457
+    || ENABLED( E0_IS_TMC2208 ) \
1458
+    || ENABLED( E1_IS_TMC2208 ) \
1459
+    || ENABLED( E2_IS_TMC2208 ) \
1460
+    || ENABLED( E3_IS_TMC2208 ) )
1461
+  #error "Choose at least one TMC2208 stepper."
1462
+#endif
1463
+
1464
+#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1465
+  #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
1466
+#endif
1467
+
1468
+/**
1446 1469
  * Make sure HAVE_L6470DRIVER is warranted
1447 1470
  */
1448 1471
 #if ENABLED(HAVE_L6470DRIVER) && !( \

+ 167
- 72
Marlin/src/module/configuration_store.cpp Прегледај датотеку

@@ -36,13 +36,13 @@
36 36
  *
37 37
  */
38 38
 
39
-#define EEPROM_VERSION "V46"
39
+#define EEPROM_VERSION "V47"
40 40
 
41 41
 // Change EEPROM version if these are changed:
42 42
 #define EEPROM_OFFSET 100
43 43
 
44 44
 /**
45
- * V46 EEPROM Layout:
45
+ * V47 EEPROM Layout:
46 46
  *
47 47
  *  100  Version                                    (char x4)
48 48
  *  104  EEPROM CRC16                               (uint16_t)
@@ -154,6 +154,10 @@
154 154
  *  578  M906 E3   Stepper E3 current               (uint16_t)
155 155
  *  580  M906 E4   Stepper E4 current               (uint16_t)
156 156
  *
157
+ * SENSORLESS HOMING                                4 bytes
158
+ *  580  M914 X    Stepper X and X2 threshold       (int16_t)
159
+ *  582  M914 Y    Stepper Y and Y2 threshold       (int16_t)
160
+ *
157 161
  * LIN_ADVANCE:                                     8 bytes
158 162
  *  582  M900 K    extruder_advance_k               (float)
159 163
  *  586  M900 WHD  advance_ed_ratio                 (float)
@@ -542,70 +546,70 @@ void MarlinSettings::postprocess() {
542 546
       EEPROM_WRITE(dummy);
543 547
     }
544 548
 
545
-    // Save TMC2130 Configuration, and placeholder values
549
+    // Save TMC2130 or TMC2208 Configuration, and placeholder values
546 550
     uint16_t val;
547
-    #if ENABLED(HAVE_TMC2130)
548
-      #if ENABLED(X_IS_TMC2130)
551
+    #if HAS_TRINAMIC
552
+      #if X_IS_TRINAMIC
549 553
         val = stepperX.getCurrent();
550 554
       #else
551 555
         val = 0;
552 556
       #endif
553 557
       EEPROM_WRITE(val);
554
-      #if ENABLED(Y_IS_TMC2130)
558
+      #if Y_IS_TRINAMIC
555 559
         val = stepperY.getCurrent();
556 560
       #else
557 561
         val = 0;
558 562
       #endif
559 563
       EEPROM_WRITE(val);
560
-      #if ENABLED(Z_IS_TMC2130)
564
+      #if Z_IS_TRINAMIC
561 565
         val = stepperZ.getCurrent();
562 566
       #else
563 567
         val = 0;
564 568
       #endif
565 569
       EEPROM_WRITE(val);
566
-      #if ENABLED(X2_IS_TMC2130)
570
+      #if X2_IS_TRINAMIC
567 571
         val = stepperX2.getCurrent();
568 572
       #else
569 573
         val = 0;
570 574
       #endif
571 575
       EEPROM_WRITE(val);
572
-      #if ENABLED(Y2_IS_TMC2130)
576
+      #if Y2_IS_TRINAMIC
573 577
         val = stepperY2.getCurrent();
574 578
       #else
575 579
         val = 0;
576 580
       #endif
577 581
       EEPROM_WRITE(val);
578
-      #if ENABLED(Z2_IS_TMC2130)
582
+      #if Z2_IS_TRINAMIC
579 583
         val = stepperZ2.getCurrent();
580 584
       #else
581 585
         val = 0;
582 586
       #endif
583 587
       EEPROM_WRITE(val);
584
-      #if ENABLED(E0_IS_TMC2130)
588
+      #if E0_IS_TRINAMIC
585 589
         val = stepperE0.getCurrent();
586 590
       #else
587 591
         val = 0;
588 592
       #endif
589 593
       EEPROM_WRITE(val);
590
-      #if ENABLED(E1_IS_TMC2130)
594
+      #if E1_IS_TRINAMIC
591 595
         val = stepperE1.getCurrent();
592 596
       #else
593 597
         val = 0;
594 598
       #endif
595 599
       EEPROM_WRITE(val);
596
-      #if ENABLED(E2_IS_TMC2130)
600
+      #if E2_IS_TRINAMIC
597 601
         val = stepperE2.getCurrent();
598 602
       #else
599 603
         val = 0;
600 604
       #endif
601 605
       EEPROM_WRITE(val);
602
-      #if ENABLED(E3_IS_TMC2130)
606
+      #if E3_IS_TRINAMIC
603 607
         val = stepperE3.getCurrent();
604 608
       #else
605 609
         val = 0;
606 610
       #endif
607 611
       EEPROM_WRITE(val);
608
-      #if ENABLED(E4_IS_TMC2130)
612
+      #if E4_IS_TRINAMIC
609 613
         val = stepperE4.getCurrent();
610 614
       #else
611 615
         val = 0;
@@ -617,6 +621,28 @@ void MarlinSettings::postprocess() {
617 621
     #endif
618 622
 
619 623
     //
624
+    // TMC2130 Sensorless homing threshold
625
+    //
626
+    int16_t thrs;
627
+    #if ENABLED(SENSORLESS_HOMING)
628
+      #if ENABLED(X_IS_TMC2130)
629
+        thrs = stepperX.sgt();
630
+      #else
631
+        thrs = 0;
632
+      #endif
633
+      EEPROM_WRITE(thrs);
634
+      #if ENABLED(Y_IS_TMC2130)
635
+        thrs = stepperY.sgt();
636
+      #else
637
+        thrs = 0;
638
+      #endif
639
+      EEPROM_WRITE(thrs);
640
+    #else
641
+      thrs = 0;
642
+      for (uint8_t q = 2; q--;) EEPROM_WRITE(thrs);
643
+    #endif
644
+
645
+    //
620 646
     // Linear Advance
621 647
     //
622 648
 
@@ -1014,55 +1040,80 @@ void MarlinSettings::postprocess() {
1014 1040
       //
1015 1041
 
1016 1042
       uint16_t val;
1017
-      #if ENABLED(HAVE_TMC2130)
1043
+      #if HAS_TRINAMIC
1018 1044
         EEPROM_READ(val);
1019
-        #if ENABLED(X_IS_TMC2130)
1045
+        #if X_IS_TRINAMIC
1020 1046
           stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1021 1047
         #endif
1022 1048
         EEPROM_READ(val);
1023
-        #if ENABLED(Y_IS_TMC2130)
1049
+        #if Y_IS_TRINAMIC
1024 1050
           stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1025 1051
         #endif
1026 1052
         EEPROM_READ(val);
1027
-        #if ENABLED(Z_IS_TMC2130)
1053
+        #if Z_IS_TRINAMIC
1028 1054
           stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1029 1055
         #endif
1030 1056
         EEPROM_READ(val);
1031
-        #if ENABLED(X2_IS_TMC2130)
1057
+        #if X2_IS_TRINAMIC
1032 1058
           stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1033 1059
         #endif
1034 1060
         EEPROM_READ(val);
1035
-        #if ENABLED(Y2_IS_TMC2130)
1061
+        #if Y2_IS_TRINAMIC
1036 1062
           stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1037 1063
         #endif
1038 1064
         EEPROM_READ(val);
1039
-        #if ENABLED(Z2_IS_TMC2130)
1065
+        #if Z2_IS_TRINAMIC
1040 1066
           stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1041 1067
         #endif
1042 1068
         EEPROM_READ(val);
1043
-        #if ENABLED(E0_IS_TMC2130)
1069
+        #if E0_IS_TRINAMIC
1044 1070
           stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1045 1071
         #endif
1046 1072
         EEPROM_READ(val);
1047
-        #if ENABLED(E1_IS_TMC2130)
1073
+        #if E1_IS_TRINAMIC
1048 1074
           stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1049 1075
         #endif
1050 1076
         EEPROM_READ(val);
1051
-        #if ENABLED(E2_IS_TMC2130)
1077
+        #if E2_IS_TRINAMIC
1052 1078
           stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1053 1079
         #endif
1054 1080
         EEPROM_READ(val);
1055
-        #if ENABLED(E3_IS_TMC2130)
1081
+        #if E3_IS_TRINAMIC
1056 1082
           stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1057 1083
         #endif
1058 1084
         EEPROM_READ(val);
1059
-        #if ENABLED(E4_IS_TMC2130)
1085
+        #if E4_IS_TRINAMIC
1060 1086
           stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1061 1087
         #endif
1062 1088
       #else
1063 1089
         for (uint8_t q = 11; q--;) EEPROM_READ(val);
1064 1090
       #endif
1065 1091
 
1092
+      /*
1093
+       * TMC2130 Sensorless homing threshold.
1094
+       * X and X2 use the same value
1095
+       * Y and Y2 use the same value
1096
+       */
1097
+      int16_t thrs;
1098
+      #if ENABLED(SENSORLESS_HOMING)
1099
+        EEPROM_READ(thrs);
1100
+        #if ENABLED(X_IS_TMC2130)
1101
+          stepperX.sgt(thrs);
1102
+        #endif
1103
+        #if ENABLED(X2_IS_TMC2130)
1104
+          stepperX2.sgt(thrs);
1105
+        #endif
1106
+        EEPROM_READ(thrs);
1107
+        #if ENABLED(Y_IS_TMC2130)
1108
+          stepperY.sgt(thrs);
1109
+        #endif
1110
+        #if ENABLED(Y2_IS_TMC2130)
1111
+          stepperY2.sgt(thrs);
1112
+        #endif
1113
+      #else
1114
+        for (uint8_t q = 0; q < 2; q++) EEPROM_READ(thrs);
1115
+      #endif
1116
+
1066 1117
       //
1067 1118
       // Linear Advance
1068 1119
       //
@@ -1451,36 +1502,52 @@ void MarlinSettings::reset() {
1451 1502
     #endif
1452 1503
   );
1453 1504
 
1454
-  #if ENABLED(HAVE_TMC2130)
1505
+  #if X_IS_TRINAMIC
1506
+    stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1507
+  #endif
1508
+  #if Y_IS_TRINAMIC
1509
+    stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1510
+  #endif
1511
+  #if Z_IS_TRINAMIC
1512
+    stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1513
+  #endif
1514
+  #if X2_IS_TRINAMIC
1515
+    stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1516
+  #endif
1517
+  #if Y2_IS_TRINAMIC
1518
+    stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1519
+  #endif
1520
+  #if Z2_IS_TRINAMIC
1521
+    stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1522
+  #endif
1523
+  #if E0_IS_TRINAMIC
1524
+    stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1525
+  #endif
1526
+  #if E1_IS_TRINAMIC
1527
+    stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1528
+  #endif
1529
+  #if E2_IS_TRINAMIC
1530
+    stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1531
+  #endif
1532
+  #if E3_IS_TRINAMIC
1533
+    stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1534
+  #endif
1535
+  #if E4_IS_TRINAMIC
1536
+    stepperE4.setCurrent(E4_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1537
+  #endif
1538
+
1539
+  #if ENABLED(SENSORLESS_HOMING)
1455 1540
     #if ENABLED(X_IS_TMC2130)
1456
-      stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1457
-    #endif
1458
-    #if ENABLED(Y_IS_TMC2130)
1459
-      stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1460
-    #endif
1461
-    #if ENABLED(Z_IS_TMC2130)
1462
-      stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1541
+      stepperX.sgt(X_HOMING_SENSITIVITY);
1463 1542
     #endif
1464 1543
     #if ENABLED(X2_IS_TMC2130)
1465
-      stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1544
+      stepperX2.sgt(X_HOMING_SENSITIVITY);
1466 1545
     #endif
1467
-    #if ENABLED(Y2_IS_TMC2130)
1468
-      stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1469
-    #endif
1470
-    #if ENABLED(Z2_IS_TMC2130)
1471
-      stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1472
-    #endif
1473
-    #if ENABLED(E0_IS_TMC2130)
1474
-      stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1475
-    #endif
1476
-    #if ENABLED(E1_IS_TMC2130)
1477
-      stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1478
-    #endif
1479
-    #if ENABLED(E2_IS_TMC2130)
1480
-      stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1546
+    #if ENABLED(Y_IS_TMC2130)
1547
+      stepperY.sgt(Y_HOMING_SENSITIVITY);
1481 1548
     #endif
1482
-    #if ENABLED(E3_IS_TMC2130)
1483
-      stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1549
+    #if ENABLED(Y2_IS_TMC2130)
1550
+      stepperY2.sgt(Y_HOMING_SENSITIVITY);
1484 1551
     #endif
1485 1552
   #endif
1486 1553
 
@@ -1959,35 +2026,63 @@ void MarlinSettings::reset() {
1959 2026
       }
1960 2027
       CONFIG_ECHO_START;
1961 2028
       SERIAL_ECHO("  M906");
1962
-      #if ENABLED(X_IS_TMC2130)
1963
-        SERIAL_ECHOPAIR(" X", stepperX.getCurrent());
2029
+      #if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208)
2030
+        SERIAL_ECHOPAIR(" X ", stepperX.getCurrent());
1964 2031
       #endif
1965
-      #if ENABLED(Y_IS_TMC2130)
1966
-        SERIAL_ECHOPAIR(" Y", stepperY.getCurrent());
2032
+      #if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208)
2033
+        SERIAL_ECHOPAIR(" Y ", stepperY.getCurrent());
1967 2034
       #endif
1968
-      #if ENABLED(Z_IS_TMC2130)
1969
-        SERIAL_ECHOPAIR(" Z", stepperZ.getCurrent());
2035
+      #if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208)
2036
+        SERIAL_ECHOPAIR(" Z ", stepperZ.getCurrent());
1970 2037
       #endif
1971
-      #if ENABLED(X2_IS_TMC2130)
1972
-        SERIAL_ECHOPAIR(" X2", stepperX2.getCurrent());
2038
+      #if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208)
2039
+        SERIAL_ECHOPAIR(" X2 ", stepperX2.getCurrent());
1973 2040
       #endif
1974
-      #if ENABLED(Y2_IS_TMC2130)
1975
-        SERIAL_ECHOPAIR(" Y2", stepperY2.getCurrent());
2041
+      #if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208)
2042
+        SERIAL_ECHOPAIR(" Y2 ", stepperY2.getCurrent());
1976 2043
       #endif
1977
-      #if ENABLED(Z2_IS_TMC2130)
1978
-        SERIAL_ECHOPAIR(" Z2", stepperZ2.getCurrent());
2044
+      #if ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208)
2045
+        SERIAL_ECHOPAIR(" Z2 ", stepperZ2.getCurrent());
1979 2046
       #endif
1980
-      #if ENABLED(E0_IS_TMC2130)
1981
-        SERIAL_ECHOPAIR(" E0", stepperE0.getCurrent());
2047
+      #if ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208)
2048
+        SERIAL_ECHOPAIR(" E0 ", stepperE0.getCurrent());
1982 2049
       #endif
1983
-      #if ENABLED(E1_IS_TMC2130)
1984
-        SERIAL_ECHOPAIR(" E1", stepperE1.getCurrent());
2050
+      #if ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208)
2051
+        SERIAL_ECHOPAIR(" E1 ", stepperE1.getCurrent());
1985 2052
       #endif
1986
-      #if ENABLED(E2_IS_TMC2130)
1987
-        SERIAL_ECHOPAIR(" E2", stepperE2.getCurrent());
2053
+      #if ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208)
2054
+        SERIAL_ECHOPAIR(" E2 ", stepperE2.getCurrent());
1988 2055
       #endif
1989
-      #if ENABLED(E3_IS_TMC2130)
1990
-        SERIAL_ECHOPAIR(" E3", stepperE3.getCurrent());
2056
+      #if ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208)
2057
+        SERIAL_ECHOPAIR(" E3 ", stepperE3.getCurrent());
2058
+      #endif
2059
+      #if ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208)
2060
+        SERIAL_ECHOPAIR(" E4 ", stepperE4.getCurrent());
2061
+      #endif
2062
+      SERIAL_EOL();
2063
+    #endif
2064
+
2065
+    /**
2066
+     * TMC2130 Sensorless homing thresholds
2067
+     */
2068
+    #if ENABLED(HAVE_TMC2130) && ENABLED(SENSORLESS_HOMING)
2069
+      if (!forReplay) {
2070
+        CONFIG_ECHO_START;
2071
+        SERIAL_ECHOLNPGM("Sensorless homing threshold:");
2072
+      }
2073
+      CONFIG_ECHO_START;
2074
+      SERIAL_ECHO("  M914");
2075
+      #if ENABLED(X_IS_TMC2130)
2076
+        SERIAL_ECHOPAIR(" X", stepperX.sgt());
2077
+      #endif
2078
+      #if ENABLED(X2_IS_TMC2130)
2079
+        SERIAL_ECHOPAIR(" X2 ", stepperX2.sgt());
2080
+      #endif
2081
+      #if ENABLED(Y_IS_TMC2130)
2082
+        SERIAL_ECHOPAIR(" Y", stepperY.sgt());
2083
+      #endif
2084
+      #if ENABLED(X2_IS_TMC2130)
2085
+        SERIAL_ECHOPAIR(" Y2 ", stepperY2.sgt());
1991 2086
       #endif
1992 2087
       SERIAL_EOL();
1993 2088
     #endif

+ 5
- 5
Marlin/src/module/motion.cpp Прегледај датотеку

@@ -52,7 +52,7 @@
52 52
 #endif
53 53
 
54 54
 #if ENABLED(SENSORLESS_HOMING)
55
-  #include "../feature/tmc2130.h"
55
+  #include "../feature/tmc_util.h"
56 56
 #endif
57 57
 
58 58
 #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) {
1172 1172
   // Disable stealthChop if used. Enable diag1 pin on driver.
1173 1173
   #if ENABLED(SENSORLESS_HOMING)
1174 1174
     #if ENABLED(X_IS_TMC2130)
1175
-      if (axis == X_AXIS) tmc2130_sensorless_homing(stepperX);
1175
+      if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
1176 1176
     #endif
1177 1177
     #if ENABLED(Y_IS_TMC2130)
1178
-      if (axis == Y_AXIS) tmc2130_sensorless_homing(stepperY);
1178
+      if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
1179 1179
     #endif
1180 1180
   #endif
1181 1181
 
@@ -1282,10 +1282,10 @@ void homeaxis(const AxisEnum axis) {
1282 1282
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
1283 1283
   #if ENABLED(SENSORLESS_HOMING)
1284 1284
     #if ENABLED(X_IS_TMC2130)
1285
-      if (axis == X_AXIS) tmc2130_sensorless_homing(stepperX, false);
1285
+      if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
1286 1286
     #endif
1287 1287
     #if ENABLED(Y_IS_TMC2130)
1288
-      if (axis == Y_AXIS) tmc2130_sensorless_homing(stepperY, false);
1288
+      if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
1289 1289
     #endif
1290 1290
   #endif
1291 1291
 

+ 10
- 0
Marlin/src/module/stepper.cpp Прегледај датотеку

@@ -954,6 +954,16 @@ void Stepper::init() {
954 954
     tmc2130_init();
955 955
   #endif
956 956
 
957
+  // Init TMC2208 Steppers
958
+  #if ENABLED(HAVE_TMC2208)
959
+    tmc2208_init();
960
+  #endif
961
+
962
+  // TRAMS, TMC2130 and TMC2208 advanced settings
963
+  #if HAS_TRINAMIC
964
+    TMC_ADV()
965
+  #endif
966
+
957 967
   // Init L6470 Steppers
958 968
   #if ENABLED(HAVE_L6470DRIVER)
959 969
     L6470_init();

+ 226
- 25
Marlin/src/module/stepper_indirection.cpp Прегледај датотеку

@@ -129,6 +129,7 @@
129 129
 
130 130
   #include <SPI.h>
131 131
   #include <TMC2130Stepper.h>
132
+  #include "planner.h"
132 133
   #include "../core/enum.h"
133 134
 
134 135
   #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)
@@ -171,17 +172,17 @@
171 172
   // Use internal reference voltage for current calculations. This is the default.
172 173
   // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
173 174
   // https://www.trinamic.com/products/integrated-circuits/details/tmc2130/
174
-  void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float &spmm) {
175
+  void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
175 176
     st.begin();
176 177
     st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
177 178
     st.microsteps(microsteps);
178
-    st.blank_time(36);
179
+    st.blank_time(24);
179 180
     st.off_time(5); // Only enables the driver if used with stealthChop
180 181
     st.interpolate(INTERPOLATE);
181 182
     st.power_down_delay(128); // ~2s until driver lowers to hold current
182
-    st.hysterisis_start(0); // HSTRT = 1
183
-    st.hysterisis_low(1); // HEND = -2
184
-    st.diag1_active_high(0); // For sensorless homing
183
+    st.hysterisis_start(3);
184
+    st.hysterisis_end(2);
185
+    st.diag1_active_high(1); // For sensorless homing
185 186
     #if ENABLED(STEALTHCHOP)
186 187
       st.stealth_freq(1); // f_pwm = 2/683 f_clk
187 188
       st.stealth_autoscale(1);
@@ -189,61 +190,261 @@
189 190
       st.stealth_amplitude(255);
190 191
       st.stealthChop(1);
191 192
       #if ENABLED(HYBRID_THRESHOLD)
192
-        st.stealth_max_speed(12650000UL*st.microsteps()/(256*thrs*spmm));
193
+        st.stealth_max_speed(12650000UL*microsteps/(256*thrs*spmm));
194
+      #else
195
+        UNUSED(thrs);
196
+        UNUSED(spmm);
193 197
       #endif
194 198
     #elif ENABLED(SENSORLESS_HOMING)
195 199
       st.coolstep_min_speed(1024UL * 1024UL - 1UL);
196 200
     #endif
201
+    st.GSTAT(); // Clear GSTAT
197 202
   }
198 203
 
199 204
   #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
200 205
 
201 206
   void tmc2130_init() {
202
-    constexpr float steps_per_mm[] = DEFAULT_AXIS_STEPS_PER_UNIT;
203 207
     #if ENABLED(X_IS_TMC2130)
204
-      _TMC2130_INIT( X, steps_per_mm[X_AXIS]);
205
-      #if ENABLED(SENSORLESS_HOMING)
206
-        stepperX.sg_stall_value(X_HOMING_SENSITIVITY);
207
-      #endif
208
+      _TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]);
208 209
     #endif
209 210
     #if ENABLED(X2_IS_TMC2130)
210
-      _TMC2130_INIT(X2, steps_per_mm[X_AXIS]);
211
+      _TMC2130_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
211 212
     #endif
212 213
     #if ENABLED(Y_IS_TMC2130)
213
-      _TMC2130_INIT( Y, steps_per_mm[Y_AXIS]);
214
-      #if ENABLED(SENSORLESS_HOMING)
215
-        stepperY.sg_stall_value(Y_HOMING_SENSITIVITY);
216
-      #endif
214
+      _TMC2130_INIT( Y, planner.axis_steps_per_mm[Y_AXIS]);
217 215
     #endif
218 216
     #if ENABLED(Y2_IS_TMC2130)
219
-      _TMC2130_INIT(Y2, steps_per_mm[Y_AXIS]);
217
+      _TMC2130_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
220 218
     #endif
221 219
     #if ENABLED(Z_IS_TMC2130)
222
-      _TMC2130_INIT( Z, steps_per_mm[Z_AXIS]);
220
+      _TMC2130_INIT( Z, planner.axis_steps_per_mm[Z_AXIS]);
223 221
     #endif
224 222
     #if ENABLED(Z2_IS_TMC2130)
225
-      _TMC2130_INIT(Z2, steps_per_mm[Z_AXIS]);
223
+      _TMC2130_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
226 224
     #endif
227 225
     #if ENABLED(E0_IS_TMC2130)
228
-      _TMC2130_INIT(E0, steps_per_mm[E_AXIS]);
226
+      _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
229 227
     #endif
230 228
     #if ENABLED(E1_IS_TMC2130)
231
-      { constexpr int extruder = 1; _TMC2130_INIT(E1, steps_per_mm[E_AXIS_N]); }
229
+      { constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
232 230
     #endif
233 231
     #if ENABLED(E2_IS_TMC2130)
234
-      { constexpr int extruder = 2; _TMC2130_INIT(E2, steps_per_mm[E_AXIS_N]); }
232
+      { constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
235 233
     #endif
236 234
     #if ENABLED(E3_IS_TMC2130)
237
-      { constexpr int extruder = 3; _TMC2130_INIT(E3, steps_per_mm[E_AXIS_N]); }
235
+      { constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
238 236
     #endif
239 237
     #if ENABLED(E4_IS_TMC2130)
240
-      { constexpr int extruder = 4; _TMC2130_INIT(E4, steps_per_mm[E_AXIS_N]); }
238
+      { constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
241 239
     #endif
242 240
 
243
-    TMC2130_ADV()
244 241
   }
245 242
 #endif // HAVE_TMC2130
246 243
 
244
+//
245
+// TMC2208 Driver objects and inits
246
+//
247
+#if ENABLED(HAVE_TMC2208)
248
+
249
+  #include <SoftwareSerial.h>
250
+  #include <HardwareSerial.h>
251
+  #include <TMC2208Stepper.h>
252
+  #include "planner.h"
253
+
254
+  #define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL)
255
+  #define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial stepper##ST##_serial = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \
256
+                                       TMC2208Stepper stepper##ST(&stepper##ST##_serial, ST##_SERIAL_RX_PIN > -1)
257
+
258
+  // Stepper objects of TMC2208 steppers used
259
+  #if ENABLED(X_IS_TMC2208)
260
+    #if defined(X_HARDWARE_SERIAL)
261
+      _TMC2208_DEFINE_HARDWARE(X);
262
+    #else
263
+      _TMC2208_DEFINE_SOFTWARE(X);
264
+    #endif
265
+  #endif
266
+  #if ENABLED(X2_IS_TMC2208)
267
+    #if defined(X2_HARDWARE_SERIAL)
268
+      _TMC2208_DEFINE_HARDWARE(X2);
269
+    #else
270
+      _TMC2208_DEFINE_SOFTWARE(X2);
271
+    #endif
272
+  #endif
273
+  #if ENABLED(Y_IS_TMC2208)
274
+    #if defined(Y_HARDWARE_SERIAL)
275
+      _TMC2208_DEFINE_HARDWARE(Y);
276
+    #else
277
+      _TMC2208_DEFINE_SOFTWARE(Y);
278
+    #endif
279
+  #endif
280
+  #if ENABLED(Y2_IS_TMC2208)
281
+    #if defined(Y2_HARDWARE_SERIAL)
282
+      _TMC2208_DEFINE_HARDWARE(Y2);
283
+    #else
284
+      _TMC2208_DEFINE_SOFTWARE(Y2);
285
+    #endif
286
+  #endif
287
+  #if ENABLED(Z_IS_TMC2208)
288
+    #if defined(Z_HARDWARE_SERIAL)
289
+      _TMC2208_DEFINE_HARDWARE(Z);
290
+    #else
291
+      _TMC2208_DEFINE_SOFTWARE(Z);
292
+    #endif
293
+  #endif
294
+  #if ENABLED(Z2_IS_TMC2208)
295
+    #if defined(Z2_HARDWARE_SERIAL)
296
+      _TMC2208_DEFINE_HARDWARE(Z2);
297
+    #else
298
+      _TMC2208_DEFINE_SOFTWARE(Z2);
299
+    #endif
300
+  #endif
301
+  #if ENABLED(E0_IS_TMC2208)
302
+    #if defined(E0_HARDWARE_SERIAL)
303
+      _TMC2208_DEFINE_HARDWARE(E0);
304
+    #else
305
+      _TMC2208_DEFINE_SOFTWARE(E0);
306
+    #endif
307
+  #endif
308
+  #if ENABLED(E1_IS_TMC2208)
309
+    #if defined(E1_HARDWARE_SERIAL)
310
+      _TMC2208_DEFINE_HARDWARE(E1);
311
+    #else
312
+      _TMC2208_DEFINE_SOFTWARE(E1);
313
+    #endif
314
+  #endif
315
+  #if ENABLED(E2_IS_TMC2208)
316
+    #if defined(E2_HARDWARE_SERIAL)
317
+      _TMC2208_DEFINE_HARDWARE(E2);
318
+    #else
319
+      _TMC2208_DEFINE_SOFTWARE(E2);
320
+    #endif
321
+  #endif
322
+  #if ENABLED(E3_IS_TMC2208)
323
+    #if defined(E3_HARDWARE_SERIAL)
324
+      _TMC2208_DEFINE_HARDWARE(E3);
325
+    #else
326
+      _TMC2208_DEFINE_SOFTWARE(E3);
327
+    #endif
328
+  #endif
329
+  #if ENABLED(E4_IS_TMC2208)
330
+    #if defined(E4_HARDWARE_SERIAL)
331
+      _TMC2208_DEFINE_HARDWARE(E4);
332
+    #else
333
+      _TMC2208_DEFINE_SOFTWARE(E4);
334
+    #endif
335
+  #endif
336
+
337
+  void tmc2208_serial_begin() {
338
+    #if ENABLED(X_IS_TMC2208) && defined(X_HARDWARE_SERIAL)
339
+      X_HARDWARE_SERIAL.begin(250000);
340
+    #endif
341
+    #if ENABLED(X2_IS_TMC2208) && defined(X2_HARDWARE_SERIAL)
342
+      X2_HARDWARE_SERIAL.begin(250000);
343
+    #endif
344
+    #if ENABLED(Y_IS_TMC2208) && defined(Y_HARDWARE_SERIAL)
345
+      Y_HARDWARE_SERIAL.begin(250000);
346
+    #endif
347
+    #if ENABLED(Y2_IS_TMC2208) && defined(Y2_HARDWARE_SERIAL)
348
+      Y2_HARDWARE_SERIAL.begin(250000);
349
+    #endif
350
+    #if ENABLED(Z_IS_TMC2208) && defined(Z_HARDWARE_SERIAL)
351
+      Z_HARDWARE_SERIAL.begin(250000);
352
+    #endif
353
+    #if ENABLED(Z2_IS_TMC2208) && defined(Z2_HARDWARE_SERIAL)
354
+      Z2_HARDWARE_SERIAL.begin(250000);
355
+    #endif
356
+    #if ENABLED(E0_IS_TMC2208) && defined(E0_HARDWARE_SERIAL)
357
+      E0_HARDWARE_SERIAL.begin(250000);
358
+    #endif
359
+    #if ENABLED(E1_IS_TMC2208) && defined(E1_HARDWARE_SERIAL)
360
+      E1_HARDWARE_SERIAL.begin(250000);
361
+    #endif
362
+    #if ENABLED(E2_IS_TMC2208) && defined(E2_HARDWARE_SERIAL)
363
+      E2_HARDWARE_SERIAL.begin(250000);
364
+    #endif
365
+    #if ENABLED(E3_IS_TMC2208) && defined(E3_HARDWARE_SERIAL)
366
+      E3_HARDWARE_SERIAL.begin(250000);
367
+    #endif
368
+    #if ENABLED(E4_IS_TMC2208) && defined(E4_HARDWARE_SERIAL)
369
+      E4_HARDWARE_SERIAL.begin(250000);
370
+    #endif
371
+  }
372
+
373
+  // Use internal reference voltage for current calculations. This is the default.
374
+  // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
375
+  void tmc2208_init(TMC2208Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
376
+    st.pdn_disable(true); // Use UART
377
+    st.mstep_reg_select(true); // Select microsteps with UART
378
+    st.I_scale_analog(false);
379
+    st.rms_current(st.getCurrent(), HOLD_MULTIPLIER, R_SENSE);
380
+    st.microsteps(microsteps);
381
+    st.blank_time(24);
382
+    st.toff(5);
383
+    st.intpol(INTERPOLATE);
384
+    st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
385
+    st.hysterisis_start(3);
386
+    st.hysterisis_end(2);
387
+    #if ENABLED(STEALTHCHOP)
388
+      st.pwm_lim(12);
389
+      st.pwm_reg(8);
390
+      st.pwm_autograd(1);
391
+      st.pwm_autoscale(1);
392
+      st.pwm_freq(1);
393
+      st.pwm_grad(14);
394
+      st.pwm_ofs(36);
395
+      st.en_spreadCycle(false);
396
+      #if ENABLED(HYBRID_THRESHOLD)
397
+        st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm));
398
+      #else
399
+        UNUSED(thrs);
400
+        UNUSED(spmm);
401
+      #endif
402
+    #else
403
+      st.en_spreadCycle(true);
404
+    #endif
405
+    st.GSTAT(0b111); // Clear
406
+    delay(200);
407
+  }
408
+
409
+  #define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
410
+
411
+  void tmc2208_init() {
412
+    #if ENABLED(X_IS_TMC2208)
413
+      _TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]);
414
+    #endif
415
+    #if ENABLED(X2_IS_TMC2208)
416
+      _TMC2208_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
417
+    #endif
418
+    #if ENABLED(Y_IS_TMC2208)
419
+      _TMC2208_INIT(Y, planner.axis_steps_per_mm[Y_AXIS]);
420
+    #endif
421
+    #if ENABLED(Y2_IS_TMC2208)
422
+      _TMC2208_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
423
+    #endif
424
+    #if ENABLED(Z_IS_TMC2208)
425
+      _TMC2208_INIT(Z, planner.axis_steps_per_mm[Z_AXIS]);
426
+    #endif
427
+    #if ENABLED(Z2_IS_TMC2208)
428
+      _TMC2208_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
429
+    #endif
430
+    #if ENABLED(E0_IS_TMC2208)
431
+      _TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
432
+    #endif
433
+    #if ENABLED(E1_IS_TMC2208)
434
+      { constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
435
+    #endif
436
+    #if ENABLED(E2_IS_TMC2208)
437
+      { constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
438
+    #endif
439
+    #if ENABLED(E3_IS_TMC2208)
440
+      { constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
441
+    #endif
442
+    #if ENABLED(E4_IS_TMC2208)
443
+      { constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
444
+    #endif
445
+  }
446
+#endif // HAVE_TMC2208
447
+
247 448
 
248 449
 //
249 450
 // L6470 Driver objects and inits

+ 28
- 0
Marlin/src/module/stepper_indirection.h Прегледај датотеку

@@ -58,6 +58,12 @@
58 58
   void tmc2130_init();
59 59
 #endif
60 60
 
61
+#if ENABLED(HAVE_TMC2208)
62
+  #include <TMC2208Stepper.h>
63
+  void tmc2208_serial_begin();
64
+  void tmc2208_init();
65
+#endif
66
+
61 67
 // L6470 has STEP on normal pins, but DIR/ENABLE via SPI
62 68
 #if ENABLED(HAVE_L6470DRIVER)
63 69
   #include <SPI.h>
@@ -83,6 +89,8 @@
83 89
   #else
84 90
     #if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
85 91
       extern TMC2130Stepper stepperX;
92
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(X_IS_TMC2208)
93
+      extern TMC2208Stepper stepperX;
86 94
     #endif
87 95
     #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
88 96
     #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
@@ -114,6 +122,8 @@
114 122
   #else
115 123
     #if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
116 124
       extern TMC2130Stepper stepperY;
125
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(Y_IS_TMC2208)
126
+      extern TMC2208Stepper stepperY;
117 127
     #endif
118 128
     #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
119 129
     #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
@@ -145,6 +155,8 @@
145 155
   #else
146 156
     #if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
147 157
       extern TMC2130Stepper stepperZ;
158
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(Z_IS_TMC2208)
159
+      extern TMC2208Stepper stepperZ;
148 160
     #endif
149 161
     #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
150 162
     #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
@@ -177,6 +189,8 @@
177 189
     #else
178 190
       #if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
179 191
         extern TMC2130Stepper stepperX2;
192
+      #elif ENABLED(HAVE_TMC2208) && ENABLED(X2_IS_TMC2208)
193
+        extern TMC2208Stepper stepperX2;
180 194
       #endif
181 195
       #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
182 196
       #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
@@ -210,6 +224,8 @@
210 224
     #else
211 225
       #if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
212 226
         extern TMC2130Stepper stepperY2;
227
+      #elif ENABLED(HAVE_TMC2208) && ENABLED(Y2_IS_TMC2208)
228
+        extern TMC2208Stepper stepperY2;
213 229
       #endif
214 230
       #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
215 231
       #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
@@ -243,6 +259,8 @@
243 259
     #else
244 260
       #if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
245 261
         extern TMC2130Stepper stepperZ2;
262
+      #elif ENABLED(HAVE_TMC2208) && ENABLED(Z2_IS_TMC2208)
263
+        extern TMC2208Stepper stepperZ2;
246 264
       #endif
247 265
       #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
248 266
       #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
@@ -275,6 +293,8 @@
275 293
   #else
276 294
     #if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
277 295
       extern TMC2130Stepper stepperE0;
296
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(E0_IS_TMC2208)
297
+      extern TMC2208Stepper stepperE0;
278 298
     #endif
279 299
     #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
280 300
     #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
@@ -306,6 +326,8 @@
306 326
   #else
307 327
     #if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
308 328
       extern TMC2130Stepper stepperE1;
329
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(E1_IS_TMC2208)
330
+      extern TMC2208Stepper stepperE1;
309 331
     #endif
310 332
     #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
311 333
     #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
@@ -337,6 +359,8 @@
337 359
   #else
338 360
     #if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
339 361
       extern TMC2130Stepper stepperE2;
362
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(E2_IS_TMC2208)
363
+      extern TMC2208Stepper stepperE2;
340 364
     #endif
341 365
     #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
342 366
     #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
@@ -368,6 +392,8 @@
368 392
   #else
369 393
     #if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
370 394
       extern TMC2130Stepper stepperE3;
395
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(E3_IS_TMC2208)
396
+      extern TMC2208Stepper stepperE3;
371 397
     #endif
372 398
     #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
373 399
     #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
@@ -399,6 +425,8 @@
399 425
   #else
400 426
     #if ENABLED(HAVE_TMC2130) && ENABLED(E4_IS_TMC2130)
401 427
       extern TMC2130Stepper stepperE4;
428
+    #elif ENABLED(HAVE_TMC2208) && ENABLED(E4_IS_TMC2208)
429
+      extern TMC2208Stepper stepperE4;
402 430
     #endif
403 431
     #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
404 432
     #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)

+ 66
- 0
Marlin/src/pins/pinsDebug_list.h Прегледај датотеку

@@ -839,3 +839,69 @@
839 839
 #if PIN_EXISTS(ZRIB_V20_D9)
840 840
   REPORT_NAME_DIGITAL(ZRIB_V20_D9_PIN, __LINE__ )
841 841
 #endif
842
+#if PIN_EXISTS(X_SERIAL_TX)
843
+  REPORT_NAME_DIGITAL(X_SERIAL_TX_PIN, __LINE__ )
844
+#endif
845
+#if PIN_EXISTS(X_SERIAL_RX)
846
+  REPORT_NAME_DIGITAL(X_SERIAL_RX_PIN, __LINE__ )
847
+#endif
848
+#if PIN_EXISTS(X2_SERIAL_TX)
849
+  REPORT_NAME_DIGITAL(X2_SERIAL_TX_PIN, __LINE__ )
850
+#endif
851
+#if PIN_EXISTS(X2_SERIAL_RX)
852
+  REPORT_NAME_DIGITAL(X2_SERIAL_RX_PIN, __LINE__ )
853
+#endif
854
+#if PIN_EXISTS(Y_SERIAL_TX)
855
+  REPORT_NAME_DIGITAL(Y_SERIAL_TX_PIN, __LINE__ )
856
+#endif
857
+#if PIN_EXISTS(Y_SERIAL_RX)
858
+  REPORT_NAME_DIGITAL(Y_SERIAL_RX_PIN, __LINE__ )
859
+#endif
860
+#if PIN_EXISTS(Y2_SERIAL_TX)
861
+  REPORT_NAME_DIGITAL(Y2_SERIAL_TX_PIN, __LINE__ )
862
+#endif
863
+#if PIN_EXISTS(Y2_SERIAL_RX)
864
+  REPORT_NAME_DIGITAL(Y2_SERIAL_RX_PIN, __LINE__ )
865
+#endif
866
+#if PIN_EXISTS(Z_SERIAL_TX)
867
+  REPORT_NAME_DIGITAL(Z_SERIAL_TX_PIN, __LINE__ )
868
+#endif
869
+#if PIN_EXISTS(Z_SERIAL_RX)
870
+  REPORT_NAME_DIGITAL(Z_SERIAL_RX_PIN, __LINE__ )
871
+#endif
872
+#if PIN_EXISTS(Z2_SERIAL_TX)
873
+  REPORT_NAME_DIGITAL(Z2_SERIAL_TX_PIN, __LINE__ )
874
+#endif
875
+#if PIN_EXISTS(Z2_SERIAL_RX)
876
+  REPORT_NAME_DIGITAL(Z2_SERIAL_RX_PIN, __LINE__ )
877
+#endif
878
+#if PIN_EXISTS(E0_SERIAL_TX)
879
+  REPORT_NAME_DIGITAL(E0_SERIAL_TX_PIN, __LINE__ )
880
+#endif
881
+#if PIN_EXISTS(E0_SERIAL_RX)
882
+  REPORT_NAME_DIGITAL(E0_SERIAL_RX_PIN, __LINE__ )
883
+#endif
884
+#if PIN_EXISTS(E1_SERIAL_TX)
885
+  REPORT_NAME_DIGITAL(E1_SERIAL_TX_PIN, __LINE__ )
886
+#endif
887
+#if PIN_EXISTS(E1_SERIAL_RX)
888
+  REPORT_NAME_DIGITAL(E1_SERIAL_RX_PIN, __LINE__ )
889
+#endif
890
+#if PIN_EXISTS(E2_SERIAL_TX)
891
+  REPORT_NAME_DIGITAL(E2_SERIAL_TX_PIN, __LINE__ )
892
+#endif
893
+#if PIN_EXISTS(E2_SERIAL_RX)
894
+  REPORT_NAME_DIGITAL(E2_SERIAL_RX_PIN, __LINE__ )
895
+#endif
896
+#if PIN_EXISTS(E3_SERIAL_TX)
897
+  REPORT_NAME_DIGITAL(E3_SERIAL_TX_PIN, __LINE__ )
898
+#endif
899
+#if PIN_EXISTS(E3_SERIAL_RX)
900
+  REPORT_NAME_DIGITAL(E3_SERIAL_RX_PIN, __LINE__ )
901
+#endif
902
+#if PIN_EXISTS(E4_SERIAL_TX)
903
+  REPORT_NAME_DIGITAL(E4_SERIAL_TX_PIN, __LINE__ )
904
+#endif
905
+#if PIN_EXISTS(E4_SERIAL_RX)
906
+  REPORT_NAME_DIGITAL(E4_SERIAL_RX_PIN, __LINE__ )
907
+#endif

+ 50
- 0
Marlin/src/pins/pins_RAMPS.h Прегледај датотеку

@@ -119,6 +119,56 @@
119 119
 #define E1_ENABLE_PIN      30
120 120
 #define E1_CS_PIN          44
121 121
 
122
+#if ENABLED(HAVE_TMC2208)
123
+  /*
124
+   * TMC2208 stepper drivers
125
+   * 
126
+   * Hardware serial communication ports.
127
+   * If undefined software serial is used according to the pins below
128
+   */
129
+  //#define X_HARDWARE_SERIAL  Serial1
130
+  //#define X2_HARDWARE_SERIAL Serial1
131
+  //#define Y_HARDWARE_SERIAL  Serial1
132
+  //#define Y2_HARDWARE_SERIAL Serial1
133
+  #define Z_HARDWARE_SERIAL  Serial3
134
+  #define Z2_HARDWARE_SERIAL Serial1
135
+  //#define E0_HARDWARE_SERIAL Serial1
136
+  //#define E1_HARDWARE_SERIAL Serial1
137
+  //#define E2_HARDWARE_SERIAL Serial1
138
+  //#define E3_HARDWARE_SERIAL Serial1
139
+  //#define E3_HARDWARE_SERIAL Serial1
140
+
141
+  /*
142
+   * Software serial
143
+   */
144
+
145
+  #define X_SERIAL_TX_PIN    59
146
+  #define X_SERIAL_RX_PIN    63
147
+  #define X2_SERIAL_TX_PIN   -1
148
+  #define X2_SERIAL_RX_PIN   -1
149
+
150
+  #define Y_SERIAL_TX_PIN    64
151
+  #define Y_SERIAL_RX_PIN    40
152
+  #define Y2_SERIAL_TX_PIN   -1
153
+  #define Y2_SERIAL_RX_PIN   -1
154
+
155
+  #define Z_SERIAL_TX_PIN    44
156
+  #define Z_SERIAL_RX_PIN    42
157
+  #define Z2_SERIAL_TX_PIN   -1
158
+  #define Z2_SERIAL_RX_PIN   -1
159
+
160
+  #define E0_SERIAL_TX_PIN   66
161
+  #define E0_SERIAL_RX_PIN   65
162
+  #define E1_SERIAL_TX_PIN   -1
163
+  #define E1_SERIAL_RX_PIN   -1
164
+  #define E2_SERIAL_TX_PIN   -1
165
+  #define E2_SERIAL_RX_PIN   -1
166
+  #define E3_SERIAL_TX_PIN   -1
167
+  #define E3_SERIAL_RX_PIN   -1
168
+  #define E4_SERIAL_TX_PIN   -1
169
+  #define E4_SERIAL_RX_PIN   -1
170
+#endif
171
+
122 172
 //
123 173
 // Temperature Sensors
124 174
 //

+ 1
- 0
platformio.ini Прегледај датотеку

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

Loading…
Откажи
Сачувај