From 2bcc2ec7d1125428beb6898a527d1cc49c26ac78 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Sun, 23 Feb 2020 05:48:56 -0800 Subject: [PATCH] Reduce default TMC baudrate to 57600 with Software Serial (#16930) --- Marlin/src/module/stepper/trinamic.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 506383aa35..0b14aaf647 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -117,7 +117,16 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #endif #ifndef TMC_BAUD_RATE - #define TMC_BAUD_RATE 115200 + #if HAS_TMC_SW_SERIAL + // Reduce baud rate for boards not already overriding TMC_BAUD_RATE for software serial. + // Testing has shown that 115200 is not 100% reliable on AVR platforms, occasionally + // failing to read status properly. 32-bit platforms typically define an even lower + // TMC_BAUD_RATE, due to differences in how SoftwareSerial libraries work on different + // platforms. + #define TMC_BAUD_RATE 57600 + #else + #define TMC_BAUD_RATE 115200 + #endif #endif #if HAS_DRIVER(TMC2130)