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_BTT_OCTOPUS_V1_common.h 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 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. #include "env_validate.h"
  24. // Onboard I2C EEPROM
  25. #define I2C_EEPROM
  26. #define MARLIN_EEPROM_SIZE 0x8000 // 32KB (24C32A)
  27. #define I2C_SCL_PIN PB8
  28. #define I2C_SDA_PIN PB9
  29. // USB Flash Drive support
  30. #define HAS_OTG_USB_HOST_SUPPORT
  31. // Avoid conflict with TIMER_TONE
  32. #define STEP_TIMER 10
  33. //
  34. // Servos
  35. #define SERVO0_PIN PB6
  36. //
  37. // Misc. Functions
  38. //
  39. #define LED_PIN PA13
  40. //
  41. // Trinamic Stallguard pins
  42. //
  43. #define X_DIAG_PIN PG6 // X-STOP
  44. #define Y_DIAG_PIN PG9 // Y-STOP
  45. #define Z_DIAG_PIN PG10 // Z-STOP
  46. #define Z2_DIAG_PIN PG11 // Z2-STOP
  47. #define E0_DIAG_PIN PG12 // E0DET
  48. #define E1_DIAG_PIN PG13 // E1DET
  49. #define E2_DIAG_PIN PG14 // E2DET
  50. #define E3_DIAG_PIN PG15 // E3DET
  51. // Z Probe (when not Z_MIN_PIN)
  52. //
  53. #ifndef Z_MIN_PROBE_PIN
  54. #define Z_MIN_PROBE_PIN PB7
  55. #endif
  56. //
  57. // Limit Switches
  58. //
  59. #ifdef X_STALL_SENSITIVITY
  60. #define X_STOP_PIN X_DIAG_PIN
  61. #if X_HOME_TO_MIN
  62. #define X_MAX_PIN E0_DIAG_PIN // E0DET
  63. #else
  64. #define X_MIN_PIN E0_DIAG_PIN // E0DET
  65. #endif
  66. #elif EITHER(X_DUAL_ENDSTOPS, DUAL_X_CARRIAGE)
  67. #ifndef X_MIN_PIN
  68. #define X_MIN_PIN X_DIAG_PIN // X-STOP
  69. #endif
  70. #ifndef X_MAX_PIN
  71. #define X_MAX_PIN E0_DIAG_PIN // E0DET
  72. #endif
  73. #else
  74. #define X_STOP_PIN X_DIAG_PIN // X-STOP
  75. #endif
  76. #ifdef Y_STALL_SENSITIVITY
  77. #define Y_STOP_PIN Y_DIAG_PIN
  78. #if Y_HOME_TO_MIN
  79. #define Y_MAX_PIN E1_DIAG_PIN // E1DET
  80. #else
  81. #define Y_MIN_PIN E1_DIAG_PIN // E1DET
  82. #endif
  83. #elif ENABLED(Y_DUAL_ENDSTOPS)
  84. #ifndef Y_MIN_PIN
  85. #define Y_MIN_PIN Y_DIAG_PIN // Y-STOP
  86. #endif
  87. #ifndef Y_MAX_PIN
  88. #define Y_MAX_PIN E1_DIAG_PIN // E1DET
  89. #endif
  90. #else
  91. #define Y_STOP_PIN Y_DIAG_PIN // Y-STOP
  92. #endif
  93. #ifdef Z_STALL_SENSITIVITY
  94. #define Z_STOP_PIN Z_DIAG_PIN
  95. #if Z_HOME_TO_MIN
  96. #define Z_MAX_PIN E2_DIAG_PIN // PWRDET
  97. #else
  98. #define Z_MIN_PIN E2_DIAG_PIN // PWRDET
  99. #endif
  100. #elif ENABLED(Z_MULTI_ENDSTOPS)
  101. #ifndef Z_MIN_PIN
  102. #define Z_MIN_PIN Z_DIAG_PIN // Z-STOP
  103. #endif
  104. #ifndef Z_MAX_PIN
  105. #define Z_MAX_PIN E2_DIAG_PIN // PWRDET
  106. #endif
  107. #else
  108. #define Z_STOP_PIN Z_DIAG_PIN // Z-STOP
  109. #endif
  110. //
  111. // Filament Runout Sensor
  112. //
  113. #define FIL_RUNOUT_PIN PG12 // E0DET
  114. #define FIL_RUNOUT2_PIN PG13 // E1DET
  115. #define FIL_RUNOUT3_PIN PG14 // E2DET
  116. #define FIL_RUNOUT4_PIN PG15 // E3DET
  117. //
  118. // Power Supply Control
  119. //
  120. #ifndef PS_ON_PIN
  121. #define PS_ON_PIN PE11 // PS-ON
  122. #endif
  123. //
  124. // Power Loss Detection
  125. //
  126. #ifndef POWER_LOSS_PIN
  127. #define POWER_LOSS_PIN PC0 // PWRDET
  128. #endif
  129. //
  130. // NeoPixel LED
  131. //
  132. #ifndef NEOPIXEL_PIN
  133. #define NEOPIXEL_PIN PB0
  134. #endif
  135. //
  136. // Steppers
  137. //
  138. #define X_STEP_PIN PF13 // MOTOR 0
  139. #define X_DIR_PIN PF12
  140. #define X_ENABLE_PIN PF14
  141. #ifndef X_CS_PIN
  142. #define X_CS_PIN PC4
  143. #endif
  144. #define Y_STEP_PIN PG0 // MOTOR 1
  145. #define Y_DIR_PIN PG1
  146. #define Y_ENABLE_PIN PF15
  147. #ifndef Y_CS_PIN
  148. #define Y_CS_PIN PD11
  149. #endif
  150. #define Z_STEP_PIN PF11 // MOTOR 2
  151. #define Z_DIR_PIN PG3
  152. #define Z_ENABLE_PIN PG5
  153. #ifndef Z_CS_PIN
  154. #define Z_CS_PIN PC6
  155. #endif
  156. #define Z2_STEP_PIN PG4 // MOTOR 3
  157. #define Z2_DIR_PIN PC1
  158. #define Z2_ENABLE_PIN PA0
  159. #ifndef Z2_CS_PIN
  160. #define Z2_CS_PIN PC7
  161. #endif
  162. #define E0_STEP_PIN PF9 // MOTOR 4
  163. #define E0_DIR_PIN PF10
  164. #define E0_ENABLE_PIN PG2
  165. #ifndef E0_CS_PIN
  166. #define E0_CS_PIN PF2
  167. #endif
  168. #define E1_STEP_PIN PC13 // MOTOR 5
  169. #define E1_DIR_PIN PF0
  170. #define E1_ENABLE_PIN PF1
  171. #ifndef E1_CS_PIN
  172. #define E1_CS_PIN PE4
  173. #endif
  174. #define E2_STEP_PIN PE2 // MOTOR 6
  175. #define E2_DIR_PIN PE3
  176. #define E2_ENABLE_PIN PD4
  177. #ifndef E2_CS_PIN
  178. #define E2_CS_PIN PE1
  179. #endif
  180. #define E3_STEP_PIN PE6 // MOTOR 7
  181. #define E3_DIR_PIN PA14
  182. #define E3_ENABLE_PIN PE0
  183. #ifndef E3_CS_PIN
  184. #define E3_CS_PIN PD3
  185. #endif
  186. //
  187. // Temperature Sensors
  188. //
  189. #define TEMP_BED_PIN PF3 // TB
  190. #if TEMP_SENSOR_0 == 20
  191. #define TEMP_0_PIN PF8 // PT100 Connector
  192. #else
  193. #define TEMP_0_PIN PF4 // TH0
  194. #endif
  195. #define TEMP_1_PIN PF5 // TH1
  196. #define TEMP_2_PIN PF6 // TH2
  197. #define TEMP_3_PIN PF7 // TH3
  198. //
  199. // Heaters / Fans
  200. //
  201. #define HEATER_BED_PIN PA1 // Hotbed
  202. #define HEATER_0_PIN PA2 // Heater0
  203. #define HEATER_1_PIN PA3 // Heater1
  204. #define HEATER_2_PIN PB10 // Heater2
  205. #define HEATER_3_PIN PB11 // Heater3
  206. #define FAN_PIN PA8 // Fan0
  207. #define FAN1_PIN PE5 // Fan1
  208. #define FAN2_PIN PD12 // Fan2
  209. #define FAN3_PIN PD13 // Fan3
  210. #define FAN4_PIN PD14 // Fan4
  211. #define FAN5_PIN PD15 // Fan5
  212. //
  213. // SD Support
  214. //
  215. #ifndef SDCARD_CONNECTION
  216. #if HAS_WIRED_LCD
  217. #define SDCARD_CONNECTION LCD
  218. #else
  219. #define SDCARD_CONNECTION ONBOARD
  220. #endif
  221. #endif
  222. //
  223. // Software SPI pins for TMC2130 stepper drivers
  224. //
  225. #if ENABLED(TMC_USE_SW_SPI)
  226. #ifndef TMC_SW_MOSI
  227. #define TMC_SW_MOSI PA7
  228. #endif
  229. #ifndef TMC_SW_MISO
  230. #define TMC_SW_MISO PA6
  231. #endif
  232. #ifndef TMC_SW_SCK
  233. #define TMC_SW_SCK PA5
  234. #endif
  235. #endif
  236. #if HAS_TMC_UART
  237. /**
  238. * TMC2208/TMC2209 stepper drivers
  239. *
  240. * Hardware serial communication ports.
  241. * If undefined software serial is used according to the pins below
  242. */
  243. //#define X_HARDWARE_SERIAL Serial1
  244. //#define X2_HARDWARE_SERIAL Serial1
  245. //#define Y_HARDWARE_SERIAL Serial1
  246. //#define Y2_HARDWARE_SERIAL Serial1
  247. //#define Z_HARDWARE_SERIAL Serial1
  248. //#define Z2_HARDWARE_SERIAL Serial1
  249. //#define E0_HARDWARE_SERIAL Serial1
  250. //#define E1_HARDWARE_SERIAL Serial1
  251. //#define E2_HARDWARE_SERIAL Serial1
  252. //#define E3_HARDWARE_SERIAL Serial1
  253. //#define E4_HARDWARE_SERIAL Serial1
  254. #define X_SERIAL_TX_PIN PC4
  255. #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
  256. #define Y_SERIAL_TX_PIN PD11
  257. #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
  258. #define Z_SERIAL_TX_PIN PC6
  259. #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
  260. #define Z2_SERIAL_TX_PIN PC7
  261. #define Z2_SERIAL_RX_PIN Z2_SERIAL_TX_PIN
  262. #define E0_SERIAL_TX_PIN PF2
  263. #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN
  264. #define E1_SERIAL_TX_PIN PE4
  265. #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN
  266. #define E2_SERIAL_TX_PIN PE1
  267. #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN
  268. #define E3_SERIAL_TX_PIN PD3
  269. #define E3_SERIAL_RX_PIN E3_SERIAL_TX_PIN
  270. // Reduce baud rate to improve software serial reliability
  271. #define TMC_BAUD_RATE 19200
  272. #endif
  273. /** ------ ------
  274. * (BEEPER) PE8 |10 9 | PE7 (BTN_ENC) (MISO) PA6 |10 9 | PA5 (SCK)
  275. * (LCD_EN) PE9 | 8 7 | PE10 (LCD_RS) (BTN_EN1) PB2 | 8 7 | PA4 (SD_SS)
  276. * (LCD_D4) PE12 6 5 | PE13 (LCD_D5) (BTN_EN2) PB1 6 5 | PA7 (MOSI)
  277. * (LCD_D6) PE14 | 4 3 | PE15 (LCD_D7) (SD_DETECT) PC15 | 4 3 | RESET
  278. * GND | 2 1 | 5V GND | 2 1 | NC
  279. * ------ ------
  280. * EXP1 EXP2
  281. */
  282. #define EXP1_03_PIN PE15
  283. #define EXP1_04_PIN PE14
  284. #define EXP1_05_PIN PE13
  285. #define EXP1_06_PIN PE12
  286. #define EXP1_07_PIN PE10
  287. #define EXP1_08_PIN PE9
  288. #define EXP1_09_PIN PE7
  289. #define EXP1_10_PIN PE8
  290. #define EXP2_03_PIN -1
  291. #define EXP2_04_PIN PC15
  292. #define EXP2_05_PIN PA7
  293. #define EXP2_06_PIN PB2
  294. #define EXP2_07_PIN PA4
  295. #define EXP2_08_PIN PB1
  296. #define EXP2_09_PIN PA5
  297. #define EXP2_10_PIN PA6
  298. //
  299. // Onboard SD card
  300. // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
  301. //
  302. #if SD_CONNECTION_IS(ONBOARD)
  303. #define SDIO_SUPPORT // Use SDIO for onboard SD
  304. #ifndef SD_DETECT_STATE
  305. #define SD_DETECT_STATE HIGH
  306. #elif SD_DETECT_STATE == LOW
  307. #error "BOARD_BTT_OCTOPUS_V1_0 onboard SD requires SD_DETECT_STATE set to HIGH."
  308. #endif
  309. #define SD_DETECT_PIN PC14
  310. #elif SD_CONNECTION_IS(LCD)
  311. #define SDSS PA4
  312. #define SD_SS_PIN SDSS
  313. #define SD_SCK_PIN PA5
  314. #define SD_MISO_PIN PA6
  315. #define SD_MOSI_PIN PA7
  316. #define SD_DETECT_PIN PC15
  317. #elif SD_CONNECTION_IS(CUSTOM_CABLE)
  318. #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
  319. #endif
  320. #if ENABLED(BTT_MOTOR_EXPANSION)
  321. /**
  322. * ------ ------
  323. * NC | 1 2 | GND NC | 1 2 | GND
  324. * NC | 3 4 | M1EN M2EN | 3 4 | M3EN
  325. * M1STP | 5 6 M1DIR M1RX | 5 6 M1DIAG
  326. * M2DIR | 7 8 | M2STP M2RX | 7 8 | M2DIAG
  327. * M3DIR | 9 10 | M3STP M3RX | 9 10 | M3DIAG
  328. * ------ ------
  329. * EXP2 EXP1
  330. */
  331. // M1 on Driver Expansion Module
  332. #define E4_STEP_PIN EXP2_05_PIN
  333. #define E4_DIR_PIN EXP2_06_PIN
  334. #define E4_ENABLE_PIN EXP2_04_PIN
  335. #define E4_DIAG_PIN EXP1_06_PIN
  336. #define E4_CS_PIN EXP1_05_PIN
  337. #if HAS_TMC_UART
  338. #define E4_SERIAL_TX_PIN EXP1_05_PIN
  339. #define E4_SERIAL_RX_PIN E4_SERIAL_TX_PIN
  340. #endif
  341. // M2 on Driver Expansion Module
  342. #define E5_STEP_PIN EXP2_08_PIN
  343. #define E5_DIR_PIN EXP2_07_PIN
  344. #define E5_ENABLE_PIN EXP1_03_PIN
  345. #define E5_DIAG_PIN EXP1_08_PIN
  346. #define E5_CS_PIN EXP1_07_PIN
  347. #if HAS_TMC_UART
  348. #define E5_SERIAL_TX_PIN EXP1_07_PIN
  349. #define E5_SERIAL_RX_PIN E5_SERIAL_TX_PIN
  350. #endif
  351. // M3 on Driver Expansion Module
  352. #define E6_STEP_PIN EXP2_10_PIN
  353. #define E6_DIR_PIN EXP2_09_PIN
  354. #define E6_ENABLE_PIN EXP1_04_PIN
  355. #define E6_DIAG_PIN EXP1_10_PIN
  356. #define E6_CS_PIN EXP1_09_PIN
  357. #if HAS_TMC_UART
  358. #define E6_SERIAL_TX_PIN EXP1_09_PIN
  359. #define E6_SERIAL_RX_PIN E6_SERIAL_TX_PIN
  360. #endif
  361. #endif // BTT_MOTOR_EXPANSION
  362. //
  363. // LCDs and Controllers
  364. //
  365. #if IS_TFTGLCD_PANEL
  366. #if ENABLED(TFTGLCD_PANEL_SPI)
  367. #define TFTGLCD_CS EXP2_08_PIN
  368. #endif
  369. #elif HAS_WIRED_LCD
  370. #define BEEPER_PIN EXP1_10_PIN
  371. #define BTN_ENC EXP1_09_PIN
  372. #if ENABLED(CR10_STOCKDISPLAY)
  373. #define LCD_PINS_RS EXP1_04_PIN
  374. #define BTN_EN1 EXP1_08_PIN
  375. #define BTN_EN2 EXP1_06_PIN
  376. #define LCD_PINS_ENABLE EXP1_03_PIN
  377. #define LCD_PINS_D4 EXP1_05_PIN
  378. #else
  379. #define LCD_PINS_RS EXP1_07_PIN
  380. #define BTN_EN1 EXP2_08_PIN
  381. #define BTN_EN2 EXP2_06_PIN
  382. #define LCD_PINS_ENABLE EXP1_08_PIN
  383. #define LCD_PINS_D4 EXP1_06_PIN
  384. #if ENABLED(FYSETC_MINI_12864)
  385. #define DOGLCD_CS EXP1_08_PIN
  386. #define DOGLCD_A0 EXP1_07_PIN
  387. //#define LCD_BACKLIGHT_PIN -1
  388. #define LCD_RESET_PIN EXP1_06_PIN // Must be high or open for LCD to operate normally.
  389. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  390. #ifndef RGB_LED_R_PIN
  391. #define RGB_LED_R_PIN EXP1_05_PIN
  392. #endif
  393. #ifndef RGB_LED_G_PIN
  394. #define RGB_LED_G_PIN EXP1_04_PIN
  395. #endif
  396. #ifndef RGB_LED_B_PIN
  397. #define RGB_LED_B_PIN EXP1_03_PIN
  398. #endif
  399. #elif ENABLED(FYSETC_MINI_12864_2_1)
  400. #define NEOPIXEL_PIN EXP1_05_PIN
  401. #endif
  402. #endif // !FYSETC_MINI_12864
  403. #if IS_ULTIPANEL
  404. #define LCD_PINS_D5 EXP1_05_PIN
  405. #define LCD_PINS_D6 EXP1_04_PIN
  406. #define LCD_PINS_D7 EXP1_03_PIN
  407. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  408. #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
  409. #endif
  410. #endif
  411. #endif
  412. #endif // HAS_WIRED_LCD
  413. // Alter timing for graphical display
  414. #if IS_U8GLIB_ST7920
  415. #define BOARD_ST7920_DELAY_1 120
  416. #define BOARD_ST7920_DELAY_2 80
  417. #define BOARD_ST7920_DELAY_3 580
  418. #endif
  419. #if HAS_SPI_TFT
  420. #define TFT_CS_PIN EXP2_07_PIN
  421. #define TFT_A0_PIN EXP2_04_PIN
  422. #define TFT_SCK_PIN EXP2_09_PIN
  423. #define TFT_MISO_PIN EXP2_10_PIN
  424. #define TFT_MOSI_PIN EXP2_05_PIN
  425. #define TOUCH_INT_PIN EXP1_04_PIN
  426. #define TOUCH_MISO_PIN EXP1_05_PIN
  427. #define TOUCH_MOSI_PIN EXP1_08_PIN
  428. #define TOUCH_SCK_PIN EXP1_06_PIN
  429. #define TOUCH_CS_PIN EXP1_07_PIN
  430. #define BTN_EN1 EXP2_08_PIN
  431. #define BTN_EN2 EXP2_06_PIN
  432. #define BTN_ENC EXP1_09_PIN
  433. #endif
  434. //
  435. // WIFI
  436. //
  437. /**
  438. * -------
  439. * GND | 9 | | 8 | 3.3V
  440. * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI)
  441. * 3.3V | 11 | | 6 | PB14 (ESP-MISO)
  442. * (ESP-IO0) PD7 | 12 | | 5 | PB13 (ESP-CLK)
  443. * (ESP-IO4) PD10 | 13 | | 4 | NC
  444. * NC | 14 | | 3 | PE15 (ESP-EN)
  445. * (ESP-RX) PD8 | 15 | | 2 | NC
  446. * (ESP-TX) PD9 | 16 | | 1 | PE14 (ESP-RST)
  447. * -------
  448. * WIFI
  449. */
  450. #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this
  451. #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2
  452. #define ESP_WIFI_MODULE_RESET_PIN PG7
  453. #define ESP_WIFI_MODULE_ENABLE_PIN PG8
  454. #define ESP_WIFI_MODULE_GPIO0_PIN PD7
  455. #define ESP_WIFI_MODULE_GPIO4_PIN PD10