From 4a89ef6273c6b0fafd3132900863e5a1f332b579 Mon Sep 17 00:00:00 2001 From: geijt <3473304+geijt@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:33:46 +0100 Subject: [PATCH] Fix Creality E3 "Free-runs" (#26533) Followup to #25636 --- Marlin/src/inc/Conditionals_adv.h | 2 +- .../pins/stm32f4/pins_CREALITY_CR4NTXXC10.h | 20 +++++++++---------- .../MARLIN_STM32F401RE_FREERUNS/ldscript.ld | 10 +++++----- ini/stm32f4.ini | 3 ++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index f62714df4b..f1caf52c73 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1277,7 +1277,7 @@ #if LCD_IS_SERIAL_HOST && !defined(LCD_SERIAL_PORT) #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, CREALITY_CR4NTXXC10, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) #define LCD_SERIAL_PORT 2 #else #define LCD_SERIAL_PORT 3 diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h index 77be577753..0a6f3e3059 100644 --- a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h @@ -100,15 +100,15 @@ #define X_STEP_PIN PC2 #define X_DIR_PIN PB9 -#define Y_ENABLE_PIN PC3 +#define Y_ENABLE_PIN X_ENABLE_PIN #define Y_STEP_PIN PB8 #define Y_DIR_PIN PB7 -#define Z_ENABLE_PIN PC3 +#define Z_ENABLE_PIN X_ENABLE_PIN #define Z_STEP_PIN PB6 #define Z_DIR_PIN PB5 -#define E0_ENABLE_PIN PC3 +#define E0_ENABLE_PIN X_ENABLE_PIN #define E0_STEP_PIN PB4 #define E0_DIR_PIN PB3 @@ -142,21 +142,21 @@ * If undefined software serial is used according to the pins below */ #define X_HARDWARE_SERIAL Serial6 - #define Y_HARDWARE_SERIAL Serial6 - #define Z_HARDWARE_SERIAL Serial6 - #define E0_HARDWARE_SERIAL Serial6 + #define Y_HARDWARE_SERIAL X_HARDWARE_SERIAL + #define Z_HARDWARE_SERIAL X_HARDWARE_SERIAL + #define E0_HARDWARE_SERIAL X_HARDWARE_SERIAL #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 1 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 2 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 3 + #define E0_SLAVE_ADDRESS 3 #endif // Software serial diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld index f34e389fb1..2c57307813 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld @@ -51,17 +51,17 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20017FFB; /* end of RAM */ +_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ /* Specify the memory areas */ MEMORY { -FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET -RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE } /* Define output sections */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 84d26553e0..3f33471943 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -746,9 +746,10 @@ board = genericSTM32F401RE board_build.variant = marlin_STM32F401RE_freeruns board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 +board_build.rename = firmware-{date}-{time}.bin build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RE -DSTM32F4 -DSS_TIMER=4 -DTIMER_SERVO=TIM5 - -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 + -DTRANSFER_CLOCK_DIV=8 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC extra_scripts = ${stm32_variant.extra_scripts} pre:buildroot/share/PlatformIO/scripts/random-bin.py