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.h 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. /**
  24. * MKS Robin pro (STM32F103ZET6) board pin assignments
  25. */
  26. #include "env_validate.h"
  27. #if HOTENDS > 3 || E_STEPPERS > 3
  28. #error "MKS Robin pro supports up to 3 hotends / E steppers."
  29. #endif
  30. #define BOARD_INFO_NAME "MKS Robin pro"
  31. #define BOARD_NO_NATIVE_USB
  32. //
  33. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  34. //
  35. #define DISABLE_DEBUG
  36. //
  37. // Note: MKS Robin board is using SPI2 interface.
  38. //
  39. #define SPI_DEVICE 2
  40. //
  41. // Servos
  42. //
  43. #define SERVO0_PIN PA8 // Enable BLTOUCH
  44. //
  45. // Limit Switches
  46. //
  47. #define X_MIN_PIN PA15
  48. #define X_MAX_PIN PG7
  49. #define Y_MIN_PIN PA12
  50. #define Y_MAX_PIN PG8
  51. #define Z_MIN_PIN PA11
  52. #define Z_MAX_PIN PC4
  53. //
  54. // Steppers
  55. //
  56. #define X_ENABLE_PIN PE4
  57. #define X_STEP_PIN PE3
  58. #define X_DIR_PIN PE2
  59. #ifndef X_CS_PIN
  60. #define X_CS_PIN PF8
  61. #endif
  62. #define Y_ENABLE_PIN PE1
  63. #define Y_STEP_PIN PE0
  64. #define Y_DIR_PIN PB9
  65. #ifndef Y_CS_PIN
  66. #define Y_CS_PIN PF3
  67. #endif
  68. #define Z_ENABLE_PIN PB8
  69. #define Z_STEP_PIN PB5
  70. #define Z_DIR_PIN PB4
  71. #ifndef Z_CS_PIN
  72. #define Z_CS_PIN PF6
  73. #endif
  74. #define E0_ENABLE_PIN PB3
  75. #define E0_STEP_PIN PD6
  76. #define E0_DIR_PIN PD3
  77. #ifndef E0_CS_PIN
  78. #define E0_CS_PIN PG15
  79. #endif
  80. #define E1_ENABLE_PIN PA3
  81. #define E1_STEP_PIN PA6
  82. #define E1_DIR_PIN PA1
  83. #ifndef E1_CS_PIN
  84. #define E1_CS_PIN PG10
  85. #endif
  86. #define E2_ENABLE_PIN PF0
  87. #define E2_STEP_PIN PF2
  88. #define E2_DIR_PIN PF1
  89. #ifndef E2_CS_PIN
  90. #define E2_CS_PIN PG9
  91. #endif
  92. //
  93. // Software SPI pins for TMC2130 stepper drivers
  94. //
  95. #if ENABLED(TMC_USE_SW_SPI)
  96. #ifndef TMC_SW_MOSI
  97. #define TMC_SW_MOSI PB15
  98. #endif
  99. #ifndef TMC_SW_MISO
  100. #define TMC_SW_MISO PB14
  101. #endif
  102. #ifndef TMC_SW_SCK
  103. #define TMC_SW_SCK PB13
  104. #endif
  105. #endif
  106. #if HAS_TMC_UART
  107. /**
  108. * TMC2208/TMC2209 stepper drivers
  109. *
  110. * Hardware serial communication ports.
  111. * If undefined software serial is used according to the pins below
  112. */
  113. //#define X_HARDWARE_SERIAL MSerial1
  114. //#define Y_HARDWARE_SERIAL MSerial1
  115. //#define Z_HARDWARE_SERIAL MSerial1
  116. //#define E0_HARDWARE_SERIAL MSerial1
  117. //#define E1_HARDWARE_SERIAL MSerial1
  118. //#define E2_HARDWARE_SERIAL MSerial1
  119. #define X_SERIAL_TX_PIN PF7
  120. #define X_SERIAL_RX_PIN PF8
  121. #define Y_SERIAL_TX_PIN PF4
  122. #define Y_SERIAL_RX_PIN PF3
  123. #define Z_SERIAL_TX_PIN PF5
  124. #define Z_SERIAL_RX_PIN PF6
  125. #define E0_SERIAL_TX_PIN PG13
  126. #define E0_SERIAL_RX_PIN PG15
  127. #define E1_SERIAL_TX_PIN PG12
  128. #define E1_SERIAL_RX_PIN PG10
  129. #define E2_SERIAL_TX_PIN PC13
  130. #define E2_SERIAL_RX_PIN PG9
  131. #endif
  132. //
  133. // Temperature Sensors
  134. //
  135. #define TEMP_0_PIN PC1 // TH1
  136. #define TEMP_1_PIN PC2 // TH2
  137. #define TEMP_2_PIN PC3 // TH3
  138. #define TEMP_BED_PIN PC0 // TB1
  139. //
  140. // Heaters / Fans
  141. //
  142. #define HEATER_0_PIN PF10 // +HE0-
  143. #define HEATER_1_PIN PB0 // +HE1-
  144. #define HEATER_2_PIN PF9 // +HE2-
  145. #define HEATER_BED_PIN PA0 // +HOT-BED-
  146. #define FAN_PIN PB1 // +FAN-
  147. /**
  148. * Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly
  149. */
  150. //#define TEMP_0_CS_PIN PE5 // TC1 - CS1
  151. //#define TEMP_0_CS_PIN PF11 // TC2 - CS2
  152. #define POWER_LOSS_PIN PA2 // PW_DET
  153. #define FIL_RUNOUT_PIN PA4 // MT_DET1
  154. #define FIL_RUNOUT2_PIN PE6 // MT_DET2
  155. #define FIL_RUNOUT3_PIN PG14 // MT_DET3
  156. //
  157. // Power Supply Control
  158. //
  159. #if ENABLED(MKS_PWC)
  160. #if ENABLED(TFT_LVGL_UI)
  161. #if ENABLED(PSU_CONTROL)
  162. #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
  163. #endif
  164. #undef MKS_PWC
  165. #define SUICIDE_PIN PG11
  166. #define SUICIDE_PIN_STATE LOW
  167. #else
  168. #define PS_ON_PIN PG11 // PW_OFF
  169. #endif
  170. #define KILL_PIN PA2
  171. #define KILL_PIN_STATE HIGH
  172. #endif
  173. //
  174. // SD Card
  175. //
  176. #ifndef SDCARD_CONNECTION
  177. #define SDCARD_CONNECTION ONBOARD
  178. #endif
  179. #if SD_CONNECTION_IS(LCD)
  180. #define SD_DETECT_PIN PG3
  181. #define SD_SCK_PIN PB13
  182. #define SD_MISO_PIN PB14
  183. #define SD_MOSI_PIN PB15
  184. #define SD_SS_PIN PG6
  185. #elif SD_CONNECTION_IS(ONBOARD)
  186. #define SDIO_SUPPORT
  187. #define SD_DETECT_PIN PD12
  188. #define ONBOARD_SD_CS_PIN PC11
  189. #elif SD_CONNECTION_IS(CUSTOM_CABLE)
  190. #error "No custom SD drive cable defined for this board."
  191. #endif
  192. //
  193. // TFT with FSMC interface
  194. //
  195. #if HAS_FSMC_TFT
  196. /**
  197. * Note: MKS Robin TFT screens use various TFT controllers.
  198. * If the screen stays white, disable 'LCD_RESET_PIN'
  199. * to let the bootloader init the screen.
  200. */
  201. #define TFT_RESET_PIN LCD_RESET_PIN
  202. #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
  203. #define FSMC_CS_PIN PD7 // NE4
  204. #define FSMC_RS_PIN PD11 // A0
  205. #define FSMC_DMA_DEV DMA2
  206. #define FSMC_DMA_CHANNEL DMA_CH5
  207. #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
  208. #define TFT_CS_PIN FSMC_CS_PIN
  209. #define TFT_RS_PIN FSMC_RS_PIN
  210. #define LCD_RESET_PIN PC6
  211. #define LCD_BACKLIGHT_PIN PD13
  212. #define TFT_BUFFER_SIZE 14400
  213. #if NEED_TOUCH_PINS
  214. #define TOUCH_BUTTONS_HW_SPI
  215. #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
  216. #define TOUCH_CS_PIN PA7 // SPI2_NSS
  217. #define TOUCH_SCK_PIN PB13 // SPI2_SCK
  218. #define TOUCH_MISO_PIN PB14 // SPI2_MISO
  219. #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
  220. #else
  221. #define BEEPER_PIN PC5
  222. #define BTN_ENC PG2
  223. #define BTN_EN1 PG5
  224. #define BTN_EN2 PG4
  225. #endif
  226. #elif IS_TFTGLCD_PANEL
  227. #if ENABLED(TFTGLCD_PANEL_SPI)
  228. #define TFTGLCD_CS PG5
  229. #endif
  230. #elif HAS_WIRED_LCD
  231. #define BEEPER_PIN PC5
  232. #define BTN_ENC PG2
  233. #define LCD_PINS_ENABLE PG0
  234. #define LCD_PINS_RS PG1
  235. #define BTN_EN1 PG5
  236. #define BTN_EN2 PG4
  237. // MKS MINI12864 and MKS LCD12864B. If using MKS LCD12864A (Need to remove RPK2 resistor)
  238. #if ENABLED(MKS_MINI_12864)
  239. #define LCD_BACKLIGHT_PIN -1
  240. #define LCD_RESET_PIN -1
  241. #define DOGLCD_A0 PF12
  242. #define DOGLCD_CS PF15
  243. #define DOGLCD_SCK PB13
  244. #define DOGLCD_MOSI PB15
  245. #else // !MKS_MINI_12864 && !ENDER2_STOCKDISPLAY
  246. #define LCD_PINS_D4 PF14
  247. #if IS_ULTIPANEL
  248. #define LCD_PINS_D5 PF15
  249. #define LCD_PINS_D6 PF12
  250. #define LCD_PINS_D7 PF13
  251. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  252. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  253. #endif
  254. #endif
  255. #endif // !MKS_MINI_12864 && !ENDER2_STOCKDISPLAY
  256. #endif
  257. // Alter timing for graphical display
  258. #if IS_U8GLIB_ST7920
  259. #define BOARD_ST7920_DELAY_1 125
  260. #define BOARD_ST7920_DELAY_2 125
  261. #define BOARD_ST7920_DELAY_3 125
  262. #endif
  263. #define HAS_SPI_FLASH 1
  264. #if HAS_SPI_FLASH
  265. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  266. #define SPI_FLASH_CS_PIN PB12 // Flash chip-select
  267. #define SPI_FLASH_MOSI_PIN PB15
  268. #define SPI_FLASH_MISO_PIN PB14
  269. #define SPI_FLASH_SCK_PIN PB13
  270. #endif