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 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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. * MKS SGEN-L pin assignments
  25. */
  26. #if NOT_TARGET(MCU_LPC1768)
  27. #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
  28. #endif
  29. #define BOARD_INFO_NAME "MKS SGen-L"
  30. #define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-SGEN_L"
  31. //
  32. // Servos
  33. //
  34. #define SERVO0_PIN P1_23 // SERVO P1.23
  35. #define SERVO1_PIN P2_00 // SERVO P2.0
  36. //
  37. // Trinamic Stallguard pins
  38. //
  39. #define X_DIAG_PIN P1_29 // X-
  40. #define Y_DIAG_PIN P1_27 // Y-
  41. #define Z_DIAG_PIN P1_25 // Z-
  42. #define E0_DIAG_PIN P1_28 // X+
  43. #define E1_DIAG_PIN P1_26 // Y+
  44. //
  45. // Limit Switches
  46. //
  47. #ifdef X_STALL_SENSITIVITY
  48. #define X_STOP_PIN X_DIAG_PIN
  49. #if X_HOME_DIR < 0
  50. #define X_MAX_PIN P1_28 // X+
  51. #else
  52. #define X_MIN_PIN P1_28 // X+
  53. #endif
  54. #else
  55. #define X_MIN_PIN P1_29 // X-
  56. #define X_MAX_PIN P1_28 // X+
  57. #endif
  58. #ifdef Y_STALL_SENSITIVITY
  59. #define Y_STOP_PIN Y_DIAG_PIN
  60. #if Y_HOME_DIR < 0
  61. #define Y_MAX_PIN P1_26 // Y+
  62. #else
  63. #define Y_MIN_PIN P1_26 // Y+
  64. #endif
  65. #else
  66. #define Y_MIN_PIN P1_27 // Y-
  67. #define Y_MAX_PIN P1_26 // Y+
  68. #endif
  69. #ifdef Z_STALL_SENSITIVITY
  70. #define Z_STOP_PIN Z_DIAG_PIN
  71. #if Z_HOME_DIR < 0
  72. #define Z_MAX_PIN P1_24 // Z+
  73. #else
  74. #define Z_MIN_PIN P1_24 // Z+
  75. #endif
  76. #else
  77. #define Z_MIN_PIN P1_25 // Z-
  78. #define Z_MAX_PIN P1_24 // Z+
  79. #endif
  80. //
  81. // Z Probe (when not Z_MIN_PIN)
  82. //
  83. #ifndef Z_MIN_PROBE_PIN
  84. #define Z_MIN_PROBE_PIN P1_24
  85. #endif
  86. //
  87. // Steppers
  88. //
  89. #define X_STEP_PIN P2_02
  90. #define X_DIR_PIN P2_03
  91. #define X_ENABLE_PIN P2_01
  92. #ifndef X_CS_PIN
  93. #define X_CS_PIN P1_01
  94. #endif
  95. #define Y_STEP_PIN P0_19
  96. #define Y_DIR_PIN P0_20
  97. #define Y_ENABLE_PIN P2_08
  98. #ifndef Y_CS_PIN
  99. #define Y_CS_PIN P1_08
  100. #endif
  101. #define Z_STEP_PIN P0_22
  102. #define Z_DIR_PIN P2_11
  103. #define Z_ENABLE_PIN P0_21
  104. #ifndef Z_CS_PIN
  105. #define Z_CS_PIN P1_10
  106. #endif
  107. #define E0_STEP_PIN P2_13
  108. #define E0_DIR_PIN P0_11
  109. #define E0_ENABLE_PIN P2_12
  110. #ifndef E0_CS_PIN
  111. #define E0_CS_PIN P1_15
  112. #endif
  113. #define E1_STEP_PIN P0_01
  114. #define E1_DIR_PIN P0_00
  115. #define E1_ENABLE_PIN P0_10
  116. #ifndef E1_CS_PIN
  117. #define E1_CS_PIN P1_17
  118. #endif
  119. //
  120. // Software SPI pins for TMC2130 stepper drivers
  121. //
  122. #if ENABLED(TMC_USE_SW_SPI)
  123. #ifndef TMC_SW_MOSI
  124. #define TMC_SW_MOSI P4_28
  125. #endif
  126. #ifndef TMC_SW_MISO
  127. #define TMC_SW_MISO P0_05
  128. #endif
  129. #ifndef TMC_SW_SCK
  130. #define TMC_SW_SCK P0_04
  131. #endif
  132. #endif
  133. #if HAS_TMC_UART
  134. /**
  135. * TMC2208/TMC2209 stepper drivers
  136. *
  137. * Hardware serial communication ports.
  138. * If undefined software serial is used according to the pins below
  139. */
  140. //#define X_HARDWARE_SERIAL Serial1
  141. //#define X2_HARDWARE_SERIAL Serial1
  142. //#define Y_HARDWARE_SERIAL Serial1
  143. //#define Y2_HARDWARE_SERIAL Serial1
  144. //#define Z_HARDWARE_SERIAL Serial1
  145. //#define Z2_HARDWARE_SERIAL Serial1
  146. //#define E0_HARDWARE_SERIAL Serial1
  147. //#define E1_HARDWARE_SERIAL Serial1
  148. //#define E2_HARDWARE_SERIAL Serial1
  149. //#define E3_HARDWARE_SERIAL Serial1
  150. //#define E4_HARDWARE_SERIAL Serial1
  151. //
  152. // Software serial
  153. //
  154. #define X_SERIAL_TX_PIN P1_04
  155. #define X_SERIAL_RX_PIN P1_01
  156. #define Y_SERIAL_TX_PIN P1_09
  157. #define Y_SERIAL_RX_PIN P1_08
  158. #define Z_SERIAL_TX_PIN P1_14
  159. #define Z_SERIAL_RX_PIN P1_10
  160. #define E0_SERIAL_TX_PIN P1_16
  161. #define E0_SERIAL_RX_PIN P1_15
  162. #define E1_SERIAL_TX_PIN P4_29
  163. #define E1_SERIAL_RX_PIN P1_17
  164. #define Z2_SERIAL_TX_PIN P4_29
  165. #define Z2_SERIAL_RX_PIN P1_17
  166. // Reduce baud rate to improve software serial reliability
  167. #define TMC_BAUD_RATE 19200
  168. #endif // TMC2208 || TMC2209
  169. //
  170. // Temperature Sensors
  171. // 3.3V max when defined as an analog input
  172. //
  173. #define TEMP_0_PIN P0_23_A0 // Analog Input A0 (TH1)
  174. #define TEMP_BED_PIN P0_24_A1 // Analog Input A1 (TB)
  175. #define TEMP_1_PIN P0_25_A2 // Analog Input A2 (TH2)
  176. //
  177. // Heaters / Fans
  178. //
  179. #define HEATER_BED_PIN P2_05
  180. #define HEATER_0_PIN P2_07
  181. #if HOTENDS == 1
  182. #ifndef FAN1_PIN
  183. #define FAN1_PIN P2_06
  184. #endif
  185. #else
  186. #ifndef HEATER_1_PIN
  187. #define HEATER_1_PIN P2_06
  188. #endif
  189. #endif
  190. #ifndef FAN_PIN
  191. #define FAN_PIN P2_04
  192. #endif
  193. //
  194. // Misc. Functions
  195. //
  196. #define LED_PIN P1_18 // Used as a status indicator
  197. #define LED2_PIN P1_19
  198. #define LED3_PIN P1_20
  199. #define LED4_PIN P1_21
  200. /**
  201. * _____ _____
  202. * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
  203. * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
  204. * (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI)
  205. * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
  206. * GND | · · | 5V GND | · · | NC
  207. * ----- -----
  208. * EXP1 EXP2
  209. */
  210. #if HAS_WIRED_LCD
  211. #define BEEPER_PIN P1_31
  212. #define BTN_ENC P1_30
  213. #if ENABLED(CR10_STOCKDISPLAY)
  214. #define LCD_PINS_RS P1_00
  215. #define BTN_EN1 P0_18
  216. #define BTN_EN2 P0_15
  217. #define LCD_PINS_ENABLE P1_22
  218. #define LCD_PINS_D4 P0_17
  219. #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
  220. #define TFT_CS_PIN P1_00
  221. #define TFT_A0_PIN P1_22
  222. #define TFT_DC_PIN P1_22
  223. #define TFT_MISO_PIN P0_08
  224. #define TFT_BACKLIGHT_PIN P0_18
  225. #define TFT_RESET_PIN P0_16
  226. #define LCD_USE_DMA_SPI
  227. #define TOUCH_INT_PIN P0_17
  228. #define TOUCH_CS_PIN P0_15
  229. #define TOUCH_BUTTONS_HW_SPI
  230. #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
  231. // Disable any LCD related PINs config
  232. #define LCD_PINS_ENABLE -1
  233. #define LCD_PINS_RS -1
  234. #ifndef TFT_BUFFER_SIZE
  235. #define TFT_BUFFER_SIZE 1200
  236. #endif
  237. #ifndef TFT_QUEUE_SIZE
  238. #define TFT_QUEUE_SIZE 6144
  239. #endif
  240. #define BTN_EN1 P3_25
  241. #define BTN_EN2 P3_26
  242. #elif IS_TFTGLCD_PANEL
  243. #undef BEEPER_PIN
  244. #undef BTN_ENC
  245. #if ENABLED(TFTGLCD_PANEL_SPI)
  246. #define TFTGLCD_CS P3_25
  247. #endif
  248. #else
  249. #define BTN_EN1 P3_25
  250. #define BTN_EN2 P3_26
  251. #define LCD_SDSS P0_28
  252. #if ENABLED(MKS_12864OLED_SSD1306)
  253. #define LCD_PINS_DC P0_17
  254. #define DOGLCD_CS P0_16
  255. #define DOGLCD_A0 LCD_PINS_DC
  256. #define DOGLCD_SCK P0_15
  257. #define DOGLCD_MOSI P0_18
  258. #define LCD_PINS_RS P1_00
  259. #define LCD_PINS_D7 P1_22
  260. #define KILL_PIN -1 // NC
  261. #else // !MKS_12864OLED_SSD1306
  262. #define LCD_PINS_RS P0_16
  263. #define LCD_PINS_ENABLE P0_18
  264. #define LCD_PINS_D4 P0_15
  265. #if ENABLED(FYSETC_MINI_12864)
  266. #define DOGLCD_CS P0_18
  267. #define DOGLCD_A0 P0_16
  268. #define DOGLCD_SCK P0_07
  269. #define DOGLCD_MOSI P0_09
  270. #define LCD_BACKLIGHT_PIN -1
  271. #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
  272. // results in LCD soft SPI mode 3, SD soft SPI mode 0
  273. #define LCD_RESET_PIN P0_15 // Must be high or open for LCD to operate normally.
  274. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  275. #ifndef RGB_LED_R_PIN
  276. #define RGB_LED_R_PIN P0_17
  277. #endif
  278. #ifndef RGB_LED_G_PIN
  279. #define RGB_LED_G_PIN P1_00
  280. #endif
  281. #ifndef RGB_LED_B_PIN
  282. #define RGB_LED_B_PIN P1_22
  283. #endif
  284. #elif ENABLED(FYSETC_MINI_12864_2_1)
  285. #define NEOPIXEL_PIN P0_17
  286. #endif
  287. #else // !FYSETC_MINI_12864
  288. #if ENABLED(MKS_MINI_12864)
  289. #define DOGLCD_CS P0_17
  290. #define DOGLCD_A0 P1_00
  291. #endif
  292. #if IS_ULTIPANEL
  293. #define LCD_PINS_D5 P0_17
  294. #define LCD_PINS_D6 P1_00
  295. #define LCD_PINS_D7 P1_22
  296. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  297. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  298. #endif
  299. #endif
  300. #endif // !FYSETC_MINI_12864
  301. #endif // !MKS_12864OLED_SSD1306
  302. #endif // !CR10_STOCKDISPLAY
  303. #endif // HAS_WIRED_LCD
  304. #ifndef SDCARD_CONNECTION
  305. #define SDCARD_CONNECTION ONBOARD
  306. #endif
  307. #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
  308. #if SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD)
  309. #define SD_DETECT_PIN P0_27
  310. #define SCK_PIN P0_07
  311. #define MISO_PIN P0_08
  312. #define MOSI_PIN P0_09
  313. #if SD_CONNECTION_IS(ONBOARD)
  314. #define SS_PIN ONBOARD_SD_CS_PIN
  315. #else
  316. #define SS_PIN P0_28
  317. #endif
  318. #elif SD_CONNECTION_IS(CUSTOM_CABLE)
  319. #error "No custom SD drive cable defined for this board."
  320. #endif
  321. //
  322. // Other Pins
  323. //
  324. //#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  325. //#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  326. //#define PS_ON_PIN P1_23 // SERVO P1.23