From 7a60862a6dfc8f41692351fe5675b92214a31e40 Mon Sep 17 00:00:00 2001 From: Tom Nisbet Date: Mon, 24 Aug 2020 19:55:06 -0400 Subject: [PATCH] Issue #14 - consume the ACK to the xmodem EOT when sending files. --- TommyPROM/TommyPROM.ino | 2 +- TommyPROM/XModem.cpp | 12 +++++++++--- docs/index.md | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/TommyPROM/TommyPROM.ino b/TommyPROM/TommyPROM.ino index 4f52dbc..ae71fa6 100644 --- a/TommyPROM/TommyPROM.ino +++ b/TommyPROM/TommyPROM.ino @@ -19,7 +19,7 @@ #include "XModem.h" -static const char * MY_VERSION = "2.1"; +static const char * MY_VERSION = "2.2"; // Global status diff --git a/TommyPROM/XModem.cpp b/TommyPROM/XModem.cpp index df418a8..150bd93 100644 --- a/TommyPROM/XModem.cpp +++ b/TommyPROM/XModem.cpp @@ -103,7 +103,16 @@ bool XModem::SendFile(uint32_t address, uint32_t fileSize) bytesSent += PKTLEN; } + // Signal end of transfer and process the ACK Serial.write(XMDM_EOT); + rxChar = GetChar(5000); + if (rxChar != XMDM_ACK) + { + cmdStatus.error("Expected XModem ACK to EOT, but received:"); + cmdStatus.setValueDec(0, "char", rxChar); + return false; + } + return true; } @@ -247,6 +256,3 @@ void XModem::SendPacket(uint32_t address, uint8_t seq) Serial.write(crc >> 8); Serial.write(crc & 0xff); } - - - diff --git a/docs/index.md b/docs/index.md index 8dcffc9..123265e 100755 --- a/docs/index.md +++ b/docs/index.md @@ -70,6 +70,10 @@ program, such as TeraTerm (Windows) or Minicom (Linux). The Arduino development Monitor can also be used as a terminal initially, but it does not support XMODEM transfers, so the READ and WRITE commands can't be used. +When using minicom, a few parameters need to be set. Disable both hardware and software +flow control. Also add the '-c' command line option to the two xmodem settings to enable +CRC mode for the file transfers. + Set the terminal's serial parameters to 115200 baud, 8 bits, no parity, 1 stop bit to match the Arduino. Press the Enter key. If the connection is successful, TommyPROM will display a menu of options.