My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pins_MKS_SGEN_L.h 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Makerbase MKS SGEN-L pin assignments
  25. */
  26. #include "env_validate.h"
  27. #define BOARD_INFO_NAME "MKS SGen-L"
  28. #define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-SGEN_L"
  29. #define USES_DIAG_JUMPERS
  30. //
  31. // Servos
  32. //
  33. #define SERVO0_PIN P1_23 // SERVO P1.23
  34. #define SERVO1_PIN P2_00 // SERVO P2.0
  35. //
  36. // Trinamic Stallguard pins
  37. //
  38. #define X_DIAG_PIN P1_29 // X-
  39. #define Y_DIAG_PIN P1_27 // Y-
  40. #define Z_DIAG_PIN P1_25 // Z-
  41. #define E0_DIAG_PIN P1_28 // X+
  42. #define E1_DIAG_PIN P1_26 // Y+
  43. //
  44. // Limit Switches
  45. //
  46. #ifdef X_STALL_SENSITIVITY
  47. #define X_STOP_PIN X_DIAG_PIN
  48. #if X_HOME_TO_MIN
  49. #define X_MAX_PIN P1_28 // X+
  50. #else
  51. #define X_MIN_PIN P1_28 // X+
  52. #endif
  53. #else
  54. #define X_MIN_PIN P1_29 // X-
  55. #define X_MAX_PIN P1_28 // X+
  56. #endif
  57. #ifdef Y_STALL_SENSITIVITY
  58. #define Y_STOP_PIN Y_DIAG_PIN
  59. #if Y_HOME_TO_MIN
  60. #define Y_MAX_PIN P1_26 // Y+
  61. #else
  62. #define Y_MIN_PIN P1_26 // Y+
  63. #endif
  64. #else
  65. #define Y_MIN_PIN P1_27 // Y-
  66. #define Y_MAX_PIN P1_26 // Y+
  67. #endif
  68. #ifdef Z_STALL_SENSITIVITY
  69. #define Z_STOP_PIN Z_DIAG_PIN
  70. #if Z_HOME_TO_MIN
  71. #define Z_MAX_PIN P1_24 // Z+
  72. #else
  73. #define Z_MIN_PIN P1_24 // Z+
  74. #endif
  75. #else
  76. #define Z_MIN_PIN P1_25 // Z-
  77. #define Z_MAX_PIN P1_24 // Z+
  78. #endif
  79. //
  80. // Z Probe (when not Z_MIN_PIN)
  81. //
  82. #ifndef Z_MIN_PROBE_PIN
  83. #define Z_MIN_PROBE_PIN P1_24
  84. #endif
  85. //
  86. // Steppers
  87. //
  88. #define X_STEP_PIN P2_02
  89. #define X_DIR_PIN P2_03
  90. #define X_ENABLE_PIN P2_01
  91. #ifndef X_CS_PIN
  92. #define X_CS_PIN P1_01
  93. #endif
  94. #define Y_STEP_PIN P0_19
  95. #define Y_DIR_PIN P0_20
  96. #define Y_ENABLE_PIN P2_08
  97. #ifndef Y_CS_PIN
  98. #define Y_CS_PIN P1_08
  99. #endif
  100. #define Z_STEP_PIN P0_22
  101. #define Z_DIR_PIN P2_11
  102. #define Z_ENABLE_PIN P0_21
  103. #ifndef Z_CS_PIN
  104. #define Z_CS_PIN P1_10
  105. #endif
  106. #define E0_STEP_PIN P2_13
  107. #define E0_DIR_PIN P0_11
  108. #define E0_ENABLE_PIN P2_12
  109. #ifndef E0_CS_PIN
  110. #define E0_CS_PIN P1_15
  111. #endif
  112. #define E1_STEP_PIN P0_01
  113. #define E1_DIR_PIN P0_00
  114. #define E1_ENABLE_PIN P0_10
  115. #ifndef E1_CS_PIN
  116. #define E1_CS_PIN P1_17
  117. #endif
  118. //
  119. // Software SPI pins for TMC2130 stepper drivers
  120. //
  121. #if ENABLED(TMC_USE_SW_SPI)
  122. #ifndef TMC_SW_MOSI
  123. #define TMC_SW_MOSI P4_28
  124. #endif
  125. #ifndef TMC_SW_MISO
  126. #define TMC_SW_MISO P0_05
  127. #endif
  128. #ifndef TMC_SW_SCK
  129. #define TMC_SW_SCK P0_04
  130. #endif
  131. #endif
  132. #if HAS_TMC_UART
  133. /**
  134. * TMC2208/TMC2209 stepper drivers
  135. *
  136. * Hardware serial communication ports.
  137. * If undefined software serial is used according to the pins below
  138. */
  139. //#define X_HARDWARE_SERIAL Serial1
  140. //#define X2_HARDWARE_SERIAL Serial1
  141. //#define Y_HARDWARE_SERIAL Serial1
  142. //#define Y2_HARDWARE_SERIAL Serial1
  143. //#define Z_HARDWARE_SERIAL Serial1
  144. //#define Z2_HARDWARE_SERIAL Serial1
  145. //#define E0_HARDWARE_SERIAL Serial1
  146. //#define E1_HARDWARE_SERIAL Serial1
  147. //#define E2_HARDWARE_SERIAL Serial1
  148. //#define E3_HARDWARE_SERIAL Serial1
  149. //#define E4_HARDWARE_SERIAL Serial1
  150. #define X_SERIAL_TX_PIN P1_04
  151. #define X_SERIAL_RX_PIN P1_01
  152. #define Y_SERIAL_TX_PIN P1_09
  153. #define Y_SERIAL_RX_PIN P1_08
  154. #define Z_SERIAL_TX_PIN P1_14
  155. #define Z_SERIAL_RX_PIN P1_10
  156. #define E0_SERIAL_TX_PIN P1_16
  157. #define E0_SERIAL_RX_PIN P1_15
  158. #define E1_SERIAL_TX_PIN P4_29
  159. #define E1_SERIAL_RX_PIN P1_17
  160. #define Z2_SERIAL_TX_PIN P4_29
  161. #define Z2_SERIAL_RX_PIN P1_17
  162. // Reduce baud rate to improve software serial reliability
  163. #define TMC_BAUD_RATE 19200
  164. #endif // HAS_TMC_UART
  165. //
  166. // Temperature Sensors
  167. // 3.3V max when defined as an analog input
  168. //
  169. #define TEMP_0_PIN P0_23_A0 // Analog Input A0 (TH1)
  170. #define TEMP_BED_PIN P0_24_A1 // Analog Input A1 (TB)
  171. #define TEMP_1_PIN P0_25_A2 // Analog Input A2 (TH2)
  172. //
  173. // Heaters / Fans
  174. //
  175. #define HEATER_BED_PIN P2_05
  176. #define HEATER_0_PIN P2_07
  177. #if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL)
  178. #ifndef FAN1_PIN
  179. #define FAN1_PIN P2_06
  180. #endif
  181. #else
  182. #ifndef HEATER_1_PIN
  183. #define HEATER_1_PIN P2_06
  184. #endif
  185. #endif
  186. #ifndef FAN_PIN
  187. #define FAN_PIN P2_04
  188. #endif
  189. //
  190. // Power Supply Control
  191. //
  192. #if ENABLED(MKS_PWC)
  193. #define PS_ON_PIN P2_00 // SERVO1
  194. #define KILL_PIN P1_24 // Z+
  195. #define KILL_PIN_STATE HIGH
  196. #endif
  197. //
  198. // Misc. Functions
  199. //
  200. #define LED_PIN P1_18 // Used as a status indicator
  201. #define LED2_PIN P1_19
  202. #define LED3_PIN P1_20
  203. #define LED4_PIN P1_21
  204. /** ------ ------
  205. * (BEEPER) 1.31 | 1 2 | 1.30 (BTN_ENC) (MISO) 0.8 | 1 2 | 0.7 (SD_SCK)
  206. * (LCD_EN) 0.18 | 3 4 | 0.16 (LCD_RS) (BTN_EN1) 3.25 | 3 4 | 0.28 (SD_CS2)
  207. * (LCD_D4) 0.15 5 6 | 0.17 (LCD_D5) (BTN_EN2) 3.26 5 6 | 0.9 (SD_MOSI)
  208. * (LCD_D6) 1.0 | 7 8 | 1.22 (LCD_D7) (SD_DETECT) 0.27 | 7 8 | RESET
  209. * GND | 9 10 | 5V GND | 9 10 | --
  210. * ------ ------
  211. * EXP1 EXP2
  212. */
  213. #define EXP1_01_PIN P1_31
  214. #define EXP1_02_PIN P1_30
  215. #define EXP1_03_PIN P0_18
  216. #define EXP1_04_PIN P0_16
  217. #define EXP1_05_PIN P0_15
  218. #define EXP1_06_PIN P0_17
  219. #define EXP1_07_PIN P1_00
  220. #define EXP1_08_PIN P1_22
  221. #define EXP2_01_PIN P0_08
  222. #define EXP2_02_PIN P0_07
  223. #define EXP2_03_PIN P3_25
  224. #define EXP2_04_PIN P0_28
  225. #define EXP2_05_PIN P3_26
  226. #define EXP2_06_PIN P0_09
  227. #define EXP2_07_PIN P0_27
  228. #define EXP2_08_PIN -1 // RESET
  229. #ifndef SDCARD_CONNECTION
  230. #define SDCARD_CONNECTION ONBOARD
  231. #endif
  232. #if SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD)
  233. #define SD_DETECT_PIN EXP2_07_PIN
  234. #define SD_SCK_PIN EXP2_02_PIN
  235. #define SD_MISO_PIN EXP2_01_PIN
  236. #define SD_MOSI_PIN EXP2_06_PIN
  237. #if SD_CONNECTION_IS(ONBOARD)
  238. #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
  239. #define SD_SS_PIN ONBOARD_SD_CS_PIN
  240. #else
  241. #define SD_SS_PIN EXP2_04_PIN
  242. #endif
  243. #elif SD_CONNECTION_IS(CUSTOM_CABLE)
  244. #error "No custom SD drive cable defined for this board."
  245. #endif
  246. #if HAS_WIRED_LCD
  247. #define BEEPER_PIN EXP1_01_PIN
  248. #define BTN_ENC EXP1_02_PIN
  249. #if ENABLED(CR10_STOCKDISPLAY)
  250. #define LCD_PINS_RS EXP1_07_PIN
  251. #define BTN_EN1 EXP1_03_PIN
  252. #define BTN_EN2 EXP1_05_PIN
  253. #define LCD_PINS_ENABLE EXP1_08_PIN
  254. #define LCD_PINS_D4 EXP1_06_PIN
  255. #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
  256. #define TFT_CS_PIN EXP1_07_PIN
  257. #define TFT_A0_PIN EXP1_08_PIN
  258. #define TFT_DC_PIN EXP1_08_PIN
  259. #define TFT_MISO_PIN EXP2_01_PIN
  260. #define TFT_BACKLIGHT_PIN EXP1_03_PIN
  261. #define TFT_RESET_PIN EXP1_04_PIN
  262. #define LCD_USE_DMA_SPI
  263. #define TOUCH_INT_PIN EXP1_06_PIN
  264. #define TOUCH_CS_PIN EXP1_05_PIN
  265. #define TOUCH_BUTTONS_HW_SPI
  266. #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
  267. // Disable any LCD related PINs config
  268. #define LCD_PINS_ENABLE -1
  269. #define LCD_PINS_RS -1
  270. #ifndef TFT_BUFFER_SIZE
  271. #define TFT_BUFFER_SIZE 1200
  272. #endif
  273. #ifndef TFT_QUEUE_SIZE
  274. #define TFT_QUEUE_SIZE 6144
  275. #endif
  276. #define BTN_EN1 EXP2_03_PIN
  277. #define BTN_EN2 EXP2_05_PIN
  278. #elif IS_TFTGLCD_PANEL
  279. #undef BEEPER_PIN
  280. #undef BTN_ENC
  281. #if ENABLED(TFTGLCD_PANEL_SPI)
  282. #define TFTGLCD_CS EXP2_03_PIN
  283. #endif
  284. #else
  285. #define BTN_EN1 EXP2_03_PIN
  286. #define BTN_EN2 EXP2_05_PIN
  287. #define LCD_SDSS EXP2_04_PIN
  288. #if ENABLED(MKS_12864OLED_SSD1306)
  289. #define LCD_PINS_DC EXP1_06_PIN
  290. #define DOGLCD_CS EXP1_04_PIN
  291. #define DOGLCD_A0 LCD_PINS_DC
  292. #define DOGLCD_SCK EXP1_05_PIN
  293. #define DOGLCD_MOSI EXP1_03_PIN
  294. #define LCD_PINS_RS EXP1_07_PIN
  295. #define LCD_PINS_D7 EXP1_08_PIN
  296. #define KILL_PIN -1 // NC
  297. #else // !MKS_12864OLED_SSD1306
  298. #define LCD_PINS_RS EXP1_04_PIN
  299. #define LCD_PINS_ENABLE EXP1_03_PIN
  300. #define LCD_PINS_D4 EXP1_05_PIN
  301. #if ENABLED(FYSETC_MINI_12864)
  302. #define DOGLCD_CS EXP1_03_PIN
  303. #define DOGLCD_A0 EXP1_04_PIN
  304. #define DOGLCD_SCK EXP2_02_PIN
  305. #define DOGLCD_MOSI EXP2_06_PIN
  306. #define LCD_BACKLIGHT_PIN -1
  307. #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
  308. // results in LCD soft SPI mode 3, SD soft SPI mode 0
  309. #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally.
  310. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  311. #ifndef RGB_LED_R_PIN
  312. #define RGB_LED_R_PIN EXP1_06_PIN
  313. #endif
  314. #ifndef RGB_LED_G_PIN
  315. #define RGB_LED_G_PIN EXP1_07_PIN
  316. #endif
  317. #ifndef RGB_LED_B_PIN
  318. #define RGB_LED_B_PIN EXP1_08_PIN
  319. #endif
  320. #elif ENABLED(FYSETC_MINI_12864_2_1)
  321. #define NEOPIXEL_PIN EXP1_06_PIN
  322. #endif
  323. #else // !FYSETC_MINI_12864
  324. #if ENABLED(MKS_MINI_12864)
  325. #define DOGLCD_CS EXP1_06_PIN
  326. #define DOGLCD_A0 EXP1_07_PIN
  327. #endif
  328. #if IS_ULTIPANEL
  329. #define LCD_PINS_D5 EXP1_06_PIN
  330. #define LCD_PINS_D6 EXP1_07_PIN
  331. #define LCD_PINS_D7 EXP1_08_PIN
  332. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  333. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  334. #endif
  335. #endif
  336. #endif // !FYSETC_MINI_12864
  337. #endif // !MKS_12864OLED_SSD1306
  338. #endif // !CR10_STOCKDISPLAY
  339. #endif // HAS_WIRED_LCD
  340. //
  341. // Other Pins
  342. //
  343. //#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  344. //#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  345. //#define PS_ON_PIN P1_23 // SERVO0 P1.23