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_ROBIN_PRO_V2.h 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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. #define ALLOW_STM32DUINO
  24. #include "env_validate.h"
  25. #if HOTENDS > 2 || E_STEPPERS > 2
  26. #error "MKS Robin Nano V3 supports up to 2 hotends / E steppers."
  27. #endif
  28. #define BOARD_INFO_NAME "MKS Robin PRO V2"
  29. // Avoid conflict with TIMER_TONE
  30. #define STEP_TIMER 10
  31. // Use one of these or SDCard-based Emulation will be used
  32. //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
  33. //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
  34. #define I2C_EEPROM
  35. #define MARLIN_EEPROM_SIZE 0x1000 // 4K
  36. #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support
  37. //
  38. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  39. //
  40. //#define DISABLE_DEBUG
  41. //
  42. // Note: MKS Robin board is using SPI2 interface.
  43. //
  44. //#define SPI_MODULE 2
  45. //
  46. // Servos
  47. //
  48. #define SERVO0_PIN PA8 // Enable BLTOUCH
  49. //
  50. // Limit Switches
  51. //
  52. #define X_DIAG_PIN PA15
  53. #define Y_DIAG_PIN PA12
  54. #define Z_DIAG_PIN PA11
  55. #define E0_DIAG_PIN PC4
  56. #define E1_DIAG_PIN PE7
  57. #define X_STOP_PIN PA15
  58. #define Y_STOP_PIN PA12
  59. #define Z_MIN_PIN PA11
  60. #define Z_MAX_PIN PC4
  61. #ifndef FIL_RUNOUT_PIN
  62. #define FIL_RUNOUT_PIN PA4 // MT_DET
  63. #endif
  64. //
  65. // Steppers
  66. //
  67. #define X_ENABLE_PIN PE4
  68. #define X_STEP_PIN PE3
  69. #define X_DIR_PIN PE2
  70. #ifndef X_CS_PIN
  71. #define X_CS_PIN PD5
  72. #endif
  73. #define Y_ENABLE_PIN PE1
  74. #define Y_STEP_PIN PE0
  75. #define Y_DIR_PIN PB9
  76. #ifndef Y_CS_PIN
  77. #define Y_CS_PIN PD7
  78. #endif
  79. #define Z_ENABLE_PIN PB8
  80. #define Z_STEP_PIN PB5
  81. #define Z_DIR_PIN PB4
  82. #ifndef Z_CS_PIN
  83. #define Z_CS_PIN PD4
  84. #endif
  85. #define E0_ENABLE_PIN PB3
  86. #define E0_STEP_PIN PD6
  87. #define E0_DIR_PIN PD3
  88. #ifndef E0_CS_PIN
  89. #define E0_CS_PIN PD9
  90. #endif
  91. #define E1_ENABLE_PIN PA3
  92. #define E1_STEP_PIN PD15
  93. #define E1_DIR_PIN PA1
  94. #ifndef E1_CS_PIN
  95. #define E1_CS_PIN PD8
  96. #endif
  97. //
  98. // Software SPI pins for TMC2130 stepper drivers
  99. //
  100. #if ENABLED(TMC_USE_SW_SPI)
  101. #ifndef TMC_SW_MOSI
  102. #define TMC_SW_MOSI PD14
  103. #endif
  104. #ifndef TMC_SW_MISO
  105. #define TMC_SW_MISO PD1
  106. #endif
  107. #ifndef TMC_SW_SCK
  108. #define TMC_SW_SCK PD0
  109. #endif
  110. #endif
  111. #if HAS_TMC_UART
  112. /**
  113. * TMC2208/TMC2209 stepper drivers
  114. *
  115. * Hardware serial communication ports.
  116. * If undefined software serial is used according to the pins below
  117. */
  118. //#define X_HARDWARE_SERIAL Serial1
  119. //#define X2_HARDWARE_SERIAL Serial1
  120. //#define Y_HARDWARE_SERIAL Serial1
  121. //#define Y2_HARDWARE_SERIAL Serial1
  122. //#define Z_HARDWARE_SERIAL Serial1
  123. //#define Z2_HARDWARE_SERIAL Serial1
  124. //#define E0_HARDWARE_SERIAL Serial1
  125. //#define E1_HARDWARE_SERIAL Serial1
  126. //#define E2_HARDWARE_SERIAL Serial1
  127. //#define E3_HARDWARE_SERIAL Serial1
  128. //#define E4_HARDWARE_SERIAL Serial1
  129. #define X_SERIAL_TX_PIN PD5
  130. #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
  131. #define Y_SERIAL_TX_PIN PD7
  132. #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
  133. #define Z_SERIAL_TX_PIN PD4
  134. #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
  135. #define E0_SERIAL_TX_PIN PD9
  136. #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN
  137. #define E1_SERIAL_TX_PIN PD8
  138. #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN
  139. // Reduce baud rate to improve software serial reliability
  140. #define TMC_BAUD_RATE 19200
  141. #endif // HAS_TMC_UART
  142. //
  143. // Temperature Sensors
  144. //
  145. #define TEMP_0_PIN PC1 // TH1
  146. #define TEMP_1_PIN PC2 // TH2
  147. #define TEMP_BED_PIN PC0 // TB1
  148. //
  149. // Heaters / Fans
  150. //
  151. #define HEATER_0_PIN PC3 // HEATER1
  152. #define HEATER_1_PIN PB0 // HEATER2
  153. #define HEATER_BED_PIN PA0 // HOT BED
  154. #define FAN_PIN PB1 // FAN
  155. //
  156. // Thermocouples
  157. //
  158. //#define TEMP_0_CS_PIN PE5 // TC1 - CS1
  159. //#define TEMP_0_CS_PIN PE6 // TC2 - CS2
  160. //
  161. // Misc. Functions
  162. //
  163. //#define POWER_LOSS_PIN PA2 // PW_DET
  164. //#define PS_ON_PIN PA3 // PW_OFF
  165. //
  166. // Power Supply Control
  167. //
  168. #if ENABLED(MKS_PWC)
  169. #define SUICIDE_PIN PB2
  170. #define KILL_PIN PA2
  171. #define KILL_PIN_STATE LOW
  172. #else
  173. #define LED_PIN PB2
  174. #endif
  175. #ifndef SDCARD_CONNECTION
  176. #define SDCARD_CONNECTION ONBOARD
  177. #endif
  178. //#define USE_NEW_SPI_API 1
  179. //
  180. // Onboard SD card
  181. // NOT compatible with LCD
  182. //
  183. // Detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled
  184. #if SD_CONNECTION_IS(ONBOARD)
  185. #if USE_NEW_SPI_API
  186. #define SD_SPI MARLIN_SPI(HardwareSPI3, PC9)
  187. #else
  188. #define ENABLE_SPI3
  189. #define SD_SS_PIN -1
  190. #define SDSS PC9
  191. #define SD_SCK_PIN PC10
  192. #define SD_MISO_PIN PC11
  193. #define SD_MOSI_PIN PC12
  194. #endif
  195. #define SD_DETECT_PIN PD12
  196. #endif
  197. /** ------ ------
  198. * (BEEPER) PC5 |10 9 | PE13 (BTN_ENC) (SPI1 MISO) PA6 |10 9 | PA5 (SPI1 SCK)
  199. * (LCD_EN) PD13 | 8 7 | PC6 (LCD_RS) (BTN_EN1) PE8 | 8 7 | PE10 (SPI1 CS)
  200. * (LCD_D4) PE14 6 5 | PE15 (LCD_D5) (BTN_EN2) PE11 6 5 | PA7 (SPI1 MOSI)
  201. * (LCD_D6) PD11 | 4 3 | PD10 (LCD_D7) (SPI DET) PE12 | 4 3 | RESET
  202. * GND | 2 1 | 5V GND | 2 1 | 3.3V
  203. * ------ ------
  204. * EXP1 EXP2
  205. */
  206. #define EXP1_03_PIN PD10
  207. #define EXP1_04_PIN PD11
  208. #define EXP1_05_PIN PE15
  209. #define EXP1_06_PIN PE14
  210. #define EXP1_07_PIN PC6
  211. #define EXP1_08_PIN PD13
  212. #define EXP1_09_PIN PE13
  213. #define EXP1_10_PIN PC5
  214. #define EXP2_03_PIN -1 // RESET
  215. #define EXP2_04_PIN PE12
  216. #define EXP2_05_PIN PA7
  217. #define EXP2_06_PIN PE11
  218. #define EXP2_07_PIN PE10
  219. #define EXP2_08_PIN PE8
  220. #define EXP2_09_PIN PA5
  221. #define EXP2_10_PIN PA6
  222. //
  223. // LCD SD
  224. //
  225. /*
  226. #if SD_CONNECTION_IS(LCD)
  227. #define ENABLE_SPI1
  228. #define SDSS EXP2_07_PIN
  229. #define SD_SCK_PIN EXP2_09_PIN
  230. #define SD_MISO_PIN EXP2_10_PIN
  231. #define SD_MOSI_PIN EXP2_05_PIN
  232. #define SD_DETECT_PIN EXP2_04_PIN
  233. #endif
  234. */
  235. //
  236. // LCD / Controller
  237. #define SPI_FLASH
  238. #define HAS_SPI_FLASH 1
  239. #define SPI_DEVICE 2
  240. #define SPI_FLASH_SIZE 0x1000000
  241. #if ENABLED(SPI_FLASH)
  242. #define SPI_FLASH_CS_PIN PB12
  243. #define SPI_FLASH_MOSI_PIN PB15
  244. #define SPI_FLASH_MISO_PIN PB14
  245. #define SPI_FLASH_SCK_PIN PB13
  246. #endif
  247. #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI)
  248. #ifndef TOUCH_CALIBRATION_X
  249. #define TOUCH_CALIBRATION_X -17253
  250. #endif
  251. #ifndef TOUCH_CALIBRATION_Y
  252. #define TOUCH_CALIBRATION_Y 11579
  253. #endif
  254. #ifndef TOUCH_OFFSET_X
  255. #define TOUCH_OFFSET_X 514
  256. #endif
  257. #ifndef TOUCH_OFFSET_Y
  258. #define TOUCH_OFFSET_Y -24
  259. #endif
  260. #ifndef TOUCH_ORIENTATION
  261. #define TOUCH_ORIENTATION TOUCH_LANDSCAPE
  262. #endif
  263. #define TFT_CS_PIN EXP1_04_PIN
  264. #define TFT_SCK_PIN EXP2_09_PIN
  265. #define TFT_MISO_PIN EXP2_10_PIN
  266. #define TFT_MOSI_PIN EXP2_05_PIN
  267. #define TFT_DC_PIN EXP1_03_PIN
  268. #define TFT_A0_PIN TFT_DC_PIN
  269. #define TFT_RESET_PIN EXP1_07_PIN
  270. #define LCD_BACKLIGHT_PIN EXP1_08_PIN
  271. #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
  272. #define TOUCH_BUTTONS_HW_SPI
  273. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  274. #ifndef TFT_WIDTH
  275. #define TFT_WIDTH 480
  276. #endif
  277. #ifndef TFT_HEIGHT
  278. #define TFT_HEIGHT 320
  279. #endif
  280. #define TOUCH_CS_PIN EXP1_06_PIN // SPI1_NSS
  281. #define TOUCH_SCK_PIN EXP2_09_PIN // SPI1_SCK
  282. #define TOUCH_MISO_PIN EXP2_10_PIN // SPI1_MISO
  283. #define TOUCH_MOSI_PIN EXP2_05_PIN // SPI1_MOSI
  284. #define BTN_EN1 EXP2_08_PIN
  285. #define BTN_EN2 EXP2_06_PIN
  286. #define BEEPER_PIN EXP1_10_PIN
  287. #define BTN_ENC EXP1_09_PIN
  288. #define LCD_READ_ID 0xD3
  289. #define LCD_USE_DMA_SPI
  290. //#define TFT_DRIVER ST7796
  291. #define TFT_BUFFER_SIZE 14400
  292. #elif HAS_WIRED_LCD
  293. #define BEEPER_PIN EXP1_10_PIN
  294. #define BTN_ENC EXP1_09_PIN
  295. #define LCD_PINS_ENABLE EXP1_08_PIN
  296. #define LCD_PINS_RS EXP1_07_PIN
  297. #define BTN_EN1 EXP2_08_PIN
  298. #define BTN_EN2 EXP2_06_PIN
  299. #define LCD_BACKLIGHT_PIN -1
  300. // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
  301. #if ENABLED(MKS_MINI_12864)
  302. //#define LCD_BACKLIGHT_PIN -1
  303. //#define LCD_RESET_PIN -1
  304. #define DOGLCD_A0 EXP1_04_PIN
  305. #define DOGLCD_CS EXP1_05_PIN
  306. //#define DOGLCD_SCK EXP2_09_PIN
  307. //#define DOGLCD_MOSI EXP2_05_PIN
  308. // Required for MKS_MINI_12864 with this board
  309. //#define MKS_LCD12864B
  310. //#undef SHOW_BOOTSCREEN
  311. #else // !MKS_MINI_12864
  312. #define LCD_PINS_D4 EXP1_06_PIN
  313. #if ENABLED(ULTIPANEL)
  314. #define LCD_PINS_D5 EXP1_05_PIN
  315. #define LCD_PINS_D6 EXP1_04_PIN
  316. #define LCD_PINS_D7 EXP1_03_PIN
  317. #endif
  318. #define BOARD_ST7920_DELAY_1 96
  319. #define BOARD_ST7920_DELAY_2 48
  320. #define BOARD_ST7920_DELAY_3 600
  321. #endif // !MKS_MINI_12864
  322. #endif // HAS_WIRED_LCD