From 6e7c20e78e1036140d9e076f71759e35f91300e2 Mon Sep 17 00:00:00 2001 From: mks-viva <1224833100@qq.com> Date: Thu, 15 Jul 2021 20:57:34 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20MKS=20Mini12864=20v3=20for=20Robin?= =?UTF-8?q?=20E3/E3D=20(#22368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 5 ++-- .../variants/MARLIN_F103Rx/variant.h | 24 +++++++++++++++---- ini/stm32f1.ini | 3 +-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index 127dfb7c7a..bc47c9169f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -156,7 +156,6 @@ #define DOGLCD_MOSI PB15 #elif ENABLED(MKS_MINI_12864_V3) - #define ENABLE_SPI3 #define DOGLCD_CS PA4 #define DOGLCD_A0 PA5 #define LCD_PINS_DC DOGLCD_A0 @@ -165,7 +164,9 @@ #define NEOPIXEL_PIN PA7 #define DOGLCD_MOSI PB15 #define DOGLCD_SCK PB13 - + #define FORCE_SOFT_SPI + #define SOFTWARE_SPI + #else #define LCD_PINS_D4 PA6 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h index 7dcbb793d0..41b194abe0 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h @@ -101,11 +101,24 @@ extern "C" { #endif // Override default Arduino configuration + // SPI Definitions -#define PIN_SPI_SS PA4 -#define PIN_SPI_MOSI PA7 -#define PIN_SPI_MISO PA6 -#define PIN_SPI_SCK PA5 +#if DEFAULT_SPI == 3 + #define PIN_SPI_SS PA15 + #define PIN_SPI_MOSI PB3 + #define PIN_SPI_MISO PB4 + #define PIN_SPI_SCK PB5 +#elif DEFAULT_SPI == 2 + #define PIN_SPI_SS PB12 + #define PIN_SPI_MOSI PB13 + #define PIN_SPI_MISO PB14 + #define PIN_SPI_SCK PB15 +#else + #define PIN_SPI_SS PA4 + #define PIN_SPI_MOSI PA7 + #define PIN_SPI_MISO PA6 + #define PIN_SPI_SCK PA5 +#endif // I2C Definitions #define PIN_WIRE_SDA PB7 @@ -118,6 +131,7 @@ extern "C" { #ifndef TIMER_SERVO #define TIMER_SERVO TIM2 #endif + // UART Definitions // Define here Serial instance number to map on Serial generic name #define SERIAL_UART_INSTANCE 1 @@ -126,7 +140,7 @@ extern "C" { #define PIN_SERIAL_RX PA10 #define PIN_SERIAL_TX PA9 -/* Extra HAL modules */ +// Extra HAL modules #if defined(STM32F103xE) || defined(STM32F103xG) #define HAL_DAC_MODULE_ENABLED #endif diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index d5f0741d41..e843ee3599 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -125,8 +125,7 @@ lib_deps = [env:mks_robin_e3] platform = ${common_stm32.platform} extends = common_STM32F103RC -build_flags = ${common_stm32.build_flags} - -DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5 +build_flags = ${common_stm32.build_flags} -DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5 -DDEFAULT_SPI=3 build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC monitor_speed = 115200 board_build.offset = 0x5000