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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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 // 4KB
  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. //
  101. // Heaters / Fans
  102. //
  103. #define HEATER_0_PIN PE5 // HEATER1
  104. #define HEATER_1_PIN PB0 // HEATER2
  105. #define HEATER_BED_PIN PA0 // HOT BED
  106. #define FAN_PIN PC14 // FAN
  107. #define FAN1_PIN PB1 // FAN1
  108. //
  109. // Thermocouples
  110. //
  111. //#define TEMP_0_CS_PIN HEATER_0_PIN // TC1 - CS1
  112. //#define TEMP_0_CS_PIN HEATER_1_PIN // TC2 - CS2
  113. //
  114. // Misc. Functions
  115. //
  116. #if HAS_TFT_LVGL_UI
  117. #define MT_DET_1_PIN PA4 // MT_DET
  118. #define MT_DET_2_PIN PE6
  119. #define MT_DET_PIN_STATE LOW
  120. #endif
  121. #ifndef FIL_RUNOUT_PIN
  122. #define FIL_RUNOUT_PIN PA4
  123. #endif
  124. #ifndef FIL_RUNOUT2_PIN
  125. #define FIL_RUNOUT2_PIN PE6
  126. #endif
  127. #ifndef POWER_LOSS_PIN
  128. #define POWER_LOSS_PIN PA13 // PW_DET
  129. #endif
  130. //#define SUICIDE_PIN PB2
  131. //#define LED_PIN PB2
  132. //#define KILL_PIN PA2
  133. //#define KILL_PIN_STATE LOW
  134. //
  135. // Power Supply Control
  136. //
  137. #if ENABLED(MKS_PWC)
  138. #if ENABLED(TFT_LVGL_UI)
  139. #if ENABLED(PSU_CONTROL)
  140. #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
  141. #endif
  142. #undef MKS_PWC
  143. #define SUICIDE_PIN PB2
  144. #define SUICIDE_PIN_STATE LOW
  145. #else
  146. #define PS_ON_PIN PB2 // PW_OFF
  147. #endif
  148. #define KILL_PIN PA13 // PW_DET
  149. #define KILL_PIN_STATE HIGH
  150. #endif
  151. // Random Info
  152. #define USB_SERIAL -1 // USB Serial
  153. #define WIFI_SERIAL 3 // USART3
  154. #define MKS_WIFI_MODULE_SERIAL 1 // USART1
  155. #define MKS_WIFI_MODULE_SPI 2 // SPI2
  156. #ifndef SDCARD_CONNECTION
  157. #define SDCARD_CONNECTION ONBOARD
  158. #endif
  159. // MKS WIFI MODULE
  160. #if ENABLED(MKS_WIFI_MODULE)
  161. #define WIFI_IO0_PIN PC13
  162. #define WIFI_IO1_PIN PC7
  163. #define WIFI_RESET_PIN PE9
  164. #endif
  165. // MKS TEST
  166. #if ENABLED(MKS_TEST)
  167. #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET
  168. #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
  169. #endif
  170. //
  171. // Onboard SD card
  172. //
  173. // detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled
  174. #if SD_CONNECTION_IS(ONBOARD)
  175. #define ENABLE_SPI3
  176. #define SD_SS_PIN -1
  177. #define SDSS PC9
  178. #define SD_SCK_PIN PC10
  179. #define SD_MISO_PIN PC11
  180. #define SD_MOSI_PIN PC12
  181. #define SD_DETECT_PIN PD12
  182. #endif
  183. #define SPI_FLASH
  184. #if ENABLED(SPI_FLASH)
  185. #define HAS_SPI_FLASH 1
  186. #define SPI_DEVICE 2
  187. #define SPI_FLASH_SIZE 0x1000000
  188. #define SPI_FLASH_CS_PIN PB12
  189. #define SPI_FLASH_MOSI_PIN PC3
  190. #define SPI_FLASH_MISO_PIN PC2
  191. #define SPI_FLASH_SCK_PIN PB13
  192. #endif
  193. /**
  194. * ------ ------
  195. * (BEEPER) PC5 |10 9 | PE13 (BTN_ENC) (SPI1 MISO) PA6 |10 9 | PA5 (SPI1 SCK)
  196. * (LCD_EN) PD13 | 8 7 | PC6 (LCD_RS) (BTN_EN1) PE8 | 8 7 | PE10 (SPI1 CS)
  197. * (LCD_D4) PE14 6 5 | PE15 (LCD_D5) (BTN_EN2) PE11 6 5 | PA7 (SPI1 MOSI)
  198. * (LCD_D6) PD11 | 4 3 | PD10 (LCD_D7) (SPI1_RS) PE12 | 4 3 | RESET
  199. * GND | 2 1 | 5V GND | 2 1 | 3.3V
  200. * ------ ------
  201. * EXP1 EXP2
  202. */
  203. #define EXP1_03_PIN PD10
  204. #define EXP1_04_PIN PD11
  205. #define EXP1_05_PIN PE15
  206. #define EXP1_06_PIN PE14
  207. #define EXP1_07_PIN PC6
  208. #define EXP1_08_PIN PD13
  209. #define EXP1_09_PIN PE13
  210. #define EXP1_10_PIN PC5
  211. #define EXP2_03_PIN -1 // RESET
  212. #define EXP2_04_PIN PE12
  213. #define EXP2_05_PIN PA7
  214. #define EXP2_06_PIN PE11
  215. #define EXP2_07_PIN PE10
  216. #define EXP2_08_PIN PE8
  217. #define EXP2_09_PIN PA5
  218. #define EXP2_10_PIN PA6
  219. //
  220. // SPI SD Card
  221. //
  222. #if SD_CONNECTION_IS(LCD)
  223. #define ENABLE_SPI1
  224. #define SDSS EXP2_07_PIN
  225. #define SD_SCK_PIN EXP2_09_PIN
  226. #define SD_MISO_PIN EXP2_10_PIN
  227. #define SD_MOSI_PIN EXP2_05_PIN
  228. #define SD_DETECT_PIN EXP2_04_PIN
  229. #endif
  230. //
  231. // LCD / Controller
  232. //
  233. #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI)
  234. #define TFT_CS_PIN EXP1_04_PIN
  235. #define TFT_SCK_PIN EXP2_09_PIN
  236. #define TFT_MISO_PIN EXP2_10_PIN
  237. #define TFT_MOSI_PIN EXP2_05_PIN
  238. #define TFT_DC_PIN EXP1_03_PIN
  239. #define TFT_RST_PIN EXP1_07_PIN
  240. #define TFT_A0_PIN TFT_DC_PIN
  241. #define TFT_RESET_PIN EXP1_07_PIN
  242. #define TFT_BACKLIGHT_PIN EXP1_08_PIN
  243. #define TOUCH_BUTTONS_HW_SPI
  244. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  245. #define LCD_BACKLIGHT_PIN EXP1_08_PIN
  246. #ifndef TFT_WIDTH
  247. #define TFT_WIDTH 480
  248. #endif
  249. #ifndef TFT_HEIGHT
  250. #define TFT_HEIGHT 320
  251. #endif
  252. #define TOUCH_CS_PIN EXP1_06_PIN // SPI1_NSS
  253. #define TOUCH_SCK_PIN EXP2_09_PIN // SPI1_SCK
  254. #define TOUCH_MISO_PIN EXP2_10_PIN // SPI1_MISO
  255. #define TOUCH_MOSI_PIN EXP2_05_PIN // SPI1_MOSI
  256. #define LCD_READ_ID 0xD3
  257. #define LCD_USE_DMA_SPI
  258. #define TFT_BUFFER_SIZE 14400
  259. #ifndef TOUCH_CALIBRATION_X
  260. #define TOUCH_CALIBRATION_X -17253
  261. #endif
  262. #ifndef TOUCH_CALIBRATION_Y
  263. #define TOUCH_CALIBRATION_Y 11579
  264. #endif
  265. #ifndef TOUCH_OFFSET_X
  266. #define TOUCH_OFFSET_X 514
  267. #endif
  268. #ifndef TOUCH_OFFSET_Y
  269. #define TOUCH_OFFSET_Y -24
  270. #endif
  271. #ifndef TOUCH_ORIENTATION
  272. #define TOUCH_ORIENTATION TOUCH_LANDSCAPE
  273. #endif
  274. #elif HAS_WIRED_LCD
  275. #define LCD_PINS_ENABLE EXP1_08_PIN
  276. #define LCD_PINS_RS EXP1_07_PIN
  277. #define LCD_BACKLIGHT_PIN -1
  278. // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
  279. #if ENABLED(MKS_MINI_12864)
  280. //#define LCD_BACKLIGHT_PIN -1
  281. //#define LCD_RESET_PIN -1
  282. #define DOGLCD_A0 EXP1_04_PIN
  283. #define DOGLCD_CS EXP1_05_PIN
  284. //#define DOGLCD_SCK EXP2_09_PIN
  285. //#define DOGLCD_MOSI EXP2_05_PIN
  286. // Required for MKS_MINI_12864 with this board
  287. //#define MKS_LCD12864B
  288. //#undef SHOW_BOOTSCREEN
  289. #elif ENABLED(FYSETC_MINI_12864_2_1)
  290. #define LCD_PINS_DC EXP1_07_PIN
  291. #define DOGLCD_CS EXP1_08_PIN
  292. #define DOGLCD_A0 LCD_PINS_DC
  293. #define LCD_BACKLIGHT_PIN -1
  294. #define LCD_RESET_PIN EXP1_06_PIN
  295. #define NEOPIXEL_PIN EXP1_05_PIN
  296. #define DOGLCD_MOSI EXP2_05_PIN
  297. #define DOGLCD_SCK EXP2_09_PIN
  298. #if SD_CONNECTION_IS(ONBOARD)
  299. #define FORCE_SOFT_SPI
  300. #endif
  301. //#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270
  302. #else // !MKS_MINI_12864
  303. #define LCD_PINS_D4 EXP1_06_PIN
  304. #if ENABLED(ULTIPANEL)
  305. #define LCD_PINS_D5 EXP1_05_PIN
  306. #define LCD_PINS_D6 EXP1_04_PIN
  307. #define LCD_PINS_D7 EXP1_03_PIN
  308. #endif
  309. #define BOARD_ST7920_DELAY_1 96
  310. #define BOARD_ST7920_DELAY_2 48
  311. #define BOARD_ST7920_DELAY_3 600
  312. #endif // !MKS_MINI_12864
  313. #endif // HAS_WIRED_LCD
  314. #if HAS_TFT_LVGL_UI
  315. #define USE_SPI_DMA_TC
  316. #endif
  317. #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI, HAS_WIRED_LCD)
  318. #define BEEPER_PIN EXP1_10_PIN
  319. #if DISABLED(USE_SPI_DMA_TC)
  320. #define BTN_EN1 EXP2_08_PIN
  321. #define BTN_EN2 EXP2_06_PIN
  322. #define BTN_ENC EXP1_09_PIN
  323. #endif
  324. #endif