Browse Source

[1.1.x] TMC driver update (#8712)

teemuatlut 6 years ago
parent
commit
0ac0324af2
43 changed files with 3584 additions and 1637 deletions
  1. 12
    1
      .travis.yml
  2. 72
    43
      Marlin/Configuration_adv.h
  3. 1
    0
      Marlin/MarlinConfig.h
  4. 701
    175
      Marlin/Marlin_main.cpp
  5. 39
    17
      Marlin/SanityCheck.h
  6. 180
    85
      Marlin/configuration_store.cpp
  7. 72
    43
      Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h
  8. 72
    43
      Marlin/example_configurations/Anet/A6/Configuration_adv.h
  9. 72
    43
      Marlin/example_configurations/Anet/A8/Configuration_adv.h
  10. 72
    43
      Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h
  11. 72
    43
      Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h
  12. 72
    43
      Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h
  13. 72
    43
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  14. 72
    43
      Marlin/example_configurations/Creality/CR-10/Configuration_adv.h
  15. 72
    43
      Marlin/example_configurations/Felix/Configuration_adv.h
  16. 72
    43
      Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h
  17. 72
    43
      Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h
  18. 72
    43
      Marlin/example_configurations/Malyan/M150/Configuration_adv.h
  19. 72
    43
      Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h
  20. 72
    43
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  21. 72
    43
      Marlin/example_configurations/SCARA/Configuration_adv.h
  22. 72
    43
      Marlin/example_configurations/Sanguinololu/Configuration_adv.h
  23. 72
    43
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  24. 72
    43
      Marlin/example_configurations/Velleman/K8200/Configuration_adv.h
  25. 72
    43
      Marlin/example_configurations/Velleman/K8400/Configuration_adv.h
  26. 72
    43
      Marlin/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h
  27. 72
    43
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  28. 72
    43
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  29. 72
    43
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  30. 72
    43
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  31. 72
    43
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  32. 72
    43
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  33. 72
    43
      Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h
  34. 72
    43
      Marlin/example_configurations/makibox/Configuration_adv.h
  35. 72
    43
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  36. 72
    43
      Marlin/example_configurations/wt150/Configuration_adv.h
  37. 66
    1
      Marlin/pinsDebug_list.h
  38. 51
    0
      Marlin/pins_RAMPS.h
  39. 1
    1
      Marlin/serial.h
  40. 10
    0
      Marlin/stepper.cpp
  41. 224
    24
      Marlin/stepper_indirection.cpp
  42. 28
    0
      Marlin/stepper_indirection.h
  43. 39
    0
      Marlin/tmc_macros.h

+ 12
- 1
.travis.yml View File

@@ -52,6 +52,10 @@ install:
52 52
   - git clone https://github.com/teemuatlut/TMC2130Stepper.git
53 53
   - sudo mv TMC2130Stepper /usr/local/share/arduino/libraries/TMC2130Stepper
54 54
   #
55
+  # Install: TMC2208 Stepper Motor Controller library
56
+  - git clone https://github.com/teemuatlut/TMC2208Stepper.git
57
+  - sudo mv TMC2208Stepper /usr/local/share/arduino/libraries/TMC2208Stepper
58
+  #
55 59
   # Install: Adafruit Neopixel library
56 60
   - git clone https://github.com/adafruit/Adafruit_NeoPixel.git
57 61
   - sudo mv Adafruit_NeoPixel /usr/local/share/arduino/libraries/Adafruit_NeoPixel
@@ -345,7 +349,14 @@ script:
345 349
   - use_example_configs SCARA
346 350
   - opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER
347 351
   - opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130
348
-  - opt_enable_adv AUTOMATIC_CURRENT_CONTROL STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING
352
+  - opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG SENSORLESS_HOMING
353
+  - build_marlin
354
+  #
355
+  # TMC2208 Config
356
+  #
357
+  - restore_configs
358
+  - opt_enable_adv HAVE_TMC2208 X_IS_TMC2208 Y_IS_TMC2208 Z_IS_TMC2208
359
+  - opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG
349 360
   - build_marlin
350 361
   #
351 362
   # tvrrug Config need to check board type for sanguino atmega644p

+ 72
- 43
Marlin/Configuration_adv.h View File

@@ -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
 

+ 1
- 0
Marlin/MarlinConfig.h View File

@@ -29,6 +29,7 @@
29 29
 #include "Version.h"
30 30
 #include "Configuration.h"
31 31
 #include "Conditionals_LCD.h"
32
+#include "tmc_macros.h"
32 33
 #include "Configuration_adv.h"
33 34
 #include "pins.h"
34 35
 #ifndef USBCON

+ 701
- 175
Marlin/Marlin_main.cpp
File diff suppressed because it is too large
View File


+ 39
- 17
Marlin/SanityCheck.h View File

@@ -1404,23 +1404,45 @@ static_assert(1 >= 0
1404 1404
 /**
1405 1405
  * Make sure HAVE_TMC2130 is warranted
1406 1406
  */
1407
-#if ENABLED(HAVE_TMC2130)
1408
-  #if !( ENABLED(  X_IS_TMC2130 ) \
1409
-      || ENABLED( X2_IS_TMC2130 ) \
1410
-      || ENABLED(  Y_IS_TMC2130 ) \
1411
-      || ENABLED( Y2_IS_TMC2130 ) \
1412
-      || ENABLED(  Z_IS_TMC2130 ) \
1413
-      || ENABLED( Z2_IS_TMC2130 ) \
1414
-      || ENABLED( E0_IS_TMC2130 ) \
1415
-      || ENABLED( E1_IS_TMC2130 ) \
1416
-      || ENABLED( E2_IS_TMC2130 ) \
1417
-      || ENABLED( E3_IS_TMC2130 ) \
1418
-      || ENABLED( E4_IS_TMC2130 ) \
1419
-  )
1420
-    #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
1421
-  #elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1422
-    #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
1423
-  #endif
1407
+#if ENABLED(HAVE_TMC2130) && !( \
1408
+       ENABLED(  X_IS_TMC2130 ) \
1409
+    || ENABLED( X2_IS_TMC2130 ) \
1410
+    || ENABLED(  Y_IS_TMC2130 ) \
1411
+    || ENABLED( Y2_IS_TMC2130 ) \
1412
+    || ENABLED(  Z_IS_TMC2130 ) \
1413
+    || ENABLED( Z2_IS_TMC2130 ) \
1414
+    || ENABLED( E0_IS_TMC2130 ) \
1415
+    || ENABLED( E1_IS_TMC2130 ) \
1416
+    || ENABLED( E2_IS_TMC2130 ) \
1417
+    || ENABLED( E3_IS_TMC2130 ) \
1418
+    || ENABLED( E4_IS_TMC2130 ) )
1419
+  #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
1420
+#elif ENABLED(SENSORLESS_HOMING) && DISABLED(HAVE_TMC2130)
1421
+  #error "Enable HAVE_TMC2130 to use SENSORLESS_HOMING."
1422
+#elif defined(AUTOMATIC_CURRENT_CONTROL)
1423
+  #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration."
1424
+#endif
1425
+
1426
+/**
1427
+ * Make sure HAVE_TMC2208 is warranted
1428
+ */
1429
+
1430
+#if ENABLED(HAVE_TMC2208) && !( \
1431
+       ENABLED(  X_IS_TMC2208 ) \
1432
+    || ENABLED( X2_IS_TMC2208 ) \
1433
+    || ENABLED(  Y_IS_TMC2208 ) \
1434
+    || ENABLED( Y2_IS_TMC2208 ) \
1435
+    || ENABLED(  Z_IS_TMC2208 ) \
1436
+    || ENABLED( Z2_IS_TMC2208 ) \
1437
+    || ENABLED( E0_IS_TMC2208 ) \
1438
+    || ENABLED( E1_IS_TMC2208 ) \
1439
+    || ENABLED( E2_IS_TMC2208 ) \
1440
+    || ENABLED( E3_IS_TMC2208 ) )
1441
+  #error "HAVE_TMC2208 requires at least one TMC2208 stepper to be set."
1442
+#endif
1443
+
1444
+#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
1445
+  #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
1424 1446
 #endif
