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_FLSUN_HISPEED.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. * FLSUN HiSpeed V1 (STM32F103VET6) board pin assignments
  25. * FLSun Hispeed (clone MKS_Robin_miniV2) board.
  26. *
  27. * MKS Robin Mini USB uses UART3 (PB10-TX, PB11-RX)
  28. * #define SERIAL_PORT_2 3
  29. */
  30. #if NOT_TARGET(__STM32F1__, STM32F1xx)
  31. #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
  32. #elif HAS_MULTI_HOTEND || E_STEPPERS > 1
  33. #error "FLSUN HiSpeedV1 only supports 1 hotend / E stepper."
  34. #endif
  35. #define BOARD_INFO_NAME "FLSun HiSpeedV1"
  36. #define BOARD_WEBSITE_URL "github.com/Foxies-CSTL"
  37. #define BOARD_NO_NATIVE_USB
  38. // Avoid conflict with TIMER_SERVO when using the STM32 HAL
  39. #define TEMP_TIMER 5
  40. //
  41. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  42. //
  43. #define DISABLE_DEBUG
  44. //
  45. // EEPROM
  46. //
  47. #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
  48. #define 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 // 2K
  52. #endif
  53. //
  54. // SPI
  55. // Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface.
  56. //
  57. #define SD_SCK_PIN PB13 // SPI2
  58. #define SD_MISO_PIN PB14 // SPI2
  59. #define SD_MOSI_PIN PB15 // SPI2
  60. #define SPI_DEVICE 2
  61. // SPI Flash
  62. #define SPI_FLASH
  63. #if ENABLED(SPI_FLASH)
  64. // SPI 2
  65. #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select
  66. #define SPI_FLASH_MOSI_PIN PB15
  67. #define SPI_FLASH_MISO_PIN PB14
  68. #define SPI_FLASH_SCK_PIN PB13
  69. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  70. #endif
  71. //
  72. // Servos
  73. //
  74. //#define SERVO0_PIN PA8 // use IO0 to enable BLTOUCH support/remove Mks_Wifi
  75. //
  76. // Limit Switches
  77. //
  78. #define X_STOP_PIN PA15 // -X
  79. #define Y_STOP_PIN PA12 // -Y
  80. #define Z_MIN_PIN PA11 // -Z
  81. #define Z_MAX_PIN PC4 // +Z
  82. #ifndef FIL_RUNOUT_PIN
  83. #define FIL_RUNOUT_PIN PA4 // MT_DET
  84. #endif
  85. //
  86. // Steppers
  87. //
  88. #define X_ENABLE_PIN PE4 // X_EN
  89. #define X_STEP_PIN PE3 // X_STEP
  90. #define X_DIR_PIN PE2 // X_DIR
  91. #define Y_ENABLE_PIN PE1 // Y_EN
  92. #define Y_STEP_PIN PE0 // Y_STEP
  93. #define Y_DIR_PIN PB9 // Y_DIR
  94. #define Z_ENABLE_PIN PB8 // Z_EN
  95. #define Z_STEP_PIN PB5 // Z_STEP
  96. #define Z_DIR_PIN PB4 // Z_DIR
  97. #define E0_ENABLE_PIN PB3 // E0_EN
  98. #define E0_STEP_PIN PD6 // E0_STEP
  99. #define E0_DIR_PIN PD3 // E0_DIR
  100. /**
  101. * FLSUN Hi-Speed has no hard-wired UART pins for TMC drivers.
  102. * Several wiring options are provided below, defaulting to
  103. * to the most compatible.
  104. */
  105. #if HAS_TMC_UART
  106. // SoftwareSerial with one pin per driver
  107. // Compatible with TMC2208 and TMC2209 drivers
  108. #define X_SERIAL_TX_PIN PA10 // RXD1
  109. #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
  110. #define Y_SERIAL_TX_PIN PA9 // TXD1
  111. #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
  112. #define Z_SERIAL_TX_PIN PC7 // IO1
  113. #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
  114. #define TMC_BAUD_RATE 19200
  115. #else
  116. // Motor current PWM pins
  117. #define MOTOR_CURRENT_PWM_XY_PIN PA6 // VREF2/3 CONTROL XY
  118. #define MOTOR_CURRENT_PWM_Z_PIN PA7 // VREF4 CONTROL Z
  119. #define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
  120. #ifndef DEFAULT_PWM_MOTOR_CURRENT
  121. #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 }
  122. #endif
  123. /**
  124. * MKS Robin_Wifi or another ESP8266 module
  125. *
  126. * __ESP(M1)__ -J1-
  127. * GND| 15 | | 08 |+3v3 (22) RXD1 (PA10)
  128. * | 16 | | 07 |MOSI (21) TXD1 (PA9) Active LOW, probably OK to leave floating
  129. * IO2| 17 | | 06 |MISO (19) IO1 (PC7) Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating)
  130. * IO0| 18 | | 05 |CLK (18) IO0 (PA8) Must be HIGH (ESP3D software configures this with a pullup so OK to leave as floating)
  131. * IO1| 19 | | 03 |EN (03) WIFI_EN Must be HIGH for module to run
  132. * | nc | | nc | (01) WIFI_CTRL (PA5)
  133. * RX| 21 | | nc |
  134. * TX| 22 | | 01 |RST
  135. *  ̄ ̄ AE ̄ ̄
  136. */
  137. // Module ESP-WIFI
  138. #define ESP_WIFI_MODULE_COM 2 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this
  139. #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2
  140. #define ESP_WIFI_MODULE_RESET_PIN PA5 // WIFI CTRL/RST
  141. #define ESP_WIFI_MODULE_ENABLE_PIN -1
  142. #define ESP_WIFI_MODULE_TXD_PIN PA9 // MKS or ESP WIFI RX PIN
  143. #define ESP_WIFI_MODULE_RXD_PIN PA10 // MKS or ESP WIFI TX PIN
  144. #endif
  145. //
  146. // EXTRUDER
  147. //
  148. #if AXIS_DRIVER_TYPE_E0(TMC2208) || AXIS_DRIVER_TYPE_E0(TMC2209)
  149. #define E0_SERIAL_TX_PIN PA8 // IO0
  150. #define E0_SERIAL_RX_PIN PA8 // IO0
  151. #define TMC_BAUD_RATE 19200
  152. #else
  153. // Motor current PWM pins
  154. #define MOTOR_CURRENT_PWM_E_PIN PB0 // VREF1 CONTROL E
  155. #define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
  156. #ifndef DEFAULT_PWM_MOTOR_CURRENT
  157. #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 }
  158. #endif
  159. #endif
  160. //
  161. // Temperature Sensors (THM)
  162. //
  163. #define TEMP_0_PIN PC1 // TEMP_E0
  164. #define TEMP_BED_PIN PC0 // TEMP_BED
  165. //
  166. // Heaters / Fans
  167. //
  168. #define HEATER_0_PIN PC3 // HEATER_E0
  169. #define HEATER_BED_PIN PA0 // HEATER_BED-WKUP
  170. #define FAN_PIN PB1 // E_FAN
  171. //
  172. // Misc. Functions
  173. //
  174. #if ENABLED(BACKUP_POWER_SUPPLY)
  175. #define POWER_LOSS_PIN PA2 // PW_DET (UPS) MKSPWC
  176. #else
  177. //#define POWER_LOSS_PIN PA1 // PW_SO
  178. #endif
  179. /**
  180. * Connector J2
  181. * -------
  182. * DIO O|1 2|O 3v3
  183. * CSK O|3 5|O GND
  184. * RST O|5 6|O GND
  185. * -------
  186. */
  187. //#define SW_DIO PA13
  188. //#define SW_CLK PA14
  189. //#define SW_RST NRST // (14)
  190. //
  191. // Power Supply Control
  192. //
  193. #if ENABLED(PSU_CONTROL)
  194. #define KILL_PIN PA2 // PW_DET
  195. #define KILL_PIN_STATE HIGH
  196. //#define PS_ON_PIN PA3 // PW_CN /PW_OFF
  197. #endif
  198. #if HAS_TFT_LVGL_UI
  199. #define MT_DET_1_PIN PA4 // MT_DET
  200. #define MT_DET_2_PIN PE6
  201. #define MT_DET_PIN_STATE LOW
  202. #endif
  203. //
  204. // LED / NEOPixel
  205. //
  206. //#define LED_PIN PB2 // BOOT1
  207. #if ENABLED(NEOPIXEL_LED)
  208. #define LED_PWM PC7 // IO1
  209. #ifndef NEOPIXEL_PIN
  210. #define NEOPIXEL_PIN LED_PWM // USED WIFI IO0/IO1 PIN
  211. #endif
  212. #endif
  213. //
  214. // SD Card
  215. //
  216. #ifndef SDCARD_CONNECTION
  217. #define SDCARD_CONNECTION ONBOARD
  218. #endif
  219. // Use the on-board card socket labeled SD_Extender
  220. #if SD_CONNECTION_IS(CUSTOM_CABLE)
  221. #define SD_SCK_PIN PC12
  222. #define SD_MISO_PIN PC8
  223. #define SD_MOSI_PIN PD2
  224. #define SD_SS_PIN -1
  225. #define SD_DETECT_PIN PD12 // SD_CD (if -1 no detection)
  226. #else
  227. #define SDIO_SUPPORT
  228. #define SDIO_CLOCK 4500000 // 4.5 MHz
  229. #define SDIO_READ_RETRIES 16
  230. #define ONBOARD_SPI_DEVICE 1 // SPI1
  231. #define ONBOARD_SD_CS_PIN PC11
  232. #define SD_DETECT_PIN -1 // SD_CD (-1 active refresh)
  233. #endif
  234. //
  235. // LCD / Controller
  236. //
  237. #ifndef BEEPER_PIN
  238. #define BEEPER_PIN PC5
  239. #endif
  240. #if ENABLED(SPEAKER) && BEEPER_PIN == PC5
  241. #error "FLSun HiSpeed default BEEPER_PIN is not a SPEAKER."
  242. #endif
  243. //
  244. // TFT with FSMC interface
  245. //
  246. #if HAS_FSMC_TFT
  247. /**
  248. * Note: MKS Robin TFT screens use various TFT controllers
  249. * Supported screens are based on the ILI9341, ST7789V and ILI9328 (320x240)
  250. * ILI9488 is not supported
  251. * Define init sequences for other screens in u8g_dev_tft_320x240_upscale_from_128x64.cpp
  252. *
  253. * If the screen stays white, disable 'LCD_RESET_PIN'
  254. * to let the bootloader init the screen.
  255. *
  256. * Setting an 'LCD_RESET_PIN' may cause a flicker when entering the LCD menu
  257. * because Marlin uses the reset as a failsafe to revive a glitchy LCD.
  258. */
  259. //#define TFT_RESET_PIN PC6 // FSMC_RST
  260. #define TFT_BACKLIGHT_PIN PD13
  261. #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
  262. #define FSMC_DMA_DEV DMA2
  263. #define FSMC_DMA_CHANNEL DMA_CH5
  264. #define FSMC_CS_PIN PD7 // NE4
  265. #define FSMC_RS_PIN PD11 // A0
  266. #define TFT_CS_PIN FSMC_CS_PIN
  267. #define TFT_RS_PIN FSMC_RS_PIN
  268. #ifdef TFT_CLASSIC_UI
  269. #define TFT_MARLINBG_COLOR 0x3186 // Grey
  270. #define TFT_MARLINUI_COLOR 0xC7B6 // Green
  271. #define TFT_BTARROWS_COLOR 0xDEE6 // Yellow
  272. #define TFT_BTOKMENU_COLOR 0x145F // Cyan
  273. #endif
  274. #define TFT_BUFFER_SIZE 14400
  275. #elif HAS_GRAPHICAL_TFT
  276. #define TFT_RESET_PIN PC6
  277. #define TFT_BACKLIGHT_PIN PD13
  278. #define TFT_CS_PIN PD7 // NE4
  279. #define TFT_RS_PIN PD11 // A0
  280. #endif
  281. #if NEED_TOUCH_PINS
  282. #define TOUCH_CS_PIN PC2 // SPI2_NSS
  283. #define TOUCH_SCK_PIN PB13 // SPI2_SCK
  284. #define TOUCH_MISO_PIN PB14 // SPI2_MISO
  285. #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
  286. #define TOUCH_INT_PIN -1
  287. #endif