From 3e5485de924b8e9f21c851e037d156a7cef9d2e0 Mon Sep 17 00:00:00 2001 From: etagle Date: Tue, 8 Aug 2017 02:30:04 -0300 Subject: [PATCH] Enforcing requirements so XON/XOFF software handshake works and no drops of data are experienced while transferring data to an SD Card. I tested this with a CH340 USB to serial adapter (quite typical) at baudrates as high as 1000000 on a Atmega2560 running at 16Mhz, with no problems at all. We need a 1024 byte RX buffer. Less than that and we will have drops, higher than that is not needed --- Marlin/MarlinSerial.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h index 8456a7237..1be94d656 100644 --- a/Marlin/MarlinSerial.h +++ b/Marlin/MarlinSerial.h @@ -84,6 +84,9 @@ #ifndef RX_BUFFER_SIZE #define RX_BUFFER_SIZE 128 #endif + #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 + #error "XON/XOFF requires a 1024 or greater RX_BUFFER_SIZE for allowing reliable transfers without drops" + #endif #ifndef TX_BUFFER_SIZE #define TX_BUFFER_SIZE 32 #endif