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

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