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_4.h 17KB

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