From 23c3d2ed1d69f9ffe10be909ab9d50896e4f1ab8 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:54:05 -0800 Subject: [PATCH 1/5] Revert STM32G0B1RE Variant Changes --- .../variants/MARLIN_G0B1RE/PeripheralPins.c | 2 -- .../MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c index 3187367a2d99..eb95de1495f7 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c @@ -218,7 +218,6 @@ WEAK const PinMap PinMap_UART_TX[] = { {PC_12, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_3, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)}, - {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)}, {PF_2, LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART2)}, {NC, NP, 0} }; @@ -253,7 +252,6 @@ WEAK const PinMap PinMap_UART_RX[] = { {PC_11_ALT1, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART4)}, {PD_2, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)}, - {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)}, {NC, NP, 0} }; #endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h index 23cecd371a28..6a26baff45db 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h @@ -158,9 +158,6 @@ #endif // UART Definitions -//#define ENABLE_HWSERIAL1 done automatically by the #define SERIAL_UART_INSTANCE below -#define ENABLE_HWSERIAL3 - #ifndef SERIAL_UART_INSTANCE #define SERIAL_UART_INSTANCE 2 #endif @@ -174,15 +171,6 @@ #define PIN_SERIAL_TX PA2 #endif -// Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number -// Used when user instantiate a hardware Serial using its peripheral name. -// Example: HardwareSerial mySerial(USART3); -// will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. -#define PIN_SERIAL1_RX PA3 -#define PIN_SERIAL1_TX PA2 -#define PIN_SERIAL3_RX PD9 -#define PIN_SERIAL3_TX PD8 - /*---------------------------------------------------------------------------- * Arduino objects - C++ only *----------------------------------------------------------------------------*/ From 50cda9265d56387ed3640f9a84530af44ff17ec5 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:58:47 -0800 Subject: [PATCH 2/5] BTT Manta Environments --- Marlin/src/pins/pins.h | 6 +++--- ini/stm32g0.ini | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 18bb7dba5827..1c45b0b1552b 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -546,11 +546,11 @@ #elif MB(BTT_SKR_MINI_E3_V3_0) #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer #elif MB(BTT_MANTA_M4P_V1_0) - #include "stm32g0/pins_BTT_MANTA_M4P_V1_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer + #include "stm32g0/pins_BTT_MANTA_M4P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer #elif MB(BTT_MANTA_M5P_V1_0) - #include "stm32g0/pins_BTT_MANTA_M5P_V1_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer + #include "stm32g0/pins_BTT_MANTA_M5P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer #elif MB(BTT_MANTA_E3_EZ_V1_0) - #include "stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer + #include "stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer #elif MB(BTT_MANTA_M8P_V1_0) #include "stm32g0/pins_BTT_MANTA_M8P_V1_0.h" // STM32G0 env:STM32G0B1VE_btt env:STM32G0B1VE_btt_xfer #elif MB(BTT_MANTA_M8P_V1_1) diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index 5891395642dc..2a95ac22e388 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -41,7 +41,7 @@ upload_protocol = stlink debug_tool = stlink # -# BigTreeTech SKR Mini E3 V3.0 / Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RET6 ARM Cortex-M0+) # [env:STM32G0B1RE_btt] extends = stm32_variant @@ -59,7 +59,7 @@ upload_protocol = stlink debug_tool = stlink # -# BigTreeTech SKR Mini E3 V3.0 / Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RET6 ARM Cortex-M0+) # Custom upload to SD via Marlin with Binary Protocol # Requires Marlin with BINARY_FILE_TRANSFER already installed on the target board. # If CUSTOM_FIRMWARE_UPLOAD is also installed, Marlin will reboot the board to install the firmware. @@ -72,6 +72,39 @@ extra_scripts = ${env:STM32G0B1RE_btt.extra_scripts} pre:buildroot/share/scripts/upload.py upload_protocol = custom +# +# Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# +[env:STM32G0B1RE_manta_btt] +extends = stm32_variant +platform = ststm32@~14.1.0 +platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip +board = marlin_STM32G0B1RE +board_build.offset = 0x2000 +board_upload.offset_address = 0x08002000 +build_flags = ${stm32_variant.build_flags} + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 + -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 + -DSTEP_TIMER_IRQ_PRIO=0 +upload_protocol = stlink +debug_tool = stlink + +# +# Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# Custom upload to SD via Marlin with Binary Protocol +# Requires Marlin with BINARY_FILE_TRANSFER already installed on the target board. +# If CUSTOM_FIRMWARE_UPLOAD is also installed, Marlin will reboot the board to install the firmware. +# Currently CUSTOM_FIRMWARE_UPLOAD must also be enabled to use 'xfer' build envs. +# +[env:STM32G0B1RE_manta_btt_xfer] +extends = env:STM32G0B1RE_manta_btt +build_flags = ${env:STM32G0B1RE_manta_btt.build_flags} -DXFER_BUILD +extra_scripts = ${env:STM32G0B1RE_manta_btt.extra_scripts} + pre:buildroot/share/scripts/upload.py +upload_protocol = custom + # # BigTreeTech Manta M8P V1.x (STM32G0B1VET6 ARM Cortex-M0+) # From 228897bf656c57f090aff70ae938119a32677188 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Feb 2023 15:25:49 -0600 Subject: [PATCH 3/5] inherit from env:STM32G0B1RE_btt --- ini/stm32g0.ini | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index 2a95ac22e388..2ffee0979051 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -73,26 +73,15 @@ extra_scripts = ${env:STM32G0B1RE_btt.extra_scripts} upload_protocol = custom # -# Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# BigTreeTech Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) # [env:STM32G0B1RE_manta_btt] -extends = stm32_variant -platform = ststm32@~14.1.0 -platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip -board = marlin_STM32G0B1RE -board_build.offset = 0x2000 -board_upload.offset_address = 0x08002000 -build_flags = ${stm32_variant.build_flags} - -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 - -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10 - -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 - -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 - -DSTEP_TIMER_IRQ_PRIO=0 -upload_protocol = stlink -debug_tool = stlink +extends = env:STM32G0B1RE_btt +build_flags = ${env:STM32G0B1RE_btt.build_flags} + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 -DENABLE_HWSERIAL3 # -# Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) +# BigTreeTech Manta E3 EZ V1.0 / Manta M4P V1.0 / Manta M5P V1.0 (STM32G0B1RET6 ARM Cortex-M0+) # Custom upload to SD via Marlin with Binary Protocol # Requires Marlin with BINARY_FILE_TRANSFER already installed on the target board. # If CUSTOM_FIRMWARE_UPLOAD is also installed, Marlin will reboot the board to install the firmware. From e2ce421e43bded9a0239d1e7d133f747e5570a76 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Feb 2023 15:26:12 -0600 Subject: [PATCH 4/5] grammar --- .../share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h | 2 +- .../PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h | 2 +- .../PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h | 4 ++-- .../PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h | 2 +- .../variants/MARLIN_FYSETC_SPIDER_KING407/variant.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h index 2c70693991ed..d39e665d53e3 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h @@ -280,7 +280,7 @@ extern "C" { #define PIN_SERIAL_TX PA9 // Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number -// Used when user instantiate a hardware Serial using its peripheral name. +// Used when the user instantiates a hardware Serial using its peripheral name. // Example: HardwareSerial mySerial(USART3); // will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. #define PIN_SERIAL1_RX PA10 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h index b5cf0bad9d50..c30d7ecc777d 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h @@ -280,7 +280,7 @@ extern "C" { #define PIN_SERIAL_TX PA9 // Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number -// Used when user instantiate a hardware Serial using its peripheral name. +// Used when the user instantiates a hardware Serial using its peripheral name. // Example: HardwareSerial mySerial(USART3); // will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. #define PIN_SERIAL1_RX PA10 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h index b5a4e5ef80c2..595601aae0b7 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h @@ -112,7 +112,7 @@ extern "C" { #define PIN_SERIAL_RX PA10 #define PIN_SERIAL_TX PA9 -// Used when user instanciate a hardware Serial using its peripheral name. +// Used when the user instantiates a hardware Serial using its peripheral name. // Example: HardwareSerial mySerial(USART3); // will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. #define PIN_SERIAL1_RX PA10 @@ -148,4 +148,4 @@ extern "C" { #define SERIAL_PORT_HARDWARE_OPEN Serial2 #endif -#endif /* _VARIANT_ARDUINO_STM32_ */ \ No newline at end of file +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h index d4982113a010..a090113fa377 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h @@ -110,7 +110,7 @@ extern "C" { #define PIN_SERIAL_RX PA10 #define PIN_SERIAL_TX PA9 -// Used when user instantiate a hardware Serial using its peripheral name. +// Used when the user instantiates a hardware Serial using its peripheral name. // Example: HardwareSerial mySerial(USART3); // will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. #define PIN_SERIAL1_RX PA10 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/variant.h index 727c0d07d832..c3a0c1681160 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_SPIDER_KING407/variant.h @@ -196,7 +196,7 @@ extern "C" { #define PIN_SERIAL_TX PA9 // Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number -// Used when user instantiate a hardware Serial using its peripheral name. +// Used when the user instantiates a hardware Serial using its peripheral name. // Example: HardwareSerial mySerial(USART3); // will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. #define PIN_SERIAL1_RX PA10 From d2b2696a6972b72d39c11970eb365196d05fa856 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Feb 2023 15:27:50 -0600 Subject: [PATCH 5/5] Keep PinMap_UART_RX/TX pins? --- .../share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c index eb95de1495f7..3187367a2d99 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_G0B1RE/PeripheralPins.c @@ -218,6 +218,7 @@ WEAK const PinMap PinMap_UART_TX[] = { {PC_12, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_3, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)}, {PF_2, LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART2)}, {NC, NP, 0} }; @@ -252,6 +253,7 @@ WEAK const PinMap PinMap_UART_RX[] = { {PC_11_ALT1, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART4)}, {PD_2, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)}, {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)}, {NC, NP, 0} }; #endif