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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. #if NOT_TARGET(STM32F1, STM32F1xx)
  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"
  32. //
  33. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  34. //
  35. #define DISABLE_JTAG
  36. //
  37. // EEPROM
  38. //
  39. #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
  40. #define FLASH_EEPROM_EMULATION
  41. #define EEPROM_PAGE_SIZE (0x800U) // 2KB
  42. #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
  43. #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
  44. #endif
  45. #define ENABLE_SPI2
  46. //
  47. // Limit Switches
  48. //
  49. #define X_STOP_PIN PA15
  50. #define Y_STOP_PIN PA12
  51. #define Z_MIN_PIN PA11
  52. #define Z_MAX_PIN PC4
  53. //
  54. // Steppers
  55. //
  56. #define X_ENABLE_PIN PE4
  57. #define X_STEP_PIN PE3
  58. #define X_DIR_PIN PE2
  59. #define Y_ENABLE_PIN PE1
  60. #define Y_STEP_PIN PE0
  61. #define Y_DIR_PIN PB9
  62. #define Z_ENABLE_PIN PB8
  63. #define Z_STEP_PIN PB5
  64. #define Z_DIR_PIN PB4
  65. #define E0_ENABLE_PIN PB3
  66. #define E0_STEP_PIN PD6
  67. #define E0_DIR_PIN PD3
  68. #define E1_ENABLE_PIN PA3
  69. #define E1_STEP_PIN PA6
  70. #define E1_DIR_PIN PA1
  71. //
  72. // Temperature Sensors
  73. //
  74. #define TEMP_0_PIN PC1 // TH1
  75. #define TEMP_1_PIN PC2 // TH2
  76. #define TEMP_BED_PIN PC0 // TB1
  77. //
  78. // Heaters / Fans
  79. //
  80. #ifndef HEATER_0_PIN
  81. #define HEATER_0_PIN PC3
  82. #endif
  83. #if HOTENDS == 1
  84. #ifndef FAN1_PIN
  85. #define FAN1_PIN PB0
  86. #endif
  87. #else
  88. #ifndef HEATER_1_PIN
  89. #define HEATER_1_PIN PB0
  90. #endif
  91. #endif
  92. #ifndef FAN_PIN
  93. #define FAN_PIN PB1 // FAN
  94. #endif
  95. #ifndef HEATER_BED_PIN
  96. #define HEATER_BED_PIN PA0
  97. #endif
  98. //
  99. // Thermocouples
  100. //
  101. //#define MAX6675_SS_PIN PE5 // TC1 - CS1
  102. //#define MAX6675_SS_PIN PE6 // TC2 - CS2
  103. //
  104. // Misc. Functions
  105. //
  106. #if HAS_TFT_LVGL_UI
  107. //#define MKSPWC
  108. #ifdef MKSPWC
  109. #define SUICIDE_PIN PB2 // Enable MKSPWC SUICIDE PIN
  110. #define SUICIDE_PIN_INVERTING false // Enable MKSPWC PIN STATE
  111. #define KILL_PIN PA2 // Enable MKSPWC DET PIN
  112. #define KILL_PIN_STATE true // Enable MKSPWC PIN STATE
  113. #endif
  114. #define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
  115. #define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
  116. #define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
  117. #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
  118. #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
  119. #define WIFI_RESET_PIN PA5 // MKS ESP WIFI RESET PIN
  120. #else
  121. //#define POWER_LOSS_PIN PA2 // PW_DET
  122. //#define PS_ON_PIN PB2 // PW_OFF
  123. #define FIL_RUNOUT_PIN PA4
  124. #define FIL_RUNOUT2_PIN PE6
  125. #endif
  126. #define SERVO0_PIN PA8 // Enable BLTOUCH support
  127. //#define LED_PIN PB2
  128. //
  129. // SD Card
  130. //
  131. #ifndef SDCARD_CONNECTION
  132. #define SDCARD_CONNECTION ONBOARD
  133. #endif
  134. #define SDIO_SUPPORT
  135. #define SDIO_CLOCK 4500000 // 4.5 MHz
  136. #define SD_DETECT_PIN PD12
  137. #define ONBOARD_SD_CS_PIN PC11
  138. //
  139. // LCD / Controller
  140. //
  141. #define BEEPER_PIN PC5
  142. /**
  143. * Note: MKS Robin TFT screens use various TFT controllers.
  144. * If the screen stays white, disable 'LCD_RESET_PIN'
  145. * to let the bootloader init the screen.
  146. */
  147. // Shared FSMC Configs
  148. #if HAS_FSMC_TFT
  149. #define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h
  150. #define DOGLCD_SCK -1
  151. #define FSMC_CS_PIN PD7 // NE4
  152. #define FSMC_RS_PIN PD11 // A0
  153. #define TOUCH_CS_PIN PA7 // SPI2_NSS
  154. #define TOUCH_SCK_PIN PB13 // SPI2_SCK
  155. #define TOUCH_MISO_PIN PB14 // SPI2_MISO
  156. #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
  157. #define TFT_RESET_PIN PC6 // FSMC_RST
  158. #define TFT_BACKLIGHT_PIN PD13
  159. #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
  160. #define FSMC_CS_PIN PD7
  161. #define FSMC_RS_PIN PD11
  162. #define FSMC_DMA_DEV DMA2
  163. #define FSMC_DMA_CHANNEL DMA_CH5
  164. #define TOUCH_BUTTONS_HW_SPI
  165. #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
  166. #define TFT_BUFFER_SIZE 14400
  167. #endif
  168. // XPT2046 Touch Screen calibration
  169. #if EITHER(TFT_LVGL_UI_FSMC, TFT_480x320)
  170. #ifndef XPT2046_X_CALIBRATION
  171. #define XPT2046_X_CALIBRATION 17880
  172. #endif
  173. #ifndef XPT2046_Y_CALIBRATION
  174. #define XPT2046_Y_CALIBRATION -12234
  175. #endif
  176. #ifndef XPT2046_X_OFFSET
  177. #define XPT2046_X_OFFSET -45
  178. #endif
  179. #ifndef XPT2046_Y_OFFSET
  180. #define XPT2046_Y_OFFSET 349
  181. #endif
  182. #elif ENABLED(TFT_CLASSIC_UI)
  183. #ifndef XPT2046_X_CALIBRATION
  184. #define XPT2046_X_CALIBRATION 12149
  185. #endif
  186. #ifndef XPT2046_Y_CALIBRATION
  187. #define XPT2046_Y_CALIBRATION -8746
  188. #endif
  189. #ifndef XPT2046_X_OFFSET
  190. #define XPT2046_X_OFFSET -35
  191. #endif
  192. #ifndef XPT2046_Y_OFFSET
  193. #define XPT2046_Y_OFFSET 256
  194. #endif
  195. #elif ENABLED(TFT_320x240)
  196. #ifndef XPT2046_X_CALIBRATION
  197. #define XPT2046_X_CALIBRATION -12246
  198. #endif
  199. #ifndef XPT2046_Y_CALIBRATION
  200. #define XPT2046_Y_CALIBRATION 9453
  201. #endif
  202. #ifndef XPT2046_X_OFFSET
  203. #define XPT2046_X_OFFSET 360
  204. #endif
  205. #ifndef XPT2046_Y_OFFSET
  206. #define XPT2046_Y_OFFSET -22
  207. #endif
  208. #endif
  209. #define HAS_SPI_FLASH 1
  210. #if HAS_SPI_FLASH
  211. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  212. #define W25QXX_CS_PIN PB12
  213. #define W25QXX_MOSI_PIN PB15
  214. #define W25QXX_MISO_PIN PB14
  215. #define W25QXX_SCK_PIN PB13
  216. #endif