Advertisement
Guest User

Marlin 1.1.8 TMC2130 Config

a guest
Mar 22nd, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. // @section TMC2130, TMC2208
  2.  
  3. /**
  4. * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
  5. *
  6. * You'll also need the TMC2130Stepper Arduino library
  7. * (https://github.com/teemuatlut/TMC2130Stepper).
  8. *
  9. * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to
  10. * the hardware SPI interface on your board and define the required CS pins
  11. * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
  12. */
  13. #define HAVE_TMC2130
  14.  
  15. /**
  16. * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
  17. * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin.
  18. * To use the reading capabilities, also connect #_SERIAL_RX_PIN
  19. * to #_SERIAL_TX_PIN with a 1K resistor.
  20. * The drivers can also be used with hardware serial.
  21. *
  22. * You'll also need the TMC2208Stepper Arduino library
  23. * (https://github.com/teemuatlut/TMC2208Stepper).
  24. */
  25. //#define HAVE_TMC2208
  26.  
  27. #if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
  28.  
  29. // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
  30. #define X_IS_TMC2130
  31. //#define X2_IS_TMC2130
  32. #define Y_IS_TMC2130
  33. //#define Y2_IS_TMC2130
  34. #define Z_IS_TMC2130
  35. //#define Z2_IS_TMC2130
  36. #define E0_IS_TMC2130
  37. //#define E1_IS_TMC2130
  38. //#define E2_IS_TMC2130
  39. //#define E3_IS_TMC2130
  40. //#define E4_IS_TMC2130
  41.  
  42. //#define X_IS_TMC2208
  43. //#define X2_IS_TMC2208
  44. //#define Y_IS_TMC2208
  45. //#define Y2_IS_TMC2208
  46. //#define Z_IS_TMC2208
  47. //#define Z2_IS_TMC2208
  48. //#define E0_IS_TMC2208
  49. //#define E1_IS_TMC2208
  50. //#define E2_IS_TMC2208
  51. //#define E3_IS_TMC2208
  52. //#define E4_IS_TMC2208
  53.  
  54. /**
  55. * Stepper driver settings
  56. */
  57.  
  58. #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
  59. #define HOLD_MULTIPLIER 0.2 // Scales down the holding current from run current
  60. #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
  61.  
  62. #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current.
  63. #define X_MICROSTEPS 16 // 0..256
  64.  
  65. #define Y_CURRENT 800
  66. #define Y_MICROSTEPS 16
  67.  
  68. #define Z_CURRENT 900
  69. #define Z_MICROSTEPS 16
  70.  
  71. #define X2_CURRENT 800
  72. #define X2_MICROSTEPS 16
  73.  
  74. #define Y2_CURRENT 800
  75. #define Y2_MICROSTEPS 16
  76.  
  77. #define Z2_CURRENT 800
  78. #define Z2_MICROSTEPS 16
  79.  
  80. #define E0_CURRENT 800
  81. #define E0_MICROSTEPS 16
  82.  
  83. #define E1_CURRENT 800
  84. #define E1_MICROSTEPS 16
  85.  
  86. #define E2_CURRENT 800
  87. #define E2_MICROSTEPS 16
  88.  
  89. #define E3_CURRENT 800
  90. #define E3_MICROSTEPS 16
  91.  
  92. #define E4_CURRENT 800
  93. #define E4_MICROSTEPS 16
  94.  
  95. /**
  96. * Use Trinamic's ultra quiet stepping mode.
  97. * When disabled, Marlin will use spreadCycle stepping mode.
  98. */
  99. #define STEALTHCHOP
  100.  
  101. /**
  102. * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions,
  103. * like overtemperature and short to ground. TMC2208 requires hardware serial.
  104. * In the case of overtemperature Marlin can decrease the driver current until error condition clears.
  105. * Other detected conditions can be used to stop the current print.
  106. * Relevant g-codes:
  107. * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given.
  108. * M911 - Report stepper driver overtemperature pre-warn condition.
  109. * M912 - Clear stepper driver overtemperature pre-warn condition flag.
  110. * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG)
  111. */
  112. #define MONITOR_DRIVER_STATUS
  113.  
  114. #if ENABLED(MONITOR_DRIVER_STATUS)
  115. #define CURRENT_STEP_DOWN 50 // [mA]
  116. #define REPORT_CURRENT_CHANGE
  117. #define STOP_ON_ERROR
  118. #endif
  119.  
  120. /**
  121. * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD.
  122. * This mode allows for faster movements at the expense of higher noise levels.
  123. * STEALTHCHOP needs to be enabled.
  124. * M913 X/Y/Z/E to live tune the setting
  125. */
  126. //#define HYBRID_THRESHOLD
  127.  
  128. #define X_HYBRID_THRESHOLD 100 // [mm/s]
  129. #define X2_HYBRID_THRESHOLD 100
  130. #define Y_HYBRID_THRESHOLD 100
  131. #define Y2_HYBRID_THRESHOLD 100
  132. #define Z_HYBRID_THRESHOLD 3
  133. #define Z2_HYBRID_THRESHOLD 3
  134. #define E0_HYBRID_THRESHOLD 30
  135. #define E1_HYBRID_THRESHOLD 30
  136. #define E2_HYBRID_THRESHOLD 30
  137. #define E3_HYBRID_THRESHOLD 30
  138. #define E4_HYBRID_THRESHOLD 30
  139.  
  140. /**
  141. * Use stallGuard2 to sense an obstacle and trigger an endstop.
  142. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin.
  143. * X and Y homing will always be done in spreadCycle mode.
  144. *
  145. * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity.
  146. * Higher values make the system LESS sensitive.
  147. * Lower value make the system MORE sensitive.
  148. * Too low values can lead to false positives, while too high values will collide the axis without triggering.
  149. * It is advised to set X/Y_HOME_BUMP_MM to 0.
  150. * M914 X/Y to live tune the setting
  151. */
  152. #define SENSORLESS_HOMING // TMC2130 only
  153.  
  154. #if ENABLED(SENSORLESS_HOMING)
  155. #define X_HOMING_SENSITIVITY 8
  156. #define Y_HOMING_SENSITIVITY 8
  157. #define X_HOME_BUMP_MM 0
  158. #define Y_HOME_BUMP_MM 0
  159. #endif
  160.  
  161. /**
  162. * Enable M122 debugging command for TMC stepper drivers.
  163. * M122 S0/1 will enable continous reporting.
  164. */
  165. #define TMC_DEBUG
  166.  
  167. /**
  168. * You can set your own advanced settings by filling in predefined functions.
  169. * A list of available functions can be found on the library github page
  170. * https://github.com/teemuatlut/TMC2130Stepper
  171. * https://github.com/teemuatlut/TMC2208Stepper
  172. *
  173. * Example:
  174. * #define TMC_ADV() { \
  175. * stepperX.diag0_temp_prewarn(1); \
  176. * stepperY.interpolate(0); \
  177. * }
  178. */
  179. #define TMC_ADV() { }
  180.  
  181. #endif // TMC2130 || TMC2208
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement