My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

pins_MKS_ROBIN_NANO_V2.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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 (STM32F130VET6) board pin assignments
  25. */
  26. #if NOT_TARGET(__STM32F1__)
  27. #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
  28. #elif HOTENDS > 2 || E_STEPPERS > 2
  29. #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue."
  30. #elif HAS_FSMC_TFT
  31. #error "MKS Robin nano v2 doesn't support FSMC-based TFT displays."
  32. #endif
  33. #define BOARD_INFO_NAME "MKS Robin nano V2.0"
  34. //
  35. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  36. //
  37. #define DISABLE_DEBUG
  38. //
  39. // EEPROM
  40. //
  41. //#define FLASH_EEPROM_EMULATION
  42. //#define SDCARD_EEPROM_EMULATION
  43. #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
  44. #define I2C_EEPROM // EEPROM on I2C-0
  45. #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
  46. #endif
  47. //
  48. // Note: MKS Robin board is using SPI2 interface.
  49. //
  50. //#define SPI_MODULE 2
  51. #define ENABLE_SPI2
  52. //
  53. // Limit Switches
  54. //
  55. #define X_DIAG_PIN PA15
  56. #define Y_DIAG_PIN PA12
  57. #define Z_DIAG_PIN PA11
  58. #define E0_DIAG_PIN PC4
  59. #define E1_DIAG_PIN PE7
  60. #define X_STOP_PIN PA15
  61. #define Y_STOP_PIN PA12
  62. #define Z_MIN_PIN PA11
  63. #define Z_MAX_PIN PC4
  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 MSerial1
  119. //#define Y_HARDWARE_SERIAL MSerial1
  120. //#define Z_HARDWARE_SERIAL MSerial1
  121. //#define E0_HARDWARE_SERIAL MSerial1
  122. //#define E1_HARDWARE_SERIAL MSerial1
  123. //
  124. // Software serial
  125. //
  126. #define X_SERIAL_TX_PIN PD5
  127. #define X_SERIAL_RX_PIN PD5
  128. #define Y_SERIAL_TX_PIN PD7
  129. #define Y_SERIAL_RX_PIN PD7
  130. #define Z_SERIAL_TX_PIN PD4
  131. #define Z_SERIAL_RX_PIN PD4
  132. #define E0_SERIAL_TX_PIN PD9
  133. #define E0_SERIAL_RX_PIN PD9
  134. #define E1_SERIAL_TX_PIN PD8
  135. #define E1_SERIAL_RX_PIN PD8
  136. // Reduce baud rate to improve software serial reliability
  137. #define TMC_BAUD_RATE 19200
  138. #endif // TMC2208 || TMC2209
  139. //
  140. // Temperature Sensors
  141. //
  142. #define TEMP_0_PIN PC1 // TH1
  143. #define TEMP_1_PIN PC2 // TH2
  144. #define TEMP_BED_PIN PC0 // TB1
  145. //
  146. // Heaters / Fans
  147. //
  148. #define HEATER_0_PIN PC3 // HEATER1
  149. #define HEATER_1_PIN PB0 // HEATER2
  150. #define HEATER_BED_PIN PA0 // HOT BED
  151. #define FAN_PIN PB1 // FAN
  152. //
  153. // Thermocouples
  154. //
  155. //#define MAX6675_SS_PIN PE5 // TC1 - CS1
  156. //#define MAX6675_SS_PIN PE6 // TC2 - CS2
  157. //
  158. // Misc. Functions
  159. //
  160. #if HAS_TFT_LVGL_UI
  161. //#define MKSPWC
  162. #ifdef MKSPWC
  163. #define SUICIDE_PIN PB2 // Enable MKSPWC SUICIDE PIN
  164. #define SUICIDE_PIN_INVERTING false // Enable MKSPWC PIN STATE
  165. #define KILL_PIN PA2 // Enable MKSPWC DET PIN
  166. #define KILL_PIN_STATE true // Enable MKSPWC PIN STATE
  167. #endif
  168. #define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
  169. #define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
  170. #define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
  171. #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
  172. #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
  173. #define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN
  174. #if ENABLED(MKS_TEST)
  175. #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
  176. #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
  177. #endif
  178. #else
  179. //#define POWER_LOSS_PIN PA2 // PW_DET
  180. //#define PS_ON_PIN PB2 // PW_OFF
  181. #define FIL_RUNOUT_PIN PA4
  182. #define FIL_RUNOUT2_PIN PE6
  183. #endif
  184. #define SERVO0_PIN PA8 // Enable BLTOUCH
  185. //#define LED_PIN PB2
  186. //
  187. // SD Card
  188. //
  189. #ifndef SDCARD_CONNECTION
  190. #define SDCARD_CONNECTION ONBOARD
  191. #endif
  192. #define SDIO_SUPPORT
  193. #define SDIO_CLOCK 4500000 // 4.5 MHz
  194. #define SD_DETECT_PIN PD12
  195. #define ONBOARD_SD_CS_PIN PC11
  196. //
  197. // LCD / Controller
  198. //
  199. /**
  200. * Note: MKS Robin TFT screens use various TFT controllers.
  201. * If the screen stays white, disable 'LCD_RESET_PIN'
  202. * to let the bootloader init the screen.
  203. */
  204. #if HAS_SPI_TFT
  205. // Shared SPI TFT
  206. #define LCD_BACKLIGHT_PIN PD13
  207. #define TOUCH_CS_PIN PE14 // SPI1_NSS
  208. #define TOUCH_SCK_PIN PA5 // SPI1_SCK
  209. #define TOUCH_MISO_PIN PA6 // SPI1_MISO
  210. #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
  211. #define BTN_EN1 PE8
  212. #define BTN_EN2 PE11
  213. #define BTN_ENC PE13
  214. #define TFT_CS_PIN PD11
  215. #define TFT_SCK_PIN PA5
  216. #define TFT_MISO_PIN PA6
  217. #define TFT_MOSI_PIN PA7
  218. #define TFT_DC_PIN PD10
  219. #define TFT_RST_PIN PC6
  220. #define TFT_A0_PIN TFT_DC_PIN
  221. #define TFT_RESET_PIN PC6
  222. #define TFT_BACKLIGHT_PIN PD13
  223. #define TOUCH_BUTTONS_HW_SPI
  224. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  225. #define LCD_USE_DMA_SPI
  226. #endif
  227. #if ENABLED(TFT_CLASSIC_UI)
  228. // Emulated DOGM SPI
  229. #ifndef GRAPHICAL_TFT_UPSCALE
  230. #define GRAPHICAL_TFT_UPSCALE 3
  231. #endif
  232. #ifndef TFT_PIXEL_OFFSET_Y
  233. #define TFT_PIXEL_OFFSET_Y 32
  234. #endif
  235. #define BTN_ENC PE13
  236. #define BTN_EN1 PE8
  237. #define BTN_EN2 PE11
  238. #define LCD_PINS_ENABLE PD13
  239. #define LCD_PINS_RS PC6
  240. #elif ENABLED(TFT_COLOR_UI)
  241. #define TFT_BUFFER_SIZE 14400
  242. #endif
  243. // XPT2046 Touch Screen calibration
  244. #if EITHER(TFT_LVGL_UI, TFT_COLOR_UI)
  245. #ifndef XPT2046_X_CALIBRATION
  246. #define XPT2046_X_CALIBRATION -17253
  247. #endif
  248. #ifndef XPT2046_Y_CALIBRATION
  249. #define XPT2046_Y_CALIBRATION 11579
  250. #endif
  251. #ifndef XPT2046_X_OFFSET
  252. #define XPT2046_X_OFFSET 514
  253. #endif
  254. #ifndef XPT2046_Y_OFFSET
  255. #define XPT2046_Y_OFFSET -24
  256. #endif
  257. #elif ENABLED(TFT_CLASSIC_UI)
  258. #ifndef XPT2046_X_CALIBRATION
  259. #define XPT2046_X_CALIBRATION -11386
  260. #endif
  261. #ifndef XPT2046_Y_CALIBRATION
  262. #define XPT2046_Y_CALIBRATION 8684
  263. #endif
  264. #ifndef XPT2046_X_OFFSET
  265. #define XPT2046_X_OFFSET 339
  266. #endif
  267. #ifndef XPT2046_Y_OFFSET
  268. #define XPT2046_Y_OFFSET -18
  269. #endif
  270. #endif
  271. #if HAS_WIRED_LCD && !HAS_SPI_TFT
  272. // NON TFT Displays
  273. #if ENABLED(MKS_MINI_12864)
  274. // MKS MINI12864 and MKS LCD12864B
  275. // If using MKS LCD12864A (Need to remove RPK2 resistor)
  276. #define LCD_BACKLIGHT_PIN -1
  277. #define LCD_RESET_PIN -1
  278. #define DOGLCD_A0 PD11
  279. #define DOGLCD_CS PE15
  280. #define DOGLCD_SCK PA5
  281. #define DOGLCD_MOSI PA7
  282. #elif IS_TFTGLCD_PANEL
  283. #if ENABLED(TFTGLCD_PANEL_SPI)
  284. #define PIN_SPI_SCK PA5
  285. #define PIN_TFT_MISO PA6
  286. #define PIN_TFT_MOSI PA7
  287. #define TFTGLCD_CS PE8
  288. #endif
  289. #ifndef BEEPER_PIN
  290. #define BEEPER_PIN -1
  291. #endif
  292. #else // !MKS_MINI_12864
  293. #define LCD_PINS_D4 PE14
  294. #if ENABLED(ULTIPANEL)
  295. #define LCD_PINS_D5 PE15
  296. #define LCD_PINS_D6 PD11
  297. #define LCD_PINS_D7 PD10
  298. #endif
  299. #ifndef BOARD_ST7920_DELAY_1
  300. #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
  301. #endif
  302. #ifndef BOARD_ST7920_DELAY_2
  303. #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
  304. #endif
  305. #ifndef BOARD_ST7920_DELAY_3
  306. #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
  307. #endif
  308. #endif // !MKS_MINI_12864
  309. #endif // HAS_WIRED_LCD && !HAS_SPI_TFT
  310. #define HAS_SPI_FLASH 1
  311. #if HAS_SPI_FLASH
  312. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  313. #define W25QXX_CS_PIN PB12
  314. #define W25QXX_MOSI_PIN PB15
  315. #define W25QXX_MISO_PIN PB14
  316. #define W25QXX_SCK_PIN PB13
  317. #endif
  318. #ifndef BEEPER_PIN
  319. #define BEEPER_PIN PC5
  320. #endif
  321. #if ENABLED(SPEAKER) && BEEPER_PIN == PC5
  322. #error "MKS Robin nano default BEEPER_PIN is not a SPEAKER."
  323. #endif