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_MKS_MONSTER8_common.h 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 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. #define ALLOW_STM32DUINO
  24. #include "env_validate.h"
  25. #if HOTENDS > 3 || E_STEPPERS > 5
  26. #error "MKS Monster supports up to 3 hotends and 5 E steppers."
  27. #elif HAS_FSMC_TFT
  28. #error "MKS Monster doesn't support FSMC-based TFT displays."
  29. #endif
  30. #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support
  31. #define USES_DIAG_JUMPERS
  32. //#define DISABLE_DEBUG
  33. // Avoid conflict with TIMER_TONE
  34. #define STEP_TIMER 10
  35. // Use one of these or SDCard-based Emulation will be used
  36. //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
  37. //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
  38. #define I2C_EEPROM // Need use jumpers set i2c for EEPROM
  39. #define MARLIN_EEPROM_SIZE 0x1000 // 4K
  40. #define I2C_SCL_PIN PB8 // I2C_SCL and CAN_RX
  41. #define I2C_SDA_PIN PB9 // I2C_SDA and CAN_TX
  42. //
  43. // Servos
  44. //
  45. #define SERVO0_PIN PA8 // Enable BLTOUCH
  46. //
  47. // Limit Switches for diag signals
  48. //
  49. #define X_DIAG_PIN PA14 // Driver0 diag signal is connected to X-
  50. #define Y_DIAG_PIN PA15 // Driver1 diag signal is connected to Y-
  51. #define Z_DIAG_PIN PB13 // Driver2 diag signal is connected to Z-
  52. #define E0_DIAG_PIN PA13 // Driver3 diag signal is connected to X+
  53. #define E1_DIAG_PIN PC5 // Driver4 diag signal is connected to Y+
  54. #define E2_DIAG_PIN PB12 // Driver5 diag signal is connected to Z+
  55. #define E3_DIAG_PIN -1 // Driver6 diag signal is not connected
  56. #define E4_DIAG_PIN -1 // Driver7 diag signal is not connected
  57. // Limit Switches for endstops
  58. #define X_MIN_PIN PA14
  59. #define Y_MIN_PIN PA15
  60. #define Z_MIN_PIN PB13
  61. #define Z_MAX_PIN PB12
  62. //
  63. // Steppers
  64. //
  65. #define X_ENABLE_PIN PC15 // Driver0
  66. #define X_STEP_PIN PC14
  67. #define X_DIR_PIN PC13
  68. #ifndef X_CS_PIN
  69. #define X_CS_PIN PE6
  70. #endif
  71. #define Y_ENABLE_PIN PC15 // Driver1
  72. #define Y_STEP_PIN PE5
  73. #define Y_DIR_PIN PE4
  74. #ifndef Y_CS_PIN
  75. #define Y_CS_PIN PE3
  76. #endif
  77. #define Z_ENABLE_PIN PE2 // Driver2
  78. #define Z_STEP_PIN PE1
  79. #define Z_DIR_PIN PE0
  80. #ifndef Z_CS_PIN
  81. #define Z_CS_PIN PB7
  82. #endif
  83. #define E0_ENABLE_PIN PB6 // Driver3
  84. #define E0_STEP_PIN PB5
  85. #define E0_DIR_PIN PB4
  86. #ifndef E0_CS_PIN
  87. #define E0_CS_PIN PB3
  88. #endif
  89. #define E1_ENABLE_PIN PD7 // Driver4
  90. #define E1_STEP_PIN PD6
  91. #define E1_DIR_PIN PD5
  92. #ifndef E1_CS_PIN
  93. #define E1_CS_PIN PD4
  94. #endif
  95. #define E2_ENABLE_PIN PD3 // Driver5
  96. #define E2_STEP_PIN PD2
  97. #define E2_DIR_PIN PD1
  98. #ifndef E2_CS_PIN
  99. #define E2_CS_PIN PD0
  100. #endif
  101. #define E3_ENABLE_PIN PC8 // Driver6
  102. #define E3_STEP_PIN PC7
  103. #define E3_DIR_PIN PC6
  104. #ifndef E3_CS_PIN
  105. #define E3_CS_PIN PD15
  106. #endif
  107. #define E4_STEP_PIN PD13 // Driver7
  108. #define E4_DIR_PIN PD12
  109. #ifndef E4_CS_PIN
  110. #define E4_CS_PIN PD11
  111. #endif
  112. //
  113. // Software SPI pins for TMC2130 stepper drivers
  114. // This board only supports SW SPI for stepper drivers
  115. //
  116. #if HAS_TMC_SPI
  117. #define TMC_USE_SW_SPI
  118. #endif
  119. #if ENABLED(TMC_USE_SW_SPI)
  120. #if !defined(TMC_SW_MOSI) || TMC_SW_MOSI == -1
  121. #define TMC_SW_MOSI PE14
  122. #endif
  123. #if !defined(TMC_SW_MISO) || TMC_SW_MISO == -1
  124. #define TMC_SW_MISO PE13
  125. #endif
  126. #if !defined(TMC_SW_SCK) || TMC_SW_SCK == -1
  127. #define TMC_SW_SCK PE12
  128. #endif
  129. #endif
  130. #if HAS_TMC_UART
  131. //
  132. // Software serial
  133. // No Hardware serial for steppers
  134. //
  135. #define X_SERIAL_TX_PIN PE6
  136. #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
  137. #define Y_SERIAL_TX_PIN PE3
  138. #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
  139. #define Z_SERIAL_TX_PIN PB7
  140. #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
  141. #define E0_SERIAL_TX_PIN PB3
  142. #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN
  143. #define E1_SERIAL_TX_PIN PD4
  144. #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN
  145. #define E2_SERIAL_TX_PIN PD0
  146. #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN
  147. #define E3_SERIAL_TX_PIN PD15
  148. #define E3_SERIAL_RX_PIN E3_SERIAL_TX_PIN
  149. #define E4_SERIAL_TX_PIN PD11
  150. #define E4_SERIAL_RX_PIN E4_SERIAL_TX_PIN
  151. // Reduce baud rate to improve software serial reliability
  152. #define TMC_BAUD_RATE 19200
  153. #endif
  154. //
  155. // Temperature Sensors
  156. //
  157. #define TEMP_0_PIN PC1 // TH0
  158. #define TEMP_1_PIN PC2 // TH1
  159. #define TEMP_2_PIN PC3 // TH2
  160. #define TEMP_BED_PIN PC0 // TB
  161. //
  162. // Heaters / Fans
  163. //
  164. #define HEATER_0_PIN PB1 // HE0
  165. #define HEATER_1_PIN PB0 // HE1
  166. #define HEATER_2_PIN PA3 // HE2
  167. #define HEATER_BED_PIN PB10 // H-BED
  168. #define FAN_PIN PA2 // FAN0
  169. #define FAN1_PIN PA1 // FAN1
  170. #define FAN2_PIN PA0 // FAN2
  171. //
  172. // Power Supply Control
  173. //
  174. #if ENABLED(MKS_PWC)
  175. #define PS_ON_PIN PW_OFF
  176. #define KILL_PIN PW_DET
  177. #define KILL_PIN_STATE HIGH
  178. #endif
  179. // Random Info
  180. #define USB_SERIAL -1 // USB Serial
  181. /**
  182. * ------ ------
  183. * (BEEPER) PB2 | 1 2 | PE10 (BTN_ENC) (SPI1 MISO) PA6 | 1 2 | PA5 (SPI1 SCK)
  184. * (LCD_EN) PE11 | 3 4 | PD10 (LCD_RS) (BTN_EN1) PE9 | 3 4 | PA4 (SPI1 CS)
  185. * (LCD_D4) PD9 5 6 | PD8 (LCD_D5) (BTN_EN2) PE8 5 6 | PA7 (SPI1 MOSI)
  186. * (LCD_D6) PE15 | 7 8 | PE7 (LCD_D7) (SPI1_RS) PB11 | 7 8 | RESET
  187. * GND | 9 10 | 5V GND | 9 10 | 3.3V
  188. * ------ ------
  189. * EXP1 EXP2
  190. */
  191. #define EXP1_01_PIN PB2
  192. #define EXP1_02_PIN PE10
  193. #define EXP1_03_PIN PE11
  194. #define EXP1_04_PIN PD10
  195. #define EXP1_05_PIN PD9
  196. #define EXP1_06_PIN PD8
  197. #define EXP1_07_PIN PE15
  198. #define EXP1_08_PIN PE7
  199. #define EXP2_01_PIN PA6
  200. #define EXP2_02_PIN PA5
  201. #define EXP2_03_PIN PE9
  202. #define EXP2_04_PIN PA4
  203. #define EXP2_05_PIN PE8
  204. #define EXP2_06_PIN PA7
  205. #define EXP2_07_PIN PB11
  206. #define EXP2_08_PIN -1 // RESET
  207. #if ENABLED(SDSUPPORT)
  208. #ifndef SDCARD_CONNECTION
  209. #define SDCARD_CONNECTION ONBOARD
  210. #endif
  211. #if SD_CONNECTION_IS(ONBOARD)
  212. #define ENABLE_SPI3
  213. #define SD_SS_PIN -1
  214. #define SDSS PC9
  215. #define SD_SCK_PIN PC10
  216. #define SD_MISO_PIN PC11
  217. #define SD_MOSI_PIN PC12
  218. #define SD_DETECT_PIN PC4 // SD_DETECT_PIN doesn't work with NO_SD_HOST_DRIVE disabled
  219. #elif SD_CONNECTION_IS(LCD)
  220. #define ENABLE_SPI1
  221. #define SDSS EXP2_04_PIN
  222. #define SD_SCK_PIN EXP2_02_PIN
  223. #define SD_MISO_PIN EXP2_01_PIN
  224. #define SD_MOSI_PIN EXP2_06_PIN
  225. #define SD_DETECT_PIN EXP2_07_PIN
  226. #endif
  227. #endif
  228. #if EITHER(TFT_COLOR_UI, TFT_CLASSIC_UI)
  229. #define TFT_CS_PIN EXP1_07_PIN
  230. #define TFT_SCK_PIN EXP2_02_PIN
  231. #define TFT_MISO_PIN EXP2_01_PIN
  232. #define TFT_MOSI_PIN EXP2_06_PIN
  233. #define TFT_DC_PIN EXP1_08_PIN
  234. #define TFT_A0_PIN TFT_DC_PIN
  235. #define TFT_RESET_PIN EXP1_04_PIN
  236. #define LCD_BACKLIGHT_PIN EXP1_03_PIN
  237. #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
  238. #define TOUCH_BUTTONS_HW_SPI
  239. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  240. #ifndef TFT_WIDTH
  241. #define TFT_WIDTH 480
  242. #endif
  243. #ifndef TFT_HEIGHT
  244. #define TFT_HEIGHT 320
  245. #endif
  246. #define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS
  247. #define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK
  248. #define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO
  249. #define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI
  250. #define LCD_READ_ID 0xD3
  251. #define LCD_USE_DMA_SPI
  252. #define TFT_BUFFER_SIZE 14400
  253. #ifndef TOUCH_CALIBRATION_X
  254. #define TOUCH_CALIBRATION_X -17253
  255. #endif
  256. #ifndef TOUCH_CALIBRATION_Y
  257. #define TOUCH_CALIBRATION_Y 11579
  258. #endif
  259. #ifndef TOUCH_OFFSET_X
  260. #define TOUCH_OFFSET_X 514
  261. #endif
  262. #ifndef TOUCH_OFFSET_Y
  263. #define TOUCH_OFFSET_Y -24
  264. #endif
  265. #ifndef TOUCH_ORIENTATION
  266. #define TOUCH_ORIENTATION TOUCH_LANDSCAPE
  267. #endif
  268. #elif HAS_WIRED_LCD
  269. #define LCD_PINS_ENABLE EXP1_03_PIN
  270. #define LCD_PINS_RS EXP1_04_PIN
  271. #define LCD_BACKLIGHT_PIN -1
  272. // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
  273. #if ENABLED(MKS_MINI_12864)
  274. #define ENABLE_SPI1
  275. #define FORCE_SOFT_SPI
  276. #define DOGLCD_A0 EXP1_07_PIN
  277. #define DOGLCD_CS EXP1_06_PIN
  278. #define DOGLCD_SCK EXP2_02_PIN
  279. #define DOGLCD_MOSI EXP2_06_PIN
  280. //#define LCD_BACKLIGHT_PIN -1
  281. //#define LCD_RESET_PIN -1
  282. #elif ENABLED(FYSETC_MINI_12864_2_1)
  283. #define LCD_PINS_DC EXP1_04_PIN
  284. #define DOGLCD_CS EXP1_03_PIN
  285. #define DOGLCD_A0 LCD_PINS_DC
  286. #define LCD_BACKLIGHT_PIN -1
  287. #define LCD_RESET_PIN EXP1_05_PIN
  288. #define NEOPIXEL_PIN EXP1_06_PIN
  289. #define DOGLCD_MOSI EXP2_06_PIN
  290. #define DOGLCD_SCK EXP2_02_PIN
  291. #if SD_CONNECTION_IS(ONBOARD)
  292. #define FORCE_SOFT_SPI
  293. #endif
  294. //#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
  295. #else
  296. #define LCD_PINS_D4 EXP1_05_PIN
  297. #if ENABLED(ULTIPANEL)
  298. #define LCD_PINS_D5 EXP1_06_PIN
  299. #define LCD_PINS_D6 EXP1_07_PIN
  300. #define LCD_PINS_D7 EXP1_08_PIN
  301. #endif
  302. #define BOARD_ST7920_DELAY_1 96
  303. #define BOARD_ST7920_DELAY_2 48
  304. #define BOARD_ST7920_DELAY_3 600
  305. #endif // !MKS_MINI_12864
  306. #endif // HAS_WIRED_LCD
  307. #if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, HAS_WIRED_LCD)
  308. #define BEEPER_PIN EXP1_01_PIN
  309. #define BTN_EN1 EXP2_03_PIN
  310. #define BTN_EN2 EXP2_05_PIN
  311. #define BTN_ENC EXP1_02_PIN
  312. #endif