1425 1447
 
1426 1448
 /**

+ 180
- 85
Marlin/configuration_store.cpp View File

@@ -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)
@@ -141,7 +141,7 @@
141 141
  *  539  M200 D    parser.volumetric_enabled        (bool)
142 142
  *  540  M200 T D  planner.filament_size            (float x5) (T0..3)
143 143
  *
144
- * HAVE_TMC2130:                                    22 bytes
144
+ * HAVE_TMC2130 || HAVE_TMC2208:                    22 bytes
145 145
  *  560  M906 X    Stepper X current                (uint16_t)
146 146
  *  562  M906 Y    Stepper Y current                (uint16_t)
147 147
  *  564  M906 Z    Stepper Z current                (uint16_t)
@@ -154,25 +154,29 @@
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
+ *  582  M914 X    Stepper X and X2 threshold       (int16_t)
159
+ *  584  M914 Y    Stepper Y and Y2 threshold       (int16_t)
160
+ *
157 161
  * LIN_ADVANCE:                                     8 bytes
158
- *  582  M900 K    extruder_advance_k               (float)
159
- *  586  M900 WHD  advance_ed_ratio                 (float)
162
+ *  586  M900 K    extruder_advance_k               (float)
163
+ *  590  M900 WHD  advance_ed_ratio                 (float)
160 164
  *
161 165
  * HAS_MOTOR_CURRENT_PWM:
162
- *  590  M907 X    Stepper XY current               (uint32_t)
163
- *  594  M907 Z    Stepper Z current                (uint32_t)
164
- *  598  M907 E    Stepper E current                (uint32_t)
166
+ *  594  M907 X    Stepper XY current               (uint32_t)
167
+ *  598  M907 Z    Stepper Z current                (uint32_t)
168
+ *  602  M907 E    Stepper E current                (uint32_t)
165 169
  *
166 170
  * CNC_COORDINATE_SYSTEMS                           108 bytes
167
- *  602  G54-G59.3 coordinate_system                (float x 27)
171
+ *  606  G54-G59.3 coordinate_system                (float x 27)
168 172
  *
169 173
  * SKEW_CORRECTION:                                 12 bytes
170
- *  710  M852 I    planner.xy_skew_factor           (float)
171
- *  714  M852 J    planner.xz_skew_factor           (float)
172
- *  718  M852 K    planner.yz_skew_factor           (float)
174
+ *  714  M852 I    planner.xy_skew_factor           (float)
175
+ *  718  M852 J    planner.xz_skew_factor           (float)
176
+ *  722  M852 K    planner.yz_skew_factor           (float)
173 177
  *
174
- *  722                                   Minimum end-point
175
- * 2251 (722 + 208 + 36 + 9 + 288 + 988)  Maximum end-point
178
+ *  726                                   Minimum end-point
179
+ * 2255 (726 + 208 + 36 + 9 + 288 + 988)  Maximum end-point
176 180
  *
177 181
  * ========================================================================
178 182
  * meshes_begin (between max and min end-point, directly above)
@@ -199,7 +203,7 @@ MarlinSettings settings;
199 203
   #include "mesh_bed_leveling.h"
200 204
 #endif
201 205
 
202
-#if ENABLED(HAVE_TMC2130)
206
+#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
203 207
   #include "stepper_indirection.h"
204 208
 #endif
205 209
 
@@ -570,70 +574,70 @@ void MarlinSettings::postprocess() {
570 574
       EEPROM_WRITE(dummy);
571 575
     }
572 576
 
573
-    // Save TMC2130 Configuration, and placeholder values
577
+    // Save TMC2130 or TMC2208 Configuration, and placeholder values
574 578
     uint16_t val;
575
-    #if ENABLED(HAVE_TMC2130)
576
-      #if ENABLED(X_IS_TMC2130)
579
+    #if HAS_TRINAMIC
580
+      #if X_IS_TRINAMIC
577 581
         val = stepperX.getCurrent();
578 582
       #else
579 583
         val = 0;
580 584
       #endif
581 585
       EEPROM_WRITE(val);
582
-      #if ENABLED(Y_IS_TMC2130)
586
+      #if Y_IS_TRINAMIC
583 587
         val = stepperY.getCurrent();
584 588
       #else
585 589
         val = 0;
586 590
       #endif
587 591
       EEPROM_WRITE(val);
588
-      #if ENABLED(Z_IS_TMC2130)
592
+      #if Z_IS_TRINAMIC
589 593
         val = stepperZ.getCurrent();
590 594
       #else
591 595
         val = 0;
592 596
       #endif
593 597
       EEPROM_WRITE(val);
594
-      #if ENABLED(X2_IS_TMC2130)
598
+      #if X2_IS_TRINAMIC
595 599
         val = stepperX2.getCurrent();
596 600
       #else
597 601
         val = 0;
598 602
       #endif
599 603
       EEPROM_WRITE(val);
600
-      #if ENABLED(Y2_IS_TMC2130)
604
+      #if Y2_IS_TRINAMIC
601 605
         val = stepperY2.getCurrent();
602 606
       #else
603 607
         val = 0;
604 608
       #endif
605 609
       EEPROM_WRITE(val);
606
-      #if ENABLED(Z2_IS_TMC2130)
610
+      #if Z2_IS_TRINAMIC
607 611
         val = stepperZ2.getCurrent();
608 612
       #else
609 613
         val = 0;
610 614
       #endif
611 615
       EEPROM_WRITE(val);
612
-      #if ENABLED(E0_IS_TMC2130)
616
+      #if E0_IS_TRINAMIC
613 617
         val = stepperE0.getCurrent();
614 618
       #else
615 619
         val = 0;
616 620
       #endif
617 621
       EEPROM_WRITE(val);
618
-      #if ENABLED(E1_IS_TMC2130)
622
+      #if E1_IS_TRINAMIC
619 623
         val = stepperE1.getCurrent();
620 624
       #else
621 625
         val = 0;
622 626
       #endif
623 627
       EEPROM_WRITE(val);
624
-      #if ENABLED(E2_IS_TMC2130)
628
+      #if E2_IS_TRINAMIC
625 629
         val = stepperE2.getCurrent();
626 630
       #else
627 631
         val = 0;
628 632
       #endif
629 633
       EEPROM_WRITE(val);
630
-      #if ENABLED(E3_IS_TMC2130)
634
+      #if E3_IS_TRINAMIC
631 635
         val = stepperE3.getCurrent();
632 636
       #else
633 637
         val = 0;
634 638
       #endif
635 639
       EEPROM_WRITE(val);
636
-      #if ENABLED(E4_IS_TMC2130)
640
+      #if E4_IS_TRINAMIC
637 641
         val = stepperE4.getCurrent();
638 642
       #else
639 643
         val = 0;
@@ -645,6 +649,28 @@ void MarlinSettings::postprocess() {
645 649
     #endif
646 650
 
647 651
     //
652
+    // TMC2130 Sensorless homing threshold
653
+    //
654
+    int16_t thrs;
655
+    #if ENABLED(SENSORLESS_HOMING)
656
+      #if ENABLED(X_IS_TMC2130)
657
+        thrs = stepperX.sgt();
658
+      #else
659
+        thrs = 0;
660
+      #endif
661
+      EEPROM_WRITE(thrs);
662
+      #if ENABLED(Y_IS_TMC2130)
663
+        thrs = stepperY.sgt();
664
+      #else
665
+        thrs = 0;
666
+      #endif
667
+      EEPROM_WRITE(thrs);
668
+    #else
669
+      thrs = 0;
670
+      for (uint8_t q = 2; q--;) EEPROM_WRITE(thrs);
671
+    #endif
672
+
673
+    //
648 674
     // Linear Advance
649 675
     //
650 676
 
@@ -1039,55 +1065,80 @@ void MarlinSettings::postprocess() {
1039 1065
       //
1040 1066
 
1041 1067
       uint16_t val;
1042
-      #if ENABLED(HAVE_TMC2130)
1068
+      #if HAS_TRINAMIC
1043 1069
         EEPROM_READ(val);
1044
-        #if ENABLED(X_IS_TMC2130)
1070
+        #if X_IS_TRINAMIC
1045 1071
           stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1046 1072
         #endif
1047 1073
         EEPROM_READ(val);
1048
-        #if ENABLED(Y_IS_TMC2130)
1074
+        #if Y_IS_TRINAMIC
1049 1075
           stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1050 1076
         #endif
1051 1077
         EEPROM_READ(val);
1052
-        #if ENABLED(Z_IS_TMC2130)
1078
+        #if Z_IS_TRINAMIC
1053 1079
           stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1054 1080
         #endif
1055 1081
         EEPROM_READ(val);
1056
-        #if ENABLED(X2_IS_TMC2130)
1082
+        #if X2_IS_TRINAMIC
1057 1083
           stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1058 1084
         #endif
1059 1085
         EEPROM_READ(val);
1060
-        #if ENABLED(Y2_IS_TMC2130)
1086
+        #if Y2_IS_TRINAMIC
1061 1087
           stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1062 1088
         #endif
1063 1089
         EEPROM_READ(val);
1064
-        #if ENABLED(Z2_IS_TMC2130)
1090
+        #if Z2_IS_TRINAMIC
1065 1091
           stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1066 1092
         #endif
1067 1093
         EEPROM_READ(val);
1068
-        #if ENABLED(E0_IS_TMC2130)
1094
+        #if E0_IS_TRINAMIC
1069 1095
           stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1070 1096
         #endif
1071 1097
         EEPROM_READ(val);
1072
-        #if ENABLED(E1_IS_TMC2130)
1098
+        #if E1_IS_TRINAMIC
1073 1099
           stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1074 1100
         #endif
1075 1101
         EEPROM_READ(val);
1076
-        #if ENABLED(E2_IS_TMC2130)
1102
+        #if E2_IS_TRINAMIC
1077 1103
           stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1078 1104
         #endif
1079 1105
         EEPROM_READ(val);
1080
-        #if ENABLED(E3_IS_TMC2130)
1106
+        #if E3_IS_TRINAMIC
1081 1107
           stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1082 1108
         #endif
1083 1109
         EEPROM_READ(val);
1084
-        #if ENABLED(E4_IS_TMC2130)
1110
+        #if E4_IS_TRINAMIC
1085 1111
           stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
1086 1112
         #endif
1087 1113
       #else
1088 1114
         for (uint8_t q = 11; q--;) EEPROM_READ(val);
1089 1115
       #endif
1090 1116
 
1117
+      /*
1118
+       * TMC2130 Sensorless homing threshold.
1119
+       * X and X2 use the same value
1120
+       * Y and Y2 use the same value
1121
+       */
1122
+      int16_t thrs;
1123
+      #if ENABLED(SENSORLESS_HOMING)
1124
+        EEPROM_READ(thrs);
1125
+        #if ENABLED(X_IS_TMC2130)
1126
+          stepperX.sgt(thrs);
1127
+        #endif
1128
+        #if ENABLED(X2_IS_TMC2130)
1129
+          stepperX2.sgt(thrs);
1130
+        #endif
1131
+        EEPROM_READ(thrs);
1132
+        #if ENABLED(Y_IS_TMC2130)
1133
+          stepperY.sgt(thrs);
1134
+        #endif
1135
+        #if ENABLED(Y2_IS_TMC2130)
1136
+          stepperY2.sgt(thrs);
1137
+        #endif
1138
+      #else
1139
+        for (uint8_t q = 0; q < 2; q++) EEPROM_READ(thrs);
1140
+      #endif
1141
+
1091 1142
       //
