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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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 SBASE pin assignments
  25. */
  26. #if defined(MKS_HAS_LPC1769) && NOT_TARGET(MCU_LPC1769)
  27. #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
  28. #elif NOT_TARGET(MKS_HAS_LPC1769, MCU_LPC1768)
  29. #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
  30. #endif
  31. #ifndef BOARD_INFO_NAME
  32. #define BOARD_INFO_NAME "MKS SBASE"
  33. #endif
  34. #ifndef BOARD_WEBSITE_URL
  35. #define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-SBASE"
  36. #endif
  37. #define LED_PIN P1_18 // Used as a status indicator
  38. #define LED2_PIN P1_19
  39. #define LED3_PIN P1_20
  40. #define LED4_PIN P1_21
  41. //
  42. // Servos
  43. //
  44. #define SERVO0_PIN P1_23 // J8-3 (low jitter)
  45. #define SERVO1_PIN P2_12 // J8-4
  46. #define SERVO2_PIN P2_11 // J8-5
  47. #define SERVO3_PIN P4_28 // J8-6
  48. //
  49. // Limit Switches - Not Interrupt Capable
  50. //
  51. #define X_MIN_PIN P1_24 // 10k pullup to 3.3V, 1K series
  52. #define X_MAX_PIN P1_25 // 10k pullup to 3.3V, 1K series
  53. #define Y_MIN_PIN P1_26 // 10k pullup to 3.3V, 1K series
  54. #define Y_MAX_PIN P1_27 // 10k pullup to 3.3V, 1K series
  55. #define Z_MIN_PIN P1_28 // The original Mks Sbase DIO19 has a 10k pullup to 3.3V or 5V, 1K series, so when using a Zprobe we must use DIO41 (J8 P1.22)
  56. #define Z_MAX_PIN P1_29 // 10k pullup to 3.3V, 1K series
  57. #ifndef Z_MIN_PROBE_PIN
  58. #define Z_MIN_PROBE_PIN P4_28 // Connector J8
  59. #endif
  60. //
  61. // Steppers
  62. //
  63. #define X_STEP_PIN P2_00
  64. #define X_DIR_PIN P0_05
  65. #define X_ENABLE_PIN P0_04
  66. #define Y_STEP_PIN P2_01
  67. #define Y_DIR_PIN P0_11
  68. #define Y_ENABLE_PIN P0_10
  69. #define Z_STEP_PIN P2_02
  70. #define Z_DIR_PIN P0_20
  71. #define Z_ENABLE_PIN P0_19
  72. #define E0_STEP_PIN P2_03
  73. #define E0_DIR_PIN P0_22
  74. #define E0_ENABLE_PIN P0_21
  75. #define E1_STEP_PIN P2_08
  76. #define E1_DIR_PIN P2_13
  77. #define E1_ENABLE_PIN P4_29
  78. //
  79. // Temperature Sensors
  80. // 3.3V max when defined as an analog input
  81. //
  82. #define TEMP_BED_PIN P0_23_A0 // A0 (TH1)
  83. #define TEMP_0_PIN P0_24_A1 // A1 (TH2)
  84. #define TEMP_1_PIN P0_25_A2 // A2 (TH3)
  85. #define TEMP_2_PIN P0_26_A3 // A3 (TH4)
  86. //
  87. // Heaters / Fans
  88. //
  89. #define HEATER_BED_PIN P2_05
  90. #define HEATER_0_PIN P2_07
  91. #define HEATER_1_PIN P2_06
  92. #ifndef FAN_PIN
  93. #define FAN_PIN P2_04
  94. #endif
  95. //
  96. // Connector J7
  97. // Note: These pins are all digitally shared with the EXP1/EXP2 Connector.
  98. // Using them with an LCD connected or configured will lead to hangs & crashes.
  99. //
  100. // 5V
  101. // NC
  102. // GND
  103. #define PIN_P0_17 P0_17
  104. #define PIN_P0_16 P0_16
  105. #define PIN_P0_15 P0_15
  106. //
  107. // Connector J8
  108. //
  109. // GND
  110. #define PIN_P1_22 P1_22
  111. #define PIN_P1_23 P1_23 // PWM Capable
  112. #define PIN_P2_12 P2_12 // Interrupt Capable
  113. #define PIN_P2_11 P2_11 // Interrupt Capable
  114. //
  115. // Průša i3 MK2 Multi Material Multiplexer Support
  116. //
  117. #if ENABLED(MK2_MULTIPLEXER)
  118. #define E_MUX0_PIN P1_23 // J8-3
  119. #define E_MUX1_PIN P2_12 // J8-4
  120. #define E_MUX2_PIN P2_11 // J8-5
  121. #endif
  122. //
  123. // Misc. Functions
  124. //
  125. #define PS_ON_PIN P0_25 // TH3 Connector
  126. //
  127. // Ethernet pins
  128. //
  129. #ifndef ULTIPANEL
  130. #define ENET_MDIO P1_17 // J12-4
  131. #define ENET_RX_ER P1_14 // J12-6
  132. #define ENET_RXD1 P1_10 // J12-8
  133. #endif
  134. #define ENET_MOC P1_16 // J12-3
  135. #define REF_CLK P1_15 // J12-5
  136. #define ENET_RXD0 P1_09 // J12-7
  137. #define ENET_CRS P1_08 // J12-9
  138. #define ENET_TX_EN P1_04 // J12-10
  139. #define ENET_TXD0 P1_00 // J12-11
  140. #define ENET_TXD1 P1_01 // J12-12
  141. #ifndef SDCARD_CONNECTION
  142. #define SDCARD_CONNECTION ONBOARD
  143. #endif
  144. #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
  145. #if SD_CONNECTION_IS(CUSTOM_CABLE)
  146. /**
  147. * A custom cable is needed. See the README file in the
  148. * Marlin\src\config\examples\Mks\Sbase directory
  149. * P0.27 is on EXP2 and the on-board SD card's socket. That means it can't be
  150. * used as the SD_DETECT for the LCD's SD card.
  151. *
  152. * The best solution is to use the custom cable to connect the LCD's SD_DETECT
  153. * to a pin NOT on EXP2.
  154. *
  155. * If you can't find a pin to use for the LCD's SD_DETECT then comment out
  156. * SD_DETECT_PIN entirely and remove that wire from the the custom cable.
  157. */
  158. #define SD_DETECT_PIN P2_11 // J8-5 (moved from EXP2 P0.27)
  159. #define SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7)
  160. #define MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8)
  161. #define MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.9)
  162. #define SS_PIN P0_28
  163. #define LPC_SOFTWARE_SPI // With a custom cable we need software SPI because the
  164. // selected pins are not on a hardware SPI controller
  165. #elif SD_CONNECTION_IS(LCD)
  166. // use standard cable and header, SPI and SD detect sre shared with on-board SD card
  167. // hardware SPI is used for both SD cards. The detect pin is shred between the
  168. // LCD and onboard SD readers so we disable it.
  169. #define SCK_PIN P0_07
  170. #define MISO_PIN P0_08
  171. #define MOSI_PIN P0_09
  172. #define SS_PIN P0_28
  173. #elif SD_CONNECTION_IS(ONBOARD)
  174. #define SD_DETECT_PIN P0_27
  175. #define SCK_PIN P0_07
  176. #define MISO_PIN P0_08
  177. #define MOSI_PIN P0_09
  178. #define SS_PIN ONBOARD_SD_CS_PIN
  179. #endif
  180. /**
  181. * Smart LCD adapter
  182. *
  183. * The Smart LCD adapter can be used for the two 10 pin LCD controllers such as
  184. * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use
  185. * DOGLCD_A0, DOGLCD_CS, LCD_PINS_D5, LCD_PINS_D6 or LCD_PINS_D7. A custom cable
  186. * is needed to pick up 5V for the EXP1 connection.
  187. *
  188. * SD card on the LCD uses the same SPI signals as the LCD. This results in garbage/lines
  189. * on the LCD display during accesses of the SD card. The menus/code has been arranged so
  190. * that the garbage/lines are erased immediately after the SD card accesses are completed.
  191. */
  192. #if IS_TFTGLCD_PANEL
  193. #if ENABLED(TFTGLCD_PANEL_SPI)
  194. #define TFTGLCD_CS P3_25 // EXP2.3
  195. #endif
  196. #if SD_CONNECTION_IS(LCD)
  197. #define SD_DETECT_PIN P0_28 // EXP2.4
  198. #endif
  199. #elif HAS_WIRED_LCD
  200. #define BEEPER_PIN P1_31 // EXP1.1
  201. #define BTN_ENC P1_30 // EXP1.2
  202. #define BTN_EN1 P3_26 // EXP2.5
  203. #define BTN_EN2 P3_25 // EXP2.3
  204. #define LCD_PINS_RS P0_16 // EXP1.4
  205. #define LCD_SDSS P0_28 // EXP2.4
  206. #define LCD_PINS_ENABLE P0_18 // EXP1.3
  207. #define LCD_PINS_D4 P0_15 // EXP1.5
  208. #if ANY(VIKI2, miniVIKI)
  209. #define DOGLCD_SCK SCK_PIN
  210. #define DOGLCD_MOSI MOSI_PIN
  211. #endif
  212. #if ENABLED(FYSETC_MINI_12864)
  213. /**
  214. * The FYSETC display can NOT use the SCK and MOSI pins on EXP2, so a
  215. * special cable is needed to go between EXP2 on the FYSETC and the
  216. * controller board's EXP2 and J8. It also means that a software SPI
  217. * is needed to drive those pins.
  218. *
  219. * The FYSETC requires mode 3 SPI interface.
  220. *
  221. * Pins 6, 7 & 8 on EXP2 are no connects. That means a second special
  222. * cable will be needed if the RGB LEDs are to be active.
  223. */
  224. #define DOGLCD_CS LCD_PINS_ENABLE // EXP1.3 (LCD_EN on FYSETC schematic)
  225. #define DOGLCD_A0 LCD_PINS_RS // EXP1.4 (LCD_A0 on FYSETC schematic)
  226. #define DOGLCD_SCK P2_11 // J8-5 (SCK on FYSETC schematic)
  227. #define DOGLCD_MOSI P4_28 // J8-6 (MOSI on FYSETC schematic)
  228. //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
  229. // results in LCD soft SPI mode 3, SD soft SPI mode 0
  230. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  231. #ifndef RGB_LED_R_PIN
  232. #define RGB_LED_R_PIN P2_12 // J8-4 (LCD_D6 on FYSETC schematic)
  233. #endif
  234. #ifndef RGB_LED_G_PIN
  235. #define RGB_LED_G_PIN P1_23 // J8-3 (LCD_D5 on FYSETC schematic)
  236. #endif
  237. #ifndef RGB_LED_B_PIN
  238. #define RGB_LED_B_PIN P1_22 // J8-2 (LCD_D7 on FYSETC schematic)
  239. #endif
  240. #elif ENABLED(FYSETC_MINI_12864_2_1)
  241. #define NEOPIXEL_PIN P2_12
  242. #endif
  243. #elif ENABLED(MINIPANEL)
  244. // GLCD features
  245. // Uncomment screen orientation
  246. //#define LCD_SCREEN_ROT_90
  247. //#define LCD_SCREEN_ROT_180
  248. //#define LCD_SCREEN_ROT_270
  249. #endif
  250. #endif // HAS_WIRED_LCD
  251. /**
  252. * Example for trinamic drivers using the J8 connector on MKs Sbase.
  253. * 2130s need 1 pin for each driver. 2208/2209s need 2 pins for serial control.
  254. * This board does not have enough pins to use hardware serial.
  255. */
  256. #if HAS_DRIVER(TMC2130)
  257. // J8
  258. #define X_CS_PIN P1_22
  259. #define Y_CS_PIN P1_23
  260. #define Z_CS_PIN P2_12
  261. #define E0_CS_PIN P2_11
  262. #define E1_CS_PIN P4_28
  263. // Hardware SPI is on EXP2. See if you can make it work:
  264. // https://github.com/makerbase-mks/MKS-SBASE/issues/25
  265. #define TMC_USE_SW_SPI
  266. #if ENABLED(TMC_USE_SW_SPI)
  267. #ifndef TMC_SW_MOSI
  268. #define TMC_SW_MOSI P0_03 // AUX1
  269. #endif
  270. #ifndef TMC_SW_MISO
  271. #define TMC_SW_MISO P0_02 // AUX1
  272. #endif
  273. #ifndef TMC_SW_SCK
  274. #define TMC_SW_SCK P0_26 // TH4
  275. #endif
  276. #endif
  277. #endif
  278. #if MB(MKS_SBASE) && HAS_TMC_UART
  279. /**
  280. * TMC2208/TMC2209 stepper drivers
  281. *
  282. * The shortage of pins becomes apparent.
  283. * Worst case you may have to give up the LCD
  284. * RX pins need to be interrupt capable
  285. */
  286. #define X_SERIAL_TX_PIN P1_22 // J8-2
  287. #define X_SERIAL_RX_PIN P2_12 // J8-4 Interrupt Capable
  288. #define Y_SERIAL_TX_PIN P1_23 // J8-3
  289. #define Y_SERIAL_RX_PIN P2_11 // J8-5 Interrupt Capable
  290. #define Z_SERIAL_TX_PIN P2_12 // J8-4
  291. #define Z_SERIAL_RX_PIN P0_25 // TH3
  292. #define E0_SERIAL_TX_PIN P4_28 // J8-6
  293. #define E0_SERIAL_RX_PIN P0_26 // TH4
  294. // Reduce baud rate to improve software serial reliability
  295. #define TMC_BAUD_RATE 19200
  296. #endif
  297. // UNUSED
  298. #define PIN_P0_27 P0_27 // EXP2/Onboard SD
  299. #define PIN_P0_28 P0_28 // EXP2
  300. #define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  301. #define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  302. /**
  303. * PWMs
  304. *
  305. * There are 6 PWMs. Each PWM can be assigned to one of two pins.
  306. *
  307. * SERVO2 does NOT have a PWM assigned to it.
  308. *
  309. * PWM1.1 P1_18 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM
  310. * PWM1.1 P2_00 E0_STEP_PIN
  311. * PWM1.2 P1_20 SERVO0_PIN
  312. * PWM1.2 P2_01 X_STEP_PIN
  313. * PWM1.3 P1_21 SERVO1_PIN J5-1
  314. * PWM1.3 P2_02 Y_STEP_PIN
  315. * PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3
  316. * PWM1.4 P2_03 Z_STEP_PIN
  317. * PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
  318. * PWM1.5 P2_04 RAMPS_D9_PIN
  319. * PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
  320. * PWM1.6 P2_05 RAMPS_D10_PIN
  321. */
  322. /**
  323. * Special pins
  324. * P1_30 - not 5V tolerant - EXP1
  325. * P1_31 - not 5V tolerant - EXP1
  326. * P0_27 - open collector - EXP2
  327. * P0_28 - open collector - EXP2
  328. */
  329. /**
  330. * Serial Ports
  331. * P0_00 - Port 3
  332. * P0_01 - SD Card (Onboard)
  333. * P0_10 - Port 2
  334. * P0_11 - Y_EN/Y_DIR
  335. * P0_15 - Port 1
  336. * P0_16 - EXP1
  337. * P0_02 - Port 0
  338. * P0_03 - AUX1
  339. * P0_29 - Port -1
  340. * P0_30 - USB
  341. */