|
| 1 | +/** |
| 2 | + * Marlin 3D Printer Firmware |
| 3 | + * Copyright (c) 2023 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 | +#include "env_validate.h" |
| 25 | + |
| 26 | +//#define BOARD_CUSTOM_BUILD_FLAGS -DTONE_CHANNEL=4 -DTONE_TIMER=4 -DTIMER_TONE=4 |
| 27 | + |
| 28 | +#define USES_DIAG_JUMPERS |
| 29 | + |
| 30 | +// Ignore temp readings during development. |
| 31 | +//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 |
| 32 | + |
| 33 | +// |
| 34 | +// EEPROM |
| 35 | +// |
| 36 | +#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) |
| 37 | + #undef NO_EEPROM_SELECTED |
| 38 | + #ifndef FLASH_EEPROM_EMULATION |
| 39 | + #define FLASH_EEPROM_EMULATION |
| 40 | + #endif |
| 41 | + #define EEPROM_PAGE_SIZE (0x800UL) // 2K |
| 42 | + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) |
| 43 | + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE |
| 44 | +#endif |
| 45 | + |
| 46 | +// |
| 47 | +// Servos |
| 48 | +// |
| 49 | +#define SERVO0_PIN PB1 // PROBE |
| 50 | + |
| 51 | +// |
| 52 | +// Probe enable |
| 53 | +// |
| 54 | +#if ENABLED(PROBE_ENABLE_DISABLE) |
| 55 | + #ifndef PROBE_ENABLE_PIN |
| 56 | + #define PROBE_ENABLE_PIN SERVO0_PIN |
| 57 | + #endif |
| 58 | +#endif |
| 59 | + |
| 60 | +// |
| 61 | +// Trinamic Stallguard pins |
| 62 | +// |
| 63 | +#define X_DIAG_PIN PF3 // MIN1 |
| 64 | +#define Y_DIAG_PIN PF4 // MIN2 |
| 65 | +#define Z_DIAG_PIN PF5 // MIN3 |
| 66 | +#define Z2_DIAG_PIN PC0 // MIN4 |
| 67 | +#define E0_DIAG_PIN PC1 // MIN5 |
| 68 | +#define E1_DIAG_PIN PC2 // MIN6 |
| 69 | + |
| 70 | +// |
| 71 | +// Z Probe (when not Z_MIN_PIN) |
| 72 | +// |
| 73 | +#ifndef Z_MIN_PROBE_PIN |
| 74 | + #define Z_MIN_PROBE_PIN PB2 // PROBE |
| 75 | + //#define Z_MIN_PROBE_PIN PF6 // IND-PROBE (with adjustable voltage & pullup set via jumpers) |
| 76 | +#endif |
| 77 | + |
| 78 | +// |
| 79 | +// Check for additional used endstop pins |
| 80 | +// |
| 81 | +#if HAS_EXTRA_ENDSTOPS |
| 82 | + #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES |
| 83 | + #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) |
| 84 | + #define NEEDS_X_MINMAX 1 |
| 85 | + #endif |
| 86 | + #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) |
| 87 | + #define NEEDS_Y_MINMAX 1 |
| 88 | + #endif |
| 89 | + #undef _ENDSTOP_IS_ANY |
| 90 | +#endif |
| 91 | + |
| 92 | +// |
| 93 | +// Limit Switches |
| 94 | +// |
| 95 | +#ifdef X_STALL_SENSITIVITY |
| 96 | + #define X_STOP_PIN X_DIAG_PIN |
| 97 | + #if X_HOME_TO_MIN |
| 98 | + #define X_MAX_PIN E0_DIAG_PIN // MIN5 |
| 99 | + #else |
| 100 | + #define X_MIN_PIN E0_DIAG_PIN // MIN5 |
| 101 | + #endif |
| 102 | +#elif EITHER(DUAL_X_CARRIAGE, NEEDS_X_MINMAX) |
| 103 | + #ifndef X_MIN_PIN |
| 104 | + #define X_MIN_PIN X_DIAG_PIN // MIN1 |
| 105 | + #endif |
| 106 | + #ifndef X_MAX_PIN |
| 107 | + #define X_MAX_PIN E0_DIAG_PIN // MIN5 |
| 108 | + #endif |
| 109 | +#else |
| 110 | + #define X_STOP_PIN X_DIAG_PIN // MIN1 |
| 111 | +#endif |
| 112 | + |
| 113 | +#ifdef Y_STALL_SENSITIVITY |
| 114 | + #define Y_STOP_PIN Y_DIAG_PIN |
| 115 | + #if Y_HOME_TO_MIN |
| 116 | + #define Y_MAX_PIN E1_DIAG_PIN // MIN6 |
| 117 | + #else |
| 118 | + #define Y_MIN_PIN E1_DIAG_PIN // MIN6 |
| 119 | + #endif |
| 120 | +#elif NEEDS_Y_MINMAX |
| 121 | + #ifndef Y_MIN_PIN |
| 122 | + #define Y_MIN_PIN Y_DIAG_PIN // MIN2 |
| 123 | + #endif |
| 124 | + #ifndef Y_MAX_PIN |
| 125 | + #define Y_MAX_PIN E1_DIAG_PIN // MIN6 |
| 126 | + #endif |
| 127 | +#else |
| 128 | + #define Y_STOP_PIN Y_DIAG_PIN // MIN2 |
| 129 | +#endif |
| 130 | + |
| 131 | +#define Z_STOP_PIN Z_DIAG_PIN // MIN3 |
| 132 | + |
| 133 | +#undef NEEDS_X_MINMAX |
| 134 | +#undef NEEDS_Y_MINMAX |
| 135 | + |
| 136 | +// |
| 137 | +// Filament Runout Sensors |
| 138 | +// |
| 139 | +#define FIL_RUNOUT_PIN PC1 // MIN5 |
| 140 | +#define FIL_RUNOUT2_PIN PC2 // MIN6 |
| 141 | + |
| 142 | +#ifndef PS_ON_PIN |
| 143 | + #define PS_ON_PIN PC3 // PS-ON |
| 144 | +#endif |
| 145 | + |
| 146 | +// |
| 147 | +// Steppers |
| 148 | +// |
| 149 | +#define X_STEP_PIN PE2 // M1 |
| 150 | +#define X_DIR_PIN PB4 |
| 151 | +#define X_ENABLE_PIN PC11 |
| 152 | +#ifndef X_CS_PIN |
| 153 | + #define X_CS_PIN PC10 |
| 154 | +#endif |
| 155 | + |
| 156 | +#define Y_STEP_PIN PF12 // M2 |
| 157 | +#define Y_DIR_PIN PF11 |
| 158 | +#define Y_ENABLE_PIN PB3 |
| 159 | +#ifndef Y_CS_PIN |
| 160 | + #define Y_CS_PIN PF13 |
| 161 | +#endif |
| 162 | + |
| 163 | +#define Z_STEP_PIN PD7 // M3 |
| 164 | +#define Z_DIR_PIN PD6 |
| 165 | +#define Z_ENABLE_PIN PF10 |
| 166 | +#ifndef Z_CS_PIN |
| 167 | + #define Z_CS_PIN PF9 |
| 168 | +#endif |
| 169 | + |
| 170 | +#define Z2_STEP_PIN PD3 // M4 |
| 171 | +#define Z2_DIR_PIN PD2 |
| 172 | +#define Z2_ENABLE_PIN PD5 |
| 173 | +#ifndef Z2_CS_PIN |
| 174 | + #define Z2_CS_PIN PD4 |
| 175 | +#endif |
| 176 | + |
| 177 | +#define E0_STEP_PIN PC9 // M5 |
| 178 | +#define E0_DIR_PIN PC8 |
| 179 | +#define E0_ENABLE_PIN PD1 |
| 180 | +#ifndef E0_CS_PIN |
| 181 | + #define E0_CS_PIN PD0 |
| 182 | +#endif |
| 183 | + |
| 184 | +// |
| 185 | +// Software SPI pins for TMC2130 stepper drivers |
| 186 | +// |
| 187 | +#if ENABLED(TMC_USE_SW_SPI) |
| 188 | + #ifndef TMC_SW_MOSI |
| 189 | + #define TMC_SW_MOSI PA7 |
| 190 | + #endif |
| 191 | + #ifndef TMC_SW_MISO |
| 192 | + #define TMC_SW_MISO PA6 |
| 193 | + #endif |
| 194 | + #ifndef TMC_SW_SCK |
| 195 | + #define TMC_SW_SCK PA5 |
| 196 | + #endif |
| 197 | +#endif |
| 198 | + |
| 199 | +#if HAS_TMC_UART |
| 200 | + #define X_SERIAL_TX_PIN PC10 |
| 201 | + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN |
| 202 | + |
| 203 | + #define Y_SERIAL_TX_PIN PF13 |
| 204 | + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN |
| 205 | + |
| 206 | + #define Z_SERIAL_TX_PIN PF9 |
| 207 | + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN |
| 208 | + |
| 209 | + #define Z2_SERIAL_TX_PIN PD4 |
| 210 | + #define Z2_SERIAL_RX_PIN Z2_SERIAL_TX_PIN |
| 211 | + |
| 212 | + #define E0_SERIAL_TX_PIN PD0 |
| 213 | + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN |
| 214 | + |
| 215 | + // Reduce baud rate to improve software serial reliability |
| 216 | + #define TMC_BAUD_RATE 19200 |
| 217 | +#endif |
| 218 | + |
| 219 | +// |
| 220 | +// Temperature Sensors |
| 221 | +// |
| 222 | +#define TEMP_BED_PIN PA0 // TB |
| 223 | +#define TEMP_0_PIN PA1 // TH0 |
| 224 | +#define TEMP_1_PIN PA2 // TH1 |
| 225 | +#define TEMP_2_PIN PA3 // TH2 |
| 226 | +#define TEMP_3_PIN PA4 // TH3 |
| 227 | + |
| 228 | +// |
| 229 | +// Heaters / Fans |
| 230 | +// |
| 231 | +#define HEATER_BED_PIN PB7 // BED-OUT |
| 232 | +#define HEATER_0_PIN PE3 // HE0 |
| 233 | +#define HEATER_1_PIN PB5 // HE1 |
| 234 | +#define HEATER_2_PIN PB6 // HE2 |
| 235 | +#define HEATER_3_PIN PE1 // HE3 |
| 236 | + |
| 237 | +#define FAN_PIN PE6 // FAN0 |
| 238 | +#define FAN1_PIN PE0 // FAN1 |
| 239 | +#define FAN2_PIN PC12 // FAN2 |
| 240 | +#define FAN3_PIN PE5 // FAN3 |
| 241 | +#define FAN4_PIN PE4 // FAN4 |
| 242 | +#define FAN5_PIN PB8 // FAN5 |
| 243 | +#define FAN6_PIN PB9 // FAN6 |
| 244 | + |
| 245 | +// |
| 246 | +// SD Support |
| 247 | +// |
| 248 | +#ifndef SDCARD_CONNECTION |
| 249 | + #if HAS_WIRED_LCD |
| 250 | + #define SDCARD_CONNECTION LCD |
| 251 | + #else |
| 252 | + #define SDCARD_CONNECTION ONBOARD |
| 253 | + #endif |
| 254 | +#endif |
| 255 | + |
| 256 | +/** |
| 257 | + * ------ ------ |
| 258 | + * (BEEPER) PE9 | 1 2 | PE10 (BTN_ENC) (MISO) PB14 | 1 2 | PB13 (SCK) |
| 259 | + * (LCD_EN) PE11 | 3 4 | PE12 (LCD_RS) (BTN_EN1) PF7 | 3 4 | PB12 (SD_SS) |
| 260 | + * (LCD_D4) PE13 | 5 6 PE14 (LCD_D5) (BTN_EN2) PE7 | 5 6 PB11 (MOSI) |
| 261 | + * (LCD_D6) PE15 | 7 8 | PB10 (LCD_D7) (SD_DETECT) PE8 | 7 8 | RESET |
| 262 | + * GND | 9 10 | 5V GND | 9 10 | -- |
| 263 | + * ------ ------ |
| 264 | + * EXP1 EXP2 |
| 265 | + */ |
| 266 | +#define EXP1_01_PIN PE9 |
| 267 | +#define EXP1_02_PIN PE10 |
| 268 | +#define EXP1_03_PIN PE11 |
| 269 | +#define EXP1_04_PIN PE12 |
| 270 | +#define EXP1_05_PIN PE13 |
| 271 | +#define EXP1_06_PIN PE14 |
| 272 | +#define EXP1_07_PIN PE15 |
| 273 | +#define EXP1_08_PIN PB10 |
| 274 | + |
| 275 | +#define EXP2_01_PIN PB14 |
| 276 | +#define EXP2_02_PIN PB13 |
| 277 | +#define EXP2_03_PIN PF7 |
| 278 | +#define EXP2_04_PIN PB12 |
| 279 | +#define EXP2_05_PIN PE7 |
| 280 | +#define EXP2_06_PIN PB11 |
| 281 | +#define EXP2_07_PIN PE8 |
| 282 | +#define EXP2_08_PIN -1 |
| 283 | + |
| 284 | +// |
| 285 | +// Onboard SD card |
| 286 | +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 |
| 287 | +// |
| 288 | +#if SD_CONNECTION_IS(LCD) |
| 289 | + #define SDSS EXP2_04_PIN |
| 290 | + #define SD_SS_PIN SDSS |
| 291 | + #define SD_SCK_PIN EXP2_02_PIN |
| 292 | + #define SD_MISO_PIN EXP2_01_PIN |
| 293 | + #define SD_MOSI_PIN EXP2_06_PIN |
| 294 | + #define SD_DETECT_PIN EXP2_07_PIN |
| 295 | +#elif SD_CONNECTION_IS(ONBOARD) |
| 296 | + #define SD_DETECT_PIN PE8 |
| 297 | + #define SD_SCK_PIN PB13 |
| 298 | + #define SD_MISO_PIN PB14 |
| 299 | + #define SD_MOSI_PIN PB11 |
| 300 | + #define ONBOARD_SD_CS_PIN PB14 // Chip select for "System" SD card |
| 301 | + #define SD_SS_PIN ONBOARD_SD_CS_PIN |
| 302 | +#elif SD_CONNECTION_IS(CUSTOM_CABLE) |
| 303 | + #error "No custom SD drive cable defined for this board." |
| 304 | +#endif |
| 305 | + |
| 306 | +// |
| 307 | +// LCDs and Controllers |
| 308 | +// |
| 309 | +#if IS_TFTGLCD_PANEL |
| 310 | + |
| 311 | + #if ENABLED(TFTGLCD_PANEL_SPI) |
| 312 | + #define TFTGLCD_CS EXP2_03_PIN |
| 313 | + #endif |
| 314 | + |
| 315 | +#elif HAS_WIRED_LCD |
| 316 | + |
| 317 | + #define BEEPER_PIN EXP1_01_PIN |
| 318 | + #define BTN_ENC EXP1_02_PIN |
| 319 | + |
| 320 | + #if ENABLED(CR10_STOCKDISPLAY) |
| 321 | + |
| 322 | + #define LCD_PINS_RS EXP1_07_PIN |
| 323 | + |
| 324 | + #define BTN_EN1 EXP1_03_PIN |
| 325 | + #define BTN_EN2 EXP1_05_PIN |
| 326 | + |
| 327 | + #define LCD_PINS_ENABLE EXP1_08_PIN |
| 328 | + #define LCD_PINS_D4 EXP1_06_PIN |
| 329 | + |
| 330 | + #elif ENABLED(MKS_MINI_12864) |
| 331 | + |
| 332 | + #define DOGLCD_A0 EXP1_07_PIN |
| 333 | + #define DOGLCD_CS EXP1_06_PIN |
| 334 | + #define BTN_EN1 EXP2_03_PIN |
| 335 | + #define BTN_EN2 EXP2_05_PIN |
| 336 | + |
| 337 | + #else |
| 338 | + |
| 339 | + #define LCD_PINS_RS EXP1_04_PIN |
| 340 | + |
| 341 | + #define BTN_EN1 EXP2_03_PIN |
| 342 | + #define BTN_EN2 EXP2_05_PIN |
| 343 | + |
| 344 | + #define LCD_PINS_ENABLE EXP1_03_PIN |
| 345 | + #define LCD_PINS_D4 EXP1_05_PIN |
| 346 | + |
| 347 | + #if ENABLED(FYSETC_MINI_12864) |
| 348 | + #define DOGLCD_CS EXP1_03_PIN |
| 349 | + #define DOGLCD_A0 EXP1_04_PIN |
| 350 | + //#define LCD_BACKLIGHT_PIN -1 |
| 351 | + |
| 352 | + #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems |
| 353 | + // results in LCD soft SPI mode 3, SD soft SPI mode 0 |
| 354 | + |
| 355 | + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. |
| 356 | + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) |
| 357 | + #ifndef RGB_LED_R_PIN |
| 358 | + #define RGB_LED_R_PIN EXP1_06_PIN |
| 359 | + #endif |
| 360 | + #ifndef RGB_LED_G_PIN |
| 361 | + #define RGB_LED_G_PIN EXP1_07_PIN |
| 362 | + #endif |
| 363 | + #ifndef RGB_LED_B_PIN |
| 364 | + #define RGB_LED_B_PIN EXP1_08_PIN |
| 365 | + #endif |
| 366 | + #elif ENABLED(FYSETC_MINI_12864_2_1) |
| 367 | + #define NEOPIXEL_PIN EXP1_06_PIN |
| 368 | + #endif |
| 369 | + #endif // !FYSETC_MINI_12864 |
| 370 | + |
| 371 | + #if IS_ULTIPANEL |
| 372 | + #define LCD_PINS_D5 EXP1_06_PIN |
| 373 | + #define LCD_PINS_D6 EXP1_07_PIN |
| 374 | + #define LCD_PINS_D7 EXP1_08_PIN |
| 375 | + |
| 376 | + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) |
| 377 | + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder |
| 378 | + #endif |
| 379 | + |
| 380 | + #endif |
| 381 | + |
| 382 | + #endif |
| 383 | + |
| 384 | +#endif // HAS_WIRED_LCD |
| 385 | + |
| 386 | +// Alter timing for graphical display |
| 387 | +#if IS_U8GLIB_ST7920 |
| 388 | + #ifndef BOARD_ST7920_DELAY_1 |
| 389 | + #define BOARD_ST7920_DELAY_1 120 |
| 390 | + #endif |
| 391 | + #ifndef BOARD_ST7920_DELAY_2 |
| 392 | + #define BOARD_ST7920_DELAY_2 80 |
| 393 | + #endif |
| 394 | + #ifndef BOARD_ST7920_DELAY_3 |
| 395 | + #define BOARD_ST7920_DELAY_3 580 |
| 396 | + #endif |
| 397 | +#endif |
0 commit comments