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_PRO_common.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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 TARGET_STM32F4
  24. #error "Oops! Select an STM32F4 board in 'Tools > Board.'"
  25. #endif
  26. // Use one of these or SDCard-based Emulation will be used
  27. #if NO_EEPROM_SELECTED
  28. //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
  29. #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
  30. #endif
  31. #if ENABLED(FLASH_EEPROM_EMULATION)
  32. // Decrease delays and flash wear by spreading writes across the
  33. // 128 kB sector allocated for EEPROM emulation.
  34. #define FLASH_EEPROM_LEVELING
  35. #endif
  36. //
  37. // Servos
  38. //
  39. #define SERVO0_PIN PA1
  40. //
  41. // Trinamic Stallguard pins
  42. //
  43. #define X_DIAG_PIN PB10 // X-
  44. #define Y_DIAG_PIN PE12 // Y-
  45. #define Z_DIAG_PIN PG8 // Z-
  46. #define E0_DIAG_PIN PE15 // E0
  47. #define E1_DIAG_PIN PE10 // E1
  48. #define E2_DIAG_PIN PG5 // E2
  49. //
  50. // Limit Switches
  51. //
  52. #ifdef X_STALL_SENSITIVITY
  53. #define X_STOP_PIN X_DIAG_PIN
  54. #if X_HOME_DIR < 0
  55. #define X_MAX_PIN PE15 // E0
  56. #else
  57. #define X_MIN_PIN PE15 // E0
  58. #endif
  59. #else
  60. #define X_MIN_PIN PB10 // X-
  61. #define X_MAX_PIN PE15 // E0
  62. #endif
  63. #ifdef Y_STALL_SENSITIVITY
  64. #define Y_STOP_PIN Y_DIAG_PIN
  65. #if Y_HOME_DIR < 0
  66. #define Y_MAX_PIN PE10 // E1
  67. #else
  68. #define Y_MIN_PIN PE10 // E1
  69. #endif
  70. #else
  71. #define Y_MIN_PIN PE12 // Y-
  72. #define Y_MAX_PIN PE10 // E1
  73. #endif
  74. #ifdef Z_STALL_SENSITIVITY
  75. #define Z_STOP_PIN Z_DIAG_PIN
  76. #if Z_HOME_DIR < 0
  77. #define Z_MAX_PIN PG5 // E2
  78. #else
  79. #define Z_MIN_PIN PG5 // E2
  80. #endif
  81. #else
  82. #define Z_MIN_PIN PG8 // Z-
  83. #define Z_MAX_PIN PG5 // E2
  84. #endif
  85. //
  86. // Z Probe must be this pin
  87. //
  88. #ifndef Z_MIN_PROBE_PIN
  89. #define Z_MIN_PROBE_PIN PA2
  90. #endif
  91. //
  92. // Filament Runout Sensor
  93. //
  94. #ifndef FIL_RUNOUT_PIN
  95. #define FIL_RUNOUT_PIN PE15
  96. #endif
  97. #ifndef FIL_RUNOUT2_PIN
  98. #define FIL_RUNOUT2_PIN PE10
  99. #endif
  100. #ifndef FIL_RUNOUT3_PIN
  101. #define FIL_RUNOUT3_PIN PG5
  102. #endif
  103. //
  104. // Steppers
  105. //
  106. #define X_STEP_PIN PE9
  107. #define X_DIR_PIN PF1
  108. #define X_ENABLE_PIN PF2
  109. #ifndef X_CS_PIN
  110. #define X_CS_PIN PA15
  111. #endif
  112. #define Y_STEP_PIN PE11
  113. #define Y_DIR_PIN PE8
  114. #define Y_ENABLE_PIN PD7
  115. #ifndef Y_CS_PIN
  116. #define Y_CS_PIN PB8
  117. #endif
  118. #define Z_STEP_PIN PE13
  119. #define Z_DIR_PIN PC2
  120. #define Z_ENABLE_PIN PC0
  121. #ifndef Z_CS_PIN
  122. #define Z_CS_PIN PB9
  123. #endif
  124. #define E0_STEP_PIN PE14
  125. #define E0_DIR_PIN PA0
  126. #define E0_ENABLE_PIN PC3
  127. #ifndef E0_CS_PIN
  128. #define E0_CS_PIN PB3
  129. #endif
  130. #define E1_STEP_PIN PD15
  131. #define E1_DIR_PIN PE7
  132. #define E1_ENABLE_PIN PA3
  133. #ifndef E1_CS_PIN
  134. #define E1_CS_PIN PG15
  135. #endif
  136. #define E2_STEP_PIN PD13
  137. #define E2_DIR_PIN PG9
  138. #define E2_ENABLE_PIN PF0
  139. #ifndef E2_CS_PIN
  140. #define E2_CS_PIN PG12
  141. #endif
  142. //
  143. // Software SPI pins for TMC2130 stepper drivers
  144. //
  145. #if ENABLED(TMC_USE_SW_SPI)
  146. #ifndef TMC_SW_MOSI
  147. #define TMC_SW_MOSI PC12
  148. #endif
  149. #ifndef TMC_SW_MISO
  150. #define TMC_SW_MISO PC11
  151. #endif
  152. #ifndef TMC_SW_SCK
  153. #define TMC_SW_SCK PC10
  154. #endif
  155. #endif
  156. #if HAS_TMC_UART
  157. /**
  158. * TMC2208/TMC2209 stepper drivers
  159. *
  160. * Hardware serial communication ports.
  161. * If undefined software serial is used according to the pins below
  162. */
  163. //#define X_HARDWARE_SERIAL Serial
  164. //#define X2_HARDWARE_SERIAL Serial1
  165. //#define Y_HARDWARE_SERIAL Serial1
  166. //#define Y2_HARDWARE_SERIAL Serial1
  167. //#define Z_HARDWARE_SERIAL Serial1
  168. //#define Z2_HARDWARE_SERIAL Serial1
  169. //#define E0_HARDWARE_SERIAL Serial1
  170. //#define E1_HARDWARE_SERIAL Serial1
  171. //#define E2_HARDWARE_SERIAL Serial1
  172. //#define E3_HARDWARE_SERIAL Serial1
  173. //#define E4_HARDWARE_SERIAL Serial1
  174. //
  175. // Software serial
  176. //
  177. #define X_SERIAL_TX_PIN PC13
  178. #define X_SERIAL_RX_PIN PC13
  179. #define Y_SERIAL_TX_PIN PE3
  180. #define Y_SERIAL_RX_PIN PE3
  181. #define Z_SERIAL_TX_PIN PE1
  182. #define Z_SERIAL_RX_PIN PE1
  183. #define E0_SERIAL_TX_PIN PD4
  184. #define E0_SERIAL_RX_PIN PD4
  185. #define E1_SERIAL_TX_PIN PD1
  186. #define E1_SERIAL_RX_PIN PD1
  187. #define E2_SERIAL_TX_PIN PD6
  188. #define E2_SERIAL_RX_PIN PD6
  189. // Reduce baud rate to improve software serial reliability
  190. #define TMC_BAUD_RATE 19200
  191. #endif
  192. //
  193. // Temperature Sensors
  194. //
  195. #define TEMP_0_PIN PF4 // T1 <-> E0
  196. #define TEMP_1_PIN PF5 // T2 <-> E1
  197. #define TEMP_2_PIN PF6 // T3 <-> E2
  198. #define TEMP_BED_PIN PF3 // T0 <-> Bed
  199. //
  200. // Heaters / Fans
  201. //
  202. #define HEATER_0_PIN PB1 // Heater0
  203. #define HEATER_1_PIN PD14 // Heater1
  204. #define HEATER_2_PIN PB0 // Heater1
  205. #define HEATER_BED_PIN PD12 // Hotbed
  206. #define FAN_PIN PC8 // Fan0
  207. #define FAN1_PIN PE5 // Fan1
  208. #define FAN2_PIN PE6
  209. #ifndef E0_AUTO_FAN_PIN
  210. #define E0_AUTO_FAN_PIN FAN1_PIN
  211. #endif
  212. //
  213. // Misc. Functions
  214. //
  215. #ifndef SDCARD_CONNECTION
  216. #define SDCARD_CONNECTION LCD
  217. #endif
  218. //
  219. // Onboard SD card
  220. // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
  221. //
  222. #if SD_CONNECTION_IS(ONBOARD)
  223. #define SOFTWARE_SPI // Use soft SPI for onboard SD
  224. #define SDSS PA4
  225. #define SCK_PIN PA5
  226. #define MISO_PIN PA6
  227. #define MOSI_PIN PB5
  228. #endif
  229. /**
  230. * _____ _____
  231. * NC | · · | GND 5V | · · | GND
  232. * RESET | · · | PF12(SD_DETECT) (LCD_D7) PG7 | · · | PG6 (LCD_D6)
  233. * (MOSI)PB15 | · · | PF11(BTN_EN2) (LCD_D5) PG3 | · · | PG2 (LCD_D4)
  234. * (SD_SS)PB12 | · · | PG10(BTN_EN1) (LCD_RS) PD10 | · · | PD11 (LCD_EN)
  235. * (SCK)PB13 | · · | PB14(MISO) (BTN_ENC) PA8 | · · | PG4 (BEEPER)
  236. *  ̄ ̄  ̄ ̄
  237. * EXP2 EXP1
  238. */
  239. //
  240. // LCDs and Controllers
  241. //
  242. #if HAS_SPI_LCD
  243. #define BEEPER_PIN PG4
  244. #define BTN_ENC PA8
  245. #if SD_CONNECTION_IS(LCD)
  246. #define SDSS PB12 // Uses default hardware SPI for LCD's SD
  247. #endif
  248. #if ENABLED(CR10_STOCKDISPLAY)
  249. #define LCD_PINS_RS PG6
  250. #define BTN_EN1 PD11
  251. #define BTN_EN2 PG2
  252. #define LCD_PINS_ENABLE PG7
  253. #define LCD_PINS_D4 PG3
  254. // CR10_STOCKDISPLAY default timing is too fast
  255. #undef BOARD_ST7920_DELAY_1
  256. #undef BOARD_ST7920_DELAY_2
  257. #undef BOARD_ST7920_DELAY_3
  258. #elif ENABLED(MKS_MINI_12864)
  259. #define DOGLCD_A0 PG6
  260. #define DOGLCD_CS PG3
  261. #else
  262. #define LCD_PINS_RS PD10
  263. #define BTN_EN1 PG10
  264. #define BTN_EN2 PF11
  265. #define SD_DETECT_PIN PF12
  266. #define LCD_SDSS PB12
  267. #define LCD_PINS_ENABLE PD11
  268. #define LCD_PINS_D4 PG2
  269. #if ENABLED(FYSETC_MINI_12864)
  270. #define DOGLCD_CS PD11
  271. #define DOGLCD_A0 PD10
  272. //#define LCD_BACKLIGHT_PIN -1
  273. #define LCD_RESET_PIN PG2 // Must be high or open for LCD to operate normally.
  274. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  275. #ifndef RGB_LED_R_PIN
  276. #define RGB_LED_R_PIN PG3
  277. #endif
  278. #ifndef RGB_LED_G_PIN
  279. #define RGB_LED_G_PIN PG6
  280. #endif
  281. #ifndef RGB_LED_B_PIN
  282. #define RGB_LED_B_PIN PG7
  283. #endif
  284. #elif ENABLED(FYSETC_MINI_12864_2_1)
  285. #define NEOPIXEL_PIN PG3
  286. #endif
  287. #endif // !FYSETC_MINI_12864
  288. #if ENABLED(ULTIPANEL)
  289. #define LCD_PINS_D5 PG3
  290. #define LCD_PINS_D6 PG6
  291. #define LCD_PINS_D7 PG7
  292. #endif
  293. #endif
  294. // Alter timing for graphical display
  295. #if HAS_GRAPHICAL_LCD
  296. #ifndef BOARD_ST7920_DELAY_1
  297. #define BOARD_ST7920_DELAY_1 DELAY_NS(96)
  298. #endif
  299. #ifndef BOARD_ST7920_DELAY_2
  300. #define BOARD_ST7920_DELAY_2 DELAY_NS(48)
  301. #endif
  302. #ifndef BOARD_ST7920_DELAY_3
  303. #define BOARD_ST7920_DELAY_3 DELAY_NS(600)
  304. #endif
  305. #endif
  306. #endif // HAS_SPI_LCD
  307. //
  308. // WIFI
  309. //
  310. /**
  311. * _____
  312. * TX | 1 2 | GND Enable PG1 // Must be high for module to run
  313. * Enable | 3 4 | GPIO2 Reset PG0 // active low, probably OK to leave floating
  314. * Reset | 5 6 | GPIO0 GPIO2 PF15 // must be high (ESP3D software configures this with a pullup so OK to leave as floating)
  315. * 3.3V| 7 8 | RX GPIO0 PF14 // Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating)
  316. *  ̄ ̄
  317. * W1
  318. */
  319. #define ESP_WIFI_MODULE_COM 6 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this
  320. #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2
  321. #define ESP_WIFI_MODULE_RESET_PIN PG0
  322. #define ESP_WIFI_MODULE_ENABLE_PIN PG1
  323. #define ESP_WIFI_MODULE_GPIO0_PIN PF14
  324. #define ESP_WIFI_MODULE_GPIO2_PIN PF15