Browse Source

Merge pull request #5981 from thinkyhead/rc_tmc2130_redo

TMC2130 Library: @teemuatlut replaces @makertum
Scott Lahteine 7 years ago
parent
commit
7c9e2e2a1a
25 changed files with 1991 additions and 3851 deletions
  1. 5
    3
      .travis.yml
  2. 85
    188
      Marlin/Configuration_adv.h
  3. 2
    2
      Marlin/Marlin.ino
  4. 176
    60
      Marlin/Marlin_main.cpp
  5. 214
    8
      Marlin/configuration_store.cpp
  6. 83
    186
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  7. 83
    186
      Marlin/example_configurations/Felix/Configuration_adv.h
  8. 83
    186
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  9. 83
    186
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  10. 83
    186
      Marlin/example_configurations/K8200/Configuration_adv.h
  11. 83
    186
      Marlin/example_configurations/K8400/Configuration_adv.h
  12. 83
    186
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  13. 83
    186
      Marlin/example_configurations/SCARA/Configuration_adv.h
  14. 83
    186
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  15. 83
    186
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  16. 83
    186
      Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h
  17. 83
    186
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  18. 83
    186
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  19. 83
    186
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  20. 83
    186
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  21. 83
    186
      Marlin/example_configurations/makibox/Configuration_adv.h
  22. 83
    186
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  23. 1
    1
      Marlin/stepper.cpp
  24. 75
    403
      Marlin/stepper_indirection.cpp
  25. 22
    24
      Marlin/stepper_indirection.h

+ 5
- 3
.travis.yml View File

47
   # - sudo mv TMC26XStepper /usr/local/share/arduino/libraries/TMC26XStepper
47
   # - sudo mv TMC26XStepper /usr/local/share/arduino/libraries/TMC26XStepper
48
   #
48
   #
49
   # Install: TMC2130 Stepper Motor Controller library
49
   # Install: TMC2130 Stepper Motor Controller library
50
-  - git clone https://github.com/MarlinFirmware/Trinamic_TMC2130.git
51
-  - sudo mv Trinamic_TMC2130/Trinamic_TMC2130 /usr/local/share/arduino/libraries/Trinamic_TMC2130
50
+  - git clone https://github.com/teemuatlut/TMC2130Stepper.git
51
+  - sudo mv TMC2130Stepper /usr/local/share/arduino/libraries/TMC2130Stepper
52
   #
52
   #
53
 before_script:
53
 before_script:
54
   #
54
   #
396
   # TMC2130 Config
396
   # TMC2130 Config
397
   #
397
   #
398
   - restore_configs
398
   - restore_configs
399
-  - opt_enable_adv HAVE_TMC2130DRIVER X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130 E0_IS_TMC2130
399
+  - opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130
400
+  - build_marlin
401
+  - opt_enable_adv AUTOMATIC_CURRENT_CONTROL STEALTHCHOP
400
   - build_marlin
402
   - build_marlin
401
   #
403
   #
402
   # tvrrug Config need to check board type for sanguino atmega644p
404
   # tvrrug Config need to check board type for sanguino atmega644p

+ 85
- 188
Marlin/Configuration_adv.h View File

761
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
762
 #endif
762
 #endif
763
 
763
 
764
-/******************************************************************************\
765
- * enable this section if you have TMC26X motor drivers.
766
- * you need to import the TMC26XStepper library into the Arduino IDE for this
767
- ******************************************************************************/
768
-
769
 // @section tmc
764
 // @section tmc
770
 
765
 
766
+/**
767
+ * Enable this section if you have TMC26X motor drivers.
768
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
769
+ * (https://github.com/trinamic/TMC26XStepper.git)
770
+ */
771
 //#define HAVE_TMCDRIVER
771
 //#define HAVE_TMCDRIVER
772
+
772
 #if ENABLED(HAVE_TMCDRIVER)
773
 #if ENABLED(HAVE_TMCDRIVER)
773
 
774
 
774
   //#define X_IS_TMC
775
   //#define X_IS_TMC
826
 
827
 
827
 // @section TMC2130
828
 // @section TMC2130
828
 
829
 
829
-
830
 /**
830
 /**
831
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
831
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
832
  *
832
  *
833
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
834
- * (https://github.com/makertum/Trinamic_TMC2130).
833
+ * You'll also need the TMC2130Stepper Arduino library
834
+ * (https://github.com/teemuatlut/TMC2130Stepper).
835
  *
835
  *
836
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
837
  * the hardware SPI interface on your board and define the required CS pins
837
  * the hardware SPI interface on your board and define the required CS pins
838
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
838
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
839
  */
839
  */
840
+//#define HAVE_TMC2130
840
 
841
 
841
-//#define HAVE_TMC2130DRIVER
842
-
843
-#if ENABLED(HAVE_TMC2130DRIVER)
842
+#if ENABLED(HAVE_TMC2130)
843
+  #define STEALTHCHOP
844
 
844
 
845
-  //#define TMC2130_ADVANCED_CONFIGURATION
845
+  /**
846
+   * Let Marlin automatically control stepper current.
847
+   * This is still an experimental feature.
848
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
849
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
850
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
851
+   */ 
852
+  //#define AUTOMATIC_CURRENT_CONTROL
853
+  #define CURRENT_STEP          50  // [mA]
854
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
846
 
855
 
847
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
856
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
848
   //#define X_IS_TMC2130
857
   //#define X_IS_TMC2130
856
   //#define E2_IS_TMC2130
865
   //#define E2_IS_TMC2130
857
   //#define E3_IS_TMC2130
866
   //#define E3_IS_TMC2130
858
 
867
 
859
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
860
-
861
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
862
-    // Enabled settings will be automatically applied to all axes specified above.
863
-    //
864
-    // Please read the TMC2130 datasheet:
865
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
866
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
867
-    //
868
-    // The following, uncommented settings are only suggestion.
869
-
870
-    /* GENERAL CONFIGURATION */
871
-
872
-    //#define GLOBAL_EN_PWM_MODE        0
873
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
874
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
875
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
876
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
877
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
878
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
879
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
880
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
881
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
882
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
883
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
884
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
885
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
886
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
887
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
888
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
889
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
890
-
891
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
892
-
893
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
894
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
895
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
896
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
897
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
898
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
899
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
900
-
901
-    /* SPI MODE CONFIGURATION */
902
-
903
-    //#define GLOBAL_XDIRECT            0
904
-
905
-    /* DCSTEP MINIMUM VELOCITY */
906
-
907
-    //#define GLOBAL_VDCMIN             0
908
-
909
-    /* MOTOR DRIVER CONFIGURATION*/
910
-
911
-    //#define GLOBAL_DEDGE              0
912
-    //#define GLOBAL_DISS2G             0
913
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
914
-    #define GLOBAL_MRES              16 // number of microsteps
915
-    #define GLOBAL_SYNC               1 // [0-15]
916
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
917
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
918
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
919
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
920
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
921
-    //#define GLOBAL_RNDTF              0
922
-    //#define GLOBAL_DISFDCC            0
923
-    //#define GLOBAL_FD                 0
924
-    //#define GLOBAL_HEND               0
925
-    //#define GLOBAL_HSTRT              0
926
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
927
-
928
-    //#define GLOBAL_SFILT              0
929
-    //#define GLOBAL_SGT                0
930
-    //#define GLOBAL_SEIMIN             0
931
-    //#define GLOBAL_SEDN               0
932
-    //#define GLOBAL_SEMAX              0
933
-    //#define GLOBAL_SEUP               0
934
-    //#define GLOBAL_SEMIN              0
935
-
936
-    //#define GLOBAL_DC_TIME            0
937
-    //#define GLOBAL_DC_SG              0
938
-
939
-    //#define GLOBAL_FREEWHEEL          0
940
-    //#define GLOBAL_PWM_SYMMETRIC      0
941
-    //#define GLOBAL_PWM_AUTOSCALE      0
942
-    //#define GLOBAL_PWM_FREQ           0
943
-    //#define GLOBAL_PWM_GRAD           0
944
-    //#define GLOBAL_PWM_AMPL           0
945
-
946
-    //#define GLOBAL_ENCM_CTRL          0
947
-
948
-  #else
949
-
950
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
951
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
952
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
953
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
954
-    #define X_MRES           16 // number of microsteps
955
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
956
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
957
-
958
-    #define X2_IHOLD         31
959
-    #define X2_IRUN          31
960
-    #define X2_IHOLDDELAY    15
961
-    #define X2_I_SCALE_ANALOG 1
962
-    #define X2_MRES          16
963
-    #define X2_TBL            1
964
-    #define X2_TOFF           8
965
-
966
-    #define Y_IHOLD          31
967
-    #define Y_IRUN           31
968
-    #define Y_IHOLDDELAY     15
969
-    #define Y_I_SCALE_ANALOG  1
970
-    #define Y_MRES           16
971
-    #define Y_TBL             1
972
-    #define Y_TOFF            8
973
-
974
-    #define Y2_IHOLD         31
975
-    #define Y2_IRUN          31
976
-    #define Y2_IHOLDDELAY    15
977
-    #define Y2_I_SCALE_ANALOG 1
978
-    #define Y2_MRES          16
979
-    #define Y2_TBL            1
980
-    #define Y2_TOFF           8
981
-
982
-    #define Z_IHOLD          31
983
-    #define Z_IRUN           31
984
-    #define Z_IHOLDDELAY     15
985
-    #define Z_I_SCALE_ANALOG  1
986
-    #define Z_MRES           16
987
-    #define Z_TBL             1
988
-    #define Z_TOFF            8
989
-
990
-    #define Z2_IHOLD         31
991
-    #define Z2_IRUN          31
992
-    #define Z2_IHOLDDELAY    15
993
-    #define Z2_I_SCALE_ANALOG 1
994
-    #define Z2_MRES          16
995
-    #define Z2_TBL            1
996
-    #define Z2_TOFF           8
997
-
998
-    #define E0_IHOLD         31
999
-    #define E0_IRUN          31
1000
-    #define E0_IHOLDDELAY    15
1001
-    #define E0_I_SCALE_ANALOG 1
1002
-    #define E0_MRES          16
1003
-    #define E0_TBL            1
1004
-    #define E0_TOFF           8
1005
-
1006
-    #define E1_IHOLD         31
1007
-    #define E1_IRUN          31
1008
-    #define E1_IHOLDDELAY    15
1009
-    #define E1_I_SCALE_ANALOG 1
1010
-    #define E1_MRES          16
1011
-    #define E1_TBL            1
1012
-    #define E1_TOFF           8
1013
-
1014
-    #define E2_IHOLD         31
1015
-    #define E2_IRUN          31
1016
-    #define E2_IHOLDDELAY    15
1017
-    #define E2_I_SCALE_ANALOG 1
1018
-    #define E2_MRES          16
1019
-    #define E2_TBL            1
1020
-    #define E2_TOFF           8
1021
-
1022
-    #define E3_IHOLD         31
1023
-    #define E3_IRUN          31
1024
-    #define E3_IHOLDDELAY    15
1025
-    #define E3_I_SCALE_ANALOG 1
1026
-    #define E3_MRES          16
1027
-    #define E3_TBL            1
1028
-    #define E3_TOFF           8
1029
-
1030
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1031
-
1032
-#endif // HAVE_TMC2130DRIVER
1033
-
1034
-// @section L6470
868
+  /**
869
+   * Stepper driver settings
870
+   */
871
+
872
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
873
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
874
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
875
+
876
+  #define X_MAX_CURRENT     1000  // rms current in mA
877
+  #define X_MICROSTEPS        16  // FULLSTEP..256
878
+  #define X_CHIP_SELECT       40  // Pin
879
+
880
+  #define Y_MAX_CURRENT     1000
881
+  #define Y_MICROSTEPS        16
882
+  #define Y_CHIP_SELECT       42
883
+
884
+  #define Z_MAX_CURRENT     1000
885
+  #define Z_MICROSTEPS        16
886
+  #define Z_CHIP_SELECT       65
887
+
888
+  //#define X2_MAX_CURRENT  1000
889
+  //#define X2_MICROSTEPS     16
890
+  //#define X2_CHIP_SELECT    -1
891
+
892
+  //#define Y2_MAX_CURRENT  1000
893
+  //#define Y2_MICROSTEPS     16
894
+  //#define Y2_CHIP_SELECT    -1
895
+
896
+  //#define Z2_MAX_CURRENT  1000
897
+  //#define Z2_MICROSTEPS     16
898
+  //#define Z2_CHIP_SELECT    -1
899
+
900
+  //#define E0_MAX_CURRENT  1000
901
+  //#define E0_MICROSTEPS     16
902
+  //#define E0_CHIP_SELECT    -1
903
+
904
+  //#define E1_MAX_CURRENT  1000
905
+  //#define E1_MICROSTEPS     16
906
+  //#define E1_CHIP_SELECT    -1
907
+
908
+  //#define E2_MAX_CURRENT  1000
909
+  //#define E2_MICROSTEPS     16
910
+  //#define E2_CHIP_SELECT    -1
911
+
912
+  //#define E3_MAX_CURRENT  1000
913
+  //#define E3_MICROSTEPS     16
914
+  //#define E3_CHIP_SELECT    -1
915
+
916
+  /**
917
+   * You can set your own advanced settings by filling in predefined functions.
918
+   * A list of available functions can be found on the library github page
919
+   * https://github.com/teemuatlut/TMC2130Stepper
920
+   *
921
+   * Example:
922
+   * #define TMC2130_ADV() { \
923
+   *   stepperX.diag0_temp_prewarn(1); \
924
+   *   stepperX.interpolate(0); \
925
+   * }
926
+   */
927
+  #define  TMC2130_ADV() {  }
928
+
929
+#endif // ENABLED(HAVE_TMC2130)
1035
 
930
 
1036
 /**
931
 /**
1037
  * Enable this section if you have L6470 motor drivers.
932
  * Enable this section if you have L6470 motor drivers.
1039
  * (https://github.com/ameyer/Arduino-L6470)
934
  * (https://github.com/ameyer/Arduino-L6470)
1040
  */
935
  */
1041
 
936
 
937
+// @section l6470
938
+
1042
 //#define HAVE_L6470DRIVER
939
 //#define HAVE_L6470DRIVER
1043
 #if ENABLED(HAVE_L6470DRIVER)
940
 #if ENABLED(HAVE_L6470DRIVER)
1044
 
941
 

+ 2
- 2
Marlin/Marlin.ino View File

61
   #include <TMC26XStepper.h>
61
   #include <TMC26XStepper.h>
62
 #endif
62
 #endif
63
 
63
 
64
-#if ENABLED(HAVE_TMC2130DRIVER)
64
+#if ENABLED(HAVE_TMC2130)
65
   #include <SPI.h>
65
   #include <SPI.h>
66
-  #include <Trinamic_TMC2130.h>
66
+  #include <TMC2130Stepper.h>
67
 #endif
67
 #endif
68
 
68
 
69
 #if ENABLED(HAVE_L6470DRIVER)
69
 #if ENABLED(HAVE_L6470DRIVER)

+ 176
- 60
Marlin/Marlin_main.cpp View File

189
  * M666 - Set delta endstop adjustment. (Requires DELTA)
189
  * M666 - Set delta endstop adjustment. (Requires DELTA)
190
  * M605 - Set dual x-carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
190
  * M605 - Set dual x-carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
191
  * M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)
191
  * M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)
192
+ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires HAVE_TMC2130)
192
  * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
193
  * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
193
  * M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
194
  * M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
194
  * M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
195
  * M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
195
  * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
196
  * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
197
+ * M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130)
198
+ * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130)
196
  * M350 - Set microstepping mode. (Requires digital microstepping pins.)
199
  * M350 - Set microstepping mode. (Requires digital microstepping pins.)
197
  * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
200
  * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
198
  *
201
  *
6127
  */
6130
  */
6128
 inline void gcode_M121() { endstops.enable_globally(false); }
6131
 inline void gcode_M121() { endstops.enable_globally(false); }
6129
 
6132
 
6130
-#if ENABLED(HAVE_TMC2130DRIVER)
6131
-
6132
-  /**
6133
-   * M122: Output Trinamic TMC2130 status to serial output. Very bad formatting.
6134
-   */
6135
-
6136
-  static void tmc2130_report(Trinamic_TMC2130 &stepr, const char *name) {
6137
-    stepr.read_STAT();
6138
-    SERIAL_PROTOCOL(name);
6139
-    SERIAL_PROTOCOL(": ");
6140
-    stepr.isReset() ? SERIAL_PROTOCOLPGM("RESET ") : SERIAL_PROTOCOLPGM("----- ");
6141
-    stepr.isError() ? SERIAL_PROTOCOLPGM("ERROR ") : SERIAL_PROTOCOLPGM("----- ");
6142
-    stepr.isStallguard() ? SERIAL_PROTOCOLPGM("SLGRD ") : SERIAL_PROTOCOLPGM("----- ");
6143
-    stepr.isStandstill() ? SERIAL_PROTOCOLPGM("STILL ") : SERIAL_PROTOCOLPGM("----- ");
6144
-    SERIAL_PROTOCOLLN(stepr.debug());
6145
-  }
6146
-
6147
-  inline void gcode_M122() {
6148
-    SERIAL_PROTOCOLLNPGM("Reporting TMC2130 status");
6149
-    #if ENABLED(X_IS_TMC2130)
6150
-      tmc2130_report(stepperX, "X");
6151
-    #endif
6152
-    #if ENABLED(X2_IS_TMC2130)
6153
-      tmc2130_report(stepperX2, "X2");
6154
-    #endif
6155
-    #if ENABLED(Y_IS_TMC2130)
6156
-      tmc2130_report(stepperY, "Y");
6157
-    #endif
6158
-    #if ENABLED(Y2_IS_TMC2130)
6159
-      tmc2130_report(stepperY2, "Y2");
6160
-    #endif
6161
-    #if ENABLED(Z_IS_TMC2130)
6162
-      tmc2130_report(stepperZ, "Z");
6163
-    #endif
6164
-    #if ENABLED(Z2_IS_TMC2130)
6165
-      tmc2130_report(stepperZ2, "Z2");
6166
-    #endif
6167
-    #if ENABLED(E0_IS_TMC2130)
6168
-      tmc2130_report(stepperE0, "E0");
6169
-    #endif
6170
-    #if ENABLED(E1_IS_TMC2130)
6171
-      tmc2130_report(stepperE1, "E1");
6172
-    #endif
6173
-    #if ENABLED(E2_IS_TMC2130)
6174
-      tmc2130_report(stepperE2, "E2");
6175
-    #endif
6176
-    #if ENABLED(E3_IS_TMC2130)
6177
-      tmc2130_report(stepperE3, "E3");
6178
-    #endif
6179
-  }
6180
-#endif // HAVE_TMC2130DRIVER
6181
-
6182
 #if ENABLED(BLINKM) || ENABLED(RGB_LED)
6133
 #if ENABLED(BLINKM) || ENABLED(RGB_LED)
6183
 
6134
 
6184
   void set_led_color(const uint8_t r, const uint8_t g, const uint8_t b) {
6135
   void set_led_color(const uint8_t r, const uint8_t g, const uint8_t b) {
7610
     SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
7561
     SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
7611
   }
7562
   }
7612
 
7563
 
7613
-#endif // M605
7564
+#endif // DUAL_NOZZLE_DUPLICATION_MODE
7614
 
7565
 
7615
 #if ENABLED(LIN_ADVANCE)
7566
 #if ENABLED(LIN_ADVANCE)
7616
   /**
7567
   /**
7637
       if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Automatic");
7588
       if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Automatic");
7638
     }
7589
     }
7639
   }
7590
   }
7640
-#endif
7591
+#endif // LIN_ADVANCE
7592
+
7593
+#if ENABLED(HAVE_TMC2130)
7594
+
7595
+  static void tmc2130_print_current(const int mA, const char name) {
7596
+    SERIAL_CHAR(name);
7597
+    SERIAL_ECHOPGM(" axis driver current: ");
7598
+    SERIAL_ECHOLN(mA);
7599
+  }
7600
+  static void tmc2130_set_current(const int mA, TMC2130Stepper &st, const char name) {
7601
+    tmc2130_print_current(mA, name);
7602
+    st.setCurrent(mA, 0.11, 0.5);
7603
+  }
7604
+  static void tmc2130_get_current(TMC2130Stepper &st, const char name) {
7605
+    tmc2130_print_current(st.getCurrent(), name);
7606
+  }
7607
+  static void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
7608
+    SERIAL_CHAR(name);
7609
+    SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
7610
+    serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
7611
+  }
7612
+  static void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
7613
+    st.clear_otpw();
7614
+    SERIAL_CHAR(name);
7615
+    SERIAL_ECHOLNPGM(" prewarn flag cleared");
7616
+  }
7617
+
7618
+  /**
7619
+   * M906: Set motor current in milliamps using axis codes X, Y, Z, E
7620
+   *
7621
+   * Report driver currents when no axis specified
7622
+   */
7623
+  inline void gcode_M906() {
7624
+    uint16_t values[NUM_AXIS];
7625
+    LOOP_XYZE(i)
7626
+      values[i] = code_seen(axis_codes[i]) ? code_value_int() : 0;
7627
+
7628
+    #if ENABLED(X_IS_TMC2130)
7629
+      if (values[X_AXIS]) tmc2130_set_current(values[X_AXIS], stepperX, 'X');
7630
+      else tmc2130_get_current(stepperX, 'X');
7631
+    #endif
7632
+    #if ENABLED(Y_IS_TMC2130)
7633
+      if (values[Y_AXIS]) tmc2130_set_current(values[Y_AXIS], stepperY, 'Y');
7634
+      else tmc2130_get_current(stepperY, 'Y');
7635
+    #endif
7636
+    #if ENABLED(Z_IS_TMC2130)
7637
+      if (values[Z_AXIS]) tmc2130_set_current(values[Z_AXIS], stepperZ, 'Z');
7638
+      else tmc2130_get_current(stepperZ, 'Z');
7639
+    #endif
7640
+    #if ENABLED(E0_IS_TMC2130)
7641
+      if (values[E_AXIS]) tmc2130_set_current(values[E_AXIS], stepperE0, 'E');
7642
+      else tmc2130_get_current(stepperE0, 'E');
7643
+    #endif
7644
+  }
7645
+
7646
+  /**
7647
+   * M911: Report TMC2130 stepper driver overtemperature pre-warn flag
7648
+   * The flag is held by the library and persist until manually cleared by M912
7649
+   */
7650
+  inline void gcode_M911() {
7651
+    #if ENABLED(X_IS_TMC2130)
7652
+      tmc2130_report_otpw(stepperX, 'X');
7653
+    #endif
7654
+    #if ENABLED(Y_IS_TMC2130)
7655
+      tmc2130_report_otpw(stepperY, 'Y');
7656
+    #endif
7657
+    #if ENABLED(Z_IS_TMC2130)
7658
+      tmc2130_report_otpw(stepperZ, 'Z');
7659
+    #endif
7660
+    #if ENABLED(E0_IS_TMC2130)
7661
+      tmc2130_report_otpw(stepperE0, 'E');
7662
+    #endif
7663
+  }
7664
+
7665
+  /**
7666
+   * M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
7667
+   */
7668
+  inline void gcode_M912() {
7669
+    #if ENABLED(X_IS_TMC2130)
7670
+      if (code_seen('X')) tmc2130_clear_otpw(stepperX, 'X');
7671
+    #endif
7672
+    #if ENABLED(Y_IS_TMC2130)
7673
+      if (code_seen('Y')) tmc2130_clear_otpw(stepperY, 'Y');
7674
+    #endif
7675
+    #if ENABLED(Z_IS_TMC2130)
7676
+      if (code_seen('Z')) tmc2130_clear_otpw(stepperZ, 'Z');
7677
+    #endif
7678
+    #if ENABLED(E0_IS_TMC2130)
7679
+      if (code_seen('E')) tmc2130_clear_otpw(stepperE0, 'E');
7680
+    #endif
7681
+  }
7682
+
7683
+#endif // HAVE_TMC2130
7641
 
