File transfer default back to XModem-CRC for #20

This commit is contained in:
Tom Nisbet 2020-11-11 17:46:31 -05:00
parent b131fbe8ae
commit ec4686bfa0
5 changed files with 30 additions and 9 deletions

View File

@ -71,6 +71,7 @@ void PromDevice::resetDebugStats() {
debugLastAddress = 0;
debugLastExpected = 0;
debugLastReadback = 0;
debugStartChar = 0;
}
void PromDevice::printDebugStats() {
Serial.print(F("debugBlockWrites: "));
@ -81,6 +82,8 @@ void PromDevice::printDebugStats() {
Serial.println(debugLastExpected, HEX);
Serial.print(F("debugLastReadback: "));
Serial.println(debugLastReadback, HEX);
Serial.print(F("debugStartChar: "));
Serial.println(debugStartChar, HEX);
}
// BEGIN PRIVATE METHODS

View File

@ -28,17 +28,18 @@ class PromDevice
virtual void disableSoftwareWriteProtect() {}
virtual void enableSoftwareWriteProtect() {}
uint32_t debugBlockWrites; // Number of block write operations
uint32_t debugLastAddress; // Last address with an issue
uint8_t debugLastExpected; // Last expected readback value
uint8_t debugLastReadback; // Last actual readback value
uint8_t debugStartChar; // XModem start char sent or received
protected:
uint32_t mSize; // Size of the device, in bytes
unsigned int mBlockSize; // Block size for page writes, zero if N/A
unsigned int mMaxWriteTime; // Max time (in ms) to wait for write cycle to complete
bool mSupportsDataPoll; // End of write detected by data polling
uint32_t debugBlockWrites; // Number of block write operations
uint32_t debugLastAddress; // Last address with an issue
uint8_t debugLastExpected; // Last expected readback value
uint8_t debugLastReadback; // Last actual readback value
void setDataBusMode(uint8_t mode);
byte readDataBus();
void writeDataBus(byte data);

View File

@ -19,7 +19,7 @@
#include "XModem.h"
static const char * MY_VERSION = "2.5";
static const char * MY_VERSION = "2.6";
// Global status
@ -399,7 +399,7 @@ void fillBlock(uint32_t start, uint32_t end, byte val)
for (uint32_t addr = start; (addr <= end); addr += BLOCK_SIZE)
{
uint32_t writeLen = ((end - addr + 1) < BLOCK_SIZE) ? (end - addr + 1) : BLOCK_SIZE;
uint32_t writeLen = ((end - addr + 1) < BLOCK_SIZE) ? (end - addr + 1) : uint32_t(BLOCK_SIZE);
if (!prom.writeData(block, writeLen, addr))
{
cmdStatus.error("Write failed");

View File

@ -9,7 +9,10 @@
// they did over the long distance dail-up lines that XModem was designed for. Uncomment
// the XMODEM_CRC_PROTOCOL line below to restore the original XMODEM CRC support.
//#define XMODEM_CRC_PROTOCOL
// Update!!! - Teraterm does not seem to like sending files to TommyPROM with plain
// XModem, so the default is back to CRC. For Linux, comment out the line below to use
// checksum.
#define XMODEM_CRC_PROTOCOL
enum
{
@ -126,6 +129,7 @@ bool XModem::SendFile(uint32_t address, uint32_t fileSize)
{
rxChar = GetChar();
}
promDevice.debugStartChar = rxChar;
if (rxChar != XMDM_TRANSFER_START)
{
#ifdef XMODEM_CRC_PROTOCOL
@ -222,6 +226,7 @@ bool XModem::StartReceive()
// seconds. If nothing is received in that time then return false to indicate
// that the transfer did not start.
Serial.write(XMDM_TRANSFER_START);
promDevice.debugStartChar = XMDM_TRANSFER_START;
for (int ms = 1000; (ms); --ms)
{
if (Serial.available() > 0)
@ -312,6 +317,7 @@ void XModem::SendPacket(uint32_t address, uint8_t seq)
Serial.write(c);
crc = UpdateCrc(crc, c);
}
#ifdef XMODEM_CRC_PROTOCOL
Serial.write(crc >> 8);
#endif

View File

@ -94,11 +94,22 @@ received file size.
Once the READ or WRITE command is issued to the programmer, the transfer must
be started on the host program.
Note that previous versions of TommyPROM used the XMODEM-CRC protocol to complete the file
~~Note that previous versions of TommyPROM used the XMODEM-CRC protocol to complete the file
transfers for the READ and WRITE commands. This did not work well with minicom and other
Linux programs that rely on the sz/rz commands. Versions 2.5 and later of TommyPROM now
use basic XModem with the 8-bit checksum. The XModem-CRC support is still available as a
compile-time option. See [issue #19](https://github.com/TomNisbet/TommyPROM/issues/19)
for details.~~
**UPDATE: XModem troubles continue!**
It seems that TeraTerm does not like to send files to TommyPROM in XModem checksum mode.
The default transfer has been restored to XModem-CRC mode.
* For TeraTerm, be sure to select the XModem-CRC option in the dialog box when receiving files.
* For Linux/minicom, comment out the XMODEM_CRC_PROTOCOL in XModem.cpp and use checksum mode.
Given that there are now problems with both minicomm and TeraTerm, it seems likely that the
actual problem lies somewhere in the TommyPROM code. See [issue #20](https://github.com/TomNisbet/TommyPROM/issues/20)
for details.
The files used for READ and WRITE are simple binary images. This can be created directly