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

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