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_MINI_E3_common.h 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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. // Release PB3/PB4 (E0 STP/DIR) from JTAG pins
  25. #define DISABLE_JTAG
  26. #define USES_DIAG_JUMPERS
  27. // Ignore temp readings during development.
  28. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
  29. #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
  30. #define FLASH_EEPROM_EMULATION
  31. #define EEPROM_PAGE_SIZE (0x800U) // 2K
  32. #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
  33. #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K
  34. #endif
  35. //
  36. // Servos
  37. //
  38. #define SERVO0_PIN PA1 // SERVOS
  39. //
  40. // Limit Switches
  41. //
  42. #define X_STOP_PIN PC0 // X-STOP
  43. #define Y_STOP_PIN PC1 // Y-STOP
  44. #define Z_STOP_PIN PC2 // Z-STOP
  45. //
  46. // Z Probe must be this pin
  47. //
  48. #define Z_MIN_PROBE_PIN PC14 // PROBE
  49. //
  50. // Filament Runout Sensor
  51. //
  52. #ifndef FIL_RUNOUT_PIN
  53. #define FIL_RUNOUT_PIN PC15 // E0-STOP
  54. #endif
  55. //
  56. // Power-loss Detection
  57. //
  58. #ifndef POWER_LOSS_PIN
  59. #define POWER_LOSS_PIN PC12 // Power Loss Detection: PWR-DET
  60. #endif
  61. //
  62. // Steppers
  63. //
  64. #define X_ENABLE_PIN PB14
  65. #define X_STEP_PIN PB13
  66. #define X_DIR_PIN PB12
  67. #define Y_ENABLE_PIN PB11
  68. #define Y_STEP_PIN PB10
  69. #define Y_DIR_PIN PB2
  70. #define Z_ENABLE_PIN PB1
  71. #define Z_STEP_PIN PB0
  72. #define Z_DIR_PIN PC5
  73. #define E0_ENABLE_PIN PD2
  74. #define E0_STEP_PIN PB3
  75. #define E0_DIR_PIN PB4
  76. //
  77. // Temperature Sensors
  78. //
  79. #define TEMP_0_PIN PA0 // Analog Input "TH0"
  80. #define TEMP_BED_PIN PC3 // Analog Input "TB0"
  81. //
  82. // Heaters / Fans
  83. //
  84. #define HEATER_0_PIN PC8 // "HE"
  85. #define HEATER_BED_PIN PC9 // "HB"
  86. #ifdef SKR_MINI_E3_V2
  87. #define FAN_PIN PC6
  88. #else
  89. #define FAN_PIN PA8 // "FAN0"
  90. #endif
  91. //
  92. // USB connect control
  93. //
  94. #ifdef SKR_MINI_E3_V2
  95. #define USB_CONNECT_PIN PA14
  96. #else
  97. #define USB_CONNECT_PIN PC13
  98. #endif
  99. #define USB_CONNECT_INVERTING false
  100. /**
  101. * SKR Mini E3 V1.0, V1.2 SKR Mini E3 V2.0
  102. * ------ ------
  103. * (BEEPER) PB5 | 1 2 | PB6 (BTN_ENC) (BEEPER) PB5 | 1 2 | PA15 (BTN_ENC)
  104. * (BTN_EN1) PA9 | 3 4 | RESET (BTN_EN1) PA9 | 3 4 | RESET
  105. * (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) (BTN_EN2) PA10 5 6 | PB9 (LCD_D4)
  106. * (LCD_RS) PB8 | 7 8 | PB7 (LCD_EN) (LCD_RS) PB8 | 7 8 | PB15 (LCD_EN)
  107. * GND | 9 10 | 5V GND | 9 10 | 5V
  108. * ------ ------
  109. * EXP1 EXP1
  110. */
  111. #ifdef SKR_MINI_E3_V2
  112. #define EXP1_02_PIN PA15
  113. #define EXP1_08_PIN PB15
  114. #else
  115. #define EXP1_02_PIN PB6
  116. #define EXP1_08_PIN PB7
  117. #endif
  118. #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
  119. /**
  120. * ------ ------ ------
  121. * (ENT) | 1 2 | (BEEP) |10 9 | |10 9 |
  122. * (RX) | 3 4 | (RX) | 8 7 | (TX) RX | 8 7 | TX
  123. * (TX) 5 6 | (ENT) 6 5 | (BEEP) ENT | 6 5 | BEEP
  124. * (B) | 7 8 | (A) (B) | 4 3 | (A) B | 4 3 | A
  125. * GND | 9 10 | (VCC) GND | 2 1 | VCC GND | 2 1 | VCC
  126. * ------ ------ ------
  127. * EXP1 DWIN DWIN (plug)
  128. *
  129. * All pins are labeled as printed on DWIN PCB. Connect TX-TX, A-A and so on.
  130. */
  131. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  132. #error "CAUTION! Ender-3 V2 display requires a custom cable. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  133. #endif
  134. #define BEEPER_PIN EXP1_02_PIN
  135. #define BTN_EN1 EXP1_08_PIN
  136. #define BTN_EN2 PB8
  137. #define BTN_ENC PB5
  138. #elif HAS_WIRED_LCD
  139. #if ENABLED(CR10_STOCKDISPLAY)
  140. #define BEEPER_PIN PB5
  141. #define BTN_ENC EXP1_02_PIN
  142. #define BTN_EN1 PA9
  143. #define BTN_EN2 PA10
  144. #define LCD_PINS_RS PB8
  145. #define LCD_PINS_ENABLE EXP1_08_PIN
  146. #define LCD_PINS_D4 PB9
  147. #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD!
  148. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  149. #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  150. #endif
  151. #define LCD_PINS_RS PB9
  152. #define LCD_PINS_ENABLE EXP1_02_PIN
  153. #define LCD_PINS_D4 PB8
  154. #define LCD_PINS_D5 PA10
  155. #define LCD_PINS_D6 PA9
  156. #define LCD_PINS_D7 PB5
  157. #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD!
  158. #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  159. #define BTN_ENC EXP1_02_PIN
  160. #define BTN_EN1 PA9
  161. #define BTN_EN2 PA10
  162. #define DOGLCD_CS PB8
  163. #define DOGLCD_A0 PB9
  164. #define DOGLCD_SCK PB5
  165. #define DOGLCD_MOSI EXP1_08_PIN
  166. #define FORCE_SOFT_SPI
  167. #define LCD_BACKLIGHT_PIN -1
  168. #elif IS_TFTGLCD_PANEL
  169. #if ENABLED(TFTGLCD_PANEL_SPI)
  170. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  171. #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  172. #endif
  173. /**
  174. * TFTGLCD_PANEL_SPI display pinout
  175. *
  176. * Board Display
  177. * ------ ------
  178. * (SD_DET) PB5 | 1 2 | PB6 (BEEPER) 5V |10 9 | GND
  179. * (MOD_RESET) PA9 | 3 4 | RESET -- | 8 7 | (SD_DET)
  180. * (SD_CS) PA10 5 6 | PB9 (MOSI) | 6 5 | --
  181. * (LCD_CS) PB8 | 7 8 | PB7 (SD_CS) | 4 3 | (LCD_CS)
  182. * GND | 9 10 | 5V (SCK) | 2 1 | (MISO)
  183. * ------ ------
  184. * EXP1 EXP1
  185. *
  186. * Needs custom cable:
  187. *
  188. * Board Adapter Display
  189. * ----------------------------------
  190. * EXP1-10 ---------- EXP1-10 5V
  191. * EXP1-9 ----------- EXP1-9 GND
  192. * SPI1-4 ----------- EXP1-6 MOSI
  193. * EXP1-7 ----------- n/c
  194. * SPI1-3 ----------- EXP1-2 SCK
  195. * EXP1-5 ----------- EXP1-4 SD_CS
  196. * EXP1-4 ----------- n/c
  197. * EXP1-3 ----------- EXP1-3 LCD_CS
  198. * SPI1-1 ----------- EXP1-1 MISO
  199. * EXP1-1 ----------- EXP1-7 SD_DET
  200. */
  201. #define TFTGLCD_CS PA9
  202. #endif
  203. #elif ENABLED(FYSETC_MINI_12864_2_1)
  204. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  205. #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  206. #endif
  207. /**
  208. * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 display pinout
  209. *
  210. * Board Display
  211. * ------ ------
  212. * PB5 | 1 2 | PA15 (BEEP) |10 9 | BTN_ENC
  213. * PA9 | 3 4 | RESET LCD_CS | 8 7 | LCD A0
  214. * PA10 | 5 6 | PB9 LCD_RST | 6 5 | RED
  215. * PB8 | 7 8 | PB15 (GREEN) | 4 3 | (BLUE)
  216. * GND | 9 10 | 5V GND | 2 1 | 5V
  217. * ------ ------
  218. * EXP1 EXP1
  219. *
  220. * --- ------
  221. * RST | 1 | (MISO) |10 9 | SCK
  222. * (RX2) PA2 | 2 | BTN_EN1 | 8 7 | (SS)
  223. * (TX2) PA3 | 3 | BTN_EN2 | 6 5 | MOSI
  224. * GND | 4 | (CD) | 4 3 | (RST)
  225. * 5V | 5 | (GND) | 2 1 | (KILL)
  226. * --- ------
  227. * TFT EXP2
  228. *
  229. * Needs custom cable:
  230. *
  231. * Board Display
  232. *
  233. * EXP1-10 ---------- EXP1-1 5V
  234. * EXP1-9 ----------- EXP1-2 GND
  235. * EXP1-8 ----------- EXP2-6 EN2
  236. * EXP1-7 ----------- EXP1-5 RED
  237. * EXP1-6 ----------- EXP2-8 EN1
  238. * EXP1-5 ----------- EXP1-6 LCD_RST
  239. * EXP1-4 ----------- n/c
  240. * EXP1-3 ----------- EXP1-8 LCD_CS
  241. * EXP1-2 ----------- EXP1-9 ENC
  242. * EXP1-1 ----------- EXP1-7 LCD_A0
  243. *
  244. * TFT-2 ----------- EXP2-9 SCK
  245. * TFT-3 ----------- EXP2-5 MOSI
  246. *
  247. * for backlight configuration see steps 2 (V2.1) and 3 in https://wiki.fysetc.com/Mini12864_Panel/
  248. */
  249. #define LCD_PINS_RS PA9 // CS
  250. #define LCD_PINS_ENABLE PA3 // MOSI
  251. #define LCD_BACKLIGHT_PIN -1
  252. #define NEOPIXEL_PIN PB8
  253. #define LCD_CONTRAST 255
  254. #define LCD_RESET_PIN PA10
  255. #define DOGLCD_CS PA9
  256. #define DOGLCD_A0 PB5
  257. #define DOGLCD_SCK PA2
  258. #define DOGLCD_MOSI PA3
  259. #define BTN_ENC PA15
  260. #define BTN_EN1 PB9
  261. #define BTN_EN2 PB15
  262. #define FORCE_SOFT_SPI
  263. #else
  264. #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, TFTGLCD_PANEL_(SPI|I2C), FYSETC_MINI_12864_2_1, MKS_MINI_12864_V3, and BTT_MINI_12864_V1 are currently supported on the BIGTREE_SKR_MINI_E3."
  265. #endif
  266. #endif // HAS_WIRED_LCD
  267. #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050)
  268. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  269. #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
  270. #endif
  271. /**
  272. * FYSETC TFT TFT81050 display pinout
  273. *
  274. * Board Display
  275. * ------ ------
  276. * (SD_DET) PB5 | 1 2 | PB6 (BEEPER) 5V |10 9 | GND
  277. * (MOD_RESET) PA9 | 3 4 | RESET (RESET) | 8 7 | (SD_DET)
  278. * (SD_CS) PA10 5 6 | PB9 (MOSI) | 6 5 | (LCD_CS)
  279. * (LCD_CS) PB8 | 7 8 | PB7 (SD_CS) | 4 3 | (MOD_RESET)
  280. * GND | 9 10 | 5V (SCK) | 2 1 | (MISO)
  281. * ------ ------
  282. * EXP1 EXP1
  283. *
  284. * Needs custom cable:
  285. *
  286. * Board Adapter Display
  287. * ----------------------------------
  288. * EXP1-10 ---------- EXP1-10 5V
  289. * EXP1-9 ----------- EXP1-9 GND
  290. * SPI1-4 ----------- EXP1-6 MOSI
  291. * EXP1-7 ----------- EXP1-5 LCD_CS
  292. * SPI1-3 ----------- EXP1-2 SCK
  293. * EXP1-5 ----------- EXP1-4 SD_CS
  294. * EXP1-4 ----------- EXP1-8 RESET
  295. * EXP1-3 ----------- EXP1-3 MOD_RST
  296. * SPI1-1 ----------- EXP1-1 MISO
  297. * EXP1-1 ----------- EXP1-7 SD_DET
  298. */
  299. #define CLCD_SPI_BUS 1 // SPI1 connector
  300. #define BEEPER_PIN EXP1_02_PIN
  301. #define CLCD_MOD_RESET PA9
  302. #define CLCD_SPI_CS PB8
  303. #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050
  304. //
  305. // SD Support
  306. //
  307. #ifndef SDCARD_CONNECTION
  308. #define SDCARD_CONNECTION ONBOARD
  309. #endif
  310. #if SD_CONNECTION_IS(ONBOARD)
  311. #define SD_DETECT_PIN PC4
  312. #elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
  313. #define SD_DETECT_PIN PB5
  314. #define SD_SS_PIN PA10
  315. #elif SD_CONNECTION_IS(CUSTOM_CABLE)
  316. #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
  317. #endif
  318. #define ONBOARD_SPI_DEVICE 1 // SPI1 -> used only by HAL/STM32F1...
  319. #define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card
  320. #define ENABLE_SPI1
  321. #define SDSS ONBOARD_SD_CS_PIN
  322. #define SD_SCK_PIN PA5
  323. #define SD_MISO_PIN PA6
  324. #define SD_MOSI_PIN PA7