1092 1143
       // Linear Advance
1093 1144
       //
@@ -1469,36 +1520,52 @@ void MarlinSettings::reset() {
1469 1520
     #endif
1470 1521
   );
1471 1522
 
1472
-  #if ENABLED(HAVE_TMC2130)
1523
+  #if X_IS_TRINAMIC
1524
+    stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1525
+  #endif
1526
+  #if Y_IS_TRINAMIC
1527
+    stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1528
+  #endif
1529
+  #if Z_IS_TRINAMIC
1530
+    stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1531
+  #endif
1532
+  #if X2_IS_TRINAMIC
1533
+    stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1534
+  #endif
1535
+  #if Y2_IS_TRINAMIC
1536
+    stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1537
+  #endif
1538
+  #if Z2_IS_TRINAMIC
1539
+    stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1540
+  #endif
1541
+  #if E0_IS_TRINAMIC
1542
+    stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1543
+  #endif
1544
+  #if E1_IS_TRINAMIC
1545
+    stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1546
+  #endif
1547
+  #if E2_IS_TRINAMIC
1548
+    stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1549
+  #endif
1550
+  #if E3_IS_TRINAMIC
1551
+    stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1552
+  #endif
1553
+  #if E4_IS_TRINAMIC
1554
+    stepperE4.setCurrent(E4_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1555
+  #endif
1556
+
1557
+  #if ENABLED(SENSORLESS_HOMING)
1473 1558
     #if ENABLED(X_IS_TMC2130)
1474
-      stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1475
-    #endif
1476
-    #if ENABLED(Y_IS_TMC2130)
1477
-      stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1478
-    #endif
1479
-    #if ENABLED(Z_IS_TMC2130)
1480
-      stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1559
+      stepperX.sgt(X_HOMING_SENSITIVITY);
1481 1560
     #endif
1482 1561
     #if ENABLED(X2_IS_TMC2130)
1483
-      stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1562
+      stepperX2.sgt(X_HOMING_SENSITIVITY);
1484 1563
     #endif
1485
-    #if ENABLED(Y2_IS_TMC2130)
1486
-      stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1487
-    #endif
1488
-    #if ENABLED(Z2_IS_TMC2130)
1489
-      stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1490
-    #endif
1491
-    #if ENABLED(E0_IS_TMC2130)
1492
-      stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1493
-    #endif
1494
-    #if ENABLED(E1_IS_TMC2130)
1495
-      stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1496
-    #endif
1497
-    #if ENABLED(E2_IS_TMC2130)
1498
-      stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1564
+    #if ENABLED(Y_IS_TMC2130)
1565
+      stepperY.sgt(Y_HOMING_SENSITIVITY);
1499 1566
     #endif
1500
-    #if ENABLED(E3_IS_TMC2130)
1501
-      stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1567
+    #if ENABLED(Y2_IS_TMC2130)
1568
+      stepperY2.sgt(Y_HOMING_SENSITIVITY);
1502 1569
     #endif
1503 1570
   #endif
1504 1571
 
@@ -1982,35 +2049,63 @@ void MarlinSettings::reset() {
1982 2049
       }
1983 2050
       CONFIG_ECHO_START;
1984 2051
       SERIAL_ECHO("  M906");
1985
-      #if ENABLED(X_IS_TMC2130)
1986
-        SERIAL_ECHOPAIR(" X", stepperX.getCurrent());
2052
+      #if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208)
2053
+        SERIAL_ECHOPAIR(" X ", stepperX.getCurrent());
1987 2054
       #endif
1988
-      #if ENABLED(Y_IS_TMC2130)
1989
-        SERIAL_ECHOPAIR(" Y", stepperY.getCurrent());
2055
+      #if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208)
2056
+        SERIAL_ECHOPAIR(" Y ", stepperY.getCurrent());
1990 2057
       #endif
1991
-      #if ENABLED(Z_IS_TMC2130)
1992
-        SERIAL_ECHOPAIR(" Z", stepperZ.getCurrent());
2058
+      #if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208)
2059
+        SERIAL_ECHOPAIR(" Z ", stepperZ.getCurrent());
1993 2060
       #endif
1994
-      #if ENABLED(X2_IS_TMC2130)
1995
-        SERIAL_ECHOPAIR(" X2", stepperX2.getCurrent());
2061
+      #if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208)
2062
+        SERIAL_ECHOPAIR(" X2 ", stepperX2.getCurrent());
1996 2063
       #endif
1997
-      #if ENABLED(Y2_IS_TMC2130)
1998
-        SERIAL_ECHOPAIR(" Y2", stepperY2.getCurrent());
2064
+      #if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208)
2065
+        SERIAL_ECHOPAIR(" Y2 ", stepperY2.getCurrent());
1999 2066
       #endif
2000
-      #if ENABLED(Z2_IS_TMC2130)
2001
-        SERIAL_ECHOPAIR(" Z2", stepperZ2.getCurrent());
2067
+      #if ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208)
2068
+        SERIAL_ECHOPAIR(" Z2 ", stepperZ2.getCurrent());
2002 2069
       #endif
2003
-      #if ENABLED(E0_IS_TMC2130)
2004
-        SERIAL_ECHOPAIR(" E0", stepperE0.getCurrent());
2070
+      #if ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208)
2071
+        SERIAL_ECHOPAIR(" E0 ", stepperE0.getCurrent());
2005 2072
       #endif
2006
-      #if ENABLED(E1_IS_TMC2130)
2007
-        SERIAL_ECHOPAIR(" E1", stepperE1.getCurrent());
2073
+      #if ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208)
2074
+        SERIAL_ECHOPAIR(" E1 ", stepperE1.getCurrent());
2008 2075
       #endif
2009
-      #if ENABLED(E2_IS_TMC2130)
2010
-        SERIAL_ECHOPAIR(" E2", stepperE2.getCurrent());
2076
+      #if ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208)
2077
+        SERIAL_ECHOPAIR(" E2 ", stepperE2.getCurrent());
2011 2078
       #endif
2012
-      #if ENABLED(E3_IS_TMC2130)
2013
-        SERIAL_ECHOPAIR(" E3", stepperE3.getCurrent());
2079
+      #if ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208)
2080
+        SERIAL_ECHOPAIR(" E3 ", stepperE3.getCurrent());
2081
+      #endif
2082
+      #if ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208)
2083
+        SERIAL_ECHOPAIR(" E4 ", stepperE4.getCurrent());
2084
+      #endif
2085
+      SERIAL_EOL();
2086
+    #endif
2087
+
2088
+    /**
2089
+     * TMC2130 Sensorless homing thresholds
2090
+     */
2091
+    #if ENABLED(HAVE_TMC2130) && ENABLED(SENSORLESS_HOMING)
2092
+      if (!forReplay) {
2093
+        CONFIG_ECHO_START;
2094
+        SERIAL_ECHOLNPGM("Sensorless homing threshold:");
2095
+      }
2096
+      CONFIG_ECHO_START;
2097
+      SERIAL_ECHO("  M914");
2098
+      #if ENABLED(X_IS_TMC2130)
2099
+        SERIAL_ECHOPAIR(" X", stepperX.sgt());
2100
+      #endif
2101
+      #if ENABLED(X2_IS_TMC2130)
2102
+        SERIAL_ECHOPAIR(" X2 ", stepperX2.sgt());
2103
+      #endif
2104
+      #if ENABLED(Y_IS_TMC2130)
2105
+        SERIAL_ECHOPAIR(" Y", stepperY.sgt());
2106
+      #endif
2107
+      #if ENABLED(X2_IS_TMC2130)
2108
+        SERIAL_ECHOPAIR(" Y2 ", stepperY2.sgt());
2014 2109
       #endif
2015 2110
       SERIAL_EOL();
2016 2111
     #endif

+ 72
- 43
Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -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/example_configurations/Anet/A6/Configuration_adv.h View File

@@ -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/example_configurations/Anet/A8/Configuration_adv.h View File

@@ -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/example_configurations/BQ/Hephestos/Configuration_adv.h View File

@@ -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/example_configurations/BQ/Hephestos_2/Configuration_adv.h View File

@@ -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/example_configurations/BQ/WITBOX/Configuration_adv.h View File

@@ -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/example_configurations/Cartesio/Configuration_adv.h View File

@@ -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/example_configurations/Creality/CR-10/Configuration_adv.h View File

@@ -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/example_configurations/Felix/Configuration_adv.h View File

@@ -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/example_configurations/FolgerTech/i3-2020/Configuration_adv.h View File

@@ -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/example_configurations/Infitary/i3-M508/Configuration_adv.h View File

@@ -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/example_configurations/Malyan/M150/Configuration_adv.h View File

@@ -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/example_configurations/Micromake/C1/enhanced/Configuration_adv.h View File

@@ -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/example_configurations/RigidBot/Configuration_adv.h View File

@@ -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/example_configurations/SCARA/Configuration_adv.h View File

@@ -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/example_configurations/Sanguinololu/Configuration_adv.h View File

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

+ 72
- 43
Marlin/example_configurations/TinyBoy2/Configuration_adv.h View File

@@ -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/example_configurations/Velleman/K8200/Configuration_adv.h View File

@@ -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/example_configurations/Velleman/K8400/Configuration_adv.h View File

@@ -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/example_configurations/Wanhao/Duplicator 6/Configuration_adv.h View File

@@ -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/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -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/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -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/example_configurations/delta/generic/Configuration_adv.h View File

@@ -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/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -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/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -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/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -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/example_configurations/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -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/example_configurations/makibox/Configuration_adv.h View File

@@ -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/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -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/example_configurations/wt150/Configuration_adv.h View File

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

+ 66
- 1
Marlin/pinsDebug_list.h View File

@@ -776,4 +776,69 @@
776 776
 #if PIN_EXISTS(Z2_STEP)
777 777
   REPORT_NAME_DIGITAL(Z2_STEP_PIN, __LINE__ )
778 778
 #endif
779
-
779
+#if PIN_EXISTS(X_SERIAL_TX)
780
+  REPORT_NAME_DIGITAL(X_SERIAL_TX_PIN, __LINE__ )
781
+#endif
782
+#if PIN_EXISTS(X_SERIAL_RX)
783
+  REPORT_NAME_DIGITAL(X_SERIAL_RX_PIN, __LINE__ )
784
+#endif
785
+#if PIN_EXISTS(X2_SERIAL_TX)
786
+  REPORT_NAME_DIGITAL(X2_SERIAL_TX_PIN, __LINE__ )
787
+#endif
788
+#if PIN_EXISTS(X2_SERIAL_RX)
789
+  REPORT_NAME_DIGITAL(X2_SERIAL_RX_PIN, __LINE__ )
790
+#endif
791
+#if PIN_EXISTS(Y_SERIAL_TX)
792
+  REPORT_NAME_DIGITAL(Y_SERIAL_TX_PIN, __LINE__ )
793
+#endif
794
+#if PIN_EXISTS(Y_SERIAL_RX)
795
+  REPORT_NAME_DIGITAL(Y_SERIAL_RX_PIN, __LINE__ )
796
+#endif
797
+#if PIN_EXISTS(Y2_SERIAL_TX)
798
+  REPORT_NAME_DIGITAL(Y2_SERIAL_TX_PIN, __LINE__ )
799
+#endif
800
+#if PIN_EXISTS(Y2_SERIAL_RX)
801
+  REPORT_NAME_DIGITAL(Y2_SERIAL_RX_PIN, __LINE__ )
802
+#endif
803
+#if PIN_EXISTS(Z_SERIAL_TX)
804
+  REPORT_NAME_DIGITAL(Z_SERIAL_TX_PIN, __LINE__ )
805
+#endif
806
+#if PIN_EXISTS(Z_SERIAL_RX)
807
+  REPORT_NAME_DIGITAL(Z_SERIAL_RX_PIN, __LINE__ )
808
+#endif
809
+#if PIN_EXISTS(Z2_SERIAL_TX)
810
+  REPORT_NAME_DIGITAL(Z2_SERIAL_TX_PIN, __LINE__ )
811
+#endif
812
+#if PIN_EXISTS(Z2_SERIAL_RX)
813
+  REPORT_NAME_DIGITAL(Z2_SERIAL_RX_PIN, __LINE__ )
814
+#endif
815
+#if PIN_EXISTS(E0_SERIAL_TX)
816
+  REPORT_NAME_DIGITAL(E0_SERIAL_TX_PIN, __LINE__ )
817
+#endif
818
+#if PIN_EXISTS(E0_SERIAL_RX)
819
+  REPORT_NAME_DIGITAL(E0_SERIAL_RX_PIN, __LINE__ )
820
+#endif
821
+#if PIN_EXISTS(E1_SERIAL_TX)
822
+  REPORT_NAME_DIGITAL(E1_SERIAL_TX_PIN, __LINE__ )
823
+#endif
824
+#if PIN_EXISTS(E1_SERIAL_RX)
825
+  REPORT_NAME_DIGITAL(E1_SERIAL_RX_PIN, __LINE__ )
826
+#endif
827
+#if PIN_EXISTS(E2_SERIAL_TX)
828
+  REPORT_NAME_DIGITAL(E2_SERIAL_TX_PIN, __LINE__ )
829
+#endif
830
+#if PIN_EXISTS(E2_SERIAL_RX)
831
+  REPORT_NAME_DIGITAL(E2_SERIAL_RX_PIN, __LINE__ )
832
+#endif
833
+#if PIN_EXISTS(E3_SERIAL_TX)
834
+  REPORT_NAME_DIGITAL(E3_SERIAL_TX_PIN, __LINE__ )
835
+#endif
836
+#if PIN_EXISTS(E3_SERIAL_RX)
837
+  REPORT_NAME_DIGITAL(E3_SERIAL_RX_PIN, __LINE__ )
838
+#endif
839
+#if PIN_EXISTS(E4_SERIAL_TX)
840
+  REPORT_NAME_DIGITAL(E4_SERIAL_TX_PIN, __LINE__ )
841
+#endif
842
+#if PIN_EXISTS(E4_SERIAL_RX)
843
+  REPORT_NAME_DIGITAL(E4_SERIAL_RX_PIN, __LINE__ )
844
+#endif

+ 51
- 0
Marlin/pins_RAMPS.h View File

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

+ 1
- 1
Marlin/serial.h View File

@@ -26,7 +26,7 @@
26 26
 #include "MarlinConfig.h"
27 27
 
28 28
 #ifdef USBCON
29
-  #include "HardwareSerial.h"
29
+  #include <HardwareSerial.h>
30 30
   #if ENABLED(BLUETOOTH)
31 31
     #define MYSERIAL bluetoothSerial
32 32
   #else

+ 10
- 0
Marlin/stepper.cpp View File

@@ -965,6 +965,16 @@ void Stepper::init() {
965 965
     tmc2130_init();
966 966
   #endif
967 967
 
968
+  // Init TMC2208 Steppers
969
+  #if ENABLED(HAVE_TMC2208)
970
+    tmc2208_init();
971
+  #endif
972
+
973
+  // TRAMS, TMC2130 and TMC2208 advanced settings
974
+  #if HAS_TRINAMIC
975
+    TMC_ADV()
976
+  #endif
977
+
968 978
   // Init L6470 Steppers
969 979
   #if ENABLED(HAVE_L6470DRIVER)
970 980
     L6470_init();

+ 224
- 24
Marlin/stepper_indirection.cpp View File

@@ -129,6 +129,7 @@
129 129
 
130 130
   #include <SPI.h>
131 131
   #include <TMC2130Stepper.h>
132
+  #include "planner.h"
132 133
   #include "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,16 +172,16 @@
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
183
+    st.hysterisis_start(3);
184
+    st.hysterisis_end(2);
184 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
@@ -189,61 +190,260 @@
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
247 447
 
248 448
 //
249 449
 // L6470 Driver objects and inits

+ 28
- 0
Marlin/stepper_indirection.h View File

@@ -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)

+ 39
- 0
Marlin/tmc_macros.h View File

@@ -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

Loading…
Cancel
Save