7684
 
7642
 /**
7685
 /**
7643
  * M907: Set digital trimpot motor current using axis codes X, Y, Z, E, B, S
7686
  * M907: Set digital trimpot motor current using axis codes X, Y, Z, E, B, S
8600
         gcode_M121();
8643
         gcode_M121();
8601
         break;
8644
         break;
8602
 
8645
 
8603
-      #if ENABLED(HAVE_TMC2130DRIVER)
8604
-        case 122: // M122: Diagnose, used to debug TMC2130
8605
-          gcode_M122();
8606
-          break;
8607
-      #endif
8608
-
8609
       #if ENABLED(ULTIPANEL)
8646
       #if ENABLED(ULTIPANEL)
8610
 
8647
 
8611
         case 145: // M145: Set material heatup parameters
8648
         case 145: // M145: Set material heatup parameters
8882
           break;
8919
           break;
8883
       #endif
8920
       #endif
8884
 
8921
 
8922
+      #if ENABLED(HAVE_TMC2130)
8923
+        case 906: // M906: Set motor current in milliamps using axis codes X, Y, Z, E
8924
+          gcode_M906();
8925
+          break;
8926
+      #endif
8927
+
8885
       case 907: // M907: Set digital trimpot motor current using axis codes.
8928
       case 907: // M907: Set digital trimpot motor current using axis codes.
8886
         gcode_M907();
8929
         gcode_M907();
8887
         break;
8930
         break;
8906
 
8949
 
8907
       #endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
8950
       #endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
8908
 
8951
 
8952
+      #if ENABLED(HAVE_TMC2130)
8953
+        case 911: // M911: Report TMC2130 prewarn triggered flags
8954
+          gcode_M911();
8955
+          break;
8956
+
8957
+        case 912: // M911: Clear TMC2130 prewarn triggered flags
8958
+          gcode_M912();
8959
+          break;
8960
+      #endif
8961
+
8909
       #if HAS_MICROSTEPS
8962
       #if HAS_MICROSTEPS
8910
 
8963
 
8911
         case 350: // M350: Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
8964
         case 350: // M350: Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
10169
   disable_e3();
10222
   disable_e3();
10170
 }
10223
 }
10171
 
10224
 
10225
+#if ENABLED(AUTOMATIC_CURRENT_CONTROL)
10226
+
10227
+  void automatic_current_control(const TMC2130Stepper &st) {
10228
+    #if CURRENT_STEP > 0
10229
+      const bool is_otpw = st.checkOT(), // Check otpw even if we don't adjust. Allows for flag inspection.
10230
+                 is_otpw_triggered = st.getOTPW();
10231
+
10232
+      if (!is_otpw && !is_otpw_triggered) {
10233
+        // OTPW bit not triggered yet -> Increase current
10234
+        const uint16_t current = st.getCurrent() + CURRENT_STEP;
10235
+        if (current <= AUTO_ADJUST_MAX) st.SilentStepStick2130(current);
10236
+      }
10237
+      else if (is_otpw && is_otpw_triggered) {
10238
+        // OTPW bit triggered, triggered flag raised -> Decrease current
10239
+        st.SilentStepStick2130((float)st.getCurrent() - CURRENT_STEP);
10240
+      }
10241
+      // OTPW bit cleared (we've cooled down), triggered flag still raised until manually cleared -> Do nothing, we're good
10242
+    #endif
10243
+  }
10244
+
10245
+  void checkOverTemp() {
10246
+    static millis_t next_cOT = 0;
10247
+    if (ELAPSED(millis(), next_cOT)) {
10248
+      next_cOT = millis() + 5000;
10249
+      #if ENABLED(X_IS_TMC2130)
10250
+        automatic_current_control(stepperX);
10251
+      #endif
10252
+      #if ENABLED(Y_IS_TMC2130)
10253
+        automatic_current_control(stepperY);
10254
+      #endif
10255
+      #if ENABLED(Z_IS_TMC2130)
10256
+        automatic_current_control(stepperZ);
10257
+      #endif
10258
+      #if ENABLED(X2_IS_TMC2130)
10259
+        automatic_current_control(stepperX2);
10260
+      #endif
10261
+      #if ENABLED(Y2_IS_TMC2130)
10262
+        automatic_current_control(stepperY2);
10263
+      #endif
10264
+      #if ENABLED(Z2_IS_TMC2130)
10265
+        automatic_current_control(stepperZ2);
10266
+      #endif
10267
+      #if ENABLED(E0_IS_TMC2130)
10268
+        automatic_current_control(stepperE0);
10269
+      #endif
10270
+      #if ENABLED(E1_IS_TMC2130)
10271
+        automatic_current_control(stepperE1);
10272
+      #endif
10273
+      #if ENABLED(E2_IS_TMC2130)
10274
+        automatic_current_control(stepperE2);
10275
+      #endif
10276
+      #if ENABLED(E3_IS_TMC2130)
10277
+        automatic_current_control(stepperE3);
10278
+      #endif
10279
+    }
10280
+  }
10281
+
10282
+#endif // AUTOMATIC_CURRENT_CONTROL
10283
+
10172
 /**
10284
 /**
10173
  * Manage several activities:
10285
  * Manage several activities:
10174
  *  - Check for Filament Runout
10286
  *  - Check for Filament Runout
10360
     handle_status_leds();
10472
     handle_status_leds();
10361
   #endif
10473
   #endif
10362
 
10474
 
10475
+  #if ENABLED(AUTOMATIC_CURRENT_CONTROL)
10476
+    checkOverTemp();
10477
+  #endif
10478
+
10363
   planner.check_axes_activity();
10479
   planner.check_axes_activity();
10364
 }
10480
 }
10365
 
10481
 

+ 214
- 8
Marlin/configuration_store.cpp View File

36
  *
36
  *
37
  */
37
  */
38
 
38
 
39
-#define EEPROM_VERSION "V29"
39
+#define EEPROM_VERSION "V30"
40
 
40
 
41
 // Change EEPROM version if these are changed:
41
 // Change EEPROM version if these are changed:
42
 #define EEPROM_OFFSET 100
42
 #define EEPROM_OFFSET 100
43
 
43
 
44
 /**
44
 /**
45
- * V29 EEPROM Layout:
45
+ * V30 EEPROM Layout:
46
  *
46
  *
47
  *  100  Version                                   (char x4)
47
  *  100  Version                                   (char x4)
48
  *  104  EEPROM Checksum                           (uint16_t)
48
  *  104  EEPROM Checksum                           (uint16_t)
128
  *  509  M200 D    volumetric_enabled               (bool)
128
  *  509  M200 D    volumetric_enabled               (bool)
129
  *  510  M200 T D  filament_size                    (float x4) (T0..3)
129
  *  510  M200 T D  filament_size                    (float x4) (T0..3)
130
  *
130
  *
131
- *  526                                Minimum end-point
132
- * 1847 (526 + 36 + 9 + 288 + 988)     Maximum end-point
131
+ * TMC2130:                                         20 bytes
132
+ *  526  M906 X    TMC2130  X-stepper current       (uint16_t)
133
+ *  528  M906 Y    TMC2130  Y-stepper current       (uint16_t)
134
+ *  530  M906 Z    TMC2130  Z-stepper current       (uint16_t)
135
+ *  532  M906 X2   TMC2130 X2-stepper current       (uint16_t)
136
+ *  534  M906 Y2   TMC2130 Y2-stepper current       (uint16_t)
137
+ *  536  M906 Z2   TMC2130 Z2-stepper current       (uint16_t)
138
+ *  538  M906 E0   TMC2130 E0-stepper current       (uint16_t)
139
+ *  540  M906 E1   TMC2130 E1-stepper current       (uint16_t)
140
+ *  542  M906 E2   TMC2130 E2-stepper current       (uint16_t)
141
+ *  544  M906 E3   TMC2130 E3-stepper current       (uint16_t)
142
+ *
143
+ *  546                                Minimum end-point
144
+ * 1867 (546 + 36 + 9 + 288 + 988)     Maximum end-point
133
  *
145
  *
134
  */
146
  */
135
 #include "Marlin.h"
147
 #include "Marlin.h"
144
   #include "mesh_bed_leveling.h"
156
   #include "mesh_bed_leveling.h"
145
 #endif
157
 #endif
146
 
158
 
159
+#if ENABLED(HAVE_TMC2130)
160
+  #include "stepper_indirection.h"
161
+#endif
162
+
147
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
163
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
148
   extern void bed_level_virt_interpolate();
164
   extern void bed_level_virt_interpolate();
149
 #endif
165
 #endif
432
       EEPROM_WRITE(dummy);
448
       EEPROM_WRITE(dummy);
433
     }
449
     }
434
 
450
 
451
+    // Save TCM2130 Configuration, and placeholder values
452
+    uint16_t val;
453
+    #if ENABLED(HAVE_TMC2130)
454
+      #if ENABLED(X_IS_TMC2130)
455
+        val = stepperX.getCurrent();
456
+      #else
457
+        val = 0;
458
+      #endif
459
+      EEPROM_WRITE(val);
460
+      #if ENABLED(Y_IS_TMC2130)
461
+        val = stepperY.getCurrent();
462
+      #else
463
+        val = 0;
464
+      #endif
465
+      EEPROM_WRITE(val);
466
+      #if ENABLED(Z_IS_TMC2130)
467
+        val = stepperZ.getCurrent();
468
+      #else
469
+        val = 0;
470
+      #endif
471
+      EEPROM_WRITE(val);
472
+      #if ENABLED(X2_IS_TMC2130)
473
+        val = stepperX2.getCurrent();
474
+      #else
475
+        val = 0;
476
+      #endif
477
+      EEPROM_WRITE(val);
478
+      #if ENABLED(Y2_IS_TMC2130)
479
+        val = stepperY2.getCurrent();
480
+      #else
481
+        val = 0;
482
+      #endif
483
+      EEPROM_WRITE(val);
484
+      #if ENABLED(Z2_IS_TMC2130)
485
+        val = stepperZ2.getCurrent();
486
+      #else
487
+        val = 0;
488
+      #endif
489
+      EEPROM_WRITE(val);
490
+      #if ENABLED(E0_IS_TMC2130)
491
+        val = stepperE0.getCurrent();
492
+      #else
493
+        val = 0;
494
+      #endif
495
+      EEPROM_WRITE(val);
496
+      #if ENABLED(E1_IS_TMC2130)
497
+        val = stepperE1.getCurrent();
498
+      #else
499
+        val = 0;
500
+      #endif
501
+      EEPROM_WRITE(val);
502
+      #if ENABLED(E2_IS_TMC2130)
503
+        val = stepperE2.getCurrent();
504
+      #else
505
+        val = 0;
506
+      #endif
507
+      EEPROM_WRITE(val);
508
+      #if ENABLED(E3_IS_TMC2130)
509
+        val = stepperE3.getCurrent();
510
+      #else
511
+        val = 0;
512
+      #endif
513
+      EEPROM_WRITE(val);
514
+    #else
515
+      val = 0;
516
+      for (uint8_t q = 0; q < 10; ++q) EEPROM_WRITE(val);
517
+    #endif
518
+
435
     if (!eeprom_write_error) {
519
     if (!eeprom_write_error) {
436
 
520
 
437
-      uint16_t final_checksum = eeprom_checksum,
438
-               eeprom_size = eeprom_index;
521
+      const uint16_t final_checksum = eeprom_checksum,
522
+                     eeprom_size = eeprom_index;
439
 
523
 
440
       // Write the EEPROM header
524
       // Write the EEPROM header
441
       eeprom_index = EEPROM_OFFSET;
525
       eeprom_index = EEPROM_OFFSET;
684
         if (q < COUNT(filament_size)) filament_size[q] = dummy;
768
         if (q < COUNT(filament_size)) filament_size[q] = dummy;
685
       }
769
       }
686
 
770
 
771
+      uint16_t val;
772
+      #if ENABLED(HAVE_TMC2130)
773
+        EEPROM_READ(val);
774
+        #if ENABLED(X_IS_TMC2130)
775
+          stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
776
+        #endif
777
+        EEPROM_READ(val);
778
+        #if ENABLED(Y_IS_TMC2130)
779
+          stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
780
+        #endif
781
+        EEPROM_READ(val);
782
+        #if ENABLED(Z_IS_TMC2130)
783
+          stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
784
+        #endif
785
+        EEPROM_READ(val);
786
+        #if ENABLED(X2_IS_TMC2130)
787
+          stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
788
+        #endif
789
+        EEPROM_READ(val);
790
+        #if ENABLED(Y2_IS_TMC2130)
791
+          stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
792
+        #endif
793
+        EEPROM_READ(val);
794
+        #if ENABLED(Z2_IS_TMC2130)
795
+          stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
796
+        #endif
797
+        EEPROM_READ(val);
798
+        #if ENABLED(E0_IS_TMC2130)
799
+          stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
800
+        #endif
801
+        EEPROM_READ(val);
802
+        #if ENABLED(E1_IS_TMC2130)
803
+          stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
804
+        #endif
805
+        EEPROM_READ(val);
806
+        #if ENABLED(E2_IS_TMC2130)
807
+          stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
808
+        #endif
809
+        EEPROM_READ(val);
810
+        #if ENABLED(E3_IS_TMC2130)
811
+          stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
812
+        #endif
813
+      #else
814
+        for (uint8_t q = 0; q < 10; q++) EEPROM_READ(val);
815
+      #endif
816
+
687
       if (eeprom_checksum == stored_checksum) {
817
       if (eeprom_checksum == stored_checksum) {
688
         if (eeprom_read_error)
818
         if (eeprom_read_error)
689
           Config_ResetDefault();
819
           Config_ResetDefault();
852
     #endif
982
     #endif
853
   );
983
   );
854
 
984
 
985
+  #if ENABLED(HAVE_TMC2130)
986
+    #if ENABLED(X_IS_TMC2130)
987
+      stepperX.setCurrent(X_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
988
+    #endif
989
+    #if ENABLED(Y_IS_TMC2130)
990
+      stepperY.setCurrent(Y_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
991
+    #endif
992
+    #if ENABLED(Z_IS_TMC2130)
993
+      stepperZ.setCurrent(Z_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
994
+    #endif
995
+    #if ENABLED(X2_IS_TMC2130)
996
+      stepperX2.setCurrent(X2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
997
+    #endif
998
+    #if ENABLED(Y2_IS_TMC2130)
999
+      stepperY2.setCurrent(Y2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1000
+    #endif
1001
+    #if ENABLED(Z2_IS_TMC2130)
1002
+      stepperZ2.setCurrent(Z2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1003
+    #endif
1004
+    #if ENABLED(E0_IS_TMC2130)
1005
+      stepperE0.setCurrent(E0_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1006
+    #endif
1007
+    #if ENABLED(E1_IS_TMC2130)
1008
+      stepperE1.setCurrent(E1_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1009
+    #endif
1010
+    #if ENABLED(E2_IS_TMC2130)
1011
+      stepperE2.setCurrent(E2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1012
+    #endif
1013
+    #if ENABLED(E3_IS_TMC2130)
1014
+      stepperE3.setCurrent(E3_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
1015
+    #endif
1016
+  #endif
1017
+
855
   Config_Postprocess();
1018
   Config_Postprocess();
856
 
1019
 
857
   SERIAL_ECHO_START;
1020
   SERIAL_ECHO_START;
1184
      * Auto Bed Leveling
1347
      * Auto Bed Leveling
1185
      */
1348
      */
1186
     #if HAS_BED_PROBE
1349
     #if HAS_BED_PROBE
1350
+      CONFIG_ECHO_START;
1187
       if (!forReplay) {
1351
       if (!forReplay) {
1188
-        CONFIG_ECHO_START;
1189
         SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");
1352
         SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");
1353
+        CONFIG_ECHO_START;
1190
       }
1354
       }
1191
-      CONFIG_ECHO_START;
1192
       SERIAL_ECHOPAIR("  M851 Z", zprobe_zoffset);
1355
       SERIAL_ECHOPAIR("  M851 Z", zprobe_zoffset);
1193
       SERIAL_EOL;
1356
       SERIAL_EOL;
1194
     #endif
1357
     #endif
1358
+
1359
+    /**
1360
+     * TMC2130 stepper driver current
1361
+     */
1362
+    #if ENABLED(HAVE_TMC2130)
1363
+      CONFIG_ECHO_START;
1364
+      if (!forReplay) {
1365
+        SERIAL_ECHOLNPGM("Stepper driver current:");
1366
+        CONFIG_ECHO_START;
1367
+      }
1368
+      SERIAL_ECHO("  M906");
1369
+      #if ENABLED(X_IS_TMC2130)
1370
+        SERIAL_ECHOPAIR(" X", stepperX.getCurrent());
1371
+      #endif
1372
+      #if ENABLED(Y_IS_TMC2130)
1373
+        SERIAL_ECHOPAIR(" Y", stepperY.getCurrent());
1374
+      #endif
1375
+      #if ENABLED(Z_IS_TMC2130)
1376
+        SERIAL_ECHOPAIR(" Z", stepperZ.getCurrent());
1377
+      #endif
1378
+      #if ENABLED(X2_IS_TMC2130)
1379
+        SERIAL_ECHOPAIR(" X2", stepperX2.getCurrent());
1380
+      #endif
1381
+      #if ENABLED(Y2_IS_TMC2130)
1382
+        SERIAL_ECHOPAIR(" Y2", stepperY2.getCurrent());
1383
+      #endif
1384
+      #if ENABLED(Z2_IS_TMC2130)
1385
+        SERIAL_ECHOPAIR(" Z2", stepperZ2.getCurrent());
1386
+      #endif
1387
+      #if ENABLED(E0_IS_TMC2130)
1388
+        SERIAL_ECHOPAIR(" E0", stepperE0.getCurrent());
1389
+      #endif
1390
+      #if ENABLED(E1_IS_TMC2130)
1391
+        SERIAL_ECHOPAIR(" E1", stepperE1.getCurrent());
1392
+      #endif
1393
+      #if ENABLED(E2_IS_TMC2130)
1394
+        SERIAL_ECHOPAIR(" E2", stepperE2.getCurrent());
1395
+      #endif
1396
+      #if ENABLED(E3_IS_TMC2130)
1397
+        SERIAL_ECHOPAIR(" E3", stepperE3.getCurrent());
1398
+      #endif
1399
+      SERIAL_EOL;
1400
+    #endif
1195
   }
1401
   }
1196
 
1402
 
1197
 #endif // !DISABLE_M503
1403
 #endif // !DISABLE_M503

+ 83
- 186
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/Felix/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

741
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
741
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
742
 #endif
742
 #endif
743
 
743
 
744
-/******************************************************************************\
745
- * enable this section if you have TMC26X motor drivers.
746
- * you need to import the TMC26XStepper library into the Arduino IDE for this
747
- ******************************************************************************/
748
-
749
 // @section tmc
744
 // @section tmc
750
 
745
 
746
+/**
747
+ * Enable this section if you have TMC26X motor drivers.
748
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
749
+ * (https://github.com/trinamic/TMC26XStepper.git)
750
+ */
751
 //#define HAVE_TMCDRIVER
751
 //#define HAVE_TMCDRIVER
752
+
752
 #if ENABLED(HAVE_TMCDRIVER)
753
 #if ENABLED(HAVE_TMCDRIVER)
753
 
754
 
754
   //#define X_IS_TMC
755
   //#define X_IS_TMC
806
 
807
 
807
 // @section TMC2130
808
 // @section TMC2130
808
 
809
 
809
-
810
 /**
810
 /**
811
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
811
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
812
  *
812
  *
813
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
814
- * (https://github.com/makertum/Trinamic_TMC2130).
813
+ * You'll also need the TMC2130Stepper Arduino library
814
+ * (https://github.com/teemuatlut/TMC2130Stepper).
815
  *
815
  *
816
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
816
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
817
  * the hardware SPI interface on your board and define the required CS pins
817
  * the hardware SPI interface on your board and define the required CS pins
818
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
818
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
819
  */
819
  */
820
+//#define HAVE_TMC2130
820
 
821
 
821
-//#define HAVE_TMC2130DRIVER
822
-
823
-#if ENABLED(HAVE_TMC2130DRIVER)
822
+#if ENABLED(HAVE_TMC2130)
823
+  #define STEALTHCHOP
824
 
824
 
825
-  //#define TMC2130_ADVANCED_CONFIGURATION
825
+  /**
826
+   * Let Marlin automatically control stepper current.
827
+   * This is still an experimental feature.
828
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
829
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
830
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
831
+   */ 
832
+  //#define AUTOMATIC_CURRENT_CONTROL
833
+  #define CURRENT_STEP          50  // [mA]
834
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
826
 
835
 
827
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
836
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
828
   //#define X_IS_TMC2130
837
   //#define X_IS_TMC2130
836
   //#define E2_IS_TMC2130
845
   //#define E2_IS_TMC2130
837
   //#define E3_IS_TMC2130
846
   //#define E3_IS_TMC2130
838
 
847
 
839
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
840
-
841
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
842
-    // Enabled settings will be automatically applied to all axes specified above.
843
-    //
844
-    // Please read the TMC2130 datasheet:
845
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
846
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
847
-    //
848
-    // The following, uncommented settings are only suggestion.
849
-
850
-    /* GENERAL CONFIGURATION */
851
-
852
-    //#define GLOBAL_EN_PWM_MODE        0
853
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
854
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
855
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
856
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
857
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
858
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
859
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
860
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
861
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
862
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
863
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
864
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
865
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
866
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
867
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
868
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
869
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
870
-
871
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
872
-
873
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
874
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
875
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
876
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
877
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
878
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
879
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
880
-
881
-    /* SPI MODE CONFIGURATION */
882
-
883
-    //#define GLOBAL_XDIRECT            0
884
-
885
-    /* DCSTEP MINIMUM VELOCITY */
886
-
887
-    //#define GLOBAL_VDCMIN             0
888
-
889
-    /* MOTOR DRIVER CONFIGURATION*/
890
-
891
-    //#define GLOBAL_DEDGE              0
892
-    //#define GLOBAL_DISS2G             0
893
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
894
-    #define GLOBAL_MRES              16 // number of microsteps
895
-    #define GLOBAL_SYNC               1 // [0-15]
896
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
897
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
898
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
899
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
900
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
901
-    //#define GLOBAL_RNDTF              0
902
-    //#define GLOBAL_DISFDCC            0
903
-    //#define GLOBAL_FD                 0
904
-    //#define GLOBAL_HEND               0
905
-    //#define GLOBAL_HSTRT              0
906
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
907
-
908
-    //#define GLOBAL_SFILT              0
909
-    //#define GLOBAL_SGT                0
910
-    //#define GLOBAL_SEIMIN             0
911
-    //#define GLOBAL_SEDN               0
912
-    //#define GLOBAL_SEMAX              0
913
-    //#define GLOBAL_SEUP               0
914
-    //#define GLOBAL_SEMIN              0
915
-
916
-    //#define GLOBAL_DC_TIME            0
917
-    //#define GLOBAL_DC_SG              0
918
-
919
-    //#define GLOBAL_FREEWHEEL          0
920
-    //#define GLOBAL_PWM_SYMMETRIC      0
921
-    //#define GLOBAL_PWM_AUTOSCALE      0
922
-    //#define GLOBAL_PWM_FREQ           0
923
-    //#define GLOBAL_PWM_GRAD           0
924
-    //#define GLOBAL_PWM_AMPL           0
925
-
926
-    //#define GLOBAL_ENCM_CTRL          0
927
-
928
-  #else
929
-
930
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
931
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
932
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
933
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
934
-    #define X_MRES           16 // number of microsteps
935
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
936
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
937
-
938
-    #define X2_IHOLD         31
939
-    #define X2_IRUN          31
940
-    #define X2_IHOLDDELAY    15
941
-    #define X2_I_SCALE_ANALOG 1
942
-    #define X2_MRES          16
943
-    #define X2_TBL            1
944
-    #define X2_TOFF           8
945
-
946
-    #define Y_IHOLD          31
947
-    #define Y_IRUN           31
948
-    #define Y_IHOLDDELAY     15
949
-    #define Y_I_SCALE_ANALOG  1
950
-    #define Y_MRES           16
951
-    #define Y_TBL             1
952
-    #define Y_TOFF            8
953
-
954
-    #define Y2_IHOLD         31
955
-    #define Y2_IRUN          31
956
-    #define Y2_IHOLDDELAY    15
957
-    #define Y2_I_SCALE_ANALOG 1
958
-    #define Y2_MRES          16
959
-    #define Y2_TBL            1
960
-    #define Y2_TOFF           8
961
-
962
-    #define Z_IHOLD          31
963
-    #define Z_IRUN           31
964
-    #define Z_IHOLDDELAY     15
965
-    #define Z_I_SCALE_ANALOG  1
966
-    #define Z_MRES           16
967
-    #define Z_TBL             1
968
-    #define Z_TOFF            8
969
-
970
-    #define Z2_IHOLD         31
971
-    #define Z2_IRUN          31
972
-    #define Z2_IHOLDDELAY    15
973
-    #define Z2_I_SCALE_ANALOG 1
974
-    #define Z2_MRES          16
975
-    #define Z2_TBL            1
976
-    #define Z2_TOFF           8
977
-
978
-    #define E0_IHOLD         31
979
-    #define E0_IRUN          31
980
-    #define E0_IHOLDDELAY    15
981
-    #define E0_I_SCALE_ANALOG 1
982
-    #define E0_MRES          16
983
-    #define E0_TBL            1
984
-    #define E0_TOFF           8
985
-
986
-    #define E1_IHOLD         31
987
-    #define E1_IRUN          31
988
-    #define E1_IHOLDDELAY    15
989
-    #define E1_I_SCALE_ANALOG 1
990
-    #define E1_MRES          16
991
-    #define E1_TBL            1
992
-    #define E1_TOFF           8
993
-
994
-    #define E2_IHOLD         31
995
-    #define E2_IRUN          31
996
-    #define E2_IHOLDDELAY    15
997
-    #define E2_I_SCALE_ANALOG 1
998
-    #define E2_MRES          16
999
-    #define E2_TBL            1
1000
-    #define E2_TOFF           8
1001
-
1002
-    #define E3_IHOLD         31
1003
-    #define E3_IRUN          31
1004
-    #define E3_IHOLDDELAY    15
1005
-    #define E3_I_SCALE_ANALOG 1
1006
-    #define E3_MRES          16
1007
-    #define E3_TBL            1
1008
-    #define E3_TOFF           8
1009
-
1010
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1011
-
1012
-#endif // HAVE_TMC2130DRIVER
848
+  /**
849
+   * Stepper driver settings
850
+   */
851
+
852
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
853
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
854
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
855
+
856
+  #define X_MAX_CURRENT     1000  // rms current in mA
857
+  #define X_MICROSTEPS        16  // FULLSTEP..256
858
+  #define X_CHIP_SELECT       40  // Pin
859
+
860
+  #define Y_MAX_CURRENT     1000
861
+  #define Y_MICROSTEPS        16
862
+  #define Y_CHIP_SELECT       42
863
+
864
+  #define Z_MAX_CURRENT     1000
865
+  #define Z_MICROSTEPS        16
866
+  #define Z_CHIP_SELECT       65
867
+
868
+  //#define X2_MAX_CURRENT  1000
869
+  //#define X2_MICROSTEPS     16
870
+  //#define X2_CHIP_SELECT    -1
871
+
872
+  //#define Y2_MAX_CURRENT  1000
873
+  //#define Y2_MICROSTEPS     16
874
+  //#define Y2_CHIP_SELECT    -1
875
+
876
+  //#define Z2_MAX_CURRENT  1000
877
+  //#define Z2_MICROSTEPS     16
878
+  //#define Z2_CHIP_SELECT    -1
879
+
880
+  //#define E0_MAX_CURRENT  1000
881
+  //#define E0_MICROSTEPS     16
882
+  //#define E0_CHIP_SELECT    -1
883
+
884
+  //#define E1_MAX_CURRENT  1000
885
+  //#define E1_MICROSTEPS     16
886
+  //#define E1_CHIP_SELECT    -1
887
+
888
+  //#define E2_MAX_CURRENT  1000
889
+  //#define E2_MICROSTEPS     16
890
+  //#define E2_CHIP_SELECT    -1
891
+
892
+  //#define E3_MAX_CURRENT  1000
893
+  //#define E3_MICROSTEPS     16
894
+  //#define E3_CHIP_SELECT    -1
895
+
896
+  /**
897
+   * You can set your own advanced settings by filling in predefined functions.
898
+   * A list of available functions can be found on the library github page
899
+   * https://github.com/teemuatlut/TMC2130Stepper
900
+   *
901
+   * Example:
902
+   * #define TMC2130_ADV() { \
903
+   *   stepperX.diag0_temp_prewarn(1); \
904
+   *   stepperX.interpolate(0); \
905
+   * }
906
+   */
907
+  #define  TMC2130_ADV() {  }
908
+
909
+#endif // ENABLED(HAVE_TMC2130)
1013
 
910
 
1014
 // @section L6470
911
 // @section L6470
1015
 
912
 

+ 83
- 186
Marlin/example_configurations/K8200/Configuration_adv.h View File

771
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
771
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
772
 #endif
772
 #endif
773
 
773
 
774
-/******************************************************************************\
775
- * enable this section if you have TMC26X motor drivers.
776
- * you need to import the TMC26XStepper library into the Arduino IDE for this
777
- ******************************************************************************/
778
-
779
 // @section tmc
774
 // @section tmc
780
 
775
 
776
+/**
777
+ * Enable this section if you have TMC26X motor drivers.
778
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
779
+ * (https://github.com/trinamic/TMC26XStepper.git)
780
+ */
781
 //#define HAVE_TMCDRIVER
781
 //#define HAVE_TMCDRIVER
782
+
782
 #if ENABLED(HAVE_TMCDRIVER)
783
 #if ENABLED(HAVE_TMCDRIVER)
783
 
784
 
784
   //#define X_IS_TMC
785
   //#define X_IS_TMC
836
 
837
 
837
 // @section TMC2130
838
 // @section TMC2130
838
 
839
 
839
-
840
 /**
840
 /**
841
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
841
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
842
  *
842
  *
843
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
844
- * (https://github.com/makertum/Trinamic_TMC2130).
843
+ * You'll also need the TMC2130Stepper Arduino library
844
+ * (https://github.com/teemuatlut/TMC2130Stepper).
845
  *
845
  *
846
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
846
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
847
  * the hardware SPI interface on your board and define the required CS pins
847
  * the hardware SPI interface on your board and define the required CS pins
848
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
848
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
849
  */
849
  */
850
+//#define HAVE_TMC2130
850
 
851
 
851
-//#define HAVE_TMC2130DRIVER
852
-
853
-#if ENABLED(HAVE_TMC2130DRIVER)
852
+#if ENABLED(HAVE_TMC2130)
853
+  #define STEALTHCHOP
854
 
854
 
855
-  //#define TMC2130_ADVANCED_CONFIGURATION
855
+  /**
856
+   * Let Marlin automatically control stepper current.
857
+   * This is still an experimental feature.
858
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
859
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
860
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
861
+   */ 
862
+  //#define AUTOMATIC_CURRENT_CONTROL
863
+  #define CURRENT_STEP          50  // [mA]
864
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
856
 
865
 
857
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
866
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
858
   //#define X_IS_TMC2130
867
   //#define X_IS_TMC2130
866
   //#define E2_IS_TMC2130
875
   //#define E2_IS_TMC2130
867
   //#define E3_IS_TMC2130
876
   //#define E3_IS_TMC2130
868
 
877
 
869
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
870
-
871
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
872
-    // Enabled settings will be automatically applied to all axes specified above.
873
-    //
874
-    // Please read the TMC2130 datasheet:
875
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
876
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
877
-    //
878
-    // The following, uncommented settings are only suggestion.
879
-
880
-    /* GENERAL CONFIGURATION */
881
-
882
-    //#define GLOBAL_EN_PWM_MODE        0
883
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
884
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
885
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
886
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
887
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
888
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
889
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
890
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
891
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
892
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
893
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
894
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
895
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
896
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
897
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
898
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
899
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
900
-
901
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
902
-
903
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
904
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
905
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
906
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
907
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
908
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
909
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
910
-
911
-    /* SPI MODE CONFIGURATION */
912
-
913
-    //#define GLOBAL_XDIRECT            0
914
-
915
-    /* DCSTEP MINIMUM VELOCITY */
916
-
917
-    //#define GLOBAL_VDCMIN             0
918
-
919
-    /* MOTOR DRIVER CONFIGURATION*/
920
-
921
-    //#define GLOBAL_DEDGE              0
922
-    //#define GLOBAL_DISS2G             0
923
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
924
-    #define GLOBAL_MRES              16 // number of microsteps
925
-    #define GLOBAL_SYNC               1 // [0-15]
926
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
927
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
928
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
929
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
930
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
931
-    //#define GLOBAL_RNDTF              0
932
-    //#define GLOBAL_DISFDCC            0
933
-    //#define GLOBAL_FD                 0
934
-    //#define GLOBAL_HEND               0
935
-    //#define GLOBAL_HSTRT              0
936
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
937
-
938
-    //#define GLOBAL_SFILT              0
939
-    //#define GLOBAL_SGT                0
940
-    //#define GLOBAL_SEIMIN             0
941
-    //#define GLOBAL_SEDN               0
942
-    //#define GLOBAL_SEMAX              0
943
-    //#define GLOBAL_SEUP               0
944
-    //#define GLOBAL_SEMIN              0
945
-
946
-    //#define GLOBAL_DC_TIME            0
947
-    //#define GLOBAL_DC_SG              0
948
-
949
-    //#define GLOBAL_FREEWHEEL          0
950
-    //#define GLOBAL_PWM_SYMMETRIC      0
951
-    //#define GLOBAL_PWM_AUTOSCALE      0
952
-    //#define GLOBAL_PWM_FREQ           0
953
-    //#define GLOBAL_PWM_GRAD           0
954
-    //#define GLOBAL_PWM_AMPL           0
955
-
956
-    //#define GLOBAL_ENCM_CTRL          0
957
-
958
-  #else
959
-
960
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
961
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
962
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
963
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
964
-    #define X_MRES           16 // number of microsteps
965
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
966
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
967
-
968
-    #define X2_IHOLD         31
969
-    #define X2_IRUN          31
970
-    #define X2_IHOLDDELAY    15
971
-    #define X2_I_SCALE_ANALOG 1
972
-    #define X2_MRES          16
973
-    #define X2_TBL            1
974
-    #define X2_TOFF           8
975
-
976
-    #define Y_IHOLD          31
977
-    #define Y_IRUN           31
978
-    #define Y_IHOLDDELAY     15
979
-    #define Y_I_SCALE_ANALOG  1
980
-    #define Y_MRES           16
981
-    #define Y_TBL             1
982
-    #define Y_TOFF            8
983
-
984
-    #define Y2_IHOLD         31
985
-    #define Y2_IRUN          31
986
-    #define Y2_IHOLDDELAY    15
987
-    #define Y2_I_SCALE_ANALOG 1
988
-    #define Y2_MRES          16
989
-    #define Y2_TBL            1
990
-    #define Y2_TOFF           8
991
-
992
-    #define Z_IHOLD          31
993
-    #define Z_IRUN           31
994
-    #define Z_IHOLDDELAY     15
995
-    #define Z_I_SCALE_ANALOG  1
996
-    #define Z_MRES           16
997
-    #define Z_TBL             1
998
-    #define Z_TOFF            8
999
-
1000
-    #define Z2_IHOLD         31
1001
-    #define Z2_IRUN          31
1002
-    #define Z2_IHOLDDELAY    15
1003
-    #define Z2_I_SCALE_ANALOG 1
1004
-    #define Z2_MRES          16
1005
-    #define Z2_TBL            1
1006
-    #define Z2_TOFF           8
1007
-
1008
-    #define E0_IHOLD         31
1009
-    #define E0_IRUN          31
1010
-    #define E0_IHOLDDELAY    15
1011
-    #define E0_I_SCALE_ANALOG 1
1012
-    #define E0_MRES          16
1013
-    #define E0_TBL            1
1014
-    #define E0_TOFF           8
1015
-
1016
-    #define E1_IHOLD         31
1017
-    #define E1_IRUN          31
1018
-    #define E1_IHOLDDELAY    15
1019
-    #define E1_I_SCALE_ANALOG 1
1020
-    #define E1_MRES          16
1021
-    #define E1_TBL            1
1022
-    #define E1_TOFF           8
1023
-
1024
-    #define E2_IHOLD         31
1025
-    #define E2_IRUN          31
1026
-    #define E2_IHOLDDELAY    15
1027
-    #define E2_I_SCALE_ANALOG 1
1028
-    #define E2_MRES          16
1029
-    #define E2_TBL            1
1030
-    #define E2_TOFF           8
1031
-
1032
-    #define E3_IHOLD         31
1033
-    #define E3_IRUN          31
1034
-    #define E3_IHOLDDELAY    15
1035
-    #define E3_I_SCALE_ANALOG 1
1036
-    #define E3_MRES          16
1037
-    #define E3_TBL            1
1038
-    #define E3_TOFF           8
1039
-
1040
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1041
-
1042
-#endif // HAVE_TMC2130DRIVER
878
+  /**
879
+   * Stepper driver settings
880
+   */
881
+
882
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
883
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
884
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
885
+
886
+  #define X_MAX_CURRENT     1000  // rms current in mA
887
+  #define X_MICROSTEPS        16  // FULLSTEP..256
888
+  #define X_CHIP_SELECT       40  // Pin
889
+
890
+  #define Y_MAX_CURRENT     1000
891
+  #define Y_MICROSTEPS        16
892
+  #define Y_CHIP_SELECT       42
893
+
894
+  #define Z_MAX_CURRENT     1000
895
+  #define Z_MICROSTEPS        16
896
+  #define Z_CHIP_SELECT       65
897
+
898
+  //#define X2_MAX_CURRENT  1000
899
+  //#define X2_MICROSTEPS     16
900
+  //#define X2_CHIP_SELECT    -1
901
+
902
+  //#define Y2_MAX_CURRENT  1000
903
+  //#define Y2_MICROSTEPS     16
904
+  //#define Y2_CHIP_SELECT    -1
905
+
906
+  //#define Z2_MAX_CURRENT  1000
907
+  //#define Z2_MICROSTEPS     16
908
+  //#define Z2_CHIP_SELECT    -1
909
+
910
+  //#define E0_MAX_CURRENT  1000
911
+  //#define E0_MICROSTEPS     16
912
+  //#define E0_CHIP_SELECT    -1
913
+
914
+  //#define E1_MAX_CURRENT  1000
915
+  //#define E1_MICROSTEPS     16
916
+  //#define E1_CHIP_SELECT    -1
917
+
918
+  //#define E2_MAX_CURRENT  1000
919
+  //#define E2_MICROSTEPS     16
920
+  //#define E2_CHIP_SELECT    -1
921
+
922
+  //#define E3_MAX_CURRENT  1000
923
+  //#define E3_MICROSTEPS     16
924
+  //#define E3_CHIP_SELECT    -1
925
+
926
+  /**
927
+   * You can set your own advanced settings by filling in predefined functions.
928
+   * A list of available functions can be found on the library github page
929
+   * https://github.com/teemuatlut/TMC2130Stepper
930
+   *
931
+   * Example:
932
+   * #define TMC2130_ADV() { \
933
+   *   stepperX.diag0_temp_prewarn(1); \
934
+   *   stepperX.interpolate(0); \
935
+   * }
936
+   */
937
+  #define  TMC2130_ADV() {  }
938
+
939
+#endif // ENABLED(HAVE_TMC2130)
1043
 
940
 
1044
 // @section L6470
941
 // @section L6470
1045
 
942
 

+ 83
- 186
Marlin/example_configurations/K8400/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/SCARA/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

766
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
766
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
767
 #endif
767
 #endif
768
 
768
 
769
-/******************************************************************************\
770
- * enable this section if you have TMC26X motor drivers.
771
- * you need to import the TMC26XStepper library into the Arduino IDE for this
772
- ******************************************************************************/
773
-
774
 // @section tmc
769
 // @section tmc
775
 
770
 
771
+/**
772
+ * Enable this section if you have TMC26X motor drivers.
773
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
774
+ * (https://github.com/trinamic/TMC26XStepper.git)
775
+ */
776
 //#define HAVE_TMCDRIVER
776
 //#define HAVE_TMCDRIVER
777
+
777
 #if ENABLED(HAVE_TMCDRIVER)
778
 #if ENABLED(HAVE_TMCDRIVER)
778
 
779
 
779
   //#define X_IS_TMC
780
   //#define X_IS_TMC
831
 
832
 
832
 // @section TMC2130
833
 // @section TMC2130
833
 
834
 
834
-
835
 /**
835
 /**
836
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
836
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
837
  *
837
  *
838
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
839
- * (https://github.com/makertum/Trinamic_TMC2130).
838
+ * You'll also need the TMC2130Stepper Arduino library
839
+ * (https://github.com/teemuatlut/TMC2130Stepper).
840
  *
840
  *
841
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
841
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
842
  * the hardware SPI interface on your board and define the required CS pins
842
  * the hardware SPI interface on your board and define the required CS pins
843
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
843
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
844
  */
844
  */
845
+//#define HAVE_TMC2130
845
 
846
 
846
-//#define HAVE_TMC2130DRIVER
847
-
848
-#if ENABLED(HAVE_TMC2130DRIVER)
847
+#if ENABLED(HAVE_TMC2130)
848
+  #define STEALTHCHOP
849
 
849
 
850
-  //#define TMC2130_ADVANCED_CONFIGURATION
850
+  /**
851
+   * Let Marlin automatically control stepper current.
852
+   * This is still an experimental feature.
853
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
854
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
855
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
856
+   */ 
857
+  //#define AUTOMATIC_CURRENT_CONTROL
858
+  #define CURRENT_STEP          50  // [mA]
859
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
851
 
860
 
852
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
861
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   //#define X_IS_TMC2130
862
   //#define X_IS_TMC2130
861
   //#define E2_IS_TMC2130
870
   //#define E2_IS_TMC2130
862
   //#define E3_IS_TMC2130
871
   //#define E3_IS_TMC2130
863
 
872
 
864
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
865
-
866
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
867
-    // Enabled settings will be automatically applied to all axes specified above.
868
-    //
869
-    // Please read the TMC2130 datasheet:
870
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
871
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
872
-    //
873
-    // The following, uncommented settings are only suggestion.
874
-
875
-    /* GENERAL CONFIGURATION */
876
-
877
-    //#define GLOBAL_EN_PWM_MODE        0
878
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
879
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
880
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
881
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
882
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
883
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
884
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
885
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
886
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
887
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
888
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
889
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
890
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
891
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
892
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
893
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
894
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
895
-
896
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
897
-
898
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
899
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
900
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
901
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
902
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
903
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
904
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
905
-
906
-    /* SPI MODE CONFIGURATION */
907
-
908
-    //#define GLOBAL_XDIRECT            0
909
-
910
-    /* DCSTEP MINIMUM VELOCITY */
911
-
912
-    //#define GLOBAL_VDCMIN             0
913
-
914
-    /* MOTOR DRIVER CONFIGURATION*/
915
-
916
-    //#define GLOBAL_DEDGE              0
917
-    //#define GLOBAL_DISS2G             0
918
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
919
-    #define GLOBAL_MRES              16 // number of microsteps
920
-    #define GLOBAL_SYNC               1 // [0-15]
921
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
922
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
923
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
924
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
925
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
926
-    //#define GLOBAL_RNDTF              0
927
-    //#define GLOBAL_DISFDCC            0
928
-    //#define GLOBAL_FD                 0
929
-    //#define GLOBAL_HEND               0
930
-    //#define GLOBAL_HSTRT              0
931
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
932
-
933
-    //#define GLOBAL_SFILT              0
934
-    //#define GLOBAL_SGT                0
935
-    //#define GLOBAL_SEIMIN             0
936
-    //#define GLOBAL_SEDN               0
937
-    //#define GLOBAL_SEMAX              0
938
-    //#define GLOBAL_SEUP               0
939
-    //#define GLOBAL_SEMIN              0
940
-
941
-    //#define GLOBAL_DC_TIME            0
942
-    //#define GLOBAL_DC_SG              0
943
-
944
-    //#define GLOBAL_FREEWHEEL          0
945
-    //#define GLOBAL_PWM_SYMMETRIC      0
946
-    //#define GLOBAL_PWM_AUTOSCALE      0
947
-    //#define GLOBAL_PWM_FREQ           0
948
-    //#define GLOBAL_PWM_GRAD           0
949
-    //#define GLOBAL_PWM_AMPL           0
950
-
951
-    //#define GLOBAL_ENCM_CTRL          0
952
-
953
-  #else
954
-
955
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
956
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
957
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
958
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
959
-    #define X_MRES           16 // number of microsteps
960
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
961
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
962
-
963
-    #define X2_IHOLD         31
964
-    #define X2_IRUN          31
965
-    #define X2_IHOLDDELAY    15
966
-    #define X2_I_SCALE_ANALOG 1
967
-    #define X2_MRES          16
968
-    #define X2_TBL            1
969
-    #define X2_TOFF           8
970
-
971
-    #define Y_IHOLD          31
972
-    #define Y_IRUN           31
973
-    #define Y_IHOLDDELAY     15
974
-    #define Y_I_SCALE_ANALOG  1
975
-    #define Y_MRES           16
976
-    #define Y_TBL             1
977
-    #define Y_TOFF            8
978
-
979
-    #define Y2_IHOLD         31
980
-    #define Y2_IRUN          31
981
-    #define Y2_IHOLDDELAY    15
982
-    #define Y2_I_SCALE_ANALOG 1
983
-    #define Y2_MRES          16
984
-    #define Y2_TBL            1
985
-    #define Y2_TOFF           8
986
-
987
-    #define Z_IHOLD          31
988
-    #define Z_IRUN           31
989
-    #define Z_IHOLDDELAY     15
990
-    #define Z_I_SCALE_ANALOG  1
991
-    #define Z_MRES           16
992
-    #define Z_TBL             1
993
-    #define Z_TOFF            8
994
-
995
-    #define Z2_IHOLD         31
996
-    #define Z2_IRUN          31
997
-    #define Z2_IHOLDDELAY    15
998
-    #define Z2_I_SCALE_ANALOG 1
999
-    #define Z2_MRES          16
1000
-    #define Z2_TBL            1
1001
-    #define Z2_TOFF           8
1002
-
1003
-    #define E0_IHOLD         31
1004
-    #define E0_IRUN          31
1005
-    #define E0_IHOLDDELAY    15
1006
-    #define E0_I_SCALE_ANALOG 1
1007
-    #define E0_MRES          16
1008
-    #define E0_TBL            1
1009
-    #define E0_TOFF           8
1010
-
1011
-    #define E1_IHOLD         31
1012
-    #define E1_IRUN          31
1013
-    #define E1_IHOLDDELAY    15
1014
-    #define E1_I_SCALE_ANALOG 1
1015
-    #define E1_MRES          16
1016
-    #define E1_TBL            1
1017
-    #define E1_TOFF           8
1018
-
1019
-    #define E2_IHOLD         31
1020
-    #define E2_IRUN          31
1021
-    #define E2_IHOLDDELAY    15
1022
-    #define E2_I_SCALE_ANALOG 1
1023
-    #define E2_MRES          16
1024
-    #define E2_TBL            1
1025
-    #define E2_TOFF           8
1026
-
1027
-    #define E3_IHOLD         31
1028
-    #define E3_IRUN          31
1029
-    #define E3_IHOLDDELAY    15
1030
-    #define E3_I_SCALE_ANALOG 1
1031
-    #define E3_MRES          16
1032
-    #define E3_TBL            1
1033
-    #define E3_TOFF           8
1034
-
1035
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1036
-
1037
-#endif // HAVE_TMC2130DRIVER
873
+  /**
874
+   * Stepper driver settings
875
+   */
876
+
877
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
878
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
879
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
880
+
881
+  #define X_MAX_CURRENT     1000  // rms current in mA
882
+  #define X_MICROSTEPS        16  // FULLSTEP..256
883
+  #define X_CHIP_SELECT       40  // Pin
884
+
885
+  #define Y_MAX_CURRENT     1000
886
+  #define Y_MICROSTEPS        16
887
+  #define Y_CHIP_SELECT       42
888
+
889
+  #define Z_MAX_CURRENT     1000
890
+  #define Z_MICROSTEPS        16
891
+  #define Z_CHIP_SELECT       65
892
+
893
+  //#define X2_MAX_CURRENT  1000
894
+  //#define X2_MICROSTEPS     16
895
+  //#define X2_CHIP_SELECT    -1
896
+
897
+  //#define Y2_MAX_CURRENT  1000
898
+  //#define Y2_MICROSTEPS     16
899
+  //#define Y2_CHIP_SELECT    -1
900
+
901
+  //#define Z2_MAX_CURRENT  1000
902
+  //#define Z2_MICROSTEPS     16
903
+  //#define Z2_CHIP_SELECT    -1
904
+
905
+  //#define E0_MAX_CURRENT  1000
906
+  //#define E0_MICROSTEPS     16
907
+  //#define E0_CHIP_SELECT    -1
908
+
909
+  //#define E1_MAX_CURRENT  1000
910
+  //#define E1_MICROSTEPS     16
911
+  //#define E1_CHIP_SELECT    -1
912
+
913
+  //#define E2_MAX_CURRENT  1000
914
+  //#define E2_MICROSTEPS     16
915
+  //#define E2_CHIP_SELECT    -1
916
+
917
+  //#define E3_MAX_CURRENT  1000
918
+  //#define E3_MICROSTEPS     16
919
+  //#define E3_CHIP_SELECT    -1
920
+
921
+  /**
922
+   * You can set your own advanced settings by filling in predefined functions.
923
+   * A list of available functions can be found on the library github page
924
+   * https://github.com/teemuatlut/TMC2130Stepper
925
+   *
926
+   * Example:
927
+   * #define TMC2130_ADV() { \
928
+   *   stepperX.diag0_temp_prewarn(1); \
929
+   *   stepperX.interpolate(0); \
930
+   * }
931
+   */
932
+  #define  TMC2130_ADV() {  }
933
+
934
+#endif // ENABLED(HAVE_TMC2130)
1038
 
935
 
1039
 // @section L6470
936
 // @section L6470
1040
 
937
 

+ 83
- 186
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h View File

763
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
763
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
764
 #endif
764
 #endif
765
 
765
 
766
-/******************************************************************************\
767
- * enable this section if you have TMC26X motor drivers.
768
- * you need to import the TMC26XStepper library into the Arduino IDE for this
769
- ******************************************************************************/
770
-
771
 // @section tmc
766
 // @section tmc
772
 
767
 
768
+/**
769
+ * Enable this section if you have TMC26X motor drivers.
770
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
771
+ * (https://github.com/trinamic/TMC26XStepper.git)
772
+ */
773
 //#define HAVE_TMCDRIVER
773
 //#define HAVE_TMCDRIVER
774
+
774
 #if ENABLED(HAVE_TMCDRIVER)
775
 #if ENABLED(HAVE_TMCDRIVER)
775
 
776
 
776
   //#define X_IS_TMC
777
   //#define X_IS_TMC
828
 
829
 
829
 // @section TMC2130
830
 // @section TMC2130
830
 
831
 
831
-
832
 /**
832
 /**
833
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
833
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
834
  *
834
  *
835
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
836
- * (https://github.com/makertum/Trinamic_TMC2130).
835
+ * You'll also need the TMC2130Stepper Arduino library
836
+ * (https://github.com/teemuatlut/TMC2130Stepper).
837
  *
837
  *
838
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
838
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
839
  * the hardware SPI interface on your board and define the required CS pins
839
  * the hardware SPI interface on your board and define the required CS pins
840
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
840
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
841
  */
841
  */
842
+//#define HAVE_TMC2130
842
 
843
 
843
-//#define HAVE_TMC2130DRIVER
844
-
845
-#if ENABLED(HAVE_TMC2130DRIVER)
844
+#if ENABLED(HAVE_TMC2130)
845
+  #define STEALTHCHOP
846
 
846
 
847
-  //#define TMC2130_ADVANCED_CONFIGURATION
847
+  /**
848
+   * Let Marlin automatically control stepper current.
849
+   * This is still an experimental feature.
850
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
851
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
852
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
853
+   */ 
854
+  //#define AUTOMATIC_CURRENT_CONTROL
855
+  #define CURRENT_STEP          50  // [mA]
856
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
848
 
857
 
849
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
858
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
850
   //#define X_IS_TMC2130
859
   //#define X_IS_TMC2130
858
   //#define E2_IS_TMC2130
867
   //#define E2_IS_TMC2130
859
   //#define E3_IS_TMC2130
868
   //#define E3_IS_TMC2130
860
 
869
 
861
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
862
-
863
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
864
-    // Enabled settings will be automatically applied to all axes specified above.
865
-    //
866
-    // Please read the TMC2130 datasheet:
867
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
868
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
869
-    //
870
-    // The following, uncommented settings are only suggestion.
871
-
872
-    /* GENERAL CONFIGURATION */
873
-
874
-    //#define GLOBAL_EN_PWM_MODE        0
875
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
876
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
877
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
878
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
879
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
880
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
881
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
882
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
883
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
884
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
885
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
886
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
887
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
888
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
889
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
890
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
891
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
892
-
893
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
894
-
895
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
896
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
897
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
898
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
899
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
900
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
901
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
902
-
903
-    /* SPI MODE CONFIGURATION */
904
-
905
-    //#define GLOBAL_XDIRECT            0
906
-
907
-    /* DCSTEP MINIMUM VELOCITY */
908
-
909
-    //#define GLOBAL_VDCMIN             0
910
-
911
-    /* MOTOR DRIVER CONFIGURATION*/
912
-
913
-    //#define GLOBAL_DEDGE              0
914
-    //#define GLOBAL_DISS2G             0
915
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
916
-    #define GLOBAL_MRES              16 // number of microsteps
917
-    #define GLOBAL_SYNC               1 // [0-15]
918
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
919
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
920
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
921
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
922
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
923
-    //#define GLOBAL_RNDTF              0
924
-    //#define GLOBAL_DISFDCC            0
925
-    //#define GLOBAL_FD                 0
926
-    //#define GLOBAL_HEND               0
927
-    //#define GLOBAL_HSTRT              0
928
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
929
-
930
-    //#define GLOBAL_SFILT              0
931
-    //#define GLOBAL_SGT                0
932
-    //#define GLOBAL_SEIMIN             0
933
-    //#define GLOBAL_SEDN               0
934
-    //#define GLOBAL_SEMAX              0
935
-    //#define GLOBAL_SEUP               0
936
-    //#define GLOBAL_SEMIN              0
937
-
938
-    //#define GLOBAL_DC_TIME            0
939
-    //#define GLOBAL_DC_SG              0
940
-
941
-    //#define GLOBAL_FREEWHEEL          0
942
-    //#define GLOBAL_PWM_SYMMETRIC      0
943
-    //#define GLOBAL_PWM_AUTOSCALE      0
944
-    //#define GLOBAL_PWM_FREQ           0
945
-    //#define GLOBAL_PWM_GRAD           0
946
-    //#define GLOBAL_PWM_AMPL           0
947
-
948
-    //#define GLOBAL_ENCM_CTRL          0
949
-
950
-  #else
951
-
952
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
953
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
954
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
955
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
956
-    #define X_MRES           16 // number of microsteps
957
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
958
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
959
-
960
-    #define X2_IHOLD         31
961
-    #define X2_IRUN          31
962
-    #define X2_IHOLDDELAY    15
963
-    #define X2_I_SCALE_ANALOG 1
964
-    #define X2_MRES          16
965
-    #define X2_TBL            1
966
-    #define X2_TOFF           8
967
-
968
-    #define Y_IHOLD          31
969
-    #define Y_IRUN           31
970
-    #define Y_IHOLDDELAY     15
971
-    #define Y_I_SCALE_ANALOG  1
972
-    #define Y_MRES           16
973
-    #define Y_TBL             1
974
-    #define Y_TOFF            8
975
-
976
-    #define Y2_IHOLD         31
977
-    #define Y2_IRUN          31
978
-    #define Y2_IHOLDDELAY    15
979
-    #define Y2_I_SCALE_ANALOG 1
980
-    #define Y2_MRES          16
981
-    #define Y2_TBL            1
982
-    #define Y2_TOFF           8
983
-
984
-    #define Z_IHOLD          31
985
-    #define Z_IRUN           31
986
-    #define Z_IHOLDDELAY     15
987
-    #define Z_I_SCALE_ANALOG  1
988
-    #define Z_MRES           16
989
-    #define Z_TBL             1
990
-    #define Z_TOFF            8
991
-
992
-    #define Z2_IHOLD         31
993
-    #define Z2_IRUN          31
994
-    #define Z2_IHOLDDELAY    15
995
-    #define Z2_I_SCALE_ANALOG 1
996
-    #define Z2_MRES          16
997
-    #define Z2_TBL            1
998
-    #define Z2_TOFF           8
999
-
1000
-    #define E0_IHOLD         31
1001
-    #define E0_IRUN          31
1002
-    #define E0_IHOLDDELAY    15
1003
-    #define E0_I_SCALE_ANALOG 1
1004
-    #define E0_MRES          16
1005
-    #define E0_TBL            1
1006
-    #define E0_TOFF           8
1007
-
1008
-    #define E1_IHOLD         31
1009
-    #define E1_IRUN          31
1010
-    #define E1_IHOLDDELAY    15
1011
-    #define E1_I_SCALE_ANALOG 1
1012
-    #define E1_MRES          16
1013
-    #define E1_TBL            1
1014
-    #define E1_TOFF           8
1015
-
1016
-    #define E2_IHOLD         31
1017
-    #define E2_IRUN          31
1018
-    #define E2_IHOLDDELAY    15
1019
-    #define E2_I_SCALE_ANALOG 1
1020
-    #define E2_MRES          16
1021
-    #define E2_TBL            1
1022
-    #define E2_TOFF           8
1023
-
1024
-    #define E3_IHOLD         31
1025
-    #define E3_IRUN          31
1026
-    #define E3_IHOLDDELAY    15
1027
-    #define E3_I_SCALE_ANALOG 1
1028
-    #define E3_MRES          16
1029
-    #define E3_TBL            1
1030
-    #define E3_TOFF           8
1031
-
1032
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1033
-
1034
-#endif // HAVE_TMC2130DRIVER
870
+  /**
871
+   * Stepper driver settings
872
+   */
873
+
874
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
875
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
876
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
877
+
878
+  #define X_MAX_CURRENT     1000  // rms current in mA
879
+  #define X_MICROSTEPS        16  // FULLSTEP..256
880
+  #define X_CHIP_SELECT       40  // Pin
881
+
882
+  #define Y_MAX_CURRENT     1000
883
+  #define Y_MICROSTEPS        16
884
+  #define Y_CHIP_SELECT       42
885
+
886
+  #define Z_MAX_CURRENT     1000
887
+  #define Z_MICROSTEPS        16
888
+  #define Z_CHIP_SELECT       65
889
+
890
+  //#define X2_MAX_CURRENT  1000
891
+  //#define X2_MICROSTEPS     16
892
+  //#define X2_CHIP_SELECT    -1
893
+
894
+  //#define Y2_MAX_CURRENT  1000
895
+  //#define Y2_MICROSTEPS     16
896
+  //#define Y2_CHIP_SELECT    -1
897
+
898
+  //#define Z2_MAX_CURRENT  1000
899
+  //#define Z2_MICROSTEPS     16
900
+  //#define Z2_CHIP_SELECT    -1
901
+
902
+  //#define E0_MAX_CURRENT  1000
903
+  //#define E0_MICROSTEPS     16
904
+  //#define E0_CHIP_SELECT    -1
905
+
906
+  //#define E1_MAX_CURRENT  1000
907
+  //#define E1_MICROSTEPS     16
908
+  //#define E1_CHIP_SELECT    -1
909
+
910
+  //#define E2_MAX_CURRENT  1000
911
+  //#define E2_MICROSTEPS     16
912
+  //#define E2_CHIP_SELECT    -1
913
+
914
+  //#define E3_MAX_CURRENT  1000
915
+  //#define E3_MICROSTEPS     16
916
+  //#define E3_CHIP_SELECT    -1
917
+
918
+  /**
919
+   * You can set your own advanced settings by filling in predefined functions.
920
+   * A list of available functions can be found on the library github page
921
+   * https://github.com/teemuatlut/TMC2130Stepper
922
+   *
923
+   * Example:
924
+   * #define TMC2130_ADV() { \
925
+   *   stepperX.diag0_temp_prewarn(1); \
926
+   *   stepperX.interpolate(0); \
927
+   * }
928
+   */
929
+  #define  TMC2130_ADV() {  }
930
+
931
+#endif // ENABLED(HAVE_TMC2130)
1035
 
932
 
1036
 // @section L6470
933
 // @section L6470
1037
 
934
 

+ 83
- 186
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761
 #endif
761
 #endif
762
 
762
 
763
-/******************************************************************************\
764
- * enable this section if you have TMC26X motor drivers.
765
- * you need to import the TMC26XStepper library into the Arduino IDE for this
766
- ******************************************************************************/
767
-
768
 // @section tmc
763
 // @section tmc
769
 
764
 
765
+/**
766
+ * Enable this section if you have TMC26X motor drivers.
767
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
768
+ * (https://github.com/trinamic/TMC26XStepper.git)
769
+ */
770
 //#define HAVE_TMCDRIVER
770
 //#define HAVE_TMCDRIVER
771
+
771
 #if ENABLED(HAVE_TMCDRIVER)
772
 #if ENABLED(HAVE_TMCDRIVER)
772
 
773
 
773
   //#define X_IS_TMC
774
   //#define X_IS_TMC
825
 
826
 
826
 // @section TMC2130
827
 // @section TMC2130
827
 
828
 
828
-
829
 /**
829
 /**
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
831
  *
831
  *
832
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
833
- * (https://github.com/makertum/Trinamic_TMC2130).
832
+ * You'll also need the TMC2130Stepper Arduino library
833
+ * (https://github.com/teemuatlut/TMC2130Stepper).
834
  *
834
  *
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836
  * the hardware SPI interface on your board and define the required CS pins
836
  * the hardware SPI interface on your board and define the required CS pins
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
838
  */
838
  */
839
+//#define HAVE_TMC2130
839
 
840
 
840
-//#define HAVE_TMC2130DRIVER
841
-
842
-#if ENABLED(HAVE_TMC2130DRIVER)
841
+#if ENABLED(HAVE_TMC2130)
842
+  #define STEALTHCHOP
843
 
843
 
844
-  //#define TMC2130_ADVANCED_CONFIGURATION
844
+  /**
845
+   * Let Marlin automatically control stepper current.
846
+   * This is still an experimental feature.
847
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
848
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
849
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
850
+   */ 
851
+  //#define AUTOMATIC_CURRENT_CONTROL
852
+  #define CURRENT_STEP          50  // [mA]
853
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
845
 
854
 
846
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847
   //#define X_IS_TMC2130
856
   //#define X_IS_TMC2130
855
   //#define E2_IS_TMC2130
864
   //#define E2_IS_TMC2130
856
   //#define E3_IS_TMC2130
865
   //#define E3_IS_TMC2130
857
 
866
 
858
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
859
-
860
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
861
-    // Enabled settings will be automatically applied to all axes specified above.
862
-    //
863
-    // Please read the TMC2130 datasheet:
864
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
865
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
866
-    //
867
-    // The following, uncommented settings are only suggestion.
868
-
869
-    /* GENERAL CONFIGURATION */
870
-
871
-    //#define GLOBAL_EN_PWM_MODE        0
872
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
873
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
874
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
875
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
876
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
877
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
878
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
879
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
881
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
882
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
883
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
884
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
885
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
886
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
887
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
888
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
889
-
890
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
891
-
892
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
893
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
894
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
895
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
896
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
898
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
899
-
900
-    /* SPI MODE CONFIGURATION */
901
-
902
-    //#define GLOBAL_XDIRECT            0
903
-
904
-    /* DCSTEP MINIMUM VELOCITY */
905
-
906
-    //#define GLOBAL_VDCMIN             0
907
-
908
-    /* MOTOR DRIVER CONFIGURATION*/
909
-
910
-    //#define GLOBAL_DEDGE              0
911
-    //#define GLOBAL_DISS2G             0
912
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
913
-    #define GLOBAL_MRES              16 // number of microsteps
914
-    #define GLOBAL_SYNC               1 // [0-15]
915
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
916
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
917
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
918
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
919
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
920
-    //#define GLOBAL_RNDTF              0
921
-    //#define GLOBAL_DISFDCC            0
922
-    //#define GLOBAL_FD                 0
923
-    //#define GLOBAL_HEND               0
924
-    //#define GLOBAL_HSTRT              0
925
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
926
-
927
-    //#define GLOBAL_SFILT              0
928
-    //#define GLOBAL_SGT                0
929
-    //#define GLOBAL_SEIMIN             0
930
-    //#define GLOBAL_SEDN               0
931
-    //#define GLOBAL_SEMAX              0
932
-    //#define GLOBAL_SEUP               0
933
-    //#define GLOBAL_SEMIN              0
934
-
935
-    //#define GLOBAL_DC_TIME            0
936
-    //#define GLOBAL_DC_SG              0
937
-
938
-    //#define GLOBAL_FREEWHEEL          0
939
-    //#define GLOBAL_PWM_SYMMETRIC      0
940
-    //#define GLOBAL_PWM_AUTOSCALE      0
941
-    //#define GLOBAL_PWM_FREQ           0
942
-    //#define GLOBAL_PWM_GRAD           0
943
-    //#define GLOBAL_PWM_AMPL           0
944
-
945
-    //#define GLOBAL_ENCM_CTRL          0
946
-
947
-  #else
948
-
949
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
950
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
951
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
952
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
953
-    #define X_MRES           16 // number of microsteps
954
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
955
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
956
-
957
-    #define X2_IHOLD         31
958
-    #define X2_IRUN          31
959
-    #define X2_IHOLDDELAY    15
960
-    #define X2_I_SCALE_ANALOG 1
961
-    #define X2_MRES          16
962
-    #define X2_TBL            1
963
-    #define X2_TOFF           8
964
-
965
-    #define Y_IHOLD          31
966
-    #define Y_IRUN           31
967
-    #define Y_IHOLDDELAY     15
968
-    #define Y_I_SCALE_ANALOG  1
969
-    #define Y_MRES           16
970
-    #define Y_TBL             1
971
-    #define Y_TOFF            8
972
-
973
-    #define Y2_IHOLD         31
974
-    #define Y2_IRUN          31
975
-    #define Y2_IHOLDDELAY    15
976
-    #define Y2_I_SCALE_ANALOG 1
977
-    #define Y2_MRES          16
978
-    #define Y2_TBL            1
979
-    #define Y2_TOFF           8
980
-
981
-    #define Z_IHOLD          31
982
-    #define Z_IRUN           31
983
-    #define Z_IHOLDDELAY     15
984
-    #define Z_I_SCALE_ANALOG  1
985
-    #define Z_MRES           16
986
-    #define Z_TBL             1
987
-    #define Z_TOFF            8
988
-
989
-    #define Z2_IHOLD         31
990
-    #define Z2_IRUN          31
991
-    #define Z2_IHOLDDELAY    15
992
-    #define Z2_I_SCALE_ANALOG 1
993
-    #define Z2_MRES          16
994
-    #define Z2_TBL            1
995
-    #define Z2_TOFF           8
996
-
997
-    #define E0_IHOLD         31
998
-    #define E0_IRUN          31
999
-    #define E0_IHOLDDELAY    15
1000
-    #define E0_I_SCALE_ANALOG 1
1001
-    #define E0_MRES          16
1002
-    #define E0_TBL            1
1003
-    #define E0_TOFF           8
1004
-
1005
-    #define E1_IHOLD         31
1006
-    #define E1_IRUN          31
1007
-    #define E1_IHOLDDELAY    15
1008
-    #define E1_I_SCALE_ANALOG 1
1009
-    #define E1_MRES          16
1010
-    #define E1_TBL            1
1011
-    #define E1_TOFF           8
1012
-
1013
-    #define E2_IHOLD         31
1014
-    #define E2_IRUN          31
1015
-    #define E2_IHOLDDELAY    15
1016
-    #define E2_I_SCALE_ANALOG 1
1017
-    #define E2_MRES          16
1018
-    #define E2_TBL            1
1019
-    #define E2_TOFF           8
1020
-
1021
-    #define E3_IHOLD         31
1022
-    #define E3_IRUN          31
1023
-    #define E3_IHOLDDELAY    15
1024
-    #define E3_I_SCALE_ANALOG 1
1025
-    #define E3_MRES          16
1026
-    #define E3_TBL            1
1027
-    #define E3_TOFF           8
1028
-
1029
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1030
-
1031
-#endif // HAVE_TMC2130DRIVER
867
+  /**
868
+   * Stepper driver settings
869
+   */
870
+
871
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
872
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
873
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
874
+
875
+  #define X_MAX_CURRENT     1000  // rms current in mA
876
+  #define X_MICROSTEPS        16  // FULLSTEP..256
877
+  #define X_CHIP_SELECT       40  // Pin
878
+
879
+  #define Y_MAX_CURRENT     1000
880
+  #define Y_MICROSTEPS        16
881
+  #define Y_CHIP_SELECT       42
882
+
883
+  #define Z_MAX_CURRENT     1000
884
+  #define Z_MICROSTEPS        16
885
+  #define Z_CHIP_SELECT       65
886
+
887
+  //#define X2_MAX_CURRENT  1000
888
+  //#define X2_MICROSTEPS     16
889
+  //#define X2_CHIP_SELECT    -1
890
+
891
+  //#define Y2_MAX_CURRENT  1000
892
+  //#define Y2_MICROSTEPS     16
893
+  //#define Y2_CHIP_SELECT    -1
894
+
895
+  //#define Z2_MAX_CURRENT  1000
896
+  //#define Z2_MICROSTEPS     16
897
+  //#define Z2_CHIP_SELECT    -1
898
+
899
+  //#define E0_MAX_CURRENT  1000
900
+  //#define E0_MICROSTEPS     16
901
+  //#define E0_CHIP_SELECT    -1
902
+
903
+  //#define E1_MAX_CURRENT  1000
904
+  //#define E1_MICROSTEPS     16
905
+  //#define E1_CHIP_SELECT    -1
906
+
907
+  //#define E2_MAX_CURRENT  1000
908
+  //#define E2_MICROSTEPS     16
909
+  //#define E2_CHIP_SELECT    -1
910
+
911
+  //#define E3_MAX_CURRENT  1000
912
+  //#define E3_MICROSTEPS     16
913
+  //#define E3_CHIP_SELECT    -1
914
+
915
+  /**
916
+   * You can set your own advanced settings by filling in predefined functions.
917
+   * A list of available functions can be found on the library github page
918
+   * https://github.com/teemuatlut/TMC2130Stepper
919
+   *
920
+   * Example:
921
+   * #define TMC2130_ADV() { \
922
+   *   stepperX.diag0_temp_prewarn(1); \
923
+   *   stepperX.interpolate(0); \
924
+   * }
925
+   */
926
+  #define  TMC2130_ADV() {  }
927
+
928
+#endif // ENABLED(HAVE_TMC2130)
1032
 
929
 
1033
 // @section L6470
930
 // @section L6470
1034
 
931
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761
 #endif
761
 #endif
762
 
762
 
763
-/******************************************************************************\
764
- * enable this section if you have TMC26X motor drivers.
765
- * you need to import the TMC26XStepper library into the Arduino IDE for this
766
- ******************************************************************************/
767
-
768
 // @section tmc
763
 // @section tmc
769
 
764
 
765
+/**
766
+ * Enable this section if you have TMC26X motor drivers.
767
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
768
+ * (https://github.com/trinamic/TMC26XStepper.git)
769
+ */
770
 //#define HAVE_TMCDRIVER
770
 //#define HAVE_TMCDRIVER
771
+
771
 #if ENABLED(HAVE_TMCDRIVER)
772
 #if ENABLED(HAVE_TMCDRIVER)
772
 
773
 
773
   //#define X_IS_TMC
774
   //#define X_IS_TMC
825
 
826
 
826
 // @section TMC2130
827
 // @section TMC2130
827
 
828
 
828
-
829
 /**
829
 /**
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
831
  *
831
  *
832
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
833
- * (https://github.com/makertum/Trinamic_TMC2130).
832
+ * You'll also need the TMC2130Stepper Arduino library
833
+ * (https://github.com/teemuatlut/TMC2130Stepper).
834
  *
834
  *
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836
  * the hardware SPI interface on your board and define the required CS pins
836
  * the hardware SPI interface on your board and define the required CS pins
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
838
  */
838
  */
839
+//#define HAVE_TMC2130
839
 
840
 
840
-//#define HAVE_TMC2130DRIVER
841
-
842
-#if ENABLED(HAVE_TMC2130DRIVER)
841
+#if ENABLED(HAVE_TMC2130)
842
+  #define STEALTHCHOP
843
 
843
 
844
-  //#define TMC2130_ADVANCED_CONFIGURATION
844
+  /**
845
+   * Let Marlin automatically control stepper current.
846
+   * This is still an experimental feature.
847
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
848
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
849
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
850
+   */ 
851
+  //#define AUTOMATIC_CURRENT_CONTROL
852
+  #define CURRENT_STEP          50  // [mA]
853
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
845
 
854
 
846
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847
   //#define X_IS_TMC2130
856
   //#define X_IS_TMC2130
855
   //#define E2_IS_TMC2130
864
   //#define E2_IS_TMC2130
856
   //#define E3_IS_TMC2130
865
   //#define E3_IS_TMC2130
857
 
866
 
858
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
859
-
860
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
861
-    // Enabled settings will be automatically applied to all axes specified above.
862
-    //
863
-    // Please read the TMC2130 datasheet:
864
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
865
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
866
-    //
867
-    // The following, uncommented settings are only suggestion.
868
-
869
-    /* GENERAL CONFIGURATION */
870
-
871
-    //#define GLOBAL_EN_PWM_MODE        0
872
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
873
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
874
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
875
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
876
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
877
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
878
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
879
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
881
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
882
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
883
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
884
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
885
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
886
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
887
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
888
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
889
-
890
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
891
-
892
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
893
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
894
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
895
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
896
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
898
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
899
-
900
-    /* SPI MODE CONFIGURATION */
901
-
902
-    //#define GLOBAL_XDIRECT            0
903
-
904
-    /* DCSTEP MINIMUM VELOCITY */
905
-
906
-    //#define GLOBAL_VDCMIN             0
907
-
908
-    /* MOTOR DRIVER CONFIGURATION*/
909
-
910
-    //#define GLOBAL_DEDGE              0
911
-    //#define GLOBAL_DISS2G             0
912
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
913
-    #define GLOBAL_MRES              16 // number of microsteps
914
-    #define GLOBAL_SYNC               1 // [0-15]
915
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
916
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
917
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
918
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
919
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
920
-    //#define GLOBAL_RNDTF              0
921
-    //#define GLOBAL_DISFDCC            0
922
-    //#define GLOBAL_FD                 0
923
-    //#define GLOBAL_HEND               0
924
-    //#define GLOBAL_HSTRT              0
925
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
926
-
927
-    //#define GLOBAL_SFILT              0
928
-    //#define GLOBAL_SGT                0
929
-    //#define GLOBAL_SEIMIN             0
930
-    //#define GLOBAL_SEDN               0
931
-    //#define GLOBAL_SEMAX              0
932
-    //#define GLOBAL_SEUP               0
933
-    //#define GLOBAL_SEMIN              0
934
-
935
-    //#define GLOBAL_DC_TIME            0
936
-    //#define GLOBAL_DC_SG              0
937
-
938
-    //#define GLOBAL_FREEWHEEL          0
939
-    //#define GLOBAL_PWM_SYMMETRIC      0
940
-    //#define GLOBAL_PWM_AUTOSCALE      0
941
-    //#define GLOBAL_PWM_FREQ           0
942
-    //#define GLOBAL_PWM_GRAD           0
943
-    //#define GLOBAL_PWM_AMPL           0
944
-
945
-    //#define GLOBAL_ENCM_CTRL          0
946
-
947
-  #else
948
-
949
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
950
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
951
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
952
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
953
-    #define X_MRES           16 // number of microsteps
954
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
955
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
956
-
957
-    #define X2_IHOLD         31
958
-    #define X2_IRUN          31
959
-    #define X2_IHOLDDELAY    15
960
-    #define X2_I_SCALE_ANALOG 1
961
-    #define X2_MRES          16
962
-    #define X2_TBL            1
963
-    #define X2_TOFF           8
964
-
965
-    #define Y_IHOLD          31
966
-    #define Y_IRUN           31
967
-    #define Y_IHOLDDELAY     15
968
-    #define Y_I_SCALE_ANALOG  1
969
-    #define Y_MRES           16
970
-    #define Y_TBL             1
971
-    #define Y_TOFF            8
972
-
973
-    #define Y2_IHOLD         31
974
-    #define Y2_IRUN          31
975
-    #define Y2_IHOLDDELAY    15
976
-    #define Y2_I_SCALE_ANALOG 1
977
-    #define Y2_MRES          16
978
-    #define Y2_TBL            1
979
-    #define Y2_TOFF           8
980
-
981
-    #define Z_IHOLD          31
982
-    #define Z_IRUN           31
983
-    #define Z_IHOLDDELAY     15
984
-    #define Z_I_SCALE_ANALOG  1
985
-    #define Z_MRES           16
986
-    #define Z_TBL             1
987
-    #define Z_TOFF            8
988
-
989
-    #define Z2_IHOLD         31
990
-    #define Z2_IRUN          31
991
-    #define Z2_IHOLDDELAY    15
992
-    #define Z2_I_SCALE_ANALOG 1
993
-    #define Z2_MRES          16
994
-    #define Z2_TBL            1
995
-    #define Z2_TOFF           8
996
-
997
-    #define E0_IHOLD         31
998
-    #define E0_IRUN          31
999
-    #define E0_IHOLDDELAY    15
1000
-    #define E0_I_SCALE_ANALOG 1
1001
-    #define E0_MRES          16
1002
-    #define E0_TBL            1
1003
-    #define E0_TOFF           8
1004
-
1005
-    #define E1_IHOLD         31
1006
-    #define E1_IRUN          31
1007
-    #define E1_IHOLDDELAY    15
1008
-    #define E1_I_SCALE_ANALOG 1
1009
-    #define E1_MRES          16
1010
-    #define E1_TBL            1
1011
-    #define E1_TOFF           8
1012
-
1013
-    #define E2_IHOLD         31
1014
-    #define E2_IRUN          31
1015
-    #define E2_IHOLDDELAY    15
1016
-    #define E2_I_SCALE_ANALOG 1
1017
-    #define E2_MRES          16
1018
-    #define E2_TBL            1
1019
-    #define E2_TOFF           8
1020
-
1021
-    #define E3_IHOLD         31
1022
-    #define E3_IRUN          31
1023
-    #define E3_IHOLDDELAY    15
1024
-    #define E3_I_SCALE_ANALOG 1
1025
-    #define E3_MRES          16
1026
-    #define E3_TBL            1
1027
-    #define E3_TOFF           8
1028
-
1029
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1030
-
1031
-#endif // HAVE_TMC2130DRIVER
867
+  /**
868
+   * Stepper driver settings
869
+   */
870
+
871
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
872
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
873
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
874
+
875
+  #define X_MAX_CURRENT     1000  // rms current in mA
876
+  #define X_MICROSTEPS        16  // FULLSTEP..256
877
+  #define X_CHIP_SELECT       40  // Pin
878
+
879
+  #define Y_MAX_CURRENT     1000
880
+  #define Y_MICROSTEPS        16
881
+  #define Y_CHIP_SELECT       42
882
+
883
+  #define Z_MAX_CURRENT     1000
884
+  #define Z_MICROSTEPS        16
885
+  #define Z_CHIP_SELECT       65
886
+
887
+  //#define X2_MAX_CURRENT  1000
888
+  //#define X2_MICROSTEPS     16
889
+  //#define X2_CHIP_SELECT    -1
890
+
891
+  //#define Y2_MAX_CURRENT  1000
892
+  //#define Y2_MICROSTEPS     16
893
+  //#define Y2_CHIP_SELECT    -1
894
+
895
+  //#define Z2_MAX_CURRENT  1000
896
+  //#define Z2_MICROSTEPS     16
897
+  //#define Z2_CHIP_SELECT    -1
898
+
899
+  //#define E0_MAX_CURRENT  1000
900
+  //#define E0_MICROSTEPS     16
901
+  //#define E0_CHIP_SELECT    -1
902
+
903
+  //#define E1_MAX_CURRENT  1000
904
+  //#define E1_MICROSTEPS     16
905
+  //#define E1_CHIP_SELECT    -1
906
+
907
+  //#define E2_MAX_CURRENT  1000
908
+  //#define E2_MICROSTEPS     16
909
+  //#define E2_CHIP_SELECT    -1
910
+
911
+  //#define E3_MAX_CURRENT  1000
912
+  //#define E3_MICROSTEPS     16
913
+  //#define E3_CHIP_SELECT    -1
914
+
915
+  /**
916
+   * You can set your own advanced settings by filling in predefined functions.
917
+   * A list of available functions can be found on the library github page
918
+   * https://github.com/teemuatlut/TMC2130Stepper
919
+   *
920
+   * Example:
921
+   * #define TMC2130_ADV() { \
922
+   *   stepperX.diag0_temp_prewarn(1); \
923
+   *   stepperX.interpolate(0); \
924
+   * }
925
+   */
926
+  #define  TMC2130_ADV() {  }
927
+
928
+#endif // ENABLED(HAVE_TMC2130)
1032
 
929
 
1033
 // @section L6470
930
 // @section L6470
1034
 
931
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

765
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
765
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
766
 #endif
766
 #endif
767
 
767
 
768
-/******************************************************************************\
769
- * enable this section if you have TMC26X motor drivers.
770
- * you need to import the TMC26XStepper library into the Arduino IDE for this
771
- ******************************************************************************/
772
-
773
 // @section tmc
768
 // @section tmc
774
 
769
 
770
+/**
771
+ * Enable this section if you have TMC26X motor drivers.
772
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
773
+ * (https://github.com/trinamic/TMC26XStepper.git)
774
+ */
775
 //#define HAVE_TMCDRIVER
775
 //#define HAVE_TMCDRIVER
776
+
776
 #if ENABLED(HAVE_TMCDRIVER)
777
 #if ENABLED(HAVE_TMCDRIVER)
777
 
778
 
778
   //#define X_IS_TMC
779
   //#define X_IS_TMC
830
 
831
 
831
 // @section TMC2130
832
 // @section TMC2130
832
 
833
 
833
-
834
 /**
834
 /**
835
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
835
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
836
  *
836
  *
837
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
838
- * (https://github.com/makertum/Trinamic_TMC2130).
837
+ * You'll also need the TMC2130Stepper Arduino library
838
+ * (https://github.com/teemuatlut/TMC2130Stepper).
839
  *
839
  *
840
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
840
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
841
  * the hardware SPI interface on your board and define the required CS pins
841
  * the hardware SPI interface on your board and define the required CS pins
842
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
842
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
843
  */
843
  */
844
+//#define HAVE_TMC2130
844
 
845
 
845
-//#define HAVE_TMC2130DRIVER
846
-
847
-#if ENABLED(HAVE_TMC2130DRIVER)
846
+#if ENABLED(HAVE_TMC2130)
847
+  #define STEALTHCHOP
848
 
848
 
849
-  //#define TMC2130_ADVANCED_CONFIGURATION
849
+  /**
850
+   * Let Marlin automatically control stepper current.
851
+   * This is still an experimental feature.
852
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
853
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
854
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
855
+   */ 
856
+  //#define AUTOMATIC_CURRENT_CONTROL
857
+  #define CURRENT_STEP          50  // [mA]
858
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
850
 
859
 
851
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
860
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
852
   //#define X_IS_TMC2130
861
   //#define X_IS_TMC2130
860
   //#define E2_IS_TMC2130
869
   //#define E2_IS_TMC2130
861
   //#define E3_IS_TMC2130
870
   //#define E3_IS_TMC2130
862
 
871
 
863
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
864
-
865
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
866
-    // Enabled settings will be automatically applied to all axes specified above.
867
-    //
868
-    // Please read the TMC2130 datasheet:
869
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
870
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
871
-    //
872
-    // The following, uncommented settings are only suggestion.
873
-
874
-    /* GENERAL CONFIGURATION */
875
-
876
-    //#define GLOBAL_EN_PWM_MODE        0
877
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
878
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
879
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
880
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
881
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
882
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
883
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
884
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
885
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
886
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
887
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
888
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
889
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
890
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
891
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
892
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
893
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
894
-
895
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
896
-
897
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
898
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
899
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
900
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
901
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
902
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
903
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
904
-
905
-    /* SPI MODE CONFIGURATION */
906
-
907
-    //#define GLOBAL_XDIRECT            0
908
-
909
-    /* DCSTEP MINIMUM VELOCITY */
910
-
911
-    //#define GLOBAL_VDCMIN             0
912
-
913
-    /* MOTOR DRIVER CONFIGURATION*/
914
-
915
-    //#define GLOBAL_DEDGE              0
916
-    //#define GLOBAL_DISS2G             0
917
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
918
-    #define GLOBAL_MRES              16 // number of microsteps
919
-    #define GLOBAL_SYNC               1 // [0-15]
920
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
921
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
922
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
923
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
924
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
925
-    //#define GLOBAL_RNDTF              0
926
-    //#define GLOBAL_DISFDCC            0
927
-    //#define GLOBAL_FD                 0
928
-    //#define GLOBAL_HEND               0
929
-    //#define GLOBAL_HSTRT              0
930
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
931
-
932
-    //#define GLOBAL_SFILT              0
933
-    //#define GLOBAL_SGT                0
934
-    //#define GLOBAL_SEIMIN             0
935
-    //#define GLOBAL_SEDN               0
936
-    //#define GLOBAL_SEMAX              0
937
-    //#define GLOBAL_SEUP               0
938
-    //#define GLOBAL_SEMIN              0
939
-
940
-    //#define GLOBAL_DC_TIME            0
941
-    //#define GLOBAL_DC_SG              0
942
-
943
-    //#define GLOBAL_FREEWHEEL          0
944
-    //#define GLOBAL_PWM_SYMMETRIC      0
945
-    //#define GLOBAL_PWM_AUTOSCALE      0
946
-    //#define GLOBAL_PWM_FREQ           0
947
-    //#define GLOBAL_PWM_GRAD           0
948
-    //#define GLOBAL_PWM_AMPL           0
949
-
950
-    //#define GLOBAL_ENCM_CTRL          0
951
-
952
-  #else
953
-
954
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
955
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
956
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
957
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
958
-    #define X_MRES           16 // number of microsteps
959
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
960
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
961
-
962
-    #define X2_IHOLD         31
963
-    #define X2_IRUN          31
964
-    #define X2_IHOLDDELAY    15
965
-    #define X2_I_SCALE_ANALOG 1
966
-    #define X2_MRES          16
967
-    #define X2_TBL            1
968
-    #define X2_TOFF           8
969
-
970
-    #define Y_IHOLD          31
971
-    #define Y_IRUN           31
972
-    #define Y_IHOLDDELAY     15
973
-    #define Y_I_SCALE_ANALOG  1
974
-    #define Y_MRES           16
975
-    #define Y_TBL             1
976
-    #define Y_TOFF            8
977
-
978
-    #define Y2_IHOLD         31
979
-    #define Y2_IRUN          31
980
-    #define Y2_IHOLDDELAY    15
981
-    #define Y2_I_SCALE_ANALOG 1
982
-    #define Y2_MRES          16
983
-    #define Y2_TBL            1
984
-    #define Y2_TOFF           8
985
-
986
-    #define Z_IHOLD          31
987
-    #define Z_IRUN           31
988
-    #define Z_IHOLDDELAY     15
989
-    #define Z_I_SCALE_ANALOG  1
990
-    #define Z_MRES           16
991
-    #define Z_TBL             1
992
-    #define Z_TOFF            8
993
-
994
-    #define Z2_IHOLD         31
995
-    #define Z2_IRUN          31
996
-    #define Z2_IHOLDDELAY    15
997
-    #define Z2_I_SCALE_ANALOG 1
998
-    #define Z2_MRES          16
999
-    #define Z2_TBL            1
1000
-    #define Z2_TOFF           8
1001
-
1002
-    #define E0_IHOLD         31
1003
-    #define E0_IRUN          31
1004
-    #define E0_IHOLDDELAY    15
1005
-    #define E0_I_SCALE_ANALOG 1
1006
-    #define E0_MRES          16
1007
-    #define E0_TBL            1
1008
-    #define E0_TOFF           8
1009
-
1010
-    #define E1_IHOLD         31
1011
-    #define E1_IRUN          31
1012
-    #define E1_IHOLDDELAY    15
1013
-    #define E1_I_SCALE_ANALOG 1
1014
-    #define E1_MRES          16
1015
-    #define E1_TBL            1
1016
-    #define E1_TOFF           8
1017
-
1018
-    #define E2_IHOLD         31
1019
-    #define E2_IRUN          31
1020
-    #define E2_IHOLDDELAY    15
1021
-    #define E2_I_SCALE_ANALOG 1
1022
-    #define E2_MRES          16
1023
-    #define E2_TBL            1
1024
-    #define E2_TOFF           8
1025
-
1026
-    #define E3_IHOLD         31
1027
-    #define E3_IRUN          31
1028
-    #define E3_IHOLDDELAY    15
1029
-    #define E3_I_SCALE_ANALOG 1
1030
-    #define E3_MRES          16
1031
-    #define E3_TBL            1
1032
-    #define E3_TOFF           8
1033
-
1034
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1035
-
1036
-#endif // HAVE_TMC2130DRIVER
872
+  /**
873
+   * Stepper driver settings
874
+   */
875
+
876
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
877
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
878
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
879
+
880
+  #define X_MAX_CURRENT     1000  // rms current in mA
881
+  #define X_MICROSTEPS        16  // FULLSTEP..256
882
+  #define X_CHIP_SELECT       40  // Pin
883
+
884
+  #define Y_MAX_CURRENT     1000
885
+  #define Y_MICROSTEPS        16
886
+  #define Y_CHIP_SELECT       42
887
+
888
+  #define Z_MAX_CURRENT     1000
889
+  #define Z_MICROSTEPS        16
890
+  #define Z_CHIP_SELECT       65
891
+
892
+  //#define X2_MAX_CURRENT  1000
893
+  //#define X2_MICROSTEPS     16
894
+  //#define X2_CHIP_SELECT    -1
895
+
896
+  //#define Y2_MAX_CURRENT  1000
897
+  //#define Y2_MICROSTEPS     16
898
+  //#define Y2_CHIP_SELECT    -1
899
+
900
+  //#define Z2_MAX_CURRENT  1000
901
+  //#define Z2_MICROSTEPS     16
902
+  //#define Z2_CHIP_SELECT    -1
903
+
904
+  //#define E0_MAX_CURRENT  1000
905
+  //#define E0_MICROSTEPS     16
906
+  //#define E0_CHIP_SELECT    -1
907
+
908
+  //#define E1_MAX_CURRENT  1000
909
+  //#define E1_MICROSTEPS     16
910
+  //#define E1_CHIP_SELECT    -1
911
+
912
+  //#define E2_MAX_CURRENT  1000
913
+  //#define E2_MICROSTEPS     16
914
+  //#define E2_CHIP_SELECT    -1
915
+
916
+  //#define E3_MAX_CURRENT  1000
917
+  //#define E3_MICROSTEPS     16
918
+  //#define E3_CHIP_SELECT    -1
919
+
920
+  /**
921
+   * You can set your own advanced settings by filling in predefined functions.
922
+   * A list of available functions can be found on the library github page
923
+   * https://github.com/teemuatlut/TMC2130Stepper
924
+   *
925
+   * Example:
926
+   * #define TMC2130_ADV() { \
927
+   *   stepperX.diag0_temp_prewarn(1); \
928
+   *   stepperX.interpolate(0); \
929
+   * }
930
+   */
931
+  #define  TMC2130_ADV() {  }
932
+
933
+#endif // ENABLED(HAVE_TMC2130)
1037
 
934
 
1038
 // @section L6470
935
 // @section L6470
1039
 
936
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761
 #endif
761
 #endif
762
 
762
 
763
-/******************************************************************************\
764
- * enable this section if you have TMC26X motor drivers.
765
- * you need to import the TMC26XStepper library into the Arduino IDE for this
766
- ******************************************************************************/
767
-
768
 // @section tmc
763
 // @section tmc
769
 
764
 
765
+/**
766
+ * Enable this section if you have TMC26X motor drivers.
767
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
768
+ * (https://github.com/trinamic/TMC26XStepper.git)
769
+ */
770
 //#define HAVE_TMCDRIVER
770
 //#define HAVE_TMCDRIVER
771
+
771
 #if ENABLED(HAVE_TMCDRIVER)
772
 #if ENABLED(HAVE_TMCDRIVER)
772
 
773
 
773
   //#define X_IS_TMC
774
   //#define X_IS_TMC
825
 
826
 
826
 // @section TMC2130
827
 // @section TMC2130
827
 
828
 
828
-
829
 /**
829
 /**
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
830
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
831
  *
831
  *
832
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
833
- * (https://github.com/makertum/Trinamic_TMC2130).
832
+ * You'll also need the TMC2130Stepper Arduino library
833
+ * (https://github.com/teemuatlut/TMC2130Stepper).
834
  *
834
  *
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836
  * the hardware SPI interface on your board and define the required CS pins
836
  * the hardware SPI interface on your board and define the required CS pins
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
837
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
838
  */
838
  */
839
+//#define HAVE_TMC2130
839
 
840
 
840
-//#define HAVE_TMC2130DRIVER
841
-
842
-#if ENABLED(HAVE_TMC2130DRIVER)
841
+#if ENABLED(HAVE_TMC2130)
842
+  #define STEALTHCHOP
843
 
843
 
844
-  //#define TMC2130_ADVANCED_CONFIGURATION
844
+  /**
845
+   * Let Marlin automatically control stepper current.
846
+   * This is still an experimental feature.
847
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
848
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
849
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
850
+   */ 
851
+  //#define AUTOMATIC_CURRENT_CONTROL
852
+  #define CURRENT_STEP          50  // [mA]
853
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
845
 
854
 
846
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847
   //#define X_IS_TMC2130
856
   //#define X_IS_TMC2130
855
   //#define E2_IS_TMC2130
864
   //#define E2_IS_TMC2130
856
   //#define E3_IS_TMC2130
865
   //#define E3_IS_TMC2130
857
 
866
 
858
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
859
-
860
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
861
-    // Enabled settings will be automatically applied to all axes specified above.
862
-    //
863
-    // Please read the TMC2130 datasheet:
864
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
865
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
866
-    //
867
-    // The following, uncommented settings are only suggestion.
868
-
869
-    /* GENERAL CONFIGURATION */
870
-
871
-    //#define GLOBAL_EN_PWM_MODE        0
872
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
873
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
874
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
875
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
876
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
877
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
878
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
879
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
881
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
882
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
883
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
884
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
885
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
886
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
887
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
888
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
889
-
890
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
891
-
892
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
893
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
894
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
895
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
896
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
898
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
899
-
900
-    /* SPI MODE CONFIGURATION */
901
-
902
-    //#define GLOBAL_XDIRECT            0
903
-
904
-    /* DCSTEP MINIMUM VELOCITY */
905
-
906
-    //#define GLOBAL_VDCMIN             0
907
-
908
-    /* MOTOR DRIVER CONFIGURATION*/
909
-
910
-    //#define GLOBAL_DEDGE              0
911
-    //#define GLOBAL_DISS2G             0
912
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
913
-    #define GLOBAL_MRES              16 // number of microsteps
914
-    #define GLOBAL_SYNC               1 // [0-15]
915
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
916
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
917
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
918
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
919
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
920
-    //#define GLOBAL_RNDTF              0
921
-    //#define GLOBAL_DISFDCC            0
922
-    //#define GLOBAL_FD                 0
923
-    //#define GLOBAL_HEND               0
924
-    //#define GLOBAL_HSTRT              0
925
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
926
-
927
-    //#define GLOBAL_SFILT              0
928
-    //#define GLOBAL_SGT                0
929
-    //#define GLOBAL_SEIMIN             0
930
-    //#define GLOBAL_SEDN               0
931
-    //#define GLOBAL_SEMAX              0
932
-    //#define GLOBAL_SEUP               0
933
-    //#define GLOBAL_SEMIN              0
934
-
935
-    //#define GLOBAL_DC_TIME            0
936
-    //#define GLOBAL_DC_SG              0
937
-
938
-    //#define GLOBAL_FREEWHEEL          0
939
-    //#define GLOBAL_PWM_SYMMETRIC      0
940
-    //#define GLOBAL_PWM_AUTOSCALE      0
941
-    //#define GLOBAL_PWM_FREQ           0
942
-    //#define GLOBAL_PWM_GRAD           0
943
-    //#define GLOBAL_PWM_AMPL           0
944
-
945
-    //#define GLOBAL_ENCM_CTRL          0
946
-
947
-  #else
948
-
949
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
950
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
951
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
952
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
953
-    #define X_MRES           16 // number of microsteps
954
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
955
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
956
-
957
-    #define X2_IHOLD         31
958
-    #define X2_IRUN          31
959
-    #define X2_IHOLDDELAY    15
960
-    #define X2_I_SCALE_ANALOG 1
961
-    #define X2_MRES          16
962
-    #define X2_TBL            1
963
-    #define X2_TOFF           8
964
-
965
-    #define Y_IHOLD          31
966
-    #define Y_IRUN           31
967
-    #define Y_IHOLDDELAY     15
968
-    #define Y_I_SCALE_ANALOG  1
969
-    #define Y_MRES           16
970
-    #define Y_TBL             1
971
-    #define Y_TOFF            8
972
-
973
-    #define Y2_IHOLD         31
974
-    #define Y2_IRUN          31
975
-    #define Y2_IHOLDDELAY    15
976
-    #define Y2_I_SCALE_ANALOG 1
977
-    #define Y2_MRES          16
978
-    #define Y2_TBL            1
979
-    #define Y2_TOFF           8
980
-
981
-    #define Z_IHOLD          31
982
-    #define Z_IRUN           31
983
-    #define Z_IHOLDDELAY     15
984
-    #define Z_I_SCALE_ANALOG  1
985
-    #define Z_MRES           16
986
-    #define Z_TBL             1
987
-    #define Z_TOFF            8
988
-
989
-    #define Z2_IHOLD         31
990
-    #define Z2_IRUN          31
991
-    #define Z2_IHOLDDELAY    15
992
-    #define Z2_I_SCALE_ANALOG 1
993
-    #define Z2_MRES          16
994
-    #define Z2_TBL            1
995
-    #define Z2_TOFF           8
996
-
997
-    #define E0_IHOLD         31
998
-    #define E0_IRUN          31
999
-    #define E0_IHOLDDELAY    15
1000
-    #define E0_I_SCALE_ANALOG 1
1001
-    #define E0_MRES          16
1002
-    #define E0_TBL            1
1003
-    #define E0_TOFF           8
1004
-
1005
-    #define E1_IHOLD         31
1006
-    #define E1_IRUN          31
1007
-    #define E1_IHOLDDELAY    15
1008
-    #define E1_I_SCALE_ANALOG 1
1009
-    #define E1_MRES          16
1010
-    #define E1_TBL            1
1011
-    #define E1_TOFF           8
1012
-
1013
-    #define E2_IHOLD         31
1014
-    #define E2_IRUN          31
1015
-    #define E2_IHOLDDELAY    15
1016
-    #define E2_I_SCALE_ANALOG 1
1017
-    #define E2_MRES          16
1018
-    #define E2_TBL            1
1019
-    #define E2_TOFF           8
1020
-
1021
-    #define E3_IHOLD         31
1022
-    #define E3_IRUN          31
1023
-    #define E3_IHOLDDELAY    15
1024
-    #define E3_I_SCALE_ANALOG 1
1025
-    #define E3_MRES          16
1026
-    #define E3_TBL            1
1027
-    #define E3_TOFF           8
1028
-
1029
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1030
-
1031
-#endif // HAVE_TMC2130DRIVER
867
+  /**
868
+   * Stepper driver settings
869
+   */
870
+
871
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
872
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
873
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
874
+
875
+  #define X_MAX_CURRENT     1000  // rms current in mA
876
+  #define X_MICROSTEPS        16  // FULLSTEP..256
877
+  #define X_CHIP_SELECT       40  // Pin
878
+
879
+  #define Y_MAX_CURRENT     1000
880
+  #define Y_MICROSTEPS        16
881
+  #define Y_CHIP_SELECT       42
882
+
883
+  #define Z_MAX_CURRENT     1000
884
+  #define Z_MICROSTEPS        16
885
+  #define Z_CHIP_SELECT       65
886
+
887
+  //#define X2_MAX_CURRENT  1000
888
+  //#define X2_MICROSTEPS     16
889
+  //#define X2_CHIP_SELECT    -1
890
+
891
+  //#define Y2_MAX_CURRENT  1000
892
+  //#define Y2_MICROSTEPS     16
893
+  //#define Y2_CHIP_SELECT    -1
894
+
895
+  //#define Z2_MAX_CURRENT  1000
896
+  //#define Z2_MICROSTEPS     16
897
+  //#define Z2_CHIP_SELECT    -1
898
+
899
+  //#define E0_MAX_CURRENT  1000
900
+  //#define E0_MICROSTEPS     16
901
+  //#define E0_CHIP_SELECT    -1
902
+
903
+  //#define E1_MAX_CURRENT  1000
904
+  //#define E1_MICROSTEPS     16
905
+  //#define E1_CHIP_SELECT    -1
906
+
907
+  //#define E2_MAX_CURRENT  1000
908
+  //#define E2_MICROSTEPS     16
909
+  //#define E2_CHIP_SELECT    -1
910
+
911
+  //#define E3_MAX_CURRENT  1000
912
+  //#define E3_MICROSTEPS     16
913
+  //#define E3_CHIP_SELECT    -1
914
+
915
+  /**
916
+   * You can set your own advanced settings by filling in predefined functions.
917
+   * A list of available functions can be found on the library github page
918
+   * https://github.com/teemuatlut/TMC2130Stepper
919
+   *
920
+   * Example:
921
+   * #define TMC2130_ADV() { \
922
+   *   stepperX.diag0_temp_prewarn(1); \
923
+   *   stepperX.interpolate(0); \
924
+   * }
925
+   */
926
+  #define  TMC2130_ADV() {  }
927
+
928
+#endif // ENABLED(HAVE_TMC2130)
1032
 
929
 
1033
 // @section L6470
930
 // @section L6470
1034
 
931
 

+ 83
- 186
Marlin/example_configurations/makibox/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 83
- 186
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759
 #endif
759
 #endif
760
 
760
 
761
-/******************************************************************************\
762
- * enable this section if you have TMC26X motor drivers.
763
- * you need to import the TMC26XStepper library into the Arduino IDE for this
764
- ******************************************************************************/
765
-
766
 // @section tmc
761
 // @section tmc
767
 
762
 
763
+/**
764
+ * Enable this section if you have TMC26X motor drivers.
765
+ * You will need to import the TMC26XStepper library into the Arduino IDE for this
766
+ * (https://github.com/trinamic/TMC26XStepper.git)
767
+ */
768
 //#define HAVE_TMCDRIVER
768
 //#define HAVE_TMCDRIVER
769
+
769
 #if ENABLED(HAVE_TMCDRIVER)
770
 #if ENABLED(HAVE_TMCDRIVER)
770
 
771
 
771
   //#define X_IS_TMC
772
   //#define X_IS_TMC
823
 
824
 
824
 // @section TMC2130
825
 // @section TMC2130
825
 
826
 
826
-
827
 /**
827
 /**
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
828
  * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
829
  *
829
  *
830
- * To use TMC2130 drivers in SPI mode, you'll also need the TMC2130 Arduino library
831
- * (https://github.com/makertum/Trinamic_TMC2130).
830
+ * You'll also need the TMC2130Stepper Arduino library
831
+ * (https://github.com/teemuatlut/TMC2130Stepper).
832
  *
832
  *
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834
  * the hardware SPI interface on your board and define the required CS pins
834
  * the hardware SPI interface on your board and define the required CS pins
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
835
  * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
836
  */
836
  */
837
+//#define HAVE_TMC2130
837
 
838
 
838
-//#define HAVE_TMC2130DRIVER
839
-
840
-#if ENABLED(HAVE_TMC2130DRIVER)
839
+#if ENABLED(HAVE_TMC2130)
840
+  #define STEALTHCHOP
841
 
841
 
842
-  //#define TMC2130_ADVANCED_CONFIGURATION
842
+  /**
843
+   * Let Marlin automatically control stepper current.
844
+   * This is still an experimental feature.
845
+   * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
846
+   * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
847
+   * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
848
+   */ 
849
+  //#define AUTOMATIC_CURRENT_CONTROL
850
+  #define CURRENT_STEP          50  // [mA]
851
+  #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
843
 
852
 
844
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845
   //#define X_IS_TMC2130
854
   //#define X_IS_TMC2130
853
   //#define E2_IS_TMC2130
862
   //#define E2_IS_TMC2130
854
   //#define E3_IS_TMC2130
863
   //#define E3_IS_TMC2130
855
 
864
 
856
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
857
-
858
-    // If you've enabled TMC2130_ADVANCED_CONFIGURATION, define global settings below.
859
-    // Enabled settings will be automatically applied to all axes specified above.
860
-    //
861
-    // Please read the TMC2130 datasheet:
862
-    // http://www.trinamic.com/_articles/products/integrated-circuits/tmc2130/_datasheet/TMC2130_datasheet.pdf
863
-    // All settings here have the same (sometimes cryptic) names as in the datasheet.
864
-    //
865
-    // The following, uncommented settings are only suggestion.
866
-
867
-    /* GENERAL CONFIGURATION */
868
-
869
-    //#define GLOBAL_EN_PWM_MODE        0
870
-    #define GLOBAL_I_SCALE_ANALOG     1 // [0,1] 0: Normal, 1: AIN
871
-    //#define GLOBAL_INTERNAL_RSENSE    0 // [0,1] 0: Normal, 1: Internal
872
-    #define GLOBAL_EN_PWM_MODE        0 // [0,1] 0: Normal, 1: stealthChop with velocity threshold
873
-    //#define GLOBAL_ENC_COMMUTATION    0 // [0,1]
874
-    #define GLOBAL_SHAFT              0 // [0,1] 0: normal, 1: invert
875
-    //#define GLOBAL_DIAG0_ERROR        0 // [0,1]
876
-    //#define GLOBAL_DIAG0_OTPW         0 // [0,1]
877
-    //#define GLOBAL_DIAG0_STALL        0 // [0,1]
878
-    //#define GLOBAL_DIAG1_STALL        0 // [0,1]
879
-    //#define GLOBAL_DIAG1_INDEX        0 // [0,1]
880
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
881
-    //#define GLOBAL_DIAG1_ONSTATE      0 // [0,1]
882
-    //#define GLOBAL_DIAG0_INT_PUSHPULL 0 // [0,1]
883
-    //#define GLOBAL_DIAG1_INT_PUSHPULL 0 // [0,1]
884
-    //#define GLOBAL_SMALL_HYSTERESIS   0 // [0,1]
885
-    //#define GLOBAL_STOP_ENABLE        0 // [0,1]
886
-    //#define GLOBAL_DIRECT_MODE        0 // [0,1]
887
-
888
-    /* VELOCITY-DEPENDENT DRIVE FEATURES */
889
-
890
-    #define GLOBAL_IHOLD             22 // [0-31] 0: min, 31: max
891
-    #define GLOBAL_IRUN              31 // [0-31] 0: min, 31: max
892
-    #define GLOBAL_IHOLDDELAY        15 // [0-15] 0: min, 15: about 4 seconds
893
-    //#define GLOBAL_TPOWERDOWN         0 // [0-255] 0: min, 255: about 4 seconds
894
-    //#define GLOBAL_TPWMTHRS           0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
895
-    //#define GLOBAL_TCOOLTHRS          0 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
896
-    #define GLOBAL_THIGH             10 // [0-1048576] e.g. 20 corresponds with 2000 steps/s
897
-
898
-    /* SPI MODE CONFIGURATION */
899
-
900
-    //#define GLOBAL_XDIRECT            0
901
-
902
-    /* DCSTEP MINIMUM VELOCITY */
903
-
904
-    //#define GLOBAL_VDCMIN             0
905
-
906
-    /* MOTOR DRIVER CONFIGURATION*/
907
-
908
-    //#define GLOBAL_DEDGE              0
909
-    //#define GLOBAL_DISS2G             0
910
-    #define GLOBAL_INTPOL             1 // 0: off 1: 256 microstep interpolation
911
-    #define GLOBAL_MRES              16 // number of microsteps
912
-    #define GLOBAL_SYNC               1 // [0-15]
913
-    #define GLOBAL_VHIGHCHM           1 // [0,1] 0: normal, 1: high velocity stepper mode
914
-    #define GLOBAL_VHIGHFS            0 // [0,1] 0: normal, 1: switch to full steps for high velocities
915
-    // #define GLOBAL_VSENSE            0 // [0,1] 0: normal, 1: high sensitivity (not recommended)
916
-    #define GLOBAL_TBL                1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
917
-    #define GLOBAL_CHM                0 // [0,1] 0: spreadCycle, 1: Constant off time with fast decay time.
918
-    //#define GLOBAL_RNDTF              0
919
-    //#define GLOBAL_DISFDCC            0
920
-    //#define GLOBAL_FD                 0
921
-    //#define GLOBAL_HEND               0
922
-    //#define GLOBAL_HSTRT              0
923
-    #define GLOBAL_TOFF              10 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
924
-
925
-    //#define GLOBAL_SFILT              0
926
-    //#define GLOBAL_SGT                0
927
-    //#define GLOBAL_SEIMIN             0
928
-    //#define GLOBAL_SEDN               0
929
-    //#define GLOBAL_SEMAX              0
930
-    //#define GLOBAL_SEUP               0
931
-    //#define GLOBAL_SEMIN              0
932
-
933
-    //#define GLOBAL_DC_TIME            0
934
-    //#define GLOBAL_DC_SG              0
935
-
936
-    //#define GLOBAL_FREEWHEEL          0
937
-    //#define GLOBAL_PWM_SYMMETRIC      0
938
-    //#define GLOBAL_PWM_AUTOSCALE      0
939
-    //#define GLOBAL_PWM_FREQ           0
940
-    //#define GLOBAL_PWM_GRAD           0
941
-    //#define GLOBAL_PWM_AMPL           0
942
-
943
-    //#define GLOBAL_ENCM_CTRL          0
944
-
945
-  #else
946
-
947
-    #define X_IHOLD          31 // [0-31] 0: min, 31: max
948
-    #define X_IRUN           31 // [0-31] 0: min, 31: max
949
-    #define X_IHOLDDELAY     15 // [0-15] 0: min, 15: about 4 seconds
950
-    #define X_I_SCALE_ANALOG  1 // 0: Normal, 1: AIN
951
-    #define X_MRES           16 // number of microsteps
952
-    #define X_TBL             1 // 0-3: set comparator blank time to 16, 24, 36 or 54 clocks, 1 or 2 is recommended
953
-    #define X_TOFF            8 // 0: driver disable, 1: use only with TBL>2, 2-15: off time setting during slow decay phase
954
-
955
-    #define X2_IHOLD         31
956
-    #define X2_IRUN          31
957
-    #define X2_IHOLDDELAY    15
958
-    #define X2_I_SCALE_ANALOG 1
959
-    #define X2_MRES          16
960
-    #define X2_TBL            1
961
-    #define X2_TOFF           8
962
-
963
-    #define Y_IHOLD          31
964
-    #define Y_IRUN           31
965
-    #define Y_IHOLDDELAY     15
966
-    #define Y_I_SCALE_ANALOG  1
967
-    #define Y_MRES           16
968
-    #define Y_TBL             1
969
-    #define Y_TOFF            8
970
-
971
-    #define Y2_IHOLD         31
972
-    #define Y2_IRUN          31
973
-    #define Y2_IHOLDDELAY    15
974
-    #define Y2_I_SCALE_ANALOG 1
975
-    #define Y2_MRES          16
976
-    #define Y2_TBL            1
977
-    #define Y2_TOFF           8
978
-
979
-    #define Z_IHOLD          31
980
-    #define Z_IRUN           31
981
-    #define Z_IHOLDDELAY     15
982
-    #define Z_I_SCALE_ANALOG  1
983
-    #define Z_MRES           16
984
-    #define Z_TBL             1
985
-    #define Z_TOFF            8
986
-
987
-    #define Z2_IHOLD         31
988
-    #define Z2_IRUN          31
989
-    #define Z2_IHOLDDELAY    15
990
-    #define Z2_I_SCALE_ANALOG 1
991
-    #define Z2_MRES          16
992
-    #define Z2_TBL            1
993
-    #define Z2_TOFF           8
994
-
995
-    #define E0_IHOLD         31
996
-    #define E0_IRUN          31
997
-    #define E0_IHOLDDELAY    15
998
-    #define E0_I_SCALE_ANALOG 1
999
-    #define E0_MRES          16
1000
-    #define E0_TBL            1
1001
-    #define E0_TOFF           8
1002
-
1003
-    #define E1_IHOLD         31
1004
-    #define E1_IRUN          31
1005
-    #define E1_IHOLDDELAY    15
1006
-    #define E1_I_SCALE_ANALOG 1
1007
-    #define E1_MRES          16
1008
-    #define E1_TBL            1
1009
-    #define E1_TOFF           8
1010
-
1011
-    #define E2_IHOLD         31
1012
-    #define E2_IRUN          31
1013
-    #define E2_IHOLDDELAY    15
1014
-    #define E2_I_SCALE_ANALOG 1
1015
-    #define E2_MRES          16
1016
-    #define E2_TBL            1
1017
-    #define E2_TOFF           8
1018
-
1019
-    #define E3_IHOLD         31
1020
-    #define E3_IRUN          31
1021
-    #define E3_IHOLDDELAY    15
1022
-    #define E3_I_SCALE_ANALOG 1
1023
-    #define E3_MRES          16
1024
-    #define E3_TBL            1
1025
-    #define E3_TOFF           8
1026
-
1027
-  #endif // TMC2130_ADVANCED_CONFIGURATION
1028
-
1029
-#endif // HAVE_TMC2130DRIVER
865
+  /**
866
+   * Stepper driver settings
867
+   */
868
+
869
+  #define R_SENSE           0.11  // R_sense resistor for SilentStepStick2130
870
+  #define HOLD_MULTIPLIER    0.5  // Scales down the holding current from run current
871
+  #define INTERPOLATE          1  // Interpolate X/Y/Z_MICROSTEPS to 256
872
+
873
+  #define X_MAX_CURRENT     1000  // rms current in mA
874
+  #define X_MICROSTEPS        16  // FULLSTEP..256
875
+  #define X_CHIP_SELECT       40  // Pin
876
+
877
+  #define Y_MAX_CURRENT     1000
878
+  #define Y_MICROSTEPS        16
879
+  #define Y_CHIP_SELECT       42
880
+
881
+  #define Z_MAX_CURRENT     1000
882
+  #define Z_MICROSTEPS        16
883
+  #define Z_CHIP_SELECT       65
884
+
885
+  //#define X2_MAX_CURRENT  1000
886
+  //#define X2_MICROSTEPS     16
887
+  //#define X2_CHIP_SELECT    -1
888
+
889
+  //#define Y2_MAX_CURRENT  1000
890
+  //#define Y2_MICROSTEPS     16
891
+  //#define Y2_CHIP_SELECT    -1
892
+
893
+  //#define Z2_MAX_CURRENT  1000
894
+  //#define Z2_MICROSTEPS     16
895
+  //#define Z2_CHIP_SELECT    -1
896
+
897
+  //#define E0_MAX_CURRENT  1000
898
+  //#define E0_MICROSTEPS     16
899
+  //#define E0_CHIP_SELECT    -1
900
+
901
+  //#define E1_MAX_CURRENT  1000
902
+  //#define E1_MICROSTEPS     16
903
+  //#define E1_CHIP_SELECT    -1
904
+
905
+  //#define E2_MAX_CURRENT  1000
906
+  //#define E2_MICROSTEPS     16
907
+  //#define E2_CHIP_SELECT    -1
908
+
909
+  //#define E3_MAX_CURRENT  1000
910
+  //#define E3_MICROSTEPS     16
911
+  //#define E3_CHIP_SELECT    -1
912
+
913
+  /**
914
+   * You can set your own advanced settings by filling in predefined functions.
915
+   * A list of available functions can be found on the library github page
916
+   * https://github.com/teemuatlut/TMC2130Stepper
917
+   *
918
+   * Example:
919
+   * #define TMC2130_ADV() { \
920
+   *   stepperX.diag0_temp_prewarn(1); \
921
+   *   stepperX.interpolate(0); \
922
+   * }
923
+   */
924
+  #define  TMC2130_ADV() {  }
925
+
926
+#endif // ENABLED(HAVE_TMC2130)
1030
 
927
 
1031
 // @section L6470
928
 // @section L6470
1032
 
929
 

+ 1
- 1
Marlin/stepper.cpp View File

894
   #endif
894
   #endif
895
 
895
 
896
   // Init TMC2130 Steppers
896
   // Init TMC2130 Steppers
897
-  #if ENABLED(HAVE_TMC2130DRIVER)
897
+  #if ENABLED(HAVE_TMC2130)
898
     tmc2130_init();
898
     tmc2130_init();
899
   #endif
899
   #endif
900
 
900
 

+ 75
- 403
Marlin/stepper_indirection.cpp View File

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
-  stepper_indirection.c - stepper motor driver indirection
25
-  to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
26
-  Part of Marlin
27
-
28
-  Copyright (c) 2015 Dominik Wenger
29
-
30
-  Marlin is free software: you can redistribute it and/or modify
31
-  it under the terms of the GNU General Public License as published by
32
-  the Free Software Foundation, either version 3 of the License, or
33
-  (at your option) any later version.
34
-
35
-  Marlin is distributed in the hope that it will be useful,
36
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
37
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
38
-  GNU General Public License for more details.
39
-
40
-  You should have received a copy of the GNU General Public License
41
-  along with Marlin.  If not, see <http://www.gnu.org/licenses/>.
42
-*/
24
+ * stepper_indirection.cpp
25
+ *
26
+ * Stepper motor driver indirection to allow some stepper functions to
27
+ * be done via SPI/I2c instead of direct pin manipulation.
28
+ *
29
+ * Part of Marlin
30
+ *
31
+ * Copyright (c) 2015 Dominik Wenger
32
+ */
43
 
33
 
44
 #include "stepper_indirection.h"
34
 #include "stepper_indirection.h"
45
 
35
 
53
   #include <SPI.h>
43
   #include <SPI.h>
54
   #include <TMC26XStepper.h>
44
   #include <TMC26XStepper.h>
55
 
45
 
46
+  #define _TMC_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_ENABLE_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
47
+
56
   #if ENABLED(X_IS_TMC)
48
   #if ENABLED(X_IS_TMC)
57
-    TMC26XStepper stepperX(200, X_ENABLE_PIN, X_STEP_PIN, X_DIR_PIN, X_MAX_CURRENT, X_SENSE_RESISTOR);
49
+    _TMC_DEFINE(X);
58
   #endif
50
   #endif
59
   #if ENABLED(X2_IS_TMC)
51
   #if ENABLED(X2_IS_TMC)
60
-    TMC26XStepper stepperX2(200, X2_ENABLE_PIN, X2_STEP_PIN, X2_DIR_PIN, X2_MAX_CURRENT, X2_SENSE_RESISTOR);
52
+    _TMC_DEFINE(X2);
61
   #endif
53
   #endif
62
   #if ENABLED(Y_IS_TMC)
54
   #if ENABLED(Y_IS_TMC)
63
-    TMC26XStepper stepperY(200, Y_ENABLE_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_MAX_CURRENT, Y_SENSE_RESISTOR);
55
+    _TMC_DEFINE(Y);
64
   #endif
56
   #endif
65
   #if ENABLED(Y2_IS_TMC)
57
   #if ENABLED(Y2_IS_TMC)
66
-    TMC26XStepper stepperY2(200, Y2_ENABLE_PIN, Y2_STEP_PIN, Y2_DIR_PIN, Y2_MAX_CURRENT, Y2_SENSE_RESISTOR);
58
+    _TMC_DEFINE(Y2);
67
   #endif
59
   #endif
68
   #if ENABLED(Z_IS_TMC)
60
   #if ENABLED(Z_IS_TMC)
69
-    TMC26XStepper stepperZ(200, Z_ENABLE_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_MAX_CURRENT, Z_SENSE_RESISTOR);
61
+    _TMC_DEFINE(Z);
70
   #endif
62
   #endif
71
   #if ENABLED(Z2_IS_TMC)
63
   #if ENABLED(Z2_IS_TMC)
72
-    TMC26XStepper stepperZ2(200, Z2_ENABLE_PIN, Z2_STEP_PIN, Z2_DIR_PIN, Z2_MAX_CURRENT, Z2_SENSE_RESISTOR);
64
+    _TMC_DEFINE(Z2);
73
   #endif
65
   #endif
74
   #if ENABLED(E0_IS_TMC)
66
   #if ENABLED(E0_IS_TMC)
75
-    TMC26XStepper stepperE0(200, E0_ENABLE_PIN, E0_STEP_PIN, E0_DIR_PIN, E0_MAX_CURRENT, E0_SENSE_RESISTOR);
67
+    _TMC_DEFINE(E0);
76
   #endif
68
   #endif
77
   #if ENABLED(E1_IS_TMC)
69
   #if ENABLED(E1_IS_TMC)
78
-    TMC26XStepper stepperE1(200, E1_ENABLE_PIN, E1_STEP_PIN, E1_DIR_PIN, E1_MAX_CURRENT, E1_SENSE_RESISTOR);
70
+    _TMC_DEFINE(E1);
79
   #endif
71
   #endif
80
   #if ENABLED(E2_IS_TMC)
72
   #if ENABLED(E2_IS_TMC)
81
-    TMC26XStepper stepperE2(200, E2_ENABLE_PIN, E2_STEP_PIN, E2_DIR_PIN, E2_MAX_CURRENT, E2_SENSE_RESISTOR);
73
+    _TMC_DEFINE(E2);
82
   #endif
74
   #endif
83
   #if ENABLED(E3_IS_TMC)
75
   #if ENABLED(E3_IS_TMC)
84
-    TMC26XStepper stepperE3(200, E3_ENABLE_PIN, E3_STEP_PIN, E3_DIR_PIN, E3_MAX_CURRENT, E3_SENSE_RESISTOR);
76
+    _TMC_DEFINE(E3);
85
   #endif
77
   #endif
86
 
78
 
87
   #define _TMC_INIT(A) do{ \
79
   #define _TMC_INIT(A) do{ \
88
     stepper##A.setMicrosteps(A##_MICROSTEPS); \
80
     stepper##A.setMicrosteps(A##_MICROSTEPS); \
89
     stepper##A.start(); \
81
     stepper##A.start(); \
90
-  } while(0)
82
+  }while(0)
91
 
83
 
92
   void tmc_init() {
84
   void tmc_init() {
93
     #if ENABLED(X_IS_TMC)
85
     #if ENABLED(X_IS_TMC)
127
 //
119
 //
128
 // TMC2130 Driver objects and inits
120
 // TMC2130 Driver objects and inits
129
 //
121
 //
130
-#if ENABLED(HAVE_TMC2130DRIVER)
122
+#if ENABLED(HAVE_TMC2130)
131
 
123
 
132
   #include <SPI.h>
124
   #include <SPI.h>
133
-  #include <Trinamic_TMC2130.h>
134
-
135
-  #if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
125
+  #include <TMC2130Stepper.h>
136
 
126
 
137
-    #ifdef GLOBAL_I_SCALE_ANALOG
138
-      #define _2130_set_I_scale_analog(A) stepper##A.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG)
139
-    #else
140
-      #define _2130_set_I_scale_analog(A) NOOP
141
-    #endif
142
-    #ifdef GLOBAL_INTERNAL_RSENSE
143
-      #define _2130_set_internal_Rsense(A) stepper##A.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE)
144
-    #else
145
-      #define _2130_set_internal_Rsense(A) NOOP
146
-    #endif
147
-    #ifdef GLOBAL_EN_PWM_MODE
148
-      #define _2130_set_en_pwm_mode(A) stepper##A.set_en_pwm_mode(GLOBAL_EN_PWM_MODE)
149
-    #else
150
-      #define _2130_set_en_pwm_mode(A) NOOP
151
-    #endif
152
-    #ifdef GLOBAL_ENC_COMMUTATION
153
-      #define _2130_set_enc_commutation(A) stepper##A.set_enc_commutation(GLOBAL_ENC_COMMUTATION)
154
-    #else
155
-      #define _2130_set_enc_commutation(A) NOOP
156
-    #endif
157
-    #ifdef GLOBAL_SHAFT
158
-      #define _2130_set_shaft(A) stepper##A.set_shaft(GLOBAL_SHAFT)
159
-    #else
160
-      #define _2130_set_shaft(A) NOOP
161
-    #endif
162
-    #ifdef GLOBAL_DIAG0_ERROR
163
-      #define _2130_set_diag0_error(A) stepper##A.set_diag0_error(GLOBAL_DIAG0_ERROR)
164
-    #else
165
-      #define _2130_set_diag0_error(A) NOOP
166
-    #endif
167
-    #ifdef GLOBAL_DIAG0_OTPW
168
-      #define _2130_set_diag0_otpw(A) stepper##A.set_diag0_otpw(GLOBAL_DIAG0_OTPW)
169
-    #else
170
-      #define _2130_set_diag0_otpw(A) NOOP
171
-    #endif
172
-    #ifdef GLOBAL_DIAG0_STALL
173
-      #define _2130_set_diag0_stall(A) stepper##A.set_diag0_stall(GLOBAL_DIAG0_STALL)
174
-    #else
175
-      #define _2130_set_diag0_stall(A) NOOP
176
-    #endif
177
-    #ifdef GLOBAL_DIAG1_STALL
178
-      #define _2130_set_diag1_stall(A) stepper##A.set_diag1_stall(GLOBAL_DIAG1_STALL)
179
-    #else
180
-      #define _2130_set_diag1_stall(A) NOOP
181
-    #endif
182
-    #ifdef GLOBAL_DIAG1_INDEX
183
-      #define _2130_set_diag1_index(A) stepper##A.set_diag1_index(GLOBAL_DIAG1_INDEX)
184
-    #else
185
-      #define _2130_set_diag1_index(A) NOOP
186
-    #endif
187
-    #ifdef GLOBAL_DIAG1_ONSTATE
188
-      #define _2130_set_diag1_onstate(A) stepper##A.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE)
189
-    #else
190
-      #define _2130_set_diag1_onstate(A) NOOP
191
-    #endif
192
-    #ifdef GLOBAL_DIAG1_ONSTATE
193
-      #define _2130_set_diag1_steps_skipped(A) stepper##A.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE)
194
-    #else
195
-      #define _2130_set_diag1_steps_skipped(A) NOOP
196
-    #endif
197
-    #ifdef GLOBAL_DIAG0_INT_PUSHPULL
198
-      #define _2130_set_diag0_int_pushpull(A) stepper##A.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL)
199
-    #else
200
-      #define _2130_set_diag0_int_pushpull(A) NOOP
201
-    #endif
202
-    #ifdef GLOBAL_DIAG1_INT_PUSHPULL
203
-      #define _2130_set_diag1_int_pushpull(A) stepper##A.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL)
204
-    #else
205
-      #define _2130_set_diag1_int_pushpull(A) NOOP
206
-    #endif
207
-    #ifdef GLOBAL_SMALL_HYSTERESIS
208
-      #define _2130_set_small_hysteresis(A) stepper##A.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS)
209
-    #else
210
-      #define _2130_set_small_hysteresis(A) NOOP
211
-    #endif
212
-    #ifdef GLOBAL_STOP_ENABLE
213
-      #define _2130_set_stop_enable(A) stepper##A.set_stop_enable(GLOBAL_STOP_ENABLE)
214
-    #else
215
-      #define _2130_set_stop_enable(A) NOOP
216
-    #endif
217
-    #ifdef GLOBAL_DIRECT_MODE
218
-      #define _2130_set_direct_mode(A) stepper##A.set_direct_mode(GLOBAL_DIRECT_MODE)
219
-    #else
220
-      #define _2130_set_direct_mode(A) NOOP
221
-    #endif
222
-    #if defined(GLOBAL_IHOLD) && defined(GLOBAL_IRUN) && defined(GLOBAL_IHOLDDELAY)
223
-      #define _2130_set_IHOLD_IRUN(A) stepper##A.set_IHOLD_IRUN(GLOBAL_IHOLD, GLOBAL_IRUN, GLOBAL_IHOLDDELAY)
224
-    #else
225
-      #define _2130_set_IHOLD_IRUN(A) NOOP
226
-    #endif
227
-    #ifdef GLOBAL_TPOWERDOWN
228
-      #define _2130_set_TPOWERDOWN(A) stepper##A.set_TPOWERDOWN(GLOBAL_TPOWERDOWN)
229
-    #else
230
-      #define _2130_set_TPOWERDOWN(A) NOOP
231
-    #endif
232
-    #ifdef GLOBAL_TPWMTHRS
233
-      #define _2130_set_TPWMTHRS(A) stepper##A.set_TPWMTHRS(GLOBAL_TPWMTHRS)
234
-    #else
235
-      #define _2130_set_TPWMTHRS(A) NOOP
236
-    #endif
237
-    #ifdef GLOBAL_TCOOLTHRS
238
-      #define _2130_set_TCOOLTHRS(A) stepper##A.set_TCOOLTHRS(GLOBAL_TCOOLTHRS)
239
-    #else
240
-      #define _2130_set_TCOOLTHRS(A) NOOP
241
-    #endif
242
-    #ifdef GLOBAL_THIGH
243
-      #define _2130_set_THIGH(A) stepper##A.set_THIGH(GLOBAL_THIGH)
244
-    #else
245
-      #define _2130_set_THIGH(A) NOOP
246
-    #endif
247
-    #ifdef GLOBAL_XDIRECT
248
-      #define _2130_set_XDIRECT(A) stepper##A.set_XDIRECT(GLOBAL_XDIRECT)
249
-    #else
250
-      #define _2130_set_XDIRECT(A) NOOP
251
-    #endif
252
-    #ifdef GLOBAL_VDCMIN
253
-      #define _2130_set_VDCMIN(A) stepper##A.set_VDCMIN(GLOBAL_VDCMIN)
254
-    #else
255
-      #define _2130_set_VDCMIN(A) NOOP
256
-    #endif
257
-    #ifdef GLOBAL_DEDGE
258
-      #define _2130_set_dedge(A) stepper##A.set_dedge(GLOBAL_DEDGE)
259
-    #else
260
-      #define _2130_set_dedge(A) NOOP
261
-    #endif
262
-    #ifdef GLOBAL_DISS2G
263
-      #define _2130_set_diss2g(A) stepper##A.set_diss2g(GLOBAL_DISS2G)
264
-    #else
265
-      #define _2130_set_diss2g(A) NOOP
266
-    #endif
267
-    #ifdef GLOBAL_INTPOL
268
-      #define _2130_set_intpol(A) stepper##A.set_intpol(GLOBAL_INTPOL)
269
-    #else
270
-      #define _2130_set_intpol(A) NOOP
271
-    #endif
272
-    #ifdef GLOBAL_MRES
273
-      #define _2130_set_mres(A) stepper##A.set_mres(GLOBAL_MRES)
274
-    #else
275
-      #define _2130_set_mres(A) NOOP
276
-    #endif
277
-    #ifdef GLOBAL_SYNC
278
-      #define _2130_set_sync(A) stepper##A.set_sync(GLOBAL_SYNC)
279
-    #else
280
-      #define _2130_set_sync(A) NOOP
281
-    #endif
282
-    #ifdef GLOBAL_VHIGHCHM
283
-      #define _2130_set_vhighchm(A) stepper##A.set_vhighchm(GLOBAL_VHIGHCHM)
284
-    #else
285
-      #define _2130_set_vhighchm(A) NOOP
286
-    #endif
287
-    #ifdef GLOBAL_VHIGHFS
288
-      #define _2130_set_vhighfs(A) stepper##A.set_vhighfs(GLOBAL_VHIGHFS)
289
-    #else
290
-      #define _2130_set_vhighfs(A) NOOP
291
-    #endif
292
-    #ifdef GLOBAL_VSENSE
293
-      #define _2130_set_vsense(A) stepper##A.set_vsense(GLOBAL_VSENSE)
294
-    #else
295
-      #define _2130_set_vsense(A) NOOP
296
-    #endif
297
-    #ifdef GLOBAL_TBL
298
-      #define _2130_set_tbl(A) stepper##A.set_tbl(GLOBAL_TBL)
299
-    #else
300
-      #define _2130_set_tbl(A) NOOP
301
-    #endif
302
-    #ifdef GLOBAL_CHM
303
-      #define _2130_set_chm(A) stepper##A.set_chm(GLOBAL_CHM)
304
-    #else
305
-      #define _2130_set_chm(A) NOOP
306
-    #endif
307
-    #ifdef GLOBAL_RNDTF
308
-      #define _2130_set_rndtf(A) stepper##A.set_rndtf(GLOBAL_RNDTF)
309
-    #else
310
-      #define _2130_set_rndtf(A) NOOP
311
-    #endif
312
-    #ifdef GLOBAL_DISFDCC
313
-      #define _2130_set_disfdcc(A) stepper##A.set_disfdcc(GLOBAL_DISFDCC)
314
-    #else
315
-      #define _2130_set_disfdcc(A) NOOP
316
-    #endif
317
-    #ifdef GLOBAL_FD
318
-      #define _2130_set_fd(A) stepper##A.set_fd(GLOBAL_FD)
319
-    #else
320
-      #define _2130_set_fd(A) NOOP
321
-    #endif
322
-    #ifdef GLOBAL_HEND
323
-      #define _2130_set_hend(A) stepper##A.set_hend(GLOBAL_HEND)
324
-    #else
325
-      #define _2130_set_hend(A) NOOP
326
-    #endif
327
-    #ifdef GLOBAL_HSTRT
328
-      #define _2130_set_hstrt(A) stepper##A.set_hstrt(GLOBAL_HSTRT)
329
-    #else
330
-      #define _2130_set_hstrt(A) NOOP
331
-    #endif
332
-    #ifdef GLOBAL_TOFF
333
-      #define _2130_set_toff(A) stepper##A.set_toff(GLOBAL_TOFF)
334
-    #else
335
-      #define _2130_set_toff(A) NOOP
336
-    #endif
337
-    #ifdef GLOBAL_SFILT
338
-      #define _2130_set_sfilt(A) stepper##A.set_sfilt(GLOBAL_SFILT)
339
-    #else
340
-      #define _2130_set_sfilt(A) NOOP
341
-    #endif
342
-    #ifdef GLOBAL_SGT
343
-      #define _2130_set_sgt(A) stepper##A.set_sgt(GLOBAL_SGT)
344
-    #else
345
-      #define _2130_set_sgt(A) NOOP
346
-    #endif
347
-    #ifdef GLOBAL_SEIMIN
348
-      #define _2130_set_seimin(A) stepper##A.set_seimin(GLOBAL_SEIMIN)
349
-    #else
350
-      #define _2130_set_seimin(A) NOOP
351
-    #endif
352
-    #ifdef GLOBAL_SEDN
353
-      #define _2130_set_sedn(A) stepper##A.set_sedn(GLOBAL_SEDN)
354
-    #else
355
-      #define _2130_set_sedn(A) NOOP
356
-    #endif
357
-    #ifdef GLOBAL_SEMAX
358
-      #define _2130_set_semax(A) stepper##A.set_semax(GLOBAL_SEMAX)
359
-    #else
360
-      #define _2130_set_semax(A) NOOP
361
-    #endif
362
-    #ifdef GLOBAL_SEUP
363
-      #define _2130_set_seup(A) stepper##A.set_seup(GLOBAL_SEUP)
364
-    #else
365
-      #define _2130_set_seup(A) NOOP
366
-    #endif
367
-    #ifdef GLOBAL_SEMIN
368
-      #define _2130_set_semin(A) stepper##A.set_semin(GLOBAL_SEMIN)
369
-    #else
370
-      #define _2130_set_semin(A) NOOP
371
-    #endif
372
-    #if defined(GLOBAL_DC_TIME) && defined(GLOBAL_DC_SG)
373
-      #define _2130_set_DCCTRL(A) stepper##A.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG)
374
-    #else
375
-      #define _2130_set_DCCTRL(A) NOOP
376
-    #endif
377
-    #ifdef GLOBAL_FREEWHEEL
378
-      #define _2130_set_freewheel(A) stepper##A.set_freewheel(GLOBAL_FREEWHEEL)
379
-    #else
380
-      #define _2130_set_freewheel(A) NOOP
381
-    #endif
382
-    #ifdef GLOBAL_PWM_SYMMETRIC
383
-      #define _2130_set_pwm_symmetric(A) stepper##A.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC)
384
-    #else
385
-      #define _2130_set_pwm_symmetric(A) NOOP
386
-    #endif
387
-    #ifdef GLOBAL_PWM_AUTOSCALE
388
-      #define _2130_set_pwm_autoscale(A) stepper##A.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE)
389
-    #else
390
-      #define _2130_set_pwm_autoscale(A) NOOP
391
-    #endif
392
-    #ifdef GLOBAL_PWM_FREQ
393
-      #define _2130_set_pwm_freq(A) stepper##A.set_pwm_freq(GLOBAL_PWM_FREQ)
394
-    #else
395
-      #define _2130_set_pwm_freq(A) NOOP
396
-    #endif
397
-    #ifdef GLOBAL_PWM_GRAD
398
-      #define _2130_set_PWM_GRAD(A) stepper##A.set_PWM_GRAD(GLOBAL_PWM_GRAD)
399
-    #else
400
-      #define _2130_set_PWM_GRAD(A) NOOP
401
-    #endif
402
-    #ifdef GLOBAL_PWM_AMPL
403
-      #define _2130_set_PWM_AMPL(A) stepper##A.set_PWM_AMPL(GLOBAL_PWM_AMPL)
404
-    #else
405
-      #define _2130_set_PWM_AMPL(A) NOOP
406
-    #endif
407
-    #ifdef GLOBAL_ENCM_CTRL
408
-      #define _2130_set_ENCM_CTRL(A) stepper##A.set_ENCM_CTRL(GLOBAL_ENCM_CTRL)
409
-    #else
410
-      #define _2130_set_ENCM_CTRL(A) NOOP
411
-    #endif
412
-
413
-    #define _TMC2130_INIT(A) do{ \
414
-      stepper##A.init(); \
415
-      _2130_set_I_scale_analog(A); \
416
-      _2130_set_internal_Rsense(A); \
417
-      _2130_set_en_pwm_mode(A); \
418
-      _2130_set_enc_commutation(A); \
419
-      _2130_set_shaft(A); \
420
-      _2130_set_diag0_error(A); \
421
-      _2130_set_diag0_otpw(A); \
422
-      _2130_set_diag0_stall(A); \
423
-      _2130_set_diag1_stall(A); \
424
-      _2130_set_diag1_index(A); \
425
-      _2130_set_diag1_onstate(A); \
426
-      _2130_set_diag1_steps_skipped(A); \
427
-      _2130_set_diag0_int_pushpull(A); \
428
-      _2130_set_diag1_int_pushpull(A); \
429
-      _2130_set_small_hysteresis(A); \
430
-      _2130_set_stop_enable(A); \
431
-      _2130_set_direct_mode(A); \
432
-      _2130_set_IHOLD_IRUN(A); \
433
-      _2130_set_TPOWERDOWN(A); \
434
-      _2130_set_TPWMTHRS(A); \
435
-      _2130_set_TCOOLTHRS(A); \
436
-      _2130_set_THIGH(A); \
437
-      _2130_set_XDIRECT(A); \
438
-      _2130_set_VDCMIN(A); \
439
-      _2130_set_dedge(A); \
440
-      _2130_set_diss2g(A); \
441
-      _2130_set_intpol(A); \
442
-      _2130_set_mres(A); \
443
-      _2130_set_sync(A); \
444
-      _2130_set_vhighchm(A); \
445
-      _2130_set_vhighfs(A); \
446
-      _2130_set_vsense(A); \
447
-      _2130_set_tbl(A); \
448
-      _2130_set_chm(A); \
449
-      _2130_set_rndtf(A); \
450
-      _2130_set_disfdcc(A); \
451
-      _2130_set_fd(A); \
452
-      _2130_set_hend(A); \
453
-      _2130_set_hstrt(A); \
454
-      _2130_set_toff(A); \
455
-      _2130_set_sfilt(A); \
456
-      _2130_set_sgt(A); \
457
-      _2130_set_seimin(A); \
458
-      _2130_set_sedn(A); \
459
-      _2130_set_semax(A); \
460
-      _2130_set_seup(A); \
461
-      _2130_set_semin(A); \
462
-      _2130_set_DCCTRL(A); \
463
-      _2130_set_freewheel(A); \
464
-      _2130_set_pwm_symmetric(A); \
465
-      _2130_set_pwm_autoscale(A); \
466
-      _2130_set_pwm_freq(A); \
467
-      _2130_set_PWM_GRAD(A); \
468
-      _2130_set_PWM_AMPL(A); \
469
-      _2130_set_ENCM_CTRL(A); \
470
-    } while(0)
471
-
472
-  #else // !TMC2130_ADVANCED_CONFIGURATION
127
+  #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CHIP_SELECT)
473
 
128
 
474
-    #define _TMC2130_INIT(A) do{ \
475
-      stepper##A.init(); \
476
-      stepper##A.set_mres(A##_MRES); \
477
-      stepper##A.set_IHOLD_IRUN(A##_IHOLD, A##_IRUN, A##_IHOLDDELAY); \
478
-      stepper##A.set_I_scale_analog(A##_I_SCALE_ANALOG); \
479
-      stepper##A.set_tbl(A##_TBL); \
480
-      stepper##A.set_toff(A##_TOFF); \
481
-    } while(0)
482
-
483
-  #endif // TMC2130_ADVANCED_CONFIGURATION
484
-
485
-  // Stepper objects of TMC2310 steppers used
129
+  // Stepper objects of TMC2130 steppers used
486
   #if ENABLED(X_IS_TMC2130)
130
   #if ENABLED(X_IS_TMC2130)
487
-    Trinamic_TMC2130 stepperX(X_CS_PIN);
131
+    _TMC2130_DEFINE(X);
488
   #endif
132
   #endif
489
   #if ENABLED(X2_IS_TMC2130)
133
   #if ENABLED(X2_IS_TMC2130)
490
-    Trinamic_TMC2130 stepperX2(X2_CS_PIN);
134
+    _TMC2130_DEFINE(X2);
491
   #endif
135
   #endif
492
   #if ENABLED(Y_IS_TMC2130)
136
   #if ENABLED(Y_IS_TMC2130)
493
-    Trinamic_TMC2130 stepperY(Y_CS_PIN);
137
+    _TMC2130_DEFINE(Y);
494
   #endif
138
   #endif
495
   #if ENABLED(Y2_IS_TMC2130)
139
   #if ENABLED(Y2_IS_TMC2130)
496
-    Trinamic_TMC2130 stepperY2(Y2_CS_PINR);
140
+    _TMC2130_DEFINE(Y2);
497
   #endif
141
   #endif
498
   #if ENABLED(Z_IS_TMC2130)
142
   #if ENABLED(Z_IS_TMC2130)
499
-    Trinamic_TMC2130 stepperZ(Z_CS_PIN);
143
+    _TMC2130_DEFINE(Z);
500
   #endif
144
   #endif
501
   #if ENABLED(Z2_IS_TMC2130)
145
   #if ENABLED(Z2_IS_TMC2130)
502
-    Trinamic_TMC2130 stepperZ2(Z2_CS_PIN);
146
+    _TMC2130_DEFINE(Z2);
503
   #endif
147
   #endif
504
   #if ENABLED(E0_IS_TMC2130)
148
   #if ENABLED(E0_IS_TMC2130)
505
-    Trinamic_TMC2130 stepperE0(E0_CS_PIN);
149
+    _TMC2130_DEFINE(E0);
506
   #endif
150
   #endif
507
   #if ENABLED(E1_IS_TMC2130)
151
   #if ENABLED(E1_IS_TMC2130)
508
-    Trinamic_TMC2130 stepperE1(E1_CS_PIN);
152
+    _TMC2130_DEFINE(E1);
509
   #endif
153
   #endif
510
   #if ENABLED(E2_IS_TMC2130)
154
   #if ENABLED(E2_IS_TMC2130)
511
-    Trinamic_TMC2130 stepperE2(E2_CS_PIN);
155
+    _TMC2130_DEFINE(E2);
512
   #endif
156
   #endif
513
   #if ENABLED(E3_IS_TMC2130)
157
   #if ENABLED(E3_IS_TMC2130)
514
-    Trinamic_TMC2130 stepperE3(E3_CS_PIN);
158
+    _TMC2130_DEFINE(E3);
515
   #endif
159
   #endif
516
 
160
 
161
+  // Use internal reference voltage for current calculations. This is the default.
162
+  // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
163
+  void tmc2130_init(TMC2130Stepper &st, const uint16_t max_current, const uint16_t microsteps) {
164
+    st.begin();
165
+    st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
166
+    st.microsteps(microsteps);
167
+    st.blank_time(24);
168
+    st.off_time(8);
169
+    st.interpolate(INTERPOLATE);
170
+    #if ENABLED(STEALTHCHOP)
171
+      st.stealthChop(1);
172
+    #endif
173
+    #if ENABLED(SENSORLESS_HOMING)
174
+      st.coolstep_min_speed(1048575);
175
+      st.sg_stall_value(STALL_THRESHOLD);
176
+      st.sg_filter(1);
177
+      st.diag1_stall(1);
178
+      st.diag1_active_high(1);
179
+    #endif
180
+  }
181
+
182
+  #define _TMC2130_INIT(ST) tmc2130_init(stepper##ST, ST##_MAX_CURRENT, ST##_MICROSTEPS)
183
+
517
   void tmc2130_init() {
184
   void tmc2130_init() {
185
+    delay(500); // Let power stabilize before configuring the steppers
518
     #if ENABLED(X_IS_TMC2130)
186
     #if ENABLED(X_IS_TMC2130)
519
       _TMC2130_INIT(X);
187
       _TMC2130_INIT(X);
520
     #endif
188
     #endif
545
     #if ENABLED(E3_IS_TMC2130)
213
     #if ENABLED(E3_IS_TMC2130)
546
       _TMC2130_INIT(E3);
214
       _TMC2130_INIT(E3);
547
     #endif
215
     #endif
216
+
217
+    TMC2130_ADV()
548
   }
218
   }
219
+#endif // HAVE_TMC2130
549
 
220
 
550
-#endif // HAVE_TMC2130DRIVER
551
 
221
 
552
 //
222
 //
553
 // L6470 Driver objects and inits
223
 // L6470 Driver objects and inits
557
   #include <SPI.h>
227
   #include <SPI.h>
558
   #include <L6470.h>
228
   #include <L6470.h>
559
 
229
 
230
+  #define _L6470_DEFINE(ST) L6470 stepper##ST(ST##_ENABLE_PIN)
231
+
560
   // L6470 Stepper objects
232
   // L6470 Stepper objects
561
   #if ENABLED(X_IS_L6470)
233
   #if ENABLED(X_IS_L6470)
562
-    L6470 stepperX(X_ENABLE_PIN);
234
+    _L6470_DEFINE(X);
563
   #endif
235
   #endif
564
   #if ENABLED(X2_IS_L6470)
236
   #if ENABLED(X2_IS_L6470)
565
-    L6470 stepperX2(X2_ENABLE_PIN);
237
+    _L6470_DEFINE(X2);
566
   #endif
238
   #endif
567
   #if ENABLED(Y_IS_L6470)
239
   #if ENABLED(Y_IS_L6470)
568
-    L6470 stepperY(Y_ENABLE_PIN);
240
+    _L6470_DEFINE(Y);
569
   #endif
241
   #endif
570
   #if ENABLED(Y2_IS_L6470)
242
   #if ENABLED(Y2_IS_L6470)
571
-    L6470 stepperY2(Y2_ENABLE_PIN);
243
+    _L6470_DEFINE(Y2);
572
   #endif
244
   #endif
573
   #if ENABLED(Z_IS_L6470)
245
   #if ENABLED(Z_IS_L6470)
574
-    L6470 stepperZ(Z_ENABLE_PIN);
246
+    _L6470_DEFINE(Z);
575
   #endif
247
   #endif
576
   #if ENABLED(Z2_IS_L6470)
248
   #if ENABLED(Z2_IS_L6470)
577
-    L6470 stepperZ2(Z2_ENABLE_PIN);
249
+    _L6470_DEFINE(Z2);
578
   #endif
250
   #endif
579
   #if ENABLED(E0_IS_L6470)
251
   #if ENABLED(E0_IS_L6470)
580
-    L6470 stepperE0(E0_ENABLE_PIN);
252
+    _L6470_DEFINE(E0);
581
   #endif
253
   #endif
582
   #if ENABLED(E1_IS_L6470)
254
   #if ENABLED(E1_IS_L6470)
583
-    L6470 stepperE1(E1_ENABLE_PIN);
255
+    _L6470_DEFINE(E1);
584
   #endif
256
   #endif
585
   #if ENABLED(E2_IS_L6470)
257
   #if ENABLED(E2_IS_L6470)
586
-    L6470 stepperE2(E2_ENABLE_PIN);
258
+    _L6470_DEFINE(E2);
587
   #endif
259
   #endif
588
   #if ENABLED(E3_IS_L6470)
260
   #if ENABLED(E3_IS_L6470)
589
-    L6470 stepperE3(E3_ENABLE_PIN);
261
+    _L6470_DEFINE(E3);
590
   #endif
262
   #endif
591
 
263
 
592
   #define _L6470_INIT(A) do{ \
264
   #define _L6470_INIT(A) do{ \

+ 22
- 24
Marlin/stepper_indirection.h View File

53
   void tmc_init();
53
   void tmc_init();
54
 #endif
54
 #endif
55
 
55
 
56
-// TMC130 drivers have STEP/DIR/ENABLE on normal pins
57
-#if ENABLED(HAVE_TMC2130DRIVER)
58
-  #include <SPI.h>
59
-  #include <Trinamic_TMC2130.h>
56
+#if ENABLED(HAVE_TMC2130)
57
+  #include <TMC2130Stepper.h>
60
   void tmc2130_init();
58
   void tmc2130_init();
61
 #endif
59
 #endif
62
 
60
 
83
     #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
81
     #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
84
     #define X_ENABLE_READ stepperX.isEnabled()
82
     #define X_ENABLE_READ stepperX.isEnabled()
85
   #else
83
   #else
86
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X_IS_TMC2130)
87
-      extern Trinamic_TMC2130 stepperX;
84
+    #if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
85
+      extern TMC2130Stepper stepperX;
88
     #endif
86
     #endif
89
     #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
87
     #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
90
     #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
88
     #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
114
     #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
112
     #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
115
     #define Y_ENABLE_READ stepperY.isEnabled()
113
     #define Y_ENABLE_READ stepperY.isEnabled()
116
   #else
114
   #else
117
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y_IS_TMC2130)
118
-      extern Trinamic_TMC2130 stepperY;
115
+    #if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
116
+      extern TMC2130Stepper stepperY;
119
     #endif
117
     #endif
120
     #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
118
     #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
121
     #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
119
     #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
145
     #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
143
     #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
146
     #define Z_ENABLE_READ stepperZ.isEnabled()
144
     #define Z_ENABLE_READ stepperZ.isEnabled()
147
   #else
145
   #else
148
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z_IS_TMC2130)
149
-      extern Trinamic_TMC2130 stepperZ;
146
+    #if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
147
+      extern TMC2130Stepper stepperZ;
150
     #endif
148
     #endif
151
     #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
149
     #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
152
     #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
150
     #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
177
       #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
175
       #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
178
       #define X2_ENABLE_READ stepperX2.isEnabled()
176
       #define X2_ENABLE_READ stepperX2.isEnabled()
179
     #else
177
     #else
180
-      #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X2_IS_TMC2130)
181
-        extern Trinamic_TMC2130 stepperX2;
178
+      #if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
179
+        extern TMC2130Stepper stepperX2;
182
       #endif
180
       #endif
183
       #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
181
       #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
184
       #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
182
       #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
210
       #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
208
       #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
211
       #define Y2_ENABLE_READ stepperY2.isEnabled()
209
       #define Y2_ENABLE_READ stepperY2.isEnabled()
212
     #else
210
     #else
213
-      #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y2_IS_TMC2130)
214
-        extern Trinamic_TMC2130 stepperY2;
211
+      #if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
212
+        extern TMC2130Stepper stepperY2;
215
       #endif
213
       #endif
216
       #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
214
       #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
217
       #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
215
       #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
243
       #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
241
       #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
244
       #define Z2_ENABLE_READ stepperZ2.isEnabled()
242
       #define Z2_ENABLE_READ stepperZ2.isEnabled()
245
     #else
243
     #else
246
-      #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z2_IS_TMC2130)
247
-        extern Trinamic_TMC2130 stepperZ2;
244
+      #if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
245
+        extern TMC2130Stepper stepperZ2;
248
       #endif
246
       #endif
249
       #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
247
       #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
250
       #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
248
       #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
275
     #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
273
     #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
276
     #define E0_ENABLE_READ stepperE0.isEnabled()
274
     #define E0_ENABLE_READ stepperE0.isEnabled()
277
   #else
275
   #else
278
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E0_IS_TMC2130)
279
-      extern Trinamic_TMC2130 stepperE0;
276
+    #if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
277
+      extern TMC2130Stepper stepperE0;
280
     #endif
278
     #endif
281
     #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
279
     #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
282
     #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
280
     #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
306
     #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
304
     #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
307
     #define E1_ENABLE_READ stepperE1.isEnabled()
305
     #define E1_ENABLE_READ stepperE1.isEnabled()
308
   #else
306
   #else
309
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E1_IS_TMC2130)
310
-      extern Trinamic_TMC2130 stepperE1;
307
+    #if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
308
+      extern TMC2130Stepper stepperE1;
311
     #endif
309
     #endif
312
     #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
310
     #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
313
     #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
311
     #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
337
     #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
335
     #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
338
     #define E2_ENABLE_READ stepperE2.isEnabled()
336
     #define E2_ENABLE_READ stepperE2.isEnabled()
339
   #else
337
   #else
340
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E2_IS_TMC2130)
341
-      extern Trinamic_TMC2130 stepperE2;
338
+    #if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
339
+      extern TMC2130Stepper stepperE2;
342
     #endif
340
     #endif
343
     #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
341
     #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
344
     #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
342
     #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
368
     #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
366
     #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
369
     #define E3_ENABLE_READ stepperE3.isEnabled()
367
     #define E3_ENABLE_READ stepperE3.isEnabled()
370
   #else
368
   #else
371
-    #if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E3_IS_TMC2130)
372
-      extern Trinamic_TMC2130 stepperE3;
369
+    #if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
370
+      extern TMC2130Stepper stepperE3;
373
     #endif
371
     #endif
374
     #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
372
     #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
375
     #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
373
     #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)

Loading…
Cancel
Save