My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

pins_MKS_ROBIN_NANO_V2.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. #ifndef __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. #endif
  31. #define BOARD_INFO_NAME "MKS Robin nano V2.0"
  32. //
  33. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  34. //
  35. #define DISABLE_DEBUG
  36. //
  37. // EEPROM
  38. //
  39. //#define FLASH_EEPROM_EMULATION
  40. //#define SDCARD_EEPROM_EMULATION
  41. #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
  42. #define I2C_EEPROM // EEPROM on I2C-0
  43. #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
  44. #endif
  45. //
  46. // Note: MKS Robin board is using SPI2 interface.
  47. //
  48. //#define SPI_MODULE 2
  49. #define ENABLE_SPI2
  50. //
  51. // Limit Switches
  52. //
  53. #define X_DIAG_PIN PA15
  54. #define Y_DIAG_PIN PA12
  55. #define Z_DIAG_PIN PA11
  56. #define E0_DIAG_PIN PC4
  57. #define E1_DIAG_PIN PE7
  58. #define X_STOP_PIN PA15
  59. #define Y_STOP_PIN PA12
  60. #define Z_MIN_PIN PA11
  61. #define Z_MAX_PIN PC4
  62. //
  63. // Steppers
  64. //
  65. #define X_ENABLE_PIN PE4
  66. #define X_STEP_PIN PE3
  67. #define X_DIR_PIN PE2
  68. #ifndef X_CS_PIN
  69. #define X_CS_PIN PD5
  70. #endif
  71. #define Y_ENABLE_PIN PE1
  72. #define Y_STEP_PIN PE0
  73. #define Y_DIR_PIN PB9
  74. #ifndef Y_CS_PIN
  75. #define Y_CS_PIN PD7
  76. #endif
  77. #define Z_ENABLE_PIN PB8
  78. #define Z_STEP_PIN PB5
  79. #define Z_DIR_PIN PB4
  80. #ifndef Z_CS_PIN
  81. #define Z_CS_PIN PD4
  82. #endif
  83. #define E0_ENABLE_PIN PB3
  84. #define E0_STEP_PIN PD6
  85. #define E0_DIR_PIN PD3
  86. #ifndef E0_CS_PIN
  87. #define E0_CS_PIN PD9
  88. #endif
  89. #define E1_ENABLE_PIN PA3
  90. #define E1_STEP_PIN PD15
  91. #define E1_DIR_PIN PA1
  92. #ifndef E1_CS_PIN
  93. #define E1_CS_PIN PD8
  94. #endif
  95. //
  96. // Software SPI pins for TMC2130 stepper drivers
  97. //
  98. #if ENABLED(TMC_USE_SW_SPI)
  99. #ifndef TMC_SW_MOSI
  100. #define TMC_SW_MOSI PD14
  101. #endif
  102. #ifndef TMC_SW_MISO
  103. #define TMC_SW_MISO PD1
  104. #endif
  105. #ifndef TMC_SW_SCK
  106. #define TMC_SW_SCK PD0
  107. #endif
  108. #endif
  109. #if HAS_TMC_UART
  110. /**
  111. * TMC2208/TMC2209 stepper drivers
  112. *
  113. * Hardware serial communication ports.
  114. * If undefined software serial is used according to the pins below
  115. */
  116. //#define X_HARDWARE_SERIAL Serial
  117. //#define X2_HARDWARE_SERIAL Serial1
  118. //#define Y_HARDWARE_SERIAL Serial1
  119. //#define Y2_HARDWARE_SERIAL Serial1
  120. //#define Z_HARDWARE_SERIAL Serial1
  121. //#define Z2_HARDWARE_SERIAL Serial1
  122. //#define E0_HARDWARE_SERIAL Serial1
  123. //#define E1_HARDWARE_SERIAL Serial1
  124. //#define E2_HARDWARE_SERIAL Serial1
  125. //#define E3_HARDWARE_SERIAL Serial1
  126. //#define E4_HARDWARE_SERIAL Serial1
  127. //
  128. // Software serial
  129. //
  130. #define X_SERIAL_TX_PIN PD5
  131. #define X_SERIAL_RX_PIN PD5
  132. #define Y_SERIAL_TX_PIN PD7
  133. #define Y_SERIAL_RX_PIN PD7
  134. #define Z_SERIAL_TX_PIN PD4
  135. #define Z_SERIAL_RX_PIN PD4
  136. #define E0_SERIAL_TX_PIN PD9
  137. #define E0_SERIAL_RX_PIN PD9
  138. #define E1_SERIAL_TX_PIN PD8
  139. #define E1_SERIAL_RX_PIN PD8
  140. // Reduce baud rate to improve software serial reliability
  141. #define TMC_BAUD_RATE 19200
  142. #endif // TMC2208 || TMC2209
  143. //
  144. // Temperature Sensors
  145. //
  146. #define TEMP_0_PIN PC1 // TH1
  147. #define TEMP_1_PIN PC2 // TH2
  148. #define TEMP_BED_PIN PC0 // TB1
  149. //
  150. // Heaters / Fans
  151. //
  152. #define HEATER_0_PIN PC3 // HEATER1
  153. #define HEATER_1_PIN PB0 // HEATER2
  154. #define HEATER_BED_PIN PA0 // HOT BED
  155. #define FAN_PIN PB1 // FAN
  156. //
  157. // Thermocouples
  158. //
  159. //#define MAX6675_SS_PIN PE5 // TC1 - CS1
  160. //#define MAX6675_SS_PIN PE6 // TC2 - CS2
  161. //
  162. // Misc. Functions
  163. //
  164. #define POWER_LOSS_PIN PA2 // PW_DET
  165. #define PS_ON_PIN PA3 // PW_OFF
  166. //#define SUICIDE_PIN PB2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
  167. //#define SUICIDE_PIN_INVERTING false
  168. //#define KILL_PIN PA2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
  169. //#define KILL_PIN_INVERTING true // Enable MKSPWC support ROBIN NANO v1.2 ONLY
  170. #define SERVO0_PIN PA8 // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
  171. //#define LED_PIN PB2
  172. #define MT_DET_1_PIN PA4
  173. #define MT_DET_2_PIN PE6
  174. #define MT_DET_PIN_INVERTING false
  175. #ifndef FIL_RUNOUT_PIN
  176. #define FIL_RUNOUT_PIN MT_DET_1_PIN
  177. #endif
  178. #ifndef FIL_RUNOUT2_PIN
  179. #define FIL_RUNOUT2_PIN MT_DET_2_PIN
  180. #endif
  181. #define WIFI_IO0_PIN PC13
  182. //
  183. // SD Card
  184. //
  185. #ifndef SDCARD_CONNECTION
  186. #define SDCARD_CONNECTION ONBOARD
  187. #endif
  188. #define SDIO_SUPPORT
  189. #define SDIO_CLOCK 4500000 // 4.5 MHz
  190. #define SD_DETECT_PIN PD12
  191. #define ONBOARD_SD_CS_PIN PC11
  192. //
  193. // LCD / Controller
  194. //
  195. #ifndef BEEPER_PIN
  196. #define BEEPER_PIN PC5
  197. #endif
  198. /**
  199. * Note: MKS Robin TFT screens use various TFT controllers.
  200. * If the screen stays white, disable 'LCD_RESET_PIN'
  201. * to let the bootloader init the screen.
  202. */
  203. #if ENABLED(TFT_LVGL_UI_SPI)
  204. #define SPI_TFT_CS_PIN PD11
  205. #define SPI_TFT_SCK_PIN PA5
  206. #define SPI_TFT_MISO_PIN PA6
  207. #define SPI_TFT_MOSI_PIN PA7
  208. #define SPI_TFT_DC_PIN PD10
  209. #define SPI_TFT_RST_PIN PC6
  210. #define LCD_BACKLIGHT_PIN PD13
  211. #define TOUCH_CS_PIN PE14 // SPI1_NSS
  212. #define TOUCH_SCK_PIN PA5 // SPI1_SCK
  213. #define TOUCH_MISO_PIN PA6 // SPI1_MISO
  214. #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
  215. #define BTN_EN1 PE8
  216. #define BTN_EN2 PE11
  217. #define BTN_ENC PE13
  218. #elif ENABLED(TFT_LITTLE_VGL_UI)
  219. #define FSMC_CS_PIN PD7 // NE4
  220. #define FSMC_RS_PIN PD11 // A0
  221. #define TOUCH_CS_PIN PA7 // SPI2_NSS
  222. #define TOUCH_SCK_PIN PB13 // SPI2_SCK
  223. #define TOUCH_MISO_PIN PB14 // SPI2_MISO
  224. #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
  225. #define LCD_BACKLIGHT_PIN PD13
  226. #endif
  227. #if HAS_SPI_LCD
  228. #if ENABLED(SPI_GRAPHICAL_TFT) // Emulated DOGM SPI
  229. #define SPI_TFT_CS_PIN PD11
  230. #define SPI_TFT_SCK_PIN PA5
  231. #define SPI_TFT_MISO_PIN PA6
  232. #define SPI_TFT_MOSI_PIN PA7
  233. #define SPI_TFT_DC_PIN PD10
  234. #define SPI_TFT_RST_PIN PC6
  235. #define LCD_BACKLIGHT_PIN PD13
  236. #define LCD_READ_ID 0xD3
  237. #define LCD_USE_DMA_SPI
  238. #define TOUCH_BUTTONS_HW_SPI
  239. #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
  240. //#define TOUCH_BUTTONS
  241. #if ENABLED(TOUCH_BUTTONS)
  242. #define TOUCH_CS_PIN PE14 // SPI1_NSS
  243. #define TOUCH_SCK_PIN PA5 // SPI1_SCK
  244. #define TOUCH_MISO_PIN PA6 // SPI1_MISO
  245. #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
  246. #ifndef XPT2046_X_CALIBRATION
  247. #define XPT2046_X_CALIBRATION -5481
  248. #endif
  249. #ifndef XPT2046_Y_CALIBRATION
  250. #define XPT2046_Y_CALIBRATION 4000
  251. #endif
  252. #ifndef XPT2046_X_OFFSET
  253. #define XPT2046_X_OFFSET 343
  254. #endif
  255. #ifndef XPT2046_Y_OFFSET
  256. #define XPT2046_Y_OFFSET 0
  257. #endif
  258. #endif
  259. #ifndef FSMC_UPSCALE
  260. #define FSMC_UPSCALE 3
  261. #endif
  262. #ifndef LCD_FULL_PIXEL_WIDTH
  263. #define LCD_FULL_PIXEL_WIDTH 480
  264. #endif
  265. #ifndef LCD_PIXEL_OFFSET_X
  266. #define LCD_PIXEL_OFFSET_X 48
  267. #endif
  268. #ifndef LCD_FULL_PIXEL_HEIGHT
  269. #define LCD_FULL_PIXEL_HEIGHT 320
  270. #endif
  271. #ifndef LCD_PIXEL_OFFSET_Y
  272. #define LCD_PIXEL_OFFSET_Y 32
  273. #endif
  274. #define BTN_ENC PE13
  275. #define BTN_EN1 PE8
  276. #define BTN_EN2 PE11
  277. #define LCD_PINS_ENABLE PD13
  278. #define LCD_PINS_RS PC6
  279. #elif ENABLED(MKS_MINI_12864)
  280. // MKS MINI12864 and MKS LCD12864B
  281. // If using MKS LCD12864A (Need to remove RPK2 resistor)
  282. #define LCD_BACKLIGHT_PIN -1
  283. #define LCD_RESET_PIN -1
  284. #define DOGLCD_A0 PD11
  285. #define DOGLCD_CS PE15
  286. #define DOGLCD_SCK PA5
  287. #define DOGLCD_MOSI PA7
  288. // Required for MKS_MINI_12864 with this board
  289. #define MKS_LCD12864B
  290. #undef SHOW_BOOTSCREEN
  291. #else // !MKS_MINI_12864
  292. #define LCD_PINS_D4 PE14
  293. #if ENABLED(ULTIPANEL)
  294. #define LCD_PINS_D5 PE15
  295. #define LCD_PINS_D6 PD11
  296. #define LCD_PINS_D7 PD10
  297. #endif
  298. #ifndef BOARD_ST7920_DELAY_1
  299. #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
  300. #endif
  301. #ifndef BOARD_ST7920_DELAY_2
  302. #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
  303. #endif
  304. #ifndef BOARD_ST7920_DELAY_3
  305. #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
  306. #endif
  307. #endif // !MKS_MINI_12864
  308. #endif // HAS_SPI_LCD
  309. #define SPI_FLASH
  310. #if ENABLED(SPI_FLASH)
  311. #define W25QXX_CS_PIN PB12
  312. #define W25QXX_MOSI_PIN PB15
  313. #define W25QXX_MISO_PIN PB14
  314. #define W25QXX_SCK_PIN PB13
  315. #endif
  316. #if ENABLED(SPEAKER) && BEEPER_PIN == PC5
  317. #error "MKS Robin nano default BEEPER_PIN is not a SPEAKER."
  318. #endif