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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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. #ifndef BOARD_INFO_NAME
  24. #define BOARD_INFO_NAME "BTT SKR V1.4"
  25. #endif
  26. #ifndef BOARD_CUSTOM_BUILD_FLAGS
  27. #define BOARD_CUSTOM_BUILD_FLAGS -DLPC_PINCFG_UART3_P4_28
  28. #endif
  29. //
  30. // SD Connection
  31. //
  32. #ifndef SDCARD_CONNECTION
  33. #define SDCARD_CONNECTION LCD
  34. #endif
  35. //
  36. // Servos
  37. //
  38. #define SERVO0_PIN P2_00
  39. //
  40. // TMC StallGuard DIAG pins
  41. //
  42. #define X_DIAG_PIN P1_29 // X-STOP
  43. #define Y_DIAG_PIN P1_28 // Y-STOP
  44. #define Z_DIAG_PIN P1_27 // Z-STOP
  45. #define E0_DIAG_PIN P1_26 // E0DET
  46. #define E1_DIAG_PIN P1_25 // E1DET
  47. //
  48. // Limit Switches
  49. //
  50. #ifdef X_STALL_SENSITIVITY
  51. #define X_STOP_PIN X_DIAG_PIN
  52. #if X_HOME_DIR < 0
  53. #define X_MAX_PIN P1_26 // E0DET
  54. #else
  55. #define X_MIN_PIN P1_26 // E0DET
  56. #endif
  57. #else
  58. #define X_STOP_PIN P1_29 // X-STOP
  59. #endif
  60. #ifdef Y_STALL_SENSITIVITY
  61. #define Y_STOP_PIN Y_DIAG_PIN
  62. #if Y_HOME_DIR < 0
  63. #define Y_MAX_PIN P1_25 // E1DET
  64. #else
  65. #define Y_MIN_PIN P1_25 // E1DET
  66. #endif
  67. #else
  68. #define Y_STOP_PIN P1_28 // Y-STOP
  69. #endif
  70. #ifdef Z_STALL_SENSITIVITY
  71. #define Z_STOP_PIN Z_DIAG_PIN
  72. #if Z_HOME_DIR < 0
  73. #define Z_MAX_PIN P1_00 // PWRDET
  74. #else
  75. #define Z_MIN_PIN P1_00 // PWRDET
  76. #endif
  77. #else
  78. #ifndef Z_STOP_PIN
  79. #define Z_STOP_PIN P1_27 // Z-STOP
  80. #endif
  81. #endif
  82. //
  83. // Z Probe (when not Z_MIN_PIN)
  84. //
  85. #ifndef Z_MIN_PROBE_PIN
  86. #define Z_MIN_PROBE_PIN P0_10
  87. #endif
  88. //
  89. // Filament Runout Sensor
  90. //
  91. #define FIL_RUNOUT_PIN P1_26 // E0DET
  92. #define FIL_RUNOUT2_PIN P1_25 // E1DET
  93. //
  94. // Power Supply Control
  95. //
  96. #ifndef PS_ON_PIN
  97. #define PS_ON_PIN P1_00 // PWRDET
  98. #endif
  99. //
  100. // Power Loss Detection
  101. //
  102. #ifndef POWER_LOSS_PIN
  103. #define POWER_LOSS_PIN P1_00 // PWRDET
  104. #endif
  105. //
  106. // Steppers
  107. //
  108. #define X_STEP_PIN P2_02
  109. #define X_DIR_PIN P2_06
  110. #define X_ENABLE_PIN P2_01
  111. #ifndef X_CS_PIN
  112. #define X_CS_PIN P1_10
  113. #endif
  114. #define Y_STEP_PIN P0_19
  115. #define Y_DIR_PIN P0_20
  116. #define Y_ENABLE_PIN P2_08
  117. #ifndef Y_CS_PIN
  118. #define Y_CS_PIN P1_09
  119. #endif
  120. #define Z_STEP_PIN P0_22
  121. #define Z_DIR_PIN P2_11
  122. #define Z_ENABLE_PIN P0_21
  123. #ifndef Z_CS_PIN
  124. #define Z_CS_PIN P1_08
  125. #endif
  126. #define E0_STEP_PIN P2_13
  127. #define E0_DIR_PIN P0_11
  128. #define E0_ENABLE_PIN P2_12
  129. #ifndef E0_CS_PIN
  130. #define E0_CS_PIN P1_04
  131. #endif
  132. #define E1_STEP_PIN P1_15
  133. #define E1_DIR_PIN P1_14
  134. #define E1_ENABLE_PIN P1_16
  135. #ifndef E1_CS_PIN
  136. #define E1_CS_PIN P1_01
  137. #endif
  138. #define TEMP_1_PIN P0_23_A0 // A0 (T0) - (67) - TEMP_1_PIN
  139. #define TEMP_BED_PIN P0_25_A2 // A2 (T2) - (69) - TEMP_BED_PIN
  140. //
  141. // Software SPI pins for TMC2130 stepper drivers
  142. //
  143. #if ENABLED(TMC_USE_SW_SPI)
  144. #ifndef TMC_SW_MOSI
  145. #define TMC_SW_MOSI P1_17
  146. #endif
  147. #ifndef TMC_SW_MISO
  148. #define TMC_SW_MISO P0_05
  149. #endif
  150. #ifndef TMC_SW_SCK
  151. #define TMC_SW_SCK P0_04
  152. #endif
  153. #endif
  154. #if HAS_TMC_UART
  155. /**
  156. * TMC2208/TMC2209 stepper drivers
  157. *
  158. * Hardware serial communication ports.
  159. * If undefined software serial is used according to the pins below
  160. */
  161. //#define X_HARDWARE_SERIAL Serial1
  162. //#define X2_HARDWARE_SERIAL Serial1
  163. //#define Y_HARDWARE_SERIAL Serial1
  164. //#define Y2_HARDWARE_SERIAL Serial1
  165. //#define Z_HARDWARE_SERIAL Serial1
  166. //#define Z2_HARDWARE_SERIAL Serial1
  167. //#define E0_HARDWARE_SERIAL Serial1
  168. //#define E1_HARDWARE_SERIAL Serial1
  169. //#define E2_HARDWARE_SERIAL Serial1
  170. //#define E3_HARDWARE_SERIAL Serial1
  171. //#define E4_HARDWARE_SERIAL Serial1
  172. //
  173. // Software serial
  174. //
  175. #define X_SERIAL_TX_PIN P1_10
  176. #define X_SERIAL_RX_PIN P1_10
  177. #define Y_SERIAL_TX_PIN P1_09
  178. #define Y_SERIAL_RX_PIN P1_09
  179. #define Z_SERIAL_TX_PIN P1_08
  180. #define Z_SERIAL_RX_PIN P1_08
  181. #define E0_SERIAL_TX_PIN P1_04
  182. #define E0_SERIAL_RX_PIN P1_04
  183. #define E1_SERIAL_TX_PIN P1_01
  184. #define E1_SERIAL_RX_PIN P1_01
  185. #define Z2_SERIAL_TX_PIN P1_01
  186. #define Z2_SERIAL_RX_PIN P1_01
  187. // Reduce baud rate to improve software serial reliability
  188. #define TMC_BAUD_RATE 19200
  189. #endif
  190. //
  191. // SD Connection
  192. //
  193. #if SD_CONNECTION_IS(LCD)
  194. #define SS_PIN P0_16
  195. #endif
  196. /**
  197. * _____ _____
  198. * NC | · · | GND 5V | · · | GND
  199. * RESET | · · | 1.31 (SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
  200. * (MOSI) 0.18 | · · | 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4)
  201. * (SD_SS) 0.16 | · · | 3.26 (BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
  202. * (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
  203. * ----- -----
  204. * EXP2 EXP1
  205. */
  206. #if HAS_WIRED_LCD
  207. #if ENABLED(ANET_FULL_GRAPHICS_LCD)
  208. #define LCD_PINS_RS P1_23
  209. #define BTN_EN1 P1_20
  210. #define BTN_EN2 P1_22
  211. #define BTN_ENC P1_18
  212. #define LCD_PINS_ENABLE P1_21
  213. #define LCD_PINS_D4 P1_19
  214. #elif ENABLED(CR10_STOCKDISPLAY)
  215. #define BTN_ENC P0_28 // (58) open-drain
  216. #define LCD_PINS_RS P1_22
  217. #define BTN_EN1 P1_18
  218. #define BTN_EN2 P1_20
  219. #define LCD_PINS_ENABLE P1_23
  220. #define LCD_PINS_D4 P1_21
  221. #elif ENABLED(ENDER2_STOCKDISPLAY)
  222. /** Creality Ender-2 display pinout
  223. * _____
  224. * 5V | 1 2 | GND
  225. * (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS)
  226. * (LCD_A0) 1.21 | 5 6 | 1.20 (BTN_EN2)
  227. * RESET 1.19 | 7 8 | 1.18 (BTN_EN1)
  228. * (BTN_ENC) 0.28 | 9 10| 1.30 (SCK)
  229. * -----
  230. * EXP1
  231. */
  232. #define BTN_EN1 P1_18
  233. #define BTN_EN2 P1_20
  234. #define BTN_ENC P0_28
  235. #define DOGLCD_CS P1_22
  236. #define DOGLCD_A0 P1_21
  237. #define DOGLCD_SCK P1_30
  238. #define DOGLCD_MOSI P1_23
  239. #define FORCE_SOFT_SPI
  240. #define LCD_BACKLIGHT_PIN -1
  241. #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
  242. #define TFT_CS_PIN P1_22
  243. #define TFT_A0_PIN P1_23
  244. #define TFT_DC_PIN P1_23
  245. #define TFT_MISO_PIN P0_17
  246. #define TFT_BACKLIGHT_PIN P1_18
  247. #define TFT_RESET_PIN P1_19
  248. #define LCD_USE_DMA_SPI
  249. #define TOUCH_INT_PIN P1_21
  250. #define TOUCH_CS_PIN P1_20
  251. #define TOUCH_BUTTONS_HW_SPI
  252. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  253. #ifndef GRAPHICAL_TFT_UPSCALE
  254. #define GRAPHICAL_TFT_UPSCALE 3
  255. #endif
  256. // Disable any LCD related PINs config
  257. #define LCD_PINS_ENABLE -1
  258. #define LCD_PINS_RS -1
  259. // Emulated DOGM have xpt calibration values independent of display resolution
  260. #if ENABLED(SPI_GRAPHICAL_TFT)
  261. #ifndef XPT2046_X_CALIBRATION
  262. #define XPT2046_X_CALIBRATION -11245
  263. #endif
  264. #ifndef XPT2046_Y_CALIBRATION
  265. #define XPT2046_Y_CALIBRATION 8629
  266. #endif
  267. #ifndef XPT2046_X_OFFSET
  268. #define XPT2046_X_OFFSET 685
  269. #endif
  270. #ifndef XPT2046_Y_OFFSET
  271. #define XPT2046_Y_OFFSET -285
  272. #endif
  273. #endif
  274. #elif IS_TFTGLCD_PANEL
  275. #if ENABLED(TFTGLCD_PANEL_SPI)
  276. #define TFTGLCD_CS P3_26
  277. #endif
  278. #define SD_DETECT_PIN P1_31
  279. #else
  280. #define BTN_ENC P0_28 // (58) open-drain
  281. #define LCD_PINS_RS P1_19
  282. #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
  283. #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
  284. #define LCD_PINS_ENABLE P1_18
  285. #define LCD_PINS_D4 P1_20
  286. #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
  287. #if SD_CONNECTION_IS(LCD)
  288. #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
  289. #endif
  290. #if ENABLED(FYSETC_MINI_12864)
  291. #define DOGLCD_CS P1_18
  292. #define DOGLCD_A0 P1_19
  293. #define DOGLCD_SCK P0_15
  294. #define DOGLCD_MOSI P0_18
  295. #define LCD_BACKLIGHT_PIN -1
  296. #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
  297. // results in LCD soft SPI mode 3, SD soft SPI mode 0
  298. #define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally.
  299. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  300. #ifndef RGB_LED_R_PIN
  301. #define RGB_LED_R_PIN P1_21
  302. #endif
  303. #ifndef RGB_LED_G_PIN
  304. #define RGB_LED_G_PIN P1_22
  305. #endif
  306. #ifndef RGB_LED_B_PIN
  307. #define RGB_LED_B_PIN P1_23
  308. #endif
  309. #elif ENABLED(FYSETC_MINI_12864_2_1)
  310. #define NEOPIXEL_PIN P1_21
  311. #endif
  312. #else // !FYSETC_MINI_12864
  313. #if ENABLED(MKS_MINI_12864)
  314. #define DOGLCD_CS P1_21
  315. #define DOGLCD_A0 P1_22
  316. #define DOGLCD_SCK P0_15
  317. #define DOGLCD_MOSI P0_18
  318. #define FORCE_SOFT_SPI
  319. #endif
  320. #if ENABLED(ULTIPANEL)
  321. #define LCD_PINS_D5 P1_21
  322. #define LCD_PINS_D6 P1_22
  323. #define LCD_PINS_D7 P1_23
  324. #endif
  325. #endif // !FYSETC_MINI_12864
  326. #endif // HAS_MARLINUI_U8GLIB
  327. #endif // HAS_WIRED_LCD
  328. #if HAS_ADC_BUTTONS
  329. #error "ADC BUTTONS do not work unmodifed on SKR 1.4, The ADC ports cannot take more than 3.3v."
  330. #endif
  331. //
  332. // NeoPixel LED
  333. //
  334. #ifndef NEOPIXEL_PIN
  335. #define NEOPIXEL_PIN P1_24
  336. #endif
  337. /**
  338. * Special pins
  339. * P1_30 (37) (NOT 5V tolerant)
  340. * P1_31 (49) (NOT 5V tolerant)
  341. * P0_27 (57) (Open collector)
  342. * P0_28 (58) (Open collector)
  343. */
  344. //
  345. // Include common SKR pins
  346. //
  347. #include "pins_BTT_SKR_common.h"