From 2b63a1b4e1daafd8743735eea3152da5ee3551ab Mon Sep 17 00:00:00 2001 From: Minims Date: Sat, 14 Nov 2020 03:13:36 +0100 Subject: [PATCH] BTT Motor Expansion for SKR Pro (#20123) --- .../pins/stm32f4/pins_BTT_SKR_PRO_common.h | 150 +++++++++++++----- 1 file changed, 111 insertions(+), 39 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index 995fcb958..e1d28f34d 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -25,6 +25,13 @@ #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #endif +// BigTreeTech driver expansion module https://bit.ly/3ptRRoj +//#define BTT_MOTOR_EXPANSION + +#if BOTH(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #error "It's not possible to have both LCD and motor expansion module on EXP1/EXP2." +#endif + // Use one of these or SDCard-based Emulation will be used #if NO_EEPROM_SELECTED //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation @@ -247,14 +254,43 @@ #define SDCARD_CONNECTION LCD #endif +/** + * ----- ----- + * NC | 1 2 | GND 5V | 1 2 | GND + * RESET | 3 4 | PF12(SD_DETECT) (LCD_D7) PG7 | 3 4 | PG6 (LCD_D6) + * (MOSI)PB15 | 5 6 PF11(BTN_EN2) (LCD_D5) PG3 | 5 6 PG2 (LCD_D4) + * (SD_SS)PB12 | 7 8 | PG10(BTN_EN1) (LCD_RS) PD10 | 7 8 | PD11 (LCD_EN) + * (SCK)PB13 | 9 10| PB14(MISO) (BTN_ENC) PA8 | 9 10| PG4 (BEEPER) + * ----- ----- + * EXP2 EXP1 + */ + +#define EXPA1_03_PIN PG7 +#define EXPA1_04_PIN PG6 +#define EXPA1_05_PIN PG3 +#define EXPA1_06_PIN PG2 +#define EXPA1_07_PIN PD10 +#define EXPA1_08_PIN PD11 +#define EXPA1_09_PIN PA8 +#define EXPA1_10_PIN PG4 + +#define EXPA2_03_PIN -1 +#define EXPA2_04_PIN PF12 +#define EXPA2_05_PIN PB15 +#define EXPA2_06_PIN PF11 +#define EXPA2_07_PIN PB12 +#define EXPA2_08_PIN PG10 +#define EXPA2_09_PIN PB13 +#define EXPA2_10_PIN PB14 + // // Onboard SD card // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 // #if SD_CONNECTION_IS(LCD) - #define SD_DETECT_PIN PF12 - #define SDSS PB12 + #define SD_DETECT_PIN EXPA2_04_PIN + #define SDSS EXPA2_07_PIN #elif SD_CONNECTION_IS(ONBOARD) @@ -273,16 +309,52 @@ #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board" #endif -/** - * ----- ----- - * NC | · · | GND 5V | · · | GND - * RESET | · · | PF12(SD_DETECT) (LCD_D7) PG7 | · · | PG6 (LCD_D6) - * (MOSI)PB15 | · · | PF11(BTN_EN2) (LCD_D5) PG3 | · · | PG2 (LCD_D4) - * (SD_SS)PB12 | · · | PG10(BTN_EN1) (LCD_RS) PD10 | · · | PD11 (LCD_EN) - * (SCK)PB13 | · · | PB14(MISO) (BTN_ENC) PA8 | · · | PG4 (BEEPER) - * ----- ----- - * EXP2 EXP1 - */ +#if ENABLED(BTT_MOTOR_EXPANSION) + /** + * _____ _____ + * NC | · · | GND NC | · · | GND + * NC | · · | PF12 (M1EN) (M2EN) PG7 | · · | PG6 (M3EN) + * (M1STP) PB15 | · · PF11 (M1DIR) (M1RX) PG3 | · · PG2 (M1DIAG) + * (M2DIR) PB12 | · · | PG10 (M2STP) (M2RX) PD10 | · · | PD11 (M2DIAG) + * (M3DIR) PB13 | · · | PB14 (M3STP) (M3RX) PA8 | · · | PG4 (M3DIAG) + * ----- ----- + * EXP2 EXP1 + */ + + // M1 on Driver Expansion Module + #define E3_STEP_PIN EXPA2_05_PIN + #define E3_DIR_PIN EXPA2_06_PIN + #define E3_ENABLE_PIN EXPA2_04_PIN + #define E3_DIAG_PIN EXPA1_06_PIN + #define E3_CS_PIN EXPA1_05_PIN + #if HAS_TMC_UART + #define E3_SERIAL_TX_PIN EXPA1_05_PIN + #define E3_SERIAL_RX_PIN EXPA1_05_PIN + #endif + + // M2 on Driver Expansion Module + #define E4_STEP_PIN EXPA2_08_PIN + #define E4_DIR_PIN EXPA2_07_PIN + #define E4_ENABLE_PIN EXPA1_03_PIN + #define E4_DIAG_PIN EXPA1_08_PIN + #define E4_CS_PIN EXPA1_07_PIN + #if HAS_TMC_UART + #define E4_SERIAL_TX_PIN EXPA1_07_PIN + #define E4_SERIAL_RX_PIN EXPA1_07_PIN + #endif + + // M3 on Driver Expansion Module + #define E5_STEP_PIN EXPA2_10_PIN + #define E5_DIR_PIN EXPA2_09_PIN + #define E5_ENABLE_PIN EXPA1_04_PIN + #define E5_DIAG_PIN EXPA1_10_PIN + #define E5_CS_PIN EXPA1_09_PIN + #if HAS_TMC_UART + #define E5_SERIAL_TX_PIN EXPA1_09_PIN + #define E5_SERIAL_RX_PIN EXPA1_09_PIN + #endif + +#endif // BTT_MOTOR_EXPANSION // // LCDs and Controllers @@ -290,23 +362,23 @@ #if IS_TFTGLCD_PANEL #if ENABLED(TFTGLCD_PANEL_SPI) - #define TFTGLCD_CS PG10 + #define TFTGLCD_CS EXPA2_08_PIN #endif #elif HAS_WIRED_LCD - #define BEEPER_PIN PG4 - #define BTN_ENC PA8 + #define BEEPER_PIN EXPA1_10_PIN + #define BTN_ENC EXPA1_09_PIN #if ENABLED(CR10_STOCKDISPLAY) - #define LCD_PINS_RS PG6 + #define LCD_PINS_RS EXPA1_04_PIN - #define BTN_EN1 PD11 - #define BTN_EN2 PG2 + #define BTN_EN1 EXPA1_08_PIN + #define BTN_EN2 EXPA1_06_PIN - #define LCD_PINS_ENABLE PG7 - #define LCD_PINS_D4 PG3 + #define LCD_PINS_ENABLE EXPA1_03_PIN + #define LCD_PINS_D4 EXPA1_05_PIN // CR10_STOCKDISPLAY default timing is too fast #undef BOARD_ST7920_DELAY_1 @@ -315,45 +387,45 @@ #elif ENABLED(MKS_MINI_12864) - #define DOGLCD_A0 PG6 - #define DOGLCD_CS PG3 - #define BTN_EN1 PG10 - #define BTN_EN2 PF11 + #define DOGLCD_A0 EXPA1_04_PIN + #define DOGLCD_CS EXPA1_05_PIN + #define BTN_EN1 EXPA2_08_PIN + #define BTN_EN2 EXPA2_06_PIN #else - #define LCD_PINS_RS PD10 + #define LCD_PINS_RS EXPA1_07_PIN - #define BTN_EN1 PG10 - #define BTN_EN2 PF11 + #define BTN_EN1 EXPA2_08_PIN + #define BTN_EN2 EXPA2_06_PIN - #define LCD_PINS_ENABLE PD11 - #define LCD_PINS_D4 PG2 + #define LCD_PINS_ENABLE EXPA1_08_PIN + #define LCD_PINS_D4 EXPA1_06_PIN #if ENABLED(FYSETC_MINI_12864) - #define DOGLCD_CS PD11 - #define DOGLCD_A0 PD10 + #define DOGLCD_CS EXPA1_08_PIN + #define DOGLCD_A0 EXPA1_07_PIN //#define LCD_BACKLIGHT_PIN -1 - #define LCD_RESET_PIN PG2 // Must be high or open for LCD to operate normally. + #define LCD_RESET_PIN EXPA1_06_PIN // Must be high or open for LCD to operate normally. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN PG3 + #define RGB_LED_R_PIN EXPA1_05_PIN #endif #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN PG6 + #define RGB_LED_G_PIN EXPA1_04_PIN #endif #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN PG7 + #define RGB_LED_B_PIN EXPA1_03_PIN #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN PG3 + #define NEOPIXEL_PIN EXPA1_05_PIN #endif #endif // !FYSETC_MINI_12864 #if IS_ULTIPANEL - #define LCD_PINS_D5 PG3 - #define LCD_PINS_D6 PG6 - #define LCD_PINS_D7 PG7 + #define LCD_PINS_D5 EXPA1_05_PIN + #define LCD_PINS_D6 EXPA1_04_PIN + #define LCD_PINS_D7 EXPA1_03_PIN #endif #endif