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_CREALITY_V4.h 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. * Creality 4.2.x (STM32F103RE / STM32F103RC) board pin assignments
  25. */
  26. #include "env_validate.h"
  27. #if HAS_MULTI_HOTEND || E_STEPPERS > 1
  28. #error "Creality v4 only supports 1 hotend / E stepper."
  29. #endif
  30. #ifndef BOARD_INFO_NAME
  31. #define BOARD_INFO_NAME "Creality V4"
  32. #endif
  33. #ifndef DEFAULT_MACHINE_NAME
  34. #define DEFAULT_MACHINE_NAME "Ender 3 V2"
  35. #endif
  36. #define BOARD_NO_NATIVE_USB
  37. //
  38. // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
  39. //
  40. #ifndef DISABLE_DEBUG
  41. #define DISABLE_DEBUG
  42. #endif
  43. //
  44. // EEPROM
  45. //
  46. #if NO_EEPROM_SELECTED
  47. #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0
  48. //#define SDCARD_EEPROM_EMULATION
  49. #endif
  50. #if ENABLED(IIC_BL24CXX_EEPROM)
  51. #define IIC_EEPROM_SDA PA11
  52. #define IIC_EEPROM_SCL PA12
  53. #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16)
  54. #elif ENABLED(SDCARD_EEPROM_EMULATION)
  55. #define MARLIN_EEPROM_SIZE 0x800 // 2K
  56. #endif
  57. //
  58. // Servos
  59. //
  60. #ifndef SERVO0_PIN
  61. #ifndef HAS_PIN_27_BOARD
  62. #define SERVO0_PIN PB0 // BLTouch OUT
  63. #else
  64. #define SERVO0_PIN PC6
  65. #endif
  66. #endif
  67. //
  68. // Limit Switches
  69. //
  70. #ifndef X_STOP_PIN
  71. #define X_STOP_PIN PA5
  72. #endif
  73. #ifndef Y_STOP_PIN
  74. #define Y_STOP_PIN PA6
  75. #endif
  76. #ifndef Z_STOP_PIN
  77. #define Z_STOP_PIN PA7
  78. #endif
  79. #ifndef Z_MIN_PROBE_PIN
  80. #define Z_MIN_PROBE_PIN PB1 // BLTouch IN
  81. #endif
  82. //
  83. // Filament Runout Sensor
  84. //
  85. #ifndef FIL_RUNOUT_PIN
  86. #define FIL_RUNOUT_PIN PA4 // "Pulled-high"
  87. #endif
  88. //
  89. // Steppers
  90. //
  91. #ifndef X_STEP_PIN
  92. #define X_STEP_PIN PC2
  93. #endif
  94. #ifndef X_DIR_PIN
  95. #define X_DIR_PIN PB9
  96. #endif
  97. #define X_ENABLE_PIN PC3 // Shared
  98. #ifndef Y_STEP_PIN
  99. #define Y_STEP_PIN PB8
  100. #endif
  101. #ifndef Y_DIR_PIN
  102. #define Y_DIR_PIN PB7
  103. #endif
  104. #define Y_ENABLE_PIN X_ENABLE_PIN
  105. #ifndef Z_STEP_PIN
  106. #define Z_STEP_PIN PB6
  107. #endif
  108. #ifndef Z_DIR_PIN
  109. #define Z_DIR_PIN PB5
  110. #endif
  111. #define Z_ENABLE_PIN X_ENABLE_PIN
  112. #ifndef E0_STEP_PIN
  113. #define E0_STEP_PIN PB4
  114. #endif
  115. #ifndef E0_DIR_PIN
  116. #define E0_DIR_PIN PB3
  117. #endif
  118. #define E0_ENABLE_PIN X_ENABLE_PIN
  119. //
  120. // Temperature Sensors
  121. //
  122. #define TEMP_0_PIN PC5 // TH1
  123. #define TEMP_BED_PIN PC4 // TB1
  124. //
  125. // Heaters / Fans
  126. //
  127. #ifndef HEATER_0_PIN
  128. #define HEATER_0_PIN PA1 // HEATER1
  129. #endif
  130. #ifndef HEATER_BED_PIN
  131. #define HEATER_BED_PIN PA2 // HOT BED
  132. #endif
  133. #ifndef FAN_PIN
  134. #define FAN_PIN PA0 // FAN
  135. #endif
  136. #define FAN_SOFT_PWM_REQUIRED
  137. //
  138. // SD Card
  139. //
  140. #define SD_DETECT_PIN PC7
  141. #define SDCARD_CONNECTION ONBOARD
  142. #define SDIO_SUPPORT
  143. #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer
  144. #if ANY(RET6_12864_LCD, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)
  145. /**
  146. * RET6 12864 LCD
  147. * ------
  148. * PC6 | 1 2 | PB2
  149. * PB10 | 3 4 | PB11
  150. * PB14 5 6 | PB13
  151. * PB12 | 7 8 | PB15
  152. * GND | 9 10 | 5V
  153. * ------
  154. */
  155. #define EXP3_01_PIN PC6
  156. #define EXP3_02_PIN PB2
  157. #define EXP3_03_PIN PB10
  158. #define EXP3_04_PIN PB11
  159. #define EXP3_05_PIN PB14
  160. #define EXP3_06_PIN PB13
  161. #define EXP3_07_PIN PB12
  162. #define EXP3_08_PIN PB15
  163. #elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD)
  164. /**
  165. * VET6 12864 LCD
  166. * ------
  167. * ? | 1 2 | PC5
  168. * PB10 | 3 4 | ?
  169. * PA6 5 6 | PA5
  170. * PA4 | 7 8 | PA7
  171. * GND | 9 10 | 5V
  172. * ------
  173. */
  174. #define EXP3_01_PIN -1
  175. #define EXP3_02_PIN PC5
  176. #define EXP3_03_PIN PB10
  177. #define EXP3_04_PIN -1
  178. #define EXP3_05_PIN PA6
  179. #define EXP3_06_PIN PA5
  180. #define EXP3_07_PIN PA4
  181. #define EXP3_08_PIN PA7
  182. #elif EITHER(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1)
  183. #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for the LCD with the Creality V4 controller."
  184. #endif
  185. #if ENABLED(CR10_STOCKDISPLAY)
  186. #define LCD_PINS_RS EXP3_07_PIN
  187. #define LCD_PINS_ENABLE EXP3_08_PIN
  188. #define LCD_PINS_D4 EXP3_06_PIN
  189. #define BTN_ENC EXP3_02_PIN
  190. #define BTN_EN1 EXP3_03_PIN
  191. #define BTN_EN2 EXP3_05_PIN
  192. #ifndef HAS_PIN_27_BOARD
  193. #define BEEPER_PIN EXP3_01_PIN
  194. #endif
  195. #elif ANY(HAS_DWIN_E3V2, IS_DWIN_MARLINUI, DWIN_VET6_CREALITY_LCD)
  196. #define BTN_ENC EXP3_05_PIN
  197. #define BTN_EN1 EXP3_08_PIN
  198. #define BTN_EN2 EXP3_07_PIN
  199. #ifndef BEEPER_PIN
  200. #define BEEPER_PIN EXP3_06_PIN
  201. #endif
  202. #elif ENABLED(FYSETC_MINI_12864_2_1)
  203. #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
  204. #error "CAUTION! FYSETC_MINI_12864_2_1 and clones require wiring modifications. See 'pins_CREALITY_V4.h' for details. Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning."
  205. #endif
  206. #if SD_CONNECTION_IS(LCD)
  207. #error "The LCD SD Card is not connected with this configuration."
  208. #endif
  209. /**
  210. *
  211. * Board (RET6 12864 LCD) Display
  212. * ------ ------
  213. * (EN1) PC6 | 1 2 | PB2 (BTN_ENC) 5V |10 9 | GND
  214. * (LCD_CS) PB10 | 3 4 | PB11 (LCD RESET) -- | 8 7 | --
  215. * (LCD_A0) PB14 5 6 | PB13 (EN2) (DIN) | 6 5 (LCD RESET)
  216. * (LCD_SCK)PB12 | 7 8 | PB15 (MOSI) (LCD_A0) | 4 3 | (LCD_CS)
  217. * GND | 9 10 | 5V (BTN_ENC) | 2 1 | --
  218. * ------ ------
  219. * EXP1 EXP1
  220. *
  221. * ------
  222. * ----- -- |10 9 | --
  223. * | 1 | VCC (RESET) | 8 7 | --
  224. * | 2 | PA13 (DIN) (MOSI) | 6 5 (EN2)
  225. * | 3 | PA14 -- | 4 3 | (EN1)
  226. * | 4 | GND (LCD_SCK)| 2 1 | --
  227. * ----- ------
  228. * Debug port EXP2
  229. *
  230. * Needs custom cable. Connect EN2-EN2, LCD_CS-LCD_CS and so on.
  231. * Debug port is just above EXP1. You need to add pins.
  232. *
  233. */
  234. #define BTN_ENC EXP3_02_PIN
  235. #define BTN_EN1 EXP3_01_PIN
  236. #define BTN_EN2 EXP3_06_PIN
  237. #define BEEPER_PIN -1
  238. #define DOGLCD_CS EXP3_03_PIN
  239. #define DOGLCD_A0 EXP3_05_PIN
  240. #define DOGLCD_SCK EXP3_07_PIN
  241. #define DOGLCD_MOSI EXP3_08_PIN
  242. #define LCD_RESET_PIN EXP3_04_PIN
  243. #define FORCE_SOFT_SPI
  244. #define LCD_BACKLIGHT_PIN -1
  245. #define NEOPIXEL_PIN PA13
  246. #endif
  247. // Pins for documentation and sanity checks only.
  248. // Changing these will not change the pin they are on.
  249. // Hardware UART pins
  250. #define UART1_TX_PIN PA9 // default uses CH340 RX
  251. #define UART1_RX_PIN PA10 // default uses CH340 TX
  252. #define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN
  253. #define UART2_RX_PIN PA3 // not connected
  254. #define UART3_TX_PIN PB10 // default uses LCD connector
  255. #define UART3_RX_PIN PB11 // default uses LCD connector
  256. #define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2
  257. #define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3
  258. #define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK
  259. #define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD
  260. // SDIO pins
  261. #define SDIO_D0_PIN PC8
  262. #define SDIO_D1_PIN PC9
  263. #define SDIO_D2_PIN PC10
  264. #define SDIO_D3_PIN PC11
  265. #define SDIO_CK_PIN PC12
  266. #define SDIO_CMD_PIN PD2