From d4ba94479b114df6a6d5220c87dd7bf100942863 Mon Sep 17 00:00:00 2001 From: ellensp Date: Wed, 11 Nov 2020 15:06:42 +1300 Subject: [PATCH] BTT driver expansion for SKR 1.3/1.4 (#20088) Co-authored-by: Scott Lahteine --- Marlin/src/lcd/tft/ui_320x240.cpp | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 172 ++++++++++-------- Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h | 51 ++++++ Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 2 +- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 6 +- Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h | 2 +- Marlin/src/pins/ramps/pins_FYSETC_F6_13.h | 2 +- 7 files changed, 157 insertions(+), 80 deletions(-) diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 999cec29b..559bc5b22 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -649,7 +649,7 @@ void menu_item(const uint8_t row, bool sel ) { menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); #if ENABLED(TOUCH_SCREEN) const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM; - touch.add_control(tct, 0, 2 + 34 * row, 320, 32, encoderTopLine + row); + touch.add_control(tct, 0, 2 + 34 * row, TFT_WIDTH, 32, encoderTopLine + row); #endif } diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 14bac7d72..bb2cacd5b 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -208,31 +208,57 @@ #define E1_SERIAL_TX_PIN P1_01 #define E1_SERIAL_RX_PIN P1_01 - #define Z2_SERIAL_TX_PIN P1_01 - #define Z2_SERIAL_RX_PIN P1_01 - // Reduce baud rate to improve software serial reliability #define TMC_BAUD_RATE 19200 #endif +/* _____ _____ + * NC | 1 2 | GND 5V | 1 2 | GND + * RESET | 3 4 | 1.31 1.23 | 3 4 | 1.22 + * 0.18 | 5 6 3.25 1.21 | 5 6 1.20 + * 0.16 | 7 8 | 3.26 1.19 | 7 8 | 1.18 + * 0.15 | 9 10| 0.17 0.28 | 9 10| 1.30 + * ----- ----- + * EXP2 EXP1 + */ + +#define EXPA1_03_PIN P1_23 +#define EXPA1_04_PIN P1_22 +#define EXPA1_05_PIN P1_21 +#define EXPA1_06_PIN P1_20 +#define EXPA1_07_PIN P1_19 +#define EXPA1_08_PIN P1_18 +#define EXPA1_09_PIN P0_28 +#define EXPA1_10_PIN P1_30 + +#define EXPA2_03_PIN -1 +#define EXPA2_04_PIN P1_31 +#define EXPA2_05_PIN P0_18 +#define EXPA2_06_PIN P3_25 +#define EXPA2_07_PIN P0_16 +#define EXPA2_08_PIN P3_26 +#define EXPA2_09_PIN P0_15 +#define EXPA2_10_PIN P0_17 + // // SD Connection // #if SD_CONNECTION_IS(LCD) - #define SS_PIN P0_16 + #define SS_PIN EXPA2_07_PIN #endif /** * _____ _____ * NC | · · | GND 5V | · · | GND * RESET | · · | 1.31 (SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6) - * (MOSI) 0.18 | · · | 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4) + * (MOSI) 0.18 | · · 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · 1.20 (LCD_D4) * (SD_SS) 0.16 | · · | 3.26 (BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN) * (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER) * ----- ----- * EXP2 EXP1 */ -#if HAS_WIRED_LCD + +#if HAS_WIRED_LCD && !HAS_BTT_EXP_MOT #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board." @@ -249,35 +275,35 @@ * * The ANET_FULL_GRAPHICS_LCD connector plug: * - * BEFORE AFTER - * _____ _____ - * GND 1 | 1 2 | 2 5V 5V 1 | 1 2 | 2 GND - * CS 3 | 3 4 | 4 BTN_EN2 CS 3 | 3 4 | 4 BTN_EN2 - * SID 5 | 5 6 6 BTN_EN1 SID 5 | 5 6 6 BTN_EN1 - * open 7 | 7 8 | 8 BTN_ENC CLK 7 | 7 8 | 8 BTN_ENC - * CLK 9 | 9 10| 10 Beeper open 9 | 9 10| 10 Beeper - * ----- ----- - * LCD LCD + * BEFORE AFTER + * _____ _____ + * GND | 1 2 | 5V 5V | 1 2 | GND + * CS | 3 4 | BTN_EN2 CS | 3 4 | BTN_EN2 + * SID | 5 6 BTN_EN1 SID | 5 6 BTN_EN1 + * open | 7 8 | BTN_ENC CLK | 7 8 | BTN_ENC + * CLK | 9 10| Beeper open | 9 10| Beeper + * ----- ----- + * LCD LCD */ - #define LCD_PINS_RS P1_23 + #define LCD_PINS_RS EXPA1_03_PIN - #define BTN_EN1 P1_20 - #define BTN_EN2 P1_22 - #define BTN_ENC P1_18 + #define BTN_EN1 EXPA1_06_PIN + #define BTN_EN2 EXPA1_04_PIN + #define BTN_ENC EXPA1_08_PIN - #define LCD_PINS_ENABLE P1_21 - #define LCD_PINS_D4 P1_19 + #define LCD_PINS_ENABLE EXPA1_05_PIN + #define LCD_PINS_D4 EXPA1_07_PIN #elif ENABLED(CR10_STOCKDISPLAY) - #define BTN_ENC P0_28 // (58) open-drain - #define LCD_PINS_RS P1_22 + #define BTN_ENC EXPA1_09_PIN // (58) open-drain + #define LCD_PINS_RS EXPA1_04_PIN - #define BTN_EN1 P1_18 - #define BTN_EN2 P1_20 + #define BTN_EN1 EXPA1_08_PIN + #define BTN_EN2 EXPA1_06_PIN - #define LCD_PINS_ENABLE P1_23 - #define LCD_PINS_D4 P1_21 + #define LCD_PINS_ENABLE EXPA1_03_PIN + #define LCD_PINS_D4 EXPA1_05_PIN #elif ENABLED(ENDER2_STOCKDISPLAY) @@ -285,43 +311,43 @@ * _____ * 5V | 1 2 | GND * (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS) - * (LCD_A0) 1.21 | 5 6 | 1.20 (BTN_EN2) + * (LCD_A0) 1.21 | 5 6 1.20 (BTN_EN2) * RESET 1.19 | 7 8 | 1.18 (BTN_EN1) * (BTN_ENC) 0.28 | 9 10| 1.30 (SCK) * ----- * EXP1 */ - #define BTN_EN1 P1_18 - #define BTN_EN2 P1_20 - #define BTN_ENC P0_28 + #define BTN_EN1 EXPA1_08_PIN + #define BTN_EN2 EXPA1_06_PIN + #define BTN_ENC EXPA1_09_PIN - #define DOGLCD_CS P1_22 - #define DOGLCD_A0 P1_21 - #define DOGLCD_SCK P1_30 - #define DOGLCD_MOSI P1_23 + #define DOGLCD_CS EXPA1_04_PIN + #define DOGLCD_A0 EXPA1_05_PIN + #define DOGLCD_SCK EXPA1_10_PIN + #define DOGLCD_MOSI EXPA1_03_PIN #define FORCE_SOFT_SPI #define LCD_BACKLIGHT_PIN -1 #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI - #define TFT_CS_PIN P1_22 - #define TFT_A0_PIN P1_23 - #define TFT_DC_PIN P1_23 - #define TFT_MISO_PIN P0_17 - #define TFT_BACKLIGHT_PIN P1_18 - #define TFT_RESET_PIN P1_19 + #define TFT_CS_PIN EXPA1_04_PIN + #define TFT_A0_PIN EXPA1_03_PIN + #define TFT_DC_PIN EXPA1_03_PIN + #define TFT_MISO_PIN EXPA2_10_PIN + #define TFT_BACKLIGHT_PIN EXPA1_08_PIN + #define TFT_RESET_PIN EXPA1_07_PIN #define LCD_USE_DMA_SPI - #define TOUCH_INT_PIN P1_21 - #define TOUCH_CS_PIN P1_20 + #define TOUCH_INT_PIN EXPA1_05_PIN + #define TOUCH_CS_PIN EXPA1_06_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 // SPI 1 - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 + #define SCK_PIN EXPA2_09_PIN + #define MISO_PIN EXPA2_10_PIN + #define MOSI_PIN EXPA2_05_PIN // Disable any LCD related PINs config #define LCD_PINS_ENABLE -1 @@ -361,72 +387,72 @@ #elif IS_TFTGLCD_PANEL #if ENABLED(TFTGLCD_PANEL_SPI) - #define TFTGLCD_CS P3_26 + #define TFTGLCD_CS EXPA2_08_PIN #endif - #define SD_DETECT_PIN P1_31 + #define SD_DETECT_PIN EXPA2_04_PIN #else - #define BTN_ENC P0_28 // (58) open-drain - #define LCD_PINS_RS P1_19 + #define BTN_ENC EXPA1_09_PIN // (58) open-drain + #define LCD_PINS_RS EXPA1_07_PIN - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 + #define BTN_EN1 EXPA2_08_PIN // (31) J3-2 & AUX-4 + #define BTN_EN2 EXPA2_06_PIN // (33) J3-4 & AUX-4 - #define LCD_PINS_ENABLE P1_18 - #define LCD_PINS_D4 P1_20 + #define LCD_PINS_ENABLE EXPA1_08_PIN + #define LCD_PINS_D4 EXPA1_06_PIN - #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define LCD_SDSS EXPA2_07_PIN // (16) J3-7 & AUX-4 #if SD_CONNECTION_IS(LCD) - #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) + #define SD_DETECT_PIN EXPA2_04_PIN // (49) (NOT 5V tolerant) #endif #if ENABLED(FYSETC_MINI_12864) - #define DOGLCD_CS P1_18 - #define DOGLCD_A0 P1_19 - #define DOGLCD_SCK P0_15 - #define DOGLCD_MOSI P0_18 + #define DOGLCD_CS EXPA1_08_PIN + #define DOGLCD_A0 EXPA1_07_PIN + #define DOGLCD_SCK EXPA2_09_PIN + #define DOGLCD_MOSI EXPA2_05_PIN #define LCD_BACKLIGHT_PIN -1 #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems // results in LCD soft SPI mode 3, SD soft SPI mode 0 - #define LCD_RESET_PIN P1_20 // 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 P1_21 + #define RGB_LED_R_PIN EXPA1_05_PIN #endif #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN P1_22 + #define RGB_LED_G_PIN EXPA1_04_PIN #endif #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN P1_23 + #define RGB_LED_B_PIN EXPA1_03_PIN #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN P1_21 + #define NEOPIXEL_PIN EXPA1_05_PIN #endif #else // !FYSETC_MINI_12864 #if ENABLED(MKS_MINI_12864) - #define DOGLCD_CS P1_21 - #define DOGLCD_A0 P1_22 - #define DOGLCD_SCK P0_15 - #define DOGLCD_MOSI P0_18 + #define DOGLCD_CS EXPA1_05_PIN + #define DOGLCD_A0 EXPA1_04_PIN + #define DOGLCD_SCK EXPA2_09_PIN + #define DOGLCD_MOSI EXPA2_05_PIN #define FORCE_SOFT_SPI #endif #if IS_ULTIPANEL - #define LCD_PINS_D5 P1_21 - #define LCD_PINS_D6 P1_22 - #define LCD_PINS_D7 P1_23 + #define LCD_PINS_D5 EXPA1_05_PIN + #define LCD_PINS_D6 EXPA1_04_PIN + #define LCD_PINS_D7 EXPA1_03_PIN #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) - #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #define BTN_ENC_EN EXPA1_03_PIN // Detect the presence of the encoder #endif #endif diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h index 820c35a01..e6cfc0afa 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h @@ -29,6 +29,14 @@ #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif +// If you have the Big tree tech driver expantion module, enable HAS_BTT_EXP_MOT +// https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT +//#define HAS_BTT_EXP_MOT 1 + +#if BOTH(HAS_WIRED_LCD,HAS_BTT_EXP_MOT) + #ERROR "Having a LCD on EXP1/EXP2 and a expanion motor module on EXP1/EXP2 is not possable." +#endif + // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 @@ -115,3 +123,46 @@ #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif + +#if HAS_BTT_EXP_MOT +/* _____ _____ + * NC | · · | GND NC | · · | GND + * NC | · · | 1.31 (M1EN) (M2EN) 1.23 | · · | 1.22 (M3EN) + * (M1STP) 0.18 | · · 3.25 (M1DIR) (M1RX) 1.21 | · · 1.20 (M1DIAG) + * (M2DIR) 0.16 | · · | 3.26 (M2STP) (M2RX) 1.19 | · · | 1.18 (M2DIAG) + * (M3DIR) 0.15 | · · | 0.17 (M3STP) (M3RX) 0.28 | · · | 1.30 (M3DIAG) + * ----- ----- + * EXP2 EXP1 + */ + + // M1 on Driver Expansion Module + #define E2_STEP_PIN EXPA2_05_PIN + #define E2_DIR_PIN EXPA2_06_PIN + #define E2_ENABLE_PIN EXPA2_04_PIN + #define E2_DIAG_PIN EXPA1_06_PIN + #define E2_CS_PIN EXPA1_05_PIN + #if HAS_TMC_UART + #define E2_SERIAL_TX_PIN EXPA1_05_PIN + #define E2_SERIAL_RX_PIN EXPA1_05_PIN + #endif + // M2 on Driver Expansion Module + #define E3_STEP_PIN EXPA2_08_PIN + #define E3_DIR_PIN EXPA2_07_PIN + #define E3_ENABLE_PIN EXPA1_03_PIN + #define E3_DIAG_PIN EXPA1_08_PIN + #define E3_CS_PIN EXPA1_07_PIN + #if HAS_TMC_UART + #define E3_SERIAL_TX_PIN EXPA1_07_PIN + #define E3_SERIAL_RX_PIN EXPA1_07_PIN + #endif + // M3 on Driver Expansion Module + #define E4_STEP_PIN EXPA2_10_PIN + #define E4_DIR_PIN EXPA2_09_PIN + #define E4_ENABLE_PIN EXPA1_04_PIN + #define E4_DIAG_PIN EXPA1_10_PIN + #define E4_CS_PIN EXPA1_09_PIN + #if HAS_TMC_UART + #define E4_SERIAL_TX_PIN EXPA1_09_PIN + #define E4_SERIAL_RX_PIN EXPA1_09_PIN + #endif +#endif // HAS_BTT_EXP_MOT diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index f948c32f9..b0d1ec1f0 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -229,7 +229,7 @@ * _____ _____ * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) - * (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI) + * (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI) * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST * GND | · · | 5V GND | · · | NC * ----- ----- diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 071975239..dcf0741a7 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -249,9 +249,9 @@ /** * _____ _____ - * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) - * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) - * (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI) + * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) + * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) + * (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI) * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST * GND | · · | 5V GND | · · | NC * ----- ----- diff --git a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h index a0174f260..c11cd9e9d 100644 --- a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h @@ -155,7 +155,7 @@ * _____ * 5V | · · | GND * (LCD_EN) P0_18 | · · | P0_16 (LCD_RS) - * (LCD_D4) P0_15 | · · | P3_25 (BTN_EN2) + * (LCD_D4) P0_15 | · · P3_25 (BTN_EN2) * (RESET) P2_11 | · · | P3_26 (BTN_EN1) * (BTN_ENC) P1_30 | · · | P1_31 (BEEPER) * ----- diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index 80eb3f153..66714240e 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -201,7 +201,7 @@ * ----- ----- * 5V/D41 | · · | GND 5V | · · | GND * RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6) - * (MOSI) D51 | · · | D33 (BTN_EN2) (LCD_D5) D25 | · · | D23 (LCD_D4) + * (MOSI) D51 | · · D33 (BTN_EN2) (LCD_D5) D25 | · · D23 (LCD_D4) * (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN) * (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER) * ----- -----