Skip to content

Commit

Permalink
✨ Robin Nano v1 CDC (USB mod) (MarlinFirmware#24619)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilGremlin authored and Andy-Big committed Jun 30, 2023
1 parent 674f6d5 commit a018840
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 13 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
#- mks_robin_maple
- mks_robin_lite_maple
- mks_robin_pro_maple
#- mks_robin_nano35_maple
#- mks_robin_nano_v1v2_maple
#- STM32F103RE_creality_maple
- STM32F103VE_ZM3E4V2_USB_maple

Expand All @@ -93,7 +93,9 @@ jobs:
- rumba32
- LERDGEX
- LERDGEK
- mks_robin_nano35
- mks_robin_nano_v1v2
- mks_robin_nano_v1_2_usbmod
- mks_robin_nano_v1_3_f4_usbmod
- NUCLEO_F767ZI
- REMRAM_V1
- BTT_SKR_SE_BX
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,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)
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,9 +55,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
Expand Down
10 changes: 9 additions & 1 deletion buildroot/share/PlatformIO/scripts/offset_and_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def encrypt(source, target, env):

<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
def rename_target(source, target, env):
firmware = os.path.join(target[0].dir.path, board.get("build.rename"))
Expand All @@ -84,9 +85,16 @@ def rename_target(source, target, env):
>>>>>>> 306e03b03b (🧑‍💻 Use spaces indent for Python)

=======
=======
# 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")

>>>>>>> 2a1c2e26ed (✨ Robin Nano v1 CDC (USB mod) (#24619))
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))

>>>>>>> 306e03b03b (🧑‍💻 Use spaces indent for Python)
=======
Expand Down
19 changes: 19 additions & 0 deletions buildroot/tests/mks_robin_nano_v1_3_f4_usbmod
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions buildroot/tests/mks_robin_nano_v1v2_usbmod
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions ini/renamed.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions ini/stm32f1-maple.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions ini/stm32f1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ build_flags = ${stm32_variant.build_flags}
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC

<<<<<<< HEAD
>>>>>>> 83320f1052 (✨ Bed Distance Sensor (#24554))
#
# MKS Robin Nano V1.2 and V2
Expand Down Expand Up @@ -247,12 +248,23 @@ build_unflags = ${stm32_variant.build_unflags}

[env:mks_robin_nano35]
platform = ${common_stm32.platform}
=======
[mks_robin_nano_v1v2_common]
>>>>>>> 2a1c2e26ed (✨ Robin Nano v1 CDC (USB mod) (#24619))
extends = stm32_variant
board = genericSTM32F103VE
board_build.variant = MARLIN_F103Vx
board_build.encrypt_mks = ../../../Releases/V1.1/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}
-D MCU_STM32F103VE
-D SS_TIMER=4
Expand All @@ -268,10 +280,22 @@ build_flags = ${stm32_variant.build_flags}
# -D MAXIMUM_STEPPER_RATE=35000
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
<<<<<<< HEAD
debug_tool = jlink
upload_protocol = jlink
<<<<<<< HEAD
=======
=======

#
# 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
>>>>>>> 2a1c2e26ed (✨ Robin Nano v1 CDC (USB mod) (#24619))

#
# Mingda MPX_ARM_MINI
Expand Down

0 comments on commit a018840

Please sign in to comment.