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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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 nano (STM32F103VET6) board pin assignments
  25. */
  26. #include "env_validate.h"
  27. #if HAS_MULTI_HOTEND || E_STEPPERS > 1
  28. #error "MKS Robin E3P only supports 1 hotend / E stepper."
  29. #elif HAS_FSMC_TFT
  30. #error "MKS Robin E3P doesn't support FSMC-based TFT displays."
  31. #endif
  32. #define BOARD_INFO_NAME "MKS Robin E3P"
  33. #define BOARD_NO_NATIVE_USB
  34. #define MKS_HARDWARE_TEST_ONLY_E0
  35. // Avoid conflict with TIMER_SERVO when using the STM32 HAL
  36. #define TEMP_TIMER 5
  37. //
  38. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  39. //
  40. #define DISABLE_DEBUG
  41. //
  42. // EEPROM
  43. //
  44. //#define FLASH_EEPROM_EMULATION
  45. //#define SDCARD_EEPROM_EMULATION
  46. #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
  47. #define I2C_EEPROM // EEPROM on I2C-0
  48. #define MARLIN_EEPROM_SIZE 0x1000 // 4K
  49. #endif
  50. //
  51. // Note: MKS Robin board is using SPI2 interface.
  52. //
  53. #define SPI_DEVICE 2
  54. //
  55. // Servos
  56. //
  57. #define SERVO0_PIN PA8 // Enable BLTOUCH
  58. //
  59. // Limit Switches
  60. //
  61. #define X_DIAG_PIN PA15
  62. #define Y_DIAG_PIN PA12
  63. #define Z_DIAG_PIN PA11
  64. #define E0_DIAG_PIN PC4
  65. #define X_STOP_PIN PA15
  66. #define Y_STOP_PIN PA12
  67. #define Z_MIN_PIN PA11
  68. #define Z_MAX_PIN PC4
  69. //
  70. // Steppers
  71. //
  72. #define X_ENABLE_PIN PE4
  73. #define X_STEP_PIN PE3
  74. #define X_DIR_PIN PE2
  75. #ifndef X_CS_PIN
  76. #define X_CS_PIN PD5
  77. #endif
  78. #define Y_ENABLE_PIN PE1
  79. #define Y_STEP_PIN PE0
  80. #define Y_DIR_PIN PB9
  81. #ifndef Y_CS_PIN
  82. #define Y_CS_PIN PD7
  83. #endif
  84. #define Z_ENABLE_PIN PB8
  85. #define Z_STEP_PIN PB5
  86. #define Z_DIR_PIN PB4
  87. #ifndef Z_CS_PIN
  88. #define Z_CS_PIN PD4
  89. #endif
  90. #define E0_ENABLE_PIN PB3
  91. #define E0_STEP_PIN PD6
  92. #define E0_DIR_PIN PD3
  93. #ifndef E0_CS_PIN
  94. #define E0_CS_PIN PD9
  95. #endif
  96. //
  97. // Software SPI pins for TMC2130 stepper drivers
  98. //
  99. #if ENABLED(TMC_USE_SW_SPI)
  100. #ifndef TMC_SW_MOSI
  101. #define TMC_SW_MOSI PD14
  102. #endif
  103. #ifndef TMC_SW_MISO
  104. #define TMC_SW_MISO PD1
  105. #endif
  106. #ifndef TMC_SW_SCK
  107. #define TMC_SW_SCK PD0
  108. #endif
  109. #endif
  110. #if HAS_TMC_UART
  111. /**
  112. * TMC2208/TMC2209 stepper drivers
  113. *
  114. * Hardware serial communication ports.
  115. * If undefined software serial is used according to the pins below
  116. */
  117. //#define X_HARDWARE_SERIAL Serial
  118. //#define X2_HARDWARE_SERIAL Serial1
  119. //#define Y_HARDWARE_SERIAL Serial1
  120. //#define Y2_HARDWARE_SERIAL Serial1
  121. //#define Z_HARDWARE_SERIAL Serial1
  122. //#define Z2_HARDWARE_SERIAL Serial1
  123. //#define E0_HARDWARE_SERIAL Serial1
  124. //#define E1_HARDWARE_SERIAL Serial1
  125. //#define E2_HARDWARE_SERIAL Serial1
  126. //#define E3_HARDWARE_SERIAL Serial1
  127. //#define E4_HARDWARE_SERIAL Serial1
  128. #define X_SERIAL_TX_PIN PD5
  129. #define X_SERIAL_RX_PIN PD5
  130. #define Y_SERIAL_TX_PIN PD7
  131. #define Y_SERIAL_RX_PIN PD7
  132. #define Z_SERIAL_TX_PIN PD4
  133. #define Z_SERIAL_RX_PIN PD4
  134. #define E0_SERIAL_TX_PIN PD9
  135. #define E0_SERIAL_RX_PIN PD9
  136. // Reduce baud rate to improve software serial reliability
  137. #define TMC_BAUD_RATE 19200
  138. #endif // HAS_TMC_UART
  139. //
  140. // Temperature Sensors
  141. //
  142. #define TEMP_0_PIN PC1 // TH1
  143. #define TEMP_BED_PIN PC0 // TB1
  144. //
  145. // Heaters / Fans
  146. //
  147. #define HEATER_0_PIN PC3 // HEATER1
  148. #define HEATER_BED_PIN PA0 // HOT BED
  149. #define FAN_PIN PB1 // FAN
  150. //
  151. // Misc. Functions
  152. //
  153. #if HAS_TFT_LVGL_UI
  154. #if ENABLED(MKS_PWC)
  155. #define SUICIDE_PIN PB2
  156. #define SUICIDE_PIN_STATE LOW
  157. #define KILL_PIN PA2
  158. #define KILL_PIN_STATE HIGH
  159. #endif
  160. #define MT_DET_1_PIN PA4
  161. #define MT_DET_PIN_STATE LOW
  162. #define WIFI_IO0_PIN PC13
  163. #define WIFI_IO1_PIN PC7
  164. #define WIFI_RESET_PIN PE9
  165. #if ENABLED(MKS_TEST)
  166. #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
  167. #define MKS_TEST_PS_ON_PIN PB0 // PW_OFF
  168. #endif
  169. #else
  170. //#define POWER_LOSS_PIN PA2 // PW_DET
  171. //#define PS_ON_PIN PB2 // PW_OFF
  172. #define FIL_RUNOUT_PIN PA4
  173. #endif
  174. //#define LED_PIN PB2
  175. /**
  176. * ------ ------
  177. * PC5 | 1 2 | PE13 PA6 | 1 2 | PA5
  178. * PD13 | 3 4 | PC6 PE8 | 3 4 | PE10
  179. * PE14 | 5 6 PE15 PE11 | 5 6 PA7
  180. * PD11 | 7 8 | PD10 PE12 | 7 8 | RESET
  181. * GND | 9 10 | 5V GND | 9 10 | 3.3V
  182. * ------ ------
  183. * EXP1 EXP2
  184. */
  185. #define EXP1_01_PIN PC5
  186. #define EXP1_02_PIN PE13
  187. #define EXP1_03_PIN PD13
  188. #define EXP1_04_PIN PC6
  189. #define EXP1_05_PIN PE14
  190. #define EXP1_06_PIN PE15
  191. #define EXP1_07_PIN PD11
  192. #define EXP1_08_PIN PD10
  193. #define EXP2_01_PIN PA6
  194. #define EXP2_02_PIN PA5
  195. #define EXP2_03_PIN PE8
  196. #define EXP2_04_PIN PE10
  197. #define EXP2_05_PIN PE11
  198. #define EXP2_06_PIN PA7
  199. #define EXP2_07_PIN PE12
  200. #define EXP2_08_PIN -1
  201. //
  202. // SD Card
  203. //
  204. #ifndef SDCARD_CONNECTION
  205. #define SDCARD_CONNECTION ONBOARD
  206. #endif
  207. #if SD_CONNECTION_IS(ONBOARD)
  208. #define SDIO_SUPPORT
  209. #define SDIO_CLOCK 4500000 // 4.5 MHz
  210. #define SD_DETECT_PIN PD12
  211. #define ONBOARD_SD_CS_PIN PC11
  212. #elif SD_CONNECTION_IS(LCD)
  213. #define ENABLE_SPI1
  214. #define SDSS EXP2_04_PIN
  215. #define SD_SCK_PIN EXP2_02_PIN
  216. #define SD_MISO_PIN EXP2_01_PIN
  217. #define SD_MOSI_PIN EXP2_06_PIN
  218. #define SD_DETECT_PIN EXP2_07_PIN
  219. #endif
  220. //
  221. // LCD / Controller
  222. //
  223. /**
  224. * Note: MKS Robin TFT screens use various TFT controllers.
  225. * If the screen stays white, disable 'LCD_RESET_PIN'
  226. * to let the bootloader init the screen.
  227. */
  228. #if HAS_SPI_TFT
  229. // Shared SPI TFT
  230. #define LCD_BACKLIGHT_PIN EXP1_03_PIN
  231. #define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS
  232. #define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK
  233. #define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO
  234. #define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI
  235. #define BTN_EN1 EXP2_03_PIN
  236. #define BTN_EN2 EXP2_05_PIN
  237. #define BTN_ENC EXP1_02_PIN
  238. #define TFT_CS_PIN EXP1_07_PIN
  239. #define TFT_SCK_PIN EXP2_02_PIN
  240. #define TFT_MISO_PIN EXP2_01_PIN
  241. #define TFT_MOSI_PIN EXP2_06_PIN
  242. #define TFT_DC_PIN EXP1_08_PIN
  243. #define TFT_A0_PIN TFT_DC_PIN
  244. #define TFT_RESET_PIN EXP1_04_PIN
  245. #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN
  246. #define TOUCH_BUTTONS_HW_SPI
  247. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  248. #define LCD_USE_DMA_SPI
  249. #endif
  250. #if ENABLED(TFT_CLASSIC_UI)
  251. // Emulated DOGM SPI
  252. #define LCD_PINS_ENABLE EXP1_03_PIN
  253. #define LCD_PINS_RS EXP1_04_PIN
  254. #define BTN_ENC EXP1_02_PIN
  255. #define BTN_EN1 EXP2_03_PIN
  256. #define BTN_EN2 EXP2_05_PIN
  257. #elif ENABLED(TFT_COLOR_UI)
  258. #define TFT_BUFFER_SIZE 14400
  259. #endif
  260. #if HAS_WIRED_LCD && !HAS_SPI_TFT
  261. #define BEEPER_PIN EXP1_01_PIN
  262. #define BTN_ENC EXP1_02_PIN
  263. #define LCD_PINS_ENABLE EXP1_03_PIN
  264. #define LCD_PINS_RS EXP1_04_PIN
  265. #define BTN_EN1 EXP2_03_PIN
  266. #define BTN_EN2 EXP2_05_PIN
  267. #define LCD_BACKLIGHT_PIN -1
  268. #if ENABLED(MKS_MINI_12864)
  269. // MKS MINI12864 and MKS LCD12864B
  270. // If using MKS LCD12864A (Need to remove RPK2 resistor)
  271. #define LCD_BACKLIGHT_PIN -1
  272. #define LCD_RESET_PIN -1
  273. #define DOGLCD_A0 EXP1_07_PIN
  274. #define DOGLCD_CS EXP1_06_PIN
  275. #define DOGLCD_SCK EXP2_02_PIN
  276. #define DOGLCD_MOSI EXP2_06_PIN
  277. #elif IS_TFTGLCD_PANEL
  278. #if ENABLED(TFTGLCD_PANEL_SPI)
  279. #define PIN_SPI_SCK EXP2_02_PIN
  280. #define PIN_TFT_MISO EXP2_01_PIN
  281. #define PIN_TFT_MOSI EXP2_06_PIN
  282. #define TFTGLCD_CS EXP2_03_PIN
  283. #endif
  284. #ifndef BEEPER_PIN
  285. #define BEEPER_PIN -1
  286. #endif
  287. #elif ENABLED(FYSETC_MINI_12864_2_1)
  288. #define LCD_PINS_DC EXP1_04_PIN
  289. #define DOGLCD_CS EXP1_03_PIN
  290. #define DOGLCD_A0 DOGLCD_A0
  291. #define LCD_BACKLIGHT_PIN -1
  292. #define LCD_RESET_PIN EXP1_05_PIN
  293. #define NEOPIXEL_PIN EXP1_06_PIN
  294. #define DOGLCD_MOSI EXP2_06_PIN
  295. #define DOGLCD_SCK EXP2_02_PIN
  296. #if SD_CONNECTION_IS(ONBOARD)
  297. #define FORCE_SOFT_SPI
  298. #endif
  299. //#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
  300. #else // !MKS_MINI_12864
  301. #define LCD_PINS_D4 EXP1_05_PIN
  302. #if IS_ULTIPANEL
  303. #define LCD_PINS_D5 EXP1_06_PIN
  304. #define LCD_PINS_D6 EXP1_07_PIN
  305. #define LCD_PINS_D7 EXP1_08_PIN
  306. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  307. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  308. #endif
  309. #endif
  310. #define BOARD_ST7920_DELAY_1 125
  311. #define BOARD_ST7920_DELAY_2 125
  312. #define BOARD_ST7920_DELAY_3 125
  313. #endif // !MKS_MINI_12864
  314. #endif // HAS_WIRED_LCD && !HAS_SPI_TFT
  315. #define SPI_FLASH
  316. #if ENABLED(SPI_FLASH)
  317. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  318. #define SPI_FLASH_CS_PIN PB12
  319. #define SPI_FLASH_MOSI_PIN PB15
  320. #define SPI_FLASH_MISO_PIN PB14
  321. #define SPI_FLASH_SCK_PIN PB13
  322. #endif
  323. #ifndef BEEPER_PIN
  324. #define BEEPER_PIN EXP1_01_PIN
  325. #endif
  326. #if ENABLED(SPEAKER) && BEEPER_PIN == PC5
  327. #error "MKS Robin nano default BEEPER_PIN is not a SPEAKER."
  328. #endif