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.h 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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 (STM32F103ZET6) board pin assignments
  25. * https://github.com/makerbase-mks/MKS-Robin/tree/master/MKS%20Robin/Hardware
  26. */
  27. #if NOT_TARGET(STM32F1, STM32F1xx)
  28. #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
  29. #elif HOTENDS > 2 || E_STEPPERS > 2
  30. #error "MKS Robin supports up to 2 hotends / E steppers."
  31. #endif
  32. #define BOARD_INFO_NAME "MKS Robin"
  33. #define BOARD_NO_NATIVE_USB
  34. //
  35. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  36. //
  37. #define DISABLE_JTAG
  38. //
  39. // EEPROM
  40. //
  41. #if NO_EEPROM_SELECTED
  42. #ifdef ARDUINO_ARCH_STM32
  43. #define FLASH_EEPROM_EMULATION
  44. #else
  45. #define SDCARD_EEPROM_EMULATION
  46. #endif
  47. #endif
  48. #if ENABLED(FLASH_EEPROM_EMULATION)
  49. #define EEPROM_PAGE_SIZE (0x800U) // 2K
  50. #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
  51. #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE)
  52. #endif
  53. //
  54. // Servos
  55. //
  56. #define SERVO0_PIN PC3 // XS1 - 5
  57. #define SERVO1_PIN PA1 // XS1 - 6
  58. #define SERVO2_PIN PF9 // XS2 - 5
  59. #define SERVO3_PIN PF8 // XS2 - 6
  60. //
  61. // Limit Switches
  62. //
  63. #define X_MIN_PIN PB12
  64. #define X_MAX_PIN PB0
  65. #define Y_MIN_PIN PC5
  66. #define Y_MAX_PIN PC4
  67. #define Z_MIN_PIN PA4
  68. #define Z_MAX_PIN PF7
  69. //
  70. // Steppers
  71. //
  72. #define X_ENABLE_PIN PB9
  73. #define X_STEP_PIN PB8
  74. #define X_DIR_PIN PB5
  75. #define Y_ENABLE_PIN PB4
  76. #define Y_STEP_PIN PG15
  77. #define Y_DIR_PIN PG10
  78. #define Z_ENABLE_PIN PD7
  79. #define Z_STEP_PIN PD3
  80. #define Z_DIR_PIN PG14
  81. #define E0_ENABLE_PIN PG13
  82. #define E0_STEP_PIN PG8
  83. #define E0_DIR_PIN PA15
  84. #define E1_ENABLE_PIN PA12
  85. #define E1_STEP_PIN PA11
  86. #define E1_DIR_PIN PA8
  87. //
  88. // Temperature Sensors
  89. //
  90. #define TEMP_0_PIN PC1 // TH1
  91. #define TEMP_1_PIN PC2 // TH2
  92. #define TEMP_BED_PIN PC0 // TB1
  93. //
  94. // Heaters
  95. //
  96. #define HEATER_0_PIN PC7 // HEATER1
  97. #define HEATER_1_PIN PA6 // HEATER2
  98. #define HEATER_BED_PIN PC6 // HOT BED
  99. //
  100. // Fan
  101. //
  102. #define FAN_PIN PA7 // FAN
  103. //
  104. // Thermocouples
  105. //
  106. //#define TEMP_0_CS_PIN PE5 // TC1 - CS1
  107. //#define TEMP_0_CS_PIN PE6 // TC2 - CS2
  108. //
  109. // Filament Runout Sensor
  110. //
  111. #define FIL_RUNOUT_PIN PF11 // MT_DET
  112. //
  113. // Power loss detection
  114. //
  115. #define POWER_LOSS_PIN PA2 // PW_DET
  116. //
  117. // Power supply control
  118. //
  119. #define PS_ON_PIN PA3 // PW_OFF
  120. //
  121. // Piezzoelectric speaker
  122. //
  123. #define BEEPER_PIN PC13
  124. //
  125. // Activity LED
  126. //
  127. #define LED_PIN PB2
  128. //
  129. // ESP12-S Wi-Fi module
  130. //
  131. #define WIFI_IO0_PIN PG1
  132. //
  133. // TFT with FSMC interface
  134. //
  135. #if HAS_FSMC_TFT
  136. /**
  137. * Note: MKS Robin TFT screens use various TFT controllers
  138. * Supported screens are based on the ILI9341, ST7789V and ILI9328 (320x240)
  139. * ILI9488 is not supported
  140. * Define init sequences for other screens in u8g_dev_tft_320x240_upscale_from_128x64.cpp
  141. *
  142. * If the screen stays white, disable 'TFT_RESET_PIN'
  143. * to let the bootloader init the screen.
  144. *
  145. * Setting an 'TFT_RESET_PIN' may cause a flicker when entering the LCD menu
  146. * because Marlin uses the reset as a failsafe to revive a glitchy LCD.
  147. */
  148. #define TFT_RESET_PIN PF6
  149. #define TFT_BACKLIGHT_PIN PG11
  150. #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
  151. #define FSMC_CS_PIN PG12 // NE4
  152. #define FSMC_RS_PIN PF0 // A0
  153. #define FSMC_DMA_DEV DMA2
  154. #define FSMC_DMA_CHANNEL DMA_CH5
  155. #define TFT_CS_PIN FSMC_CS_PIN
  156. #define TFT_RS_PIN FSMC_RS_PIN
  157. #define TOUCH_BUTTONS_HW_SPI
  158. #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
  159. #define TFT_BUFFER_SIZE 14400
  160. #endif
  161. #if NEED_TOUCH_PINS
  162. #define TOUCH_CS_PIN PB1 // SPI2_NSS
  163. #define TOUCH_SCK_PIN PB13 // SPI2_SCK
  164. #define TOUCH_MISO_PIN PB14 // SPI2_MISO
  165. #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
  166. #define TOUCH_INT_PIN -1
  167. #endif
  168. // SPI2 is shared by LCD touch driver and flash
  169. // SPI1(PA7) & SPI3(PB5) not available
  170. #define SPI_DEVICE 2
  171. #define SDIO_SUPPORT
  172. #define SDIO_CLOCK 4500000
  173. #define SDIO_READ_RETRIES 16
  174. #if ENABLED(SDIO_SUPPORT)
  175. #define SD_SCK_PIN PB13 // SPI2
  176. #define SD_MISO_PIN PB14 // SPI2
  177. #define SD_MOSI_PIN PB15 // SPI2
  178. /**
  179. * MKS Robin has a few hardware revisions
  180. * https://github.com/makerbase-mks/MKS-Robin/tree/master/MKS%20Robin/Hardware
  181. *
  182. * MKS Robin <= V2.3 have no SD_DETECT_PIN.
  183. * MKS Robin >= V2.4 have SD_DETECT_PIN on PF12.
  184. *
  185. * Uncomment here or add SD_DETECT_PIN to Configuration.h.
  186. */
  187. //#define SD_DETECT_PIN -1
  188. //#define SD_DETECT_PIN PF12 // SD_CD
  189. #else
  190. // SD as custom software SPI (SDIO pins)
  191. #define SD_SCK_PIN PC12
  192. #define SD_MISO_PIN PC8
  193. #define SD_MOSI_PIN PD2
  194. #define SD_SS_PIN -1
  195. #define ONBOARD_SD_CS_PIN PC11
  196. #define SDSS PD2
  197. #define SD_DETECT_PIN -1
  198. #endif
  199. //
  200. // Trinamic TMC2208/2209 UART
  201. //
  202. #if HAS_TMC_UART
  203. /**
  204. * This board does not have dedicated TMC UART pins. Custom wiring is needed.
  205. * You may uncomment one of the options below, or add it to your Configuration.h.
  206. *
  207. * When using up to four TMC2209 drivers, hardware serial is recommended on
  208. * MSerial0 or MSerial1.
  209. *
  210. * When using TMC2208 or more than four drivers, SoftwareSerial will be needed,
  211. * to provide dedicated pins for each drier.
  212. */
  213. //#define TMC_HARDWARE_SERIAL
  214. #if ENABLED(TMC_HARDWARE_SERIAL)
  215. #define X_HARDWARE_SERIAL MSerial0
  216. #define X2_HARDWARE_SERIAL MSerial0
  217. #define Y_HARDWARE_SERIAL MSerial0
  218. #define Y2_HARDWARE_SERIAL MSerial0
  219. #define Z_HARDWARE_SERIAL MSerial0
  220. #define Z2_HARDWARE_SERIAL MSerial0
  221. #define E0_HARDWARE_SERIAL MSerial0
  222. #define E1_HARDWARE_SERIAL MSerial0
  223. #endif
  224. //#define TMC_SOFTWARE_SERIAL
  225. #if ENABLED(TMC_SOFTWARE_SERIAL)
  226. #define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6
  227. #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
  228. #define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN -- XS2 - 5
  229. #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
  230. #define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN -- XS1 - 6
  231. #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
  232. #define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN -- XS1 - 5
  233. #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN
  234. #define TMC_BAUD_RATE 19200
  235. #endif
  236. #endif
  237. //
  238. // W25Q64 64Mb (8MB) SPI flash
  239. //
  240. #define HAS_SPI_FLASH 1
  241. #if HAS_SPI_FLASH
  242. #define SPI_FLASH_SIZE 0x800000 // 8MB
  243. #define SPI_FLASH_CS_PIN PG9
  244. #define SPI_FLASH_MOSI_PIN PB15
  245. #define SPI_FLASH_MISO_PIN PB14
  246. #define SPI_FLASH_SCK_PIN PB13
  247. #endif