From ed4194e20fbf260f88990fdf849a1f55390f2a8a Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 2 Jul 2023 09:54:51 -0700 Subject: [PATCH 1/4] Fix SPI TFT Compile Errors on SKR V3 Verified on an SKR V3.0 EZ with a BTT TFT35-SPI V1.0 and MKS TS35 V2.0 --- Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h index 2d2df4c68ac7..8cb6939e7d43 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -461,11 +461,13 @@ #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI + #define TFT_SCK_PIN EXP2_02_PIN + #define TFT_MISO_PIN EXP2_01_PIN + #define TFT_MOSI_PIN EXP2_06_PIN + #define BTN_EN1 EXP2_03_PIN #define BTN_EN2 EXP2_05_PIN - #define TFT_DC_PIN TFT_A0_PIN - #ifndef TFT_WIDTH #define TFT_WIDTH 480 #endif @@ -475,9 +477,10 @@ #if ENABLED(BTT_TFT35_SPI_V1_0) // 480x320, 3.5", SPI Display with Rotary Encoder. - // Stock Display for the BIQU B1 SE. + // Stock Display for the BIQU B1 SE Series. #define TFT_CS_PIN EXP2_04_PIN - #define TFT_A0_PIN EXP2_07_PIN + #define TFT_DC_PIN EXP2_07_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN @@ -513,7 +516,8 @@ * EXP1 EXP2 */ #define TFT_CS_PIN EXP1_07_PIN // SPI1_CS - #define TFT_A0_PIN EXP1_08_PIN // SPI1_RS + #define TFT_DC_PIN EXP1_08_PIN // SPI1_RS + #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_04_PIN From 468f99b0b893ace6aab15d19d70473c8faca4c10 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 2 Jul 2023 10:14:43 -0700 Subject: [PATCH 2/4] Fix SPI TFT Compile Errors on SKR V2 TFT supports on STM32F4 is still broken, but this will at least compile. --- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index be7e0ab35f77..70d7d157d46a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -516,15 +516,27 @@ #if HAS_SPI_TFT + #define TFT_SCK_PIN EXP2_02_PIN + #define TFT_MISO_PIN EXP2_01_PIN + #define TFT_MOSI_PIN EXP2_06_PIN + #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP2_03_PIN #define BTN_EN2 EXP2_05_PIN + #ifndef TFT_WIDTH + #define TFT_WIDTH 480 + #endif + #ifndef TFT_HEIGHT + #define TFT_HEIGHT 320 + #endif + #if ENABLED(BTT_TFT35_SPI_V1_0) // 480x320, 3.5", SPI Display with Rotary Encoder. - // Stock Display for the BIQU B1 SE. + // Stock Display for the BIQU B1 SE Series. #define TFT_CS_PIN EXP2_04_PIN - #define TFT_A0_PIN EXP2_07_PIN + #define TFT_DC_PIN EXP2_07_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN @@ -532,6 +544,22 @@ #define TOUCH_MOSI_PIN EXP1_03_PIN #define TOUCH_INT_PIN EXP1_07_PIN + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 17540 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y -11388 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X -21 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 337 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + #elif ENABLED(MKS_TS35_V2_0) /** ------ ------ @@ -544,8 +572,8 @@ * EXP1 EXP2 */ #define TFT_CS_PIN EXP1_07_PIN // SPI1_CS - #define TFT_A0_PIN EXP1_08_PIN // SPI1_RS - #define TFT_DC_PIN TFT_DC_PIN + #define TFT_DC_PIN EXP1_08_PIN // SPI1_RS + #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_04_PIN From cef5334765300b17fb1299e1d4bc824dc099e250 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 4 Jul 2023 18:44:03 -0500 Subject: [PATCH 3/4] Define A0 from DC --- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 6 +++--- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 2 +- Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 19ea927531b8..bff1167bf61b 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -377,9 +377,9 @@ #if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) - #define TFT_A0_PIN 43 #define TFT_CS_PIN 49 #define TFT_DC_PIN 43 + #define TFT_A0_PIN TFT_DC_PIN #define TFT_SCK_PIN SD_SCK_PIN #define TFT_MISO_PIN SD_MISO_PIN #define TFT_MOSI_PIN SD_MOSI_PIN diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index ffb8fe8d12cf..756697f31488 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -319,7 +319,7 @@ #define BTN_EN1 EXP2_03_PIN #define BTN_EN2 EXP2_05_PIN - #define TFT_DC_PIN TFT_A0_PIN + #define TFT_A0_PIN TFT_DC_PIN #ifndef TFT_WIDTH #define TFT_WIDTH 480 @@ -332,7 +332,7 @@ // 480x320, 3.5", SPI Display with Rotary Encoder. // Stock Display for the BIQU B1 SE. #define TFT_CS_PIN EXP2_04_PIN - #define TFT_A0_PIN EXP2_07_PIN + #define TFT_DC_PIN EXP2_07_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN @@ -343,7 +343,7 @@ #elif ENABLED(MKS_TS35_V2_0) #define TFT_CS_PIN EXP1_07_PIN - #define TFT_A0_PIN EXP1_08_PIN + #define TFT_DC_PIN EXP1_08_PIN #define TFT_RESET_PIN EXP1_04_PIN 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 a3fb8f648875..463814a5f055 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -396,8 +396,8 @@ #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI #define TFT_CS_PIN EXP1_07_PIN - #define TFT_A0_PIN EXP1_08_PIN #define TFT_DC_PIN EXP1_08_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TFT_MISO_PIN EXP2_01_PIN #define TFT_BACKLIGHT_PIN EXP1_03_PIN #define TFT_RESET_PIN EXP1_04_PIN diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 42a0155471b2..748e8cc902e3 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -295,8 +295,8 @@ #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI #define TFT_CS_PIN EXP1_07_PIN - #define TFT_A0_PIN EXP1_08_PIN #define TFT_DC_PIN EXP1_08_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TFT_MISO_PIN EXP2_01_PIN #define TFT_BACKLIGHT_PIN EXP1_03_PIN #define TFT_RESET_PIN EXP1_04_PIN diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 70d7d157d46a..104f453f110a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -536,7 +536,7 @@ // Stock Display for the BIQU B1 SE Series. #define TFT_CS_PIN EXP2_04_PIN #define TFT_DC_PIN EXP2_07_PIN - #define TFT_A0_PIN TFT_DC_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN From 9e2fddd2e36c1ce387ee2125c066d6073d376020 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:08:11 -0700 Subject: [PATCH 4/4] Add Default SKR2 + TS35 V2 Cal, BTT SPI TFT ASCII Art --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 26 +++++++++++++-- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 33 +++++++++++++++++-- .../pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 17 ++++++++-- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 756697f31488..cc3f91b4eafb 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -329,8 +329,21 @@ #endif #if ENABLED(BTT_TFT35_SPI_V1_0) - // 480x320, 3.5", SPI Display with Rotary Encoder. - // Stock Display for the BIQU B1 SE. + + /** + * ------ ------ + * BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK + * T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS + * T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI + * PENIRQ | 7 8 | F_CS RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | NC + * ------ ------ + * EXP1 EXP2 + * + * 480x320, 3.5", SPI Display with Rotary Encoder. + * Stock Display for the BIQU B1 SE Series. + * Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf + */ #define TFT_CS_PIN EXP2_04_PIN #define TFT_DC_PIN EXP2_07_PIN @@ -342,6 +355,15 @@ #elif ENABLED(MKS_TS35_V2_0) + /** ------ ------ + * BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK + * TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS + * TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI + * SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | VCC + * ------ ------ + * EXP1 EXP2 + */ #define TFT_CS_PIN EXP1_07_PIN #define TFT_DC_PIN EXP1_08_PIN diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 104f453f110a..51c171686438 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -532,8 +532,21 @@ #endif #if ENABLED(BTT_TFT35_SPI_V1_0) - // 480x320, 3.5", SPI Display with Rotary Encoder. - // Stock Display for the BIQU B1 SE Series. + + /** + * ------ ------ + * BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK + * T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS + * T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI + * PENIRQ | 7 8 | F_CS RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | NC + * ------ ------ + * EXP1 EXP2 + * + * 480x320, 3.5", SPI Display with Rotary Encoder. + * Stock Display for the BIQU B1 SE Series. + * Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf + */ #define TFT_CS_PIN EXP2_04_PIN #define TFT_DC_PIN EXP2_07_PIN #define TFT_A0_PIN TFT_DC_PIN @@ -593,6 +606,22 @@ #define TFT_BUFFER_SIZE 14400 + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X -17253 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 11579 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 514 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y -24 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + #endif #endif // HAS_SPI_TFT diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h index 8cb6939e7d43..bb946e73cd47 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -476,8 +476,21 @@ #endif #if ENABLED(BTT_TFT35_SPI_V1_0) - // 480x320, 3.5", SPI Display with Rotary Encoder. - // Stock Display for the BIQU B1 SE Series. + + /** + * ------ ------ + * BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK + * T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS + * T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI + * PENIRQ | 7 8 | F_CS RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | NC + * ------ ------ + * EXP1 EXP2 + * + * 480x320, 3.5", SPI Display with Rotary Encoder. + * Stock Display for the BIQU B1 SE Series. + * Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf + */ #define TFT_CS_PIN EXP2_04_PIN #define TFT_DC_PIN EXP2_07_PIN #define TFT_A0_PIN TFT_DC_PIN