My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

pins_MKS_ROBIN_NANO_V3_common.h 12KB

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