소스 검색

Apply TMC2130 to example configurations

Scott Lahteine 7 년 전
부모
커밋
5a456c832a

+ 83
- 186
Marlin/example_configurations/Cartesio/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/Felix/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/Hephestos/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/Hephestos_2/Configuration_adv.h 파일 보기

@@ -741,14 +741,15 @@
741 741
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
742 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 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 751
 //#define HAVE_TMCDRIVER
752
+
752 753
 #if ENABLED(HAVE_TMCDRIVER)
753 754
 
754 755
   //#define X_IS_TMC
@@ -806,23 +807,31 @@
806 807
 
807 808
 // @section TMC2130
808 809
 
809
-
810 810
 /**
811 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 816
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
817 817
  * the hardware SPI interface on your board and define the required CS pins
818 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 836
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
828 837
   //#define X_IS_TMC2130
@@ -836,180 +845,68 @@
836 845
   //#define E2_IS_TMC2130
837 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 911
 // @section L6470
1015 912
 

+ 83
- 186
Marlin/example_configurations/K8200/Configuration_adv.h 파일 보기

@@ -771,14 +771,15 @@
771 771
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
772 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 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 781
 //#define HAVE_TMCDRIVER
782
+
782 783
 #if ENABLED(HAVE_TMCDRIVER)
783 784
 
784 785
   //#define X_IS_TMC
@@ -836,23 +837,31 @@
836 837
 
837 838
 // @section TMC2130
838 839
 
839
-
840 840
 /**
841 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 846
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
847 847
  * the hardware SPI interface on your board and define the required CS pins
848 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 866
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
858 867
   //#define X_IS_TMC2130
@@ -866,180 +875,68 @@
866 875
   //#define E2_IS_TMC2130
867 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 941
 // @section L6470
1045 942
 

+ 83
- 186
Marlin/example_configurations/K8400/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/RigidBot/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/SCARA/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/TAZ4/Configuration_adv.h 파일 보기

@@ -766,14 +766,15 @@
766 766
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
767 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 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 776
 //#define HAVE_TMCDRIVER
777
+
777 778
 #if ENABLED(HAVE_TMCDRIVER)
778 779
 
779 780
   //#define X_IS_TMC
@@ -831,23 +832,31 @@
831 832
 
832 833
 // @section TMC2130
833 834
 
834
-
835 835
 /**
836 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 841
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
842 842
  * the hardware SPI interface on your board and define the required CS pins
843 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 861
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
853 862
   //#define X_IS_TMC2130
@@ -861,180 +870,68 @@
861 870
   //#define E2_IS_TMC2130
862 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 936
 // @section L6470
1040 937
 

+ 83
- 186
Marlin/example_configurations/WITBOX/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h 파일 보기

@@ -763,14 +763,15 @@
763 763
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
764 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 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 773
 //#define HAVE_TMCDRIVER
774
+
774 775
 #if ENABLED(HAVE_TMCDRIVER)
775 776
 
776 777
   //#define X_IS_TMC
@@ -828,23 +829,31 @@
828 829
 
829 830
 // @section TMC2130
830 831
 
831
-
832 832
 /**
833 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 838
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
839 839
  * the hardware SPI interface on your board and define the required CS pins
840 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 858
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
850 859
   //#define X_IS_TMC2130
@@ -858,180 +867,68 @@
858 867
   //#define E2_IS_TMC2130
859 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 933
 // @section L6470
1037 934
 

+ 83
- 186
Marlin/example_configurations/delta/generic/Configuration_adv.h 파일 보기

@@ -760,14 +760,15 @@
760 760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761 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 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 770
 //#define HAVE_TMCDRIVER
771
+
771 772
 #if ENABLED(HAVE_TMCDRIVER)
772 773
 
773 774
   //#define X_IS_TMC
@@ -825,23 +826,31 @@
825 826
 
826 827
 // @section TMC2130
827 828
 
828
-
829 829
 /**
830 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 835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836 836
  * the hardware SPI interface on your board and define the required CS pins
837 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 855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847 856
   //#define X_IS_TMC2130
@@ -855,180 +864,68 @@
855 864
   //#define E2_IS_TMC2130
856 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 930
 // @section L6470
1034 931
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h 파일 보기

@@ -760,14 +760,15 @@
760 760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761 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 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 770
 //#define HAVE_TMCDRIVER
771
+
771 772
 #if ENABLED(HAVE_TMCDRIVER)
772 773
 
773 774
   //#define X_IS_TMC
@@ -825,23 +826,31 @@
825 826
 
826 827
 // @section TMC2130
827 828
 
828
-
829 829
 /**
830 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 835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836 836
  * the hardware SPI interface on your board and define the required CS pins
837 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 855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847 856
   //#define X_IS_TMC2130
@@ -855,180 +864,68 @@
855 864
   //#define E2_IS_TMC2130
856 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 930
 // @section L6470
1034 931
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h 파일 보기

@@ -765,14 +765,15 @@
765 765
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
766 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 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 775
 //#define HAVE_TMCDRIVER
776
+
776 777
 #if ENABLED(HAVE_TMCDRIVER)
777 778
 
778 779
   //#define X_IS_TMC
@@ -830,23 +831,31 @@
830 831
 
831 832
 // @section TMC2130
832 833
 
833
-
834 834
 /**
835 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 840
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
841 841
  * the hardware SPI interface on your board and define the required CS pins
842 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 860
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
852 861
   //#define X_IS_TMC2130
@@ -860,180 +869,68 @@
860 869
   //#define E2_IS_TMC2130
861 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 935
 // @section L6470
1039 936
 

+ 83
- 186
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h 파일 보기

@@ -760,14 +760,15 @@
760 760
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
761 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 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 770
 //#define HAVE_TMCDRIVER
771
+
771 772
 #if ENABLED(HAVE_TMCDRIVER)
772 773
 
773 774
   //#define X_IS_TMC
@@ -825,23 +826,31 @@
825 826
 
826 827
 // @section TMC2130
827 828
 
828
-
829 829
 /**
830 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 835
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
836 836
  * the hardware SPI interface on your board and define the required CS pins
837 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 855
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
847 856
   //#define X_IS_TMC2130
@@ -855,180 +864,68 @@
855 864
   //#define E2_IS_TMC2130
856 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 930
 // @section L6470
1034 931
 

+ 83
- 186
Marlin/example_configurations/makibox/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

+ 83
- 186
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h 파일 보기

@@ -758,14 +758,15 @@
758 758
                                                      // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
759 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 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 768
 //#define HAVE_TMCDRIVER
769
+
769 770
 #if ENABLED(HAVE_TMCDRIVER)
770 771
 
771 772
   //#define X_IS_TMC
@@ -823,23 +824,31 @@
823 824
 
824 825
 // @section TMC2130
825 826
 
826
-
827 827
 /**
828 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 833
  * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
834 834
  * the hardware SPI interface on your board and define the required CS pins
835 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 853
   // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
845 854
   //#define X_IS_TMC2130
@@ -853,180 +862,68 @@
853 862
   //#define E2_IS_TMC2130
854 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 928
 // @section L6470
1032 929
 

Loading…
취소
저장