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

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