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.

296 lines
8.9KB

  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  5. *
  6. * Based on Sprinter and grbl.
  7. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. /**
  24. * MKS SBASE pin assignments
  25. */
  26. #ifndef TARGET_LPC1768
  27. #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
  28. #endif
  29. #ifndef BOARD_NAME
  30. #define BOARD_NAME "MKS SBASE"
  31. #define DEFAULT_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE"
  32. #endif
  33. // unused
  34. /*
  35. #define PIN_P0_27 P0_27 // EXP2/Onboard SD
  36. #define PIN_P0_28 P0_28 // EXP2
  37. #define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  38. #define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
  39. */
  40. #define LED_PIN P1_18 // LED2 P1_19, LED3 P1_20, LED4 P1_21
  41. //
  42. // Servo pin
  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. //
  58. // Steppers
  59. //
  60. #define X_STEP_PIN P2_00
  61. #define X_DIR_PIN P0_05
  62. #define X_ENABLE_PIN P0_04
  63. #define Y_STEP_PIN P2_01
  64. #define Y_DIR_PIN P0_11
  65. #define Y_ENABLE_PIN P0_10
  66. #define Z_STEP_PIN P2_02
  67. #define Z_DIR_PIN P0_20
  68. #define Z_ENABLE_PIN P0_19
  69. #define E0_STEP_PIN P2_03
  70. #define E0_DIR_PIN P0_22
  71. #define E0_ENABLE_PIN P0_21
  72. #define E1_STEP_PIN P2_08
  73. #define E1_DIR_PIN P2_13
  74. #define E1_ENABLE_PIN P4_29
  75. //
  76. // Temperature Sensors
  77. // 3.3V max when defined as an analog input
  78. //
  79. #define TEMP_BED_PIN 0 // A0 (TH1)
  80. #define TEMP_0_PIN 1 // A1 (TH2)
  81. #define TEMP_1_PIN 2 // A2 (TH3)
  82. #define TEMP_2_PIN 3 // A3 (TH4)
  83. //
  84. // Heaters / Fans
  85. //
  86. #define HEATER_BED_PIN P2_05
  87. #define HEATER_0_PIN P2_07
  88. #define HEATER_1_PIN P2_06
  89. #ifndef FAN_PIN
  90. #define FAN_PIN P2_04
  91. #endif
  92. //
  93. // Connector J7
  94. // Note: These pins are all digitally shared with the EXP1/EXP2 Connector.
  95. // Using them with an LCD connected or configured will lead to hangs & crashes.
  96. //
  97. // 5V
  98. // NC
  99. // GND
  100. #define PIN_P0_17 P0_17
  101. #define PIN_P0_16 P0_16
  102. #define PIN_P0_15 P0_15
  103. //
  104. // Connector J8
  105. //
  106. // GND
  107. #define PIN_P1_22 P1_22
  108. #define PIN_P1_23 P1_23 // PWM Capable
  109. #define PIN_P2_12 P2_12 // Interrupt Capable
  110. #define PIN_P2_11 P2_11 // Interrupt Capable
  111. #define PIN_P4_28 P4_28
  112. //
  113. // Prusa i3 MK2 Multi Material Multiplexer Support
  114. //
  115. #if ENABLED(MK2_MULTIPLEXER)
  116. #define E_MUX0_PIN P1_23 // J8-3
  117. #define E_MUX1_PIN P2_12 // J8-4
  118. #define E_MUX2_PIN P2_11 // J8-5
  119. #endif
  120. //
  121. // Misc. Functions
  122. //
  123. #define PS_ON_PIN P0_25 //TH3 Connector
  124. #define LPC_SOFTWARE_SPI // MKS_SBASE needs a software SPI because the
  125. // selected pins are not on a hardware SPI controller
  126. /**
  127. * Smart LCD adapter
  128. *
  129. * The Smart LCD adapter can be used for the two 10 pin LCD controllers such as
  130. * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use
  131. * DOGLCD_A0, DOGLCD_CS, LCD_PINS_D5, LCD_PINS_D6 or LCD_PINS_D7. A custom cable
  132. * is needed to pick up 5V for the EXP1 connection.
  133. *
  134. * SD card on the LCD uses the same SPI signals as the LCD. This results in garbage/lines
  135. * on the LCD display during accesses of the SD card. The menus/code has been arranged so
  136. * that the garbage/lines are erased immediately after the SD card accesses are completed.
  137. */
  138. #if ENABLED(ULTRA_LCD)
  139. #define BEEPER_PIN P1_31 // EXP1.1
  140. #define BTN_ENC P1_30 // EXP1.2
  141. #define BTN_EN1 P3_26 // EXP2.5
  142. #define BTN_EN2 P3_25 // EXP2.3
  143. #define LCD_PINS_RS P0_16 // EXP1.4
  144. #define LCD_SDSS P0_28 // EXP2.4
  145. #define LCD_PINS_ENABLE P0_18 // EXP1.3
  146. #define LCD_PINS_D4 P0_15 // EXP1.5
  147. #endif
  148. //
  149. // Ethernet pins
  150. //
  151. #ifndef ULTIPANEL
  152. #define ENET_MDIO P1_17 // J12-4
  153. #define ENET_RX_ER P1_14 // J12-6
  154. #define ENET_RXD1 P1_10 // J12-8
  155. #endif
  156. #define ENET_MOC P1_16 // J12-3
  157. #define REF_CLK P1_15 // J12-5
  158. #define ENET_RXD0 P1_09 // J12-7
  159. #define ENET_CRS P1_08 // J12-9
  160. #define ENET_TX_EN P1_04 // J12-10
  161. #define ENET_TXD0 P1_00 // J12-11
  162. #define ENET_TXD1 P1_01 // J12-12
  163. // A custom cable is needed. See the README file in the
  164. // Marlin\src\config\examples\Mks\Sbase directory
  165. #define SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7)
  166. #define MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8)
  167. #define MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.5)
  168. #define SS_PIN P0_28
  169. #define SDSS P0_06
  170. /**
  171. * Example for trinamic drivers using the J8 connector on MKs Sbase.
  172. * 2130s need 1 pin for each driver. 2208s need 2 pins for serial control.
  173. * This board does not have enough pins to use hardware serial.
  174. */
  175. #if HAS_DRIVER(TMC2130)
  176. // J8
  177. #define X_CS_PIN P1_22
  178. #define Y_CS_PIN P1_23
  179. #define Z_CS_PIN P2_12
  180. #define E0_CS_PIN P2_11
  181. #define E1_CS_PIN P4_28
  182. // Hardware SPI is on EXP2. See if you can make it work:
  183. // https://github.com/makerbase-mks/MKS-SBASE/issues/25
  184. #define TMC_USE_SW_SPI
  185. #if ENABLED(TMC_USE_SW_SPI)
  186. #ifndef TMC_SW_MOSI
  187. #define TMC_SW_MOSI P0_03 // AUX1
  188. #endif
  189. #ifndef TMC_SW_MISO
  190. #define TMC_SW_MISO P0_02 // AUX1
  191. #endif
  192. #ifndef TMC_SW_SCK
  193. #define TMC_SW_SCK P0_26 // TH4
  194. #endif
  195. #endif
  196. #endif
  197. #if HAS_DRIVER(TMC2208)
  198. // The shortage of pins becomes apparent.
  199. // Worst case you may have to give up the LCD
  200. // RX pins need to be interrupt capable
  201. #define X_SERIAL_TX_PIN P1_22 // J8-2
  202. #define X_SERIAL_RX_PIN P2_12 // J8-4 Interrupt Capable
  203. #define Y_SERIAL_TX_PIN P1_23 // J8-3
  204. #define Y_SERIAL_RX_PIN P2_11 // J8-5 Interrupt Capable
  205. #define Z_SERIAL_TX_PIN P2_12 // J8-4
  206. #define Z_SERIAL_RX_PIN P0_25 // TH3
  207. #define E0_SERIAL_TX_PIN P4_28 // J8-6
  208. #define E0_SERIAL_RX_PIN P0_26 // TH4
  209. #endif
  210. /**
  211. * P0.27 is on EXP2 and the on-board SD card's socket. That means it can't be
  212. * used as the SD_DETECT for the LCD's SD card.
  213. *
  214. * The best solution is to use the custom cable to connect the LCD's SD_DETECT
  215. * to a pin NOT on EXP2.
  216. *
  217. * If you can't find a pin to use for the LCD's SD_DETECT then comment out
  218. * SD_DETECT_PIN entirely and remove that wire from the the custom cable.
  219. */
  220. #define SD_DETECT_PIN P2_11 // J8-5 (moved from EXP2 P0.27)
  221. /**
  222. * PWMs
  223. *
  224. * There are 6 PWMs. Each PWM can be assigned to one of two pins.
  225. *
  226. * SERVO2 does NOT have a PWM assigned to it.
  227. *
  228. * PWM1.1 P1_18 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM
  229. * PWM1.1 P2_00 E0_STEP_PIN
  230. * PWM1.2 P1_20 SERVO0_PIN
  231. * PWM1.2 P2_01 X_STEP_PIN
  232. * PWM1.3 P1_21 SERVO1_PIN J5-1
  233. * PWM1.3 P2_02 Y_STEP_PIN
  234. * PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3
  235. * PWM1.4 P2_03 Z_STEP_PIN
  236. * PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
  237. * PWM1.5 P2_04 RAMPS_D9_PIN
  238. * PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES
  239. * PWM1.6 P2_05 RAMPS_D10_PIN
  240. */
  241. /**
  242. * Special pins
  243. * P1_30 - not 5V tolerant - EXP1
  244. * P1_31 - not 5V tolerant - EXP1
  245. * P0_27 - open collector - EXP2
  246. * P0_28 - open collector - EXP2
  247. *
  248. */
  249. /**
  250. * Serial Ports
  251. * P0_00 - Port 3
  252. * P0_01 - SD Card (Onboard)
  253. * P0_10 - Port 2
  254. * P0_11 - Y_EN/Y_DIR
  255. * P0_15 - Port 1
  256. * P0_16 - EXP1
  257. * P0_02 - Port 0
  258. * P0_03 - AUX1
  259. * P0_29 - Port -1
  260. * P0_30 - USB
  261. *
  262. */