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

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