🔨 MKS Robin E3 for HAL/STM32 (#21927)

This commit is contained in:
ldursw 2021-06-04 00:38:10 -03:00 committed by Scott Lahteine
parent aff45fd455
commit ce95f56ac8
5 changed files with 60 additions and 8 deletions

View File

@ -503,7 +503,7 @@
#elif MB(MKS_ROBIN_PRO) #elif MB(MKS_ROBIN_PRO)
#include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro #include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro
#elif MB(MKS_ROBIN_E3) #elif MB(MKS_ROBIN_E3)
#include "stm32f1/pins_MKS_ROBIN_E3.h" // STM32F1 env:mks_robin_e3 #include "stm32f1/pins_MKS_ROBIN_E3.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple
#elif MB(MKS_ROBIN_E3_V1_1) #elif MB(MKS_ROBIN_E3_V1_1)
#include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h" // STM32F1 env:mks_robin_e3 #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h" // STM32F1 env:mks_robin_e3
#elif MB(MKS_ROBIN_E3D) #elif MB(MKS_ROBIN_E3D)

View File

@ -177,7 +177,16 @@
// SD Card // SD Card
// //
#define SPI_DEVICE 2 #define SPI_DEVICE 2
#define ONBOARD_SPI_DEVICE 2
#define SDSS SD_SS_PIN
#define SDCARD_CONNECTION ONBOARD
#define SD_DETECT_PIN PC10 #define SD_DETECT_PIN PC10
#define ONBOARD_SD_CS_PIN SD_SS_PIN
#define NO_SD_HOST_DRIVE
// TODO: This is the only way to set SPI for SD on STM32 (for now)
#define ENABLE_SPI2
#define CUSTOM_SPI_PINS
#define SD_SCK_PIN PB13 #define SD_SCK_PIN PB13
#define SD_MISO_PIN PB14 #define SD_MISO_PIN PB14
#define SD_MOSI_PIN PB15 #define SD_MOSI_PIN PB15

View File

@ -0,0 +1,23 @@
#
# stm32_serialbuffer.py
#
Import("env")
# Marlin has `RX_BUFFER_SIZE` and `TX_BUFFER_SIZE` to configure the
# buffer size for receiving and transmitting data respectively.
# Stm32duino uses another set of defines for the same purpose,
# so we get the values from the Marlin configuration and set
# them in `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE`.
# It is not possible to change the values at runtime, they must
# be set with build flags.
#
# The script will set the value as the default one (64 bytes)
# or the user-configured one, whichever is higher.
mf = env["MARLIN_FEATURES"]
rxBuf = str(max(64, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
txBuf = str(max(64, int(mf["TX_BUFFER_SIZE"]) if "TX_BUFFER_SIZE" in mf else 0))
build_flags = env.get('BUILD_FLAGS')
build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf)
env.Replace(BUILD_FLAGS=build_flags)

View File

@ -268,7 +268,7 @@ extra_scripts = ${common_stm32f1.extra_scripts}
# MKS Robin E3D (STM32F103RCT6) and # MKS Robin E3D (STM32F103RCT6) and
# MKS Robin E3 with TMC2209 # MKS Robin E3 with TMC2209
# #
[env:mks_robin_e3] [env:mks_robin_e3_maple]
platform = ${common_stm32f1.platform} platform = ${common_stm32f1.platform}
extends = common_stm32f1 extends = common_stm32f1
board = genericSTM32F103RC board = genericSTM32F103RC

View File

@ -31,6 +31,8 @@ build_flags = ${common.build_flags}
-DADC_RESOLUTION=12 -DADC_RESOLUTION=12
build_unflags = -std=gnu++11 build_unflags = -std=gnu++11
src_filter = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace> src_filter = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace>
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
# #
# BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3) # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3)
@ -53,7 +55,7 @@ monitor_speed = 115200
board_build.core = stm32 board_build.core = stm32
board_build.variant = MARLIN_F103Rx board_build.variant = MARLIN_F103Rx
board_build.ldscript = ldscript.ld board_build.ldscript = ldscript.ld
extra_scripts = ${common.extra_scripts} extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py
@ -136,12 +138,30 @@ build_flags = ${common_stm32.build_flags}
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${common_stm32.build_unflags} build_unflags = ${common_stm32.build_unflags}
-DUSBCON -DUSBD_USE_CDC -DUSBCON -DUSBD_USE_CDC
extra_scripts = ${common.extra_scripts} extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py
buildroot/share/PlatformIO/scripts/mks_encrypt.py buildroot/share/PlatformIO/scripts/mks_encrypt.py
lib_deps = lib_deps =
#
# MKS Robin E3/E3D (STM32F103RCT6) with TMC2209
#
[env:mks_robin_e3]
platform = ${common_stm32.platform}
extends = common_STM32F103RC
build_flags = ${common_stm32.build_flags}
-DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
monitor_speed = 115200
board_build.offset = 0x5000
board_build.encrypt = Yes
board_build.firmware = Robin_e3.bin
board_upload.offset_address = 0x08005000
debug_tool = stlink
extra_scripts = ${env:STM32F103RC.extra_scripts}
buildroot/share/PlatformIO/scripts/mks_encrypt.py
# #
# Creality (STM32F103RET6) # Creality (STM32F103RET6)
# #
@ -181,7 +201,7 @@ board_build.firmware = Robin_mini.bin
board_build.encrypt = Yes board_build.encrypt = Yes
board_upload.offset_address = 0x08007000 board_upload.offset_address = 0x08007000
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
extra_scripts = ${common.extra_scripts} extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py
buildroot/share/PlatformIO/scripts/mks_encrypt.py buildroot/share/PlatformIO/scripts/mks_encrypt.py
@ -204,7 +224,7 @@ board_upload.offset_address = 0x08007000
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
debug_tool = jlink debug_tool = jlink
upload_protocol = jlink upload_protocol = jlink
extra_scripts = ${common.extra_scripts} extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py
buildroot/share/PlatformIO/scripts/mks_encrypt.py buildroot/share/PlatformIO/scripts/mks_encrypt.py
@ -222,6 +242,6 @@ board_build.ldscript = ldscript.ld
board_build.offset = 0x10000 board_build.offset = 0x10000
build_flags = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 build_flags = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
extra_scripts = ${common.extra_scripts} extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py