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_V2.h 14KB

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