Issue #14 - consume the ACK to the xmodem EOT when sending files.

This commit is contained in:
Tom Nisbet 2020-08-24 19:55:06 -04:00
parent f17bc110aa
commit 7a60862a6d
3 changed files with 14 additions and 4 deletions

View File

@ -19,7 +19,7 @@
#include "XModem.h" #include "XModem.h"
static const char * MY_VERSION = "2.1"; static const char * MY_VERSION = "2.2";
// Global status // Global status

View File

@ -103,7 +103,16 @@ bool XModem::SendFile(uint32_t address, uint32_t fileSize)
bytesSent += PKTLEN; bytesSent += PKTLEN;
} }
// Signal end of transfer and process the ACK
Serial.write(XMDM_EOT); 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; return true;
} }
@ -247,6 +256,3 @@ void XModem::SendPacket(uint32_t address, uint8_t seq)
Serial.write(crc >> 8); Serial.write(crc >> 8);
Serial.write(crc & 0xff); Serial.write(crc & 0xff);
} }

View File

@ -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 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. 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 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 match the Arduino. Press the Enter key. If the connection is successful, TommyPROM will
display a menu of options. display a menu of options.