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_BTT_SKR_V1_3.h 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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. * BigTreeTech SKR 1.3 pin assignments
  25. */
  26. #define BOARD_INFO_NAME "BTT SKR V1.3"
  27. #define LPC1768_IS_SKRV1_3
  28. #define USES_DIAG_JUMPERS
  29. //
  30. // Trinamic Stallguard pins
  31. //
  32. #define X_DIAG_PIN P1_29 // X-
  33. #define Y_DIAG_PIN P1_27 // Y-
  34. #define Z_DIAG_PIN P1_25 // Z-
  35. #define E0_DIAG_PIN P1_28 // X+
  36. #define E1_DIAG_PIN P1_26 // Y+
  37. //
  38. // Limit Switches
  39. //
  40. #ifdef X_STALL_SENSITIVITY
  41. #define X_STOP_PIN X_DIAG_PIN
  42. #if X_HOME_TO_MIN
  43. #define X_MAX_PIN P1_28 // X+
  44. #else
  45. #define X_MIN_PIN P1_28 // X+
  46. #endif
  47. #else
  48. #define X_MIN_PIN P1_29 // X-
  49. #define X_MAX_PIN P1_28 // X+
  50. #endif
  51. #ifdef Y_STALL_SENSITIVITY
  52. #define Y_STOP_PIN Y_DIAG_PIN
  53. #if Y_HOME_TO_MIN
  54. #define Y_MAX_PIN P1_26 // Y+
  55. #else
  56. #define Y_MIN_PIN P1_26 // Y+
  57. #endif
  58. #else
  59. #define Y_MIN_PIN P1_27 // Y-
  60. #define Y_MAX_PIN P1_26 // Y+
  61. #endif
  62. #ifdef Z_STALL_SENSITIVITY
  63. #define Z_STOP_PIN Z_DIAG_PIN
  64. #if Z_HOME_TO_MIN
  65. #define Z_MAX_PIN P1_24 // Z+
  66. #else
  67. #define Z_MIN_PIN P1_24 // Z+
  68. #endif
  69. #else
  70. #define Z_MIN_PIN P1_25 // Z-
  71. #define Z_MAX_PIN P1_24 // Z+
  72. #endif
  73. #define ONBOARD_ENDSTOPPULLUPS // Board has built-in pullups
  74. //
  75. // Servos
  76. //
  77. #ifndef SERVO0_PIN
  78. #define SERVO0_PIN P2_00
  79. #endif
  80. //
  81. // Z Probe (when not Z_MIN_PIN)
  82. //
  83. #ifndef Z_MIN_PROBE_PIN
  84. #define Z_MIN_PROBE_PIN P1_24
  85. #endif
  86. //
  87. // Filament Runout Sensor
  88. //
  89. #ifndef FIL_RUNOUT_PIN
  90. #define FIL_RUNOUT_PIN P1_28
  91. #endif
  92. //
  93. // Steppers
  94. //
  95. #define X_STEP_PIN P2_02
  96. #define X_DIR_PIN P2_06
  97. #define X_ENABLE_PIN P2_01
  98. #ifndef X_CS_PIN
  99. #define X_CS_PIN P1_17
  100. #endif
  101. #define Y_STEP_PIN P0_19
  102. #define Y_DIR_PIN P0_20
  103. #define Y_ENABLE_PIN P2_08
  104. #ifndef Y_CS_PIN
  105. #define Y_CS_PIN P1_15
  106. #endif
  107. #define Z_STEP_PIN P0_22
  108. #define Z_DIR_PIN P2_11
  109. #define Z_ENABLE_PIN P0_21
  110. #ifndef Z_CS_PIN
  111. #define Z_CS_PIN P1_10
  112. #endif
  113. #define E0_STEP_PIN P2_13
  114. #define E0_DIR_PIN P0_11
  115. #define E0_ENABLE_PIN P2_12
  116. #ifndef E0_CS_PIN
  117. #define E0_CS_PIN P1_08
  118. #endif
  119. #ifndef E1_CS_PIN
  120. #define E1_CS_PIN P1_01
  121. #endif
  122. //
  123. // Software SPI pins for TMC2130 stepper drivers
  124. //
  125. #if ENABLED(TMC_USE_SW_SPI)
  126. #ifndef TMC_SW_MOSI
  127. #define TMC_SW_MOSI P4_28
  128. #endif
  129. #ifndef TMC_SW_MISO
  130. #define TMC_SW_MISO P0_05
  131. #endif
  132. #ifndef TMC_SW_SCK
  133. #define TMC_SW_SCK P0_04
  134. #endif
  135. #endif
  136. #if HAS_TMC_UART
  137. /**
  138. * TMC2208/TMC2209 stepper drivers
  139. *
  140. * Hardware serial communication ports.
  141. * If undefined software serial is used according to the pins below
  142. */
  143. //#define X_HARDWARE_SERIAL Serial1
  144. //#define X2_HARDWARE_SERIAL Serial1
  145. //#define Y_HARDWARE_SERIAL Serial1
  146. //#define Y2_HARDWARE_SERIAL Serial1
  147. //#define Z_HARDWARE_SERIAL Serial1
  148. //#define Z2_HARDWARE_SERIAL Serial1
  149. //#define E0_HARDWARE_SERIAL Serial1
  150. //#define E1_HARDWARE_SERIAL Serial1
  151. //#define E2_HARDWARE_SERIAL Serial1
  152. //#define E3_HARDWARE_SERIAL Serial1
  153. //#define E4_HARDWARE_SERIAL Serial1
  154. #define X_SERIAL_TX_PIN P4_29
  155. #define X_SERIAL_RX_PIN P1_17
  156. #define Y_SERIAL_TX_PIN P1_16
  157. #define Y_SERIAL_RX_PIN P1_15
  158. #define Z_SERIAL_TX_PIN P1_14
  159. #define Z_SERIAL_RX_PIN P1_10
  160. #define E0_SERIAL_TX_PIN P1_09
  161. #define E0_SERIAL_RX_PIN P1_08
  162. #define E1_SERIAL_TX_PIN P1_04
  163. #define E1_SERIAL_RX_PIN P1_01
  164. // Reduce baud rate to improve software serial reliability
  165. #define TMC_BAUD_RATE 19200
  166. #endif
  167. /**
  168. * ------ ------
  169. * (BEEPER) 1.30 |10 9 | 0.28 (BTN_ENC) (MISO) 0.17 |10 9 | 0.15 (SCK)
  170. * (LCD_EN) 1.18 | 8 7 | 1.19 (LCD_RS) (BTN_EN1) 3.26 | 8 7 | 0.16 (SD_SS)
  171. * (LCD_D4) 1.20 6 5 | 1.21 (LCD_D5) (BTN_EN2) 3.25 6 5 | 0.18 (MOSI)
  172. * (LCD_D6) 1.22 | 4 3 | 1.23 (LCD_D7) (SD_DETECT) 1.31 | 4 3 | RESET
  173. * GND | 2 1 | 5V GND | 2 1 | --
  174. * ------ ------
  175. * EXP1 EXP2
  176. */
  177. #define EXP1_03_PIN P1_23
  178. #define EXP1_04_PIN P1_22
  179. #define EXP1_05_PIN P1_21
  180. #define EXP1_06_PIN P1_20
  181. #define EXP1_07_PIN P1_19
  182. #define EXP1_08_PIN P1_18
  183. #define EXP1_09_PIN P0_28
  184. #define EXP1_10_PIN P1_30
  185. #define EXP2_03_PIN -1
  186. #define EXP2_04_PIN P1_31
  187. #define EXP2_05_PIN P0_18
  188. #define EXP2_06_PIN P3_25
  189. #define EXP2_07_PIN P0_16
  190. #define EXP2_08_PIN P3_26
  191. #define EXP2_09_PIN P0_15
  192. #define EXP2_10_PIN P0_17
  193. #if HAS_WIRED_LCD
  194. #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING)
  195. #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board."
  196. #elif ENABLED(ANET_FULL_GRAPHICS_LCD)
  197. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  198. #error "CAUTION! ANET_FULL_GRAPHICS_LCD requires wiring modifications. See 'pins_BTT_SKR_V1_3.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  199. #endif
  200. /**
  201. * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way.
  202. * 2. Swap the LCD's +5V (Pin2) and GND (Pin1) wires. (This is the critical part!)
  203. * 3. Rewire the CLK Signal (LCD Pin9) to LCD Pin7. (LCD Pin9 remains open because it is open drain.)
  204. * 4. A wire is needed to connect the Reset switch at J3 (LCD Pin7) to EXP2 (Pin3) on the board.
  205. *
  206. * !!! If you are unsure, ask for help! Your motherboard may be damaged in some circumstances !!!
  207. *
  208. * The ANET_FULL_GRAPHICS_LCD connector plug:
  209. *
  210. * BEFORE AFTER
  211. * ------ ------
  212. * (CLK) |10 9 | (BEEPER) (BEEPER) |10 9 | --
  213. * -- | 8 7 | (BTN_ENC) (BTN_ENC) | 8 7 | (CLK)
  214. * (SID) 6 5 | (BTN_EN1) (BTN_EN1) 6 5 | (SID)
  215. * (CS) | 4 3 | (BTN_EN2) (BTN_EN2) | 4 3 | (CS)
  216. * GND | 2 1 | 5V GND | 2 1 | 5V
  217. * ------ ------
  218. * LCD LCD
  219. */
  220. #define LCD_PINS_RS EXP1_03_PIN
  221. #define BTN_EN1 EXP1_06_PIN
  222. #define BTN_EN2 EXP1_04_PIN
  223. #define BTN_ENC EXP1_08_PIN
  224. #define LCD_PINS_ENABLE EXP1_05_PIN
  225. #define LCD_PINS_D4 EXP1_07_PIN
  226. #elif ENABLED(WYH_L12864)
  227. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  228. #error "CAUTION! WYH_L12864 requires wiring modifications. See 'pins_BTT_SKR_V1_3.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  229. #endif
  230. /**
  231. * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way.
  232. * 2. Swap the LCD's +5V (Pin2) and GND (Pin1) wires. (This is the critical part!)
  233. * 3. Swap the LCD's MOSI (Pin9) and empty (Pin10) wires because Pin9 is open drain.
  234. *
  235. * !!! If you are unsure, ask for help! Your motherboard may be damaged in some circumstances !!!
  236. *
  237. * The WYH_L12864 connector plug:
  238. *
  239. * BEFORE AFTER
  240. * ______ ______
  241. * |10 9 | (MOSI) (MOSI) |10 9 | --
  242. * (BTN_ENC) | 8 7 | (SCK) (BTN_ENC) | 8 7 | (SCK)
  243. * (BTN_EN1) 6 5 | (SID) (BTN_EN1) 6 5 | (SID)
  244. * (BTN_EN2) | 4 3 | (CS) (BTN_EN2) | 4 3 | (CS)
  245. * 5V | 2 1 | GND GND | 2 1 | 5V
  246. * ------ ------
  247. * LCD LCD
  248. */
  249. #define BTN_EN1 EXP1_06_PIN
  250. #define BTN_EN2 EXP1_04_PIN
  251. #define BTN_ENC EXP1_08_PIN
  252. #define DOGLCD_CS EXP1_03_PIN
  253. #define DOGLCD_A0 EXP1_05_PIN
  254. #define DOGLCD_SCK EXP1_07_PIN
  255. #define DOGLCD_MOSI EXP1_10_PIN
  256. #define LCD_BACKLIGHT_PIN -1
  257. #elif ENABLED(CR10_STOCKDISPLAY)
  258. #define LCD_PINS_RS EXP1_04_PIN
  259. #define BTN_EN1 EXP1_08_PIN
  260. #define BTN_EN2 EXP1_06_PIN
  261. #define BTN_ENC EXP1_09_PIN // (58) open-drain
  262. #define LCD_PINS_ENABLE EXP1_03_PIN
  263. #define LCD_PINS_D4 EXP1_05_PIN
  264. #elif HAS_ADC_BUTTONS
  265. #error "ADC BUTTONS do not work unmodified on SKR 1.3, The ADC ports cannot take more than 3.3v."
  266. #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
  267. #define TFT_A0_PIN EXP1_03_PIN
  268. #define TFT_DC_PIN EXP1_03_PIN
  269. #define TFT_CS_PIN EXP1_04_PIN
  270. #define TFT_RESET_PIN EXP1_07_PIN
  271. #define TFT_BACKLIGHT_PIN EXP1_08_PIN
  272. //#define TFT_RST_PIN EXP2_04_PIN
  273. #define TFT_MOSI_PIN EXP2_05_PIN
  274. #define TFT_SCK_PIN EXP2_09_PIN
  275. #define TFT_MISO_PIN EXP2_10_PIN
  276. #define BTN_EN2 EXP2_06_PIN
  277. #define BTN_EN1 EXP2_08_PIN
  278. #define BTN_ENC EXP1_09_PIN
  279. #define TOUCH_BUTTONS_HW_SPI
  280. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  281. #define TFT_BUFFER_SIZE 2400
  282. #ifndef TFT_WIDTH
  283. #define TFT_WIDTH 480
  284. #endif
  285. #ifndef TFT_HEIGHT
  286. #define TFT_HEIGHT 320
  287. #endif
  288. #define LCD_READ_ID 0xD3
  289. #define LCD_USE_DMA_SPI
  290. #if ENABLED(TFT_CLASSIC_UI)
  291. #ifndef TOUCH_CALIBRATION_X
  292. #define TOUCH_CALIBRATION_X -11386
  293. #endif
  294. #ifndef TOUCH_CALIBRATION_Y
  295. #define TOUCH_CALIBRATION_Y 8684
  296. #endif
  297. #ifndef TOUCH_OFFSET_X
  298. #define TOUCH_OFFSET_X 689
  299. #endif
  300. #ifndef TOUCH_OFFSET_Y
  301. #define TOUCH_OFFSET_Y -273
  302. #endif
  303. #elif ENABLED(TFT_COLOR_UI)
  304. #ifndef TOUCH_CALIBRATION_X
  305. #define TOUCH_CALIBRATION_X -16741
  306. #endif
  307. #ifndef TOUCH_CALIBRATION_Y
  308. #define TOUCH_CALIBRATION_Y 11258
  309. #endif
  310. #ifndef TOUCH_OFFSET_X
  311. #define TOUCH_OFFSET_X 1024
  312. #endif
  313. #ifndef TOUCH_OFFSET_Y
  314. #define TOUCH_OFFSET_Y -367
  315. #endif
  316. #define TFT_BUFFER_SIZE 2400
  317. #endif
  318. #elif IS_TFTGLCD_PANEL
  319. #if ENABLED(TFTGLCD_PANEL_SPI)
  320. #define TFTGLCD_CS EXP2_08_PIN
  321. #endif
  322. #define SD_DETECT_PIN EXP2_04_PIN
  323. #else // !CR10_STOCKDISPLAY
  324. #define LCD_PINS_RS EXP1_07_PIN
  325. #define BTN_EN1 EXP2_08_PIN // (31) J3-2 & AUX-4
  326. #define BTN_EN2 EXP2_06_PIN // (33) J3-4 & AUX-4
  327. #define BTN_ENC EXP1_09_PIN // (58) open-drain
  328. #define LCD_PINS_ENABLE EXP1_08_PIN
  329. #define LCD_PINS_D4 EXP1_06_PIN
  330. #define LCD_SDSS EXP2_07_PIN // (16) J3-7 & AUX-4
  331. #define SD_DETECT_PIN EXP2_04_PIN // (49) (NOT 5V tolerant)
  332. #if ENABLED(FYSETC_MINI_12864)
  333. #define DOGLCD_CS EXP1_08_PIN
  334. #define DOGLCD_A0 EXP1_07_PIN
  335. #define DOGLCD_SCK EXP2_09_PIN
  336. #define DOGLCD_MOSI EXP2_05_PIN
  337. #define LCD_BACKLIGHT_PIN -1
  338. #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
  339. // results in LCD soft SPI mode 3, SD soft SPI mode 0
  340. #define LCD_RESET_PIN EXP1_06_PIN // Must be high or open for LCD to operate normally.
  341. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  342. #ifndef RGB_LED_R_PIN
  343. #define RGB_LED_R_PIN EXP1_05_PIN
  344. #endif
  345. #ifndef RGB_LED_G_PIN
  346. #define RGB_LED_G_PIN EXP1_04_PIN
  347. #endif
  348. #ifndef RGB_LED_B_PIN
  349. #define RGB_LED_B_PIN EXP1_03_PIN
  350. #endif
  351. #elif ENABLED(FYSETC_MINI_12864_2_1)
  352. #define NEOPIXEL_PIN EXP1_05_PIN
  353. #endif
  354. #else // !FYSETC_MINI_12864
  355. #if ENABLED(MKS_MINI_12864)
  356. #define DOGLCD_CS EXP1_05_PIN
  357. #define DOGLCD_A0 EXP1_04_PIN
  358. #define DOGLCD_SCK EXP2_09_PIN
  359. #define DOGLCD_MOSI EXP2_05_PIN
  360. #elif ENABLED(ENDER2_STOCKDISPLAY)
  361. /**
  362. * Creality Ender-2 display pinout
  363. * ------
  364. * (SCK) P1_30 |10 9 | P0_28 (BTN_ENC)
  365. * (BTN_EN1) P1_18 | 8 7 | P1_19 (RESET)
  366. * (BTN_EN2) P1_20 6 5 | P1_21 (LCD_A0)
  367. * (LCD_CS) P1_22 | 4 3 | P1_23 (MOSI)
  368. * GND | 2 1 | 5V
  369. * ------
  370. * EXP1
  371. */
  372. #define BTN_EN1 EXP1_08_PIN
  373. #define BTN_EN2 EXP1_06_PIN
  374. #define BTN_ENC EXP1_09_PIN
  375. #define DOGLCD_CS EXP1_04_PIN
  376. #define DOGLCD_A0 EXP1_05_PIN
  377. #define DOGLCD_SCK EXP1_10_PIN
  378. #define DOGLCD_MOSI EXP1_03_PIN
  379. #define FORCE_SOFT_SPI
  380. #define LCD_BACKLIGHT_PIN -1
  381. #endif
  382. #if IS_ULTIPANEL
  383. #define LCD_PINS_D5 EXP1_05_PIN
  384. #define LCD_PINS_D6 EXP1_04_PIN
  385. #define LCD_PINS_D7 EXP1_03_PIN
  386. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  387. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  388. #endif
  389. #endif
  390. #endif // !FYSETC_MINI_12864
  391. #endif // !CR10_STOCKDISPLAY
  392. #endif // HAS_WIRED_LCD
  393. #if NEED_TOUCH_PINS
  394. #define TOUCH_CS_PIN EXP1_06_PIN
  395. #define TOUCH_SCK_PIN EXP2_09_PIN
  396. #define TOUCH_MOSI_PIN EXP2_05_PIN
  397. #define TOUCH_MISO_PIN EXP2_10_PIN
  398. #define TOUCH_INT_PIN EXP1_05_PIN
  399. #endif
  400. /**
  401. * Special pins
  402. * P1_30 (37) (NOT 5V tolerant)
  403. * P1_31 (49) (NOT 5V tolerant)
  404. * P0_27 (57) (Open collector)
  405. * P0_28 (58) (Open collector)
  406. */
  407. // Include common SKR pins
  408. #include "pins_BTT_SKR_common.h"