Robin Nano v1 CDC (USB mod) (#24619)

This commit is contained in:
EvilGremlin 2022-08-22 18:31:02 +03:00 committed by Scott Lahteine
parent d94a41527f
commit a31e65e30b
12 changed files with 123 additions and 41 deletions

View File

@ -512,9 +512,9 @@
#elif MB(MKS_ROBIN_MINI)
#include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini env:mks_robin_mini_maple
#elif MB(MKS_ROBIN_NANO)
#include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano35 env:mks_robin_nano35_maple
#include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple env:mks_robin_nano_v1_2_usbmod
#elif MB(MKS_ROBIN_NANO_V2)
#include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano35 env:mks_robin_nano35_maple
#include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano3_v1v2_maple
#elif MB(MKS_ROBIN_LITE)
#include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite env:mks_robin_lite_maple
#elif MB(MKS_ROBIN_LITE3)
@ -694,7 +694,7 @@
#elif MB(OPULO_LUMEN_REV3)
#include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3
#elif MB(MKS_ROBIN_NANO_V1_3_F4)
#include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4
#include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 env:mks_robin_nano_v1_3_f4_usbmod
#elif MB(MKS_EAGLE)
#include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle
#elif MB(ARTILLERY_RUBY)

View File

@ -35,7 +35,9 @@
#define BOARD_INFO_NAME "MKS Robin nano V2.0"
#define BOARD_NO_NATIVE_USB
#ifndef USB_MOD
#define BOARD_NO_NATIVE_USB
#endif
#define USES_DIAG_PINS
// Avoid conflict with TIMER_SERVO when using the STM32 HAL

View File

@ -29,7 +29,9 @@
#error "MKS Robin nano boards support up to 2 hotends / E steppers."
#endif
#define BOARD_NO_NATIVE_USB
#ifndef USB_MOD
#define BOARD_NO_NATIVE_USB
#endif
// Avoid conflict with TIMER_SERVO when using the STM32 HAL
#define TEMP_TIMER 5
@ -58,9 +60,14 @@
// Limit Switches
//
#define X_STOP_PIN PA15
#define Y_STOP_PIN PA12
#define Z_MIN_PIN PA11
#define Z_MAX_PIN PC4
#ifndef USB_MOD
#define Y_STOP_PIN PA12
#define Z_MIN_PIN PA11
#else
#define Y_STOP_PIN PB10
#define Z_MIN_PIN PB11
#endif
//
// Steppers

View File

@ -53,8 +53,13 @@ if pioutil.is_pio_build():
#
if 'rename' in board_keys:
# If FIRMWARE_BIN is defined by config, override all
mf = env["MARLIN_FEATURES"]
if "FIRMWARE_BIN" in mf: new_name = mf["FIRMWARE_BIN"]
else: new_name = board.get("build.rename")
def rename_target(source, target, env):
from pathlib import Path
Path(target[0].path).replace(Path(target[0].dir.path, board.get("build.rename")))
Path(target[0].path).replace(Path(target[0].dir.path, new_name))
marlin.add_post_action(rename_target)

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Build tests for MKS Robin nano
# (STM32F1 genericSTM32F103VE)
#
# exit on first failure
set -e
#
# MKS/ZNP Robin nano v1.2 Emulated DOGM FSMC and native USB mod
#
use_example_configs Mks/Robin
opt_add USB_MOD
opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO SERIAL_PORT -1
exec_test $1 $2 "MKS/ZNP Robin nano v1.2 Emulated DOGM FSMC and native USB mod" "$3"
# cleanup
restore_configs

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Build tests for MKS Robin nano
# (STM32F4 genericSTM32F407VE)
#
# exit on first failure
set -e
#
# MKS/ZNP Robin nano v1.3 Emulated DOGM FSMC and native USB mod
#
use_example_configs Mks/Robin
opt_add USB_MOD
opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V1_3_F4 SERIAL_PORT -1
exec_test $1 $2 "MKS/ZNP Robin nano v1.3 Emulated DOGM FSMC and native USB mod" "$3"
# cleanup
restore_configs

View File

@ -56,3 +56,11 @@ extends = renamed
[env:STM32F103VE_GTM32]
# Renamed to STM32F103VE_GTM32_maple
extends = renamed
[env:mks_robin_nano_35]
# Renamed to mks_robin_nano_v1v2
extends = renamed
[env:mks_robin_nano_35_maple]
# Renamed to mks_robin_nano_v1v2_maple
extends = renamed

View File

@ -203,17 +203,15 @@ board_build.ldscript = mks_robin_mini.ld
build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103VE
#
# MKS Robin Nano (STM32F103VET6)
# MKS Robin Nano v1.x and v2 (STM32F103VET6)
#
[env:mks_robin_nano35_maple]
[env:mks_robin_nano_v1v2_maple]
extends = STM32F1_maple
board = genericSTM32F103VE
board_build.address = 0x08007000
board_build.rename = Robin_nano35.bin
board_build.ldscript = mks_robin_nano.ld
build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4
debug_tool = jlink
upload_protocol = jlink
#
# MKS Robin (STM32F103ZET6)

View File

@ -216,23 +216,35 @@ build_flags = ${stm32_variant.build_flags}
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
#
# MKS Robin Nano V1.2 and V2
#
[env:mks_robin_nano35]
[mks_robin_nano_v1v2_common]
extends = stm32_variant
board = genericSTM32F103VE
board_build.variant = MARLIN_F103Vx
board_build.encrypt_mks = Robin_nano35.bin
board_build.offset = 0x7000
board_upload.offset_address = 0x08007000
debug_tool = stlink
upload_protocol = stlink
#
# MKS Robin Nano V1.2 and V2
#
[env:mks_robin_nano_v1v2]
extends = mks_robin_nano_v1v2_common
build_flags = ${stm32_variant.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3
-DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
debug_tool = jlink
upload_protocol = jlink
#
# MKS/ZNP Robin Nano v1.2 with native USB modification
#
[env:mks_robin_nano_v1_2_usbmod]
extends = mks_robin_nano_v1v2_common
build_flags = ${common_stm32.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4
-DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2
#
# Mingda MPX_ARM_MINI

View File

@ -570,42 +570,54 @@ board_upload.offset_address = 0x0800C000
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/openblt.py
#
# BOARD_MKS_ROBIN_NANO_V1_3_F4
# - MKS Robin Nano V1.3 (STM32F407VET6) 5 Pololu Plug
# - MKS Robin Nano-S V1.3 (STM32F407VET6) 4 TMC2225 + 1 Pololu Plug
#
[env:mks_robin_nano_v1_3_f4]
[mks_robin_nano_v1_3_f4_common]
extends = stm32_variant
board = marlin_STM32F407VGT6_CCM
board_build.variant = MARLIN_F4x7Vx
board_build.offset = 0x8000
board_upload.offset_address = 0x08008000
board_build.rename = Robin_nano35.bin
build_flags = ${stm32_variant.build_flags}
-DMCU_STM32F407VE -DSS_TIMER=4 -DENABLE_HWSERIAL3
-DSTM32_FLASH_SIZE=512
-DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2
-DHAL_SD_MODULE_ENABLED
-DHAL_SRAM_MODULE_ENABLED
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
debug_tool = jlink
upload_protocol = jlink
#
# BOARD_MKS_ROBIN_NANO_V1_3_F4
# - MKS Robin Nano V1.3 (STM32F407VET6, 5 Pololu Plug)
# - MKS Robin Nano-S V1.3 (STM32F407VET6, 4 TMC2225, 1 Pololu Plug)
# - ZNP Robin Nano V1.3 (STM32F407VET6, 2 TMC2208, 2 A4988, 1x Polulu plug)
#
[env:mks_robin_nano_v1_3_f4]
extends = mks_robin_nano_v1_3_f4_common
build_flags = ${stm32_variant.build_flags}
-DMCU_STM32F407VE -DENABLE_HWSERIAL3 -DSTM32_FLASH_SIZE=512
-DTIMER_SERVO=TIM2 -DTIMER_TONE=TIM3 -DSS_TIMER=4
-DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
#
# MKS/ZNP Robin Nano V1.3 with native USB mod
#
[env:mks_robin_nano_v1_3_f4_usbmod]
extends = mks_robin_nano_v1_3_f4_common
build_flags = ${stm32_variant.build_flags}
-DMCU_STM32F407VE -DSTM32_FLASH_SIZE=512
-DTIMER_SERVO=TIM2 -DTIMER_TONE=TIM3 -DSS_TIMER=4
-DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED
#
# Artillery Ruby
#
[env:Artillery_Ruby]
extends = common_stm32
board = marlin_Artillery_Ruby
build_flags = ${common_stm32.build_flags}
-DSTM32F401xC -DTARGET_STM32F4 -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
-DUSB_PRODUCT=\"Artillery_3D_Printer\"
-DFLASH_DATA_SECTOR=1U -DFLASH_BASE_ADDRESS=0x08004000
extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
extends = common_stm32
board = marlin_Artillery_Ruby
build_flags = ${common_stm32.build_flags}
-DSTM32F401xC -DTARGET_STM32F4 -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
-DUSB_PRODUCT=\"Artillery_3D_Printer\"
-DFLASH_DATA_SECTOR=1U -DFLASH_BASE_ADDRESS=0x08004000
extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
#
# Ender-3 S1 STM32F401RC_creality