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 16KB

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