From 7455bb09b348c5126d651200f0fae9d00d78cc39 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 24 Mar 2020 16:14:30 -0500 Subject: [PATCH] Add SoftwareSerialM for MKS Robin (#17207) --- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 35 ++++++++++++++++++++++++ platformio.ini | 6 ++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index db35548e8..2f2881ee3 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -157,3 +157,38 @@ #define SDSS PD2 #define SD_DETECT_PIN -1 #endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // Unused servo pins may be repurposed with SoftwareSerialM + //#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN + //#define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN + //#define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN + //#define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN + //#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + //#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + //#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + //#define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + // Reduce baud rate for software serial reliability + #if HAS_TMC_SW_SERIAL + #define TMC_BAUD_RATE 19200 + #endif +#endif diff --git a/platformio.ini b/platformio.ini index 62582e1d9..2f3e86c31 100644 --- a/platformio.ini +++ b/platformio.ini @@ -491,7 +491,7 @@ build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py build_unflags = -std=gnu++11 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py src_filter = ${common.default_src_filter} + -lib_deps = ${common.lib_deps} +lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip lib_ignore = Adafruit NeoPixel, SPI @@ -502,10 +502,12 @@ lib_ignore = Adafruit NeoPixel, SPI platform = ststm32 board = genericSTM32F103ZE build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py - ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY + ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DSTM32_XL_DENSITY build_unflags = -std=gnu++11 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py src_filter = ${common.default_src_filter} + +lib_deps = ${common.lib_deps} + SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip lib_ignore = Adafruit NeoPixel, SPI #