update 27_CE algorithm for overwrite pulses

This commit is contained in:
Tom Nisbet 2024-05-03 23:04:59 -04:00
parent 7d40ea6705
commit 18bb15bec6
4 changed files with 40 additions and 7 deletions

View File

@ -130,7 +130,7 @@ bool PromDevice27::burnByteWE(byte value, uint32_t address)
writeDataBus(value);
delayMicroseconds(1);
enableWrite();
myDelay(mPulseWidthUsec * mOverwriteMultiplier);
myDelay(mPulseWidthUsec * mOverwriteMultiplier * (writeCount + 1));
disableWrite();
}
@ -179,9 +179,20 @@ bool PromDevice27::burnByteCE(byte value, uint32_t address)
enableOutput();
status = readDataBus() == value;
disableOutput();
} else {
status = true;
}
}
if (status && (mOverwriteMultiplier > 0)) {
setDataBusMode(OUTPUT);
writeDataBus(value);
delayMicroseconds(1);
enableChip();
myDelay(mPulseWidthUsec * mOverwriteMultiplier * (writeCount + 1));
disableChip();
}
setDataBusMode(INPUT);
disableChip();
return status;
@ -244,15 +255,15 @@ ERET PromDevice27::erase(uint32_t start, uint32_t end)
}
void PromDevice27::myDelay(unsigned int us)
void PromDevice27::myDelay(uint32_t us)
{
if (us > 16000) {
// The delayMicroseconds code can't do delays longer than 16ms, so use the
// ms delay code for larger values. This rounds down to the nearest ms, so
// it is not possible to delay for 40.5 ms, for example.
delay(us / 1000);
delay(uint16_t(us / 1000));
} else {
delayMicroseconds((unsigned int) us);
delayMicroseconds(uint16_t(us));
}
}

View File

@ -50,7 +50,7 @@ class PromDevice27 : public PromDevice
bool burnByteWE(byte value, uint32_t address);
bool burnByteCE(byte value, uint32_t address);
void myDelay(unsigned int us);
void myDelay(uint32_t us);
E27C_PGM mPgmType;
unsigned long mPulseWidthUsec;

View File

@ -19,7 +19,7 @@
#include "XModem.h"
static const char * MY_VERSION = "3.6";
static const char * MY_VERSION = "3.7";
// Global status
@ -49,6 +49,7 @@ PromDevice28C prom(32 * 1024L, 64, 10, true);
//PromDevice27 prom(8 * 1024L, E27C_PGM_WE, 1000L, 15, 4); // 2764 with SEEQ intelligent programming
//PromDevice27 prom(32 * 1024L, E27C_PGM_WE, 1000L, 25, 3); // 27C256 with SEEQ intelligent programming
PromDevice27 prom(32 * 1024L, E27C_PGM_CE, 100L, 25, 0); // M27C256 with Presto II intelligent programming
//PromDevice27 prom(32 * 1024L, E27C_PGM_CE, 1000L, 25, 3); // M27256 with fast programming
//PromDevice27 prom(2 * 1024L, E27C_PGM_WE, 50000L, 1, 0); // 2716 with single 50ms write
//PromDevice27 prom(512 * 1024L, E27C_PGM_CE, 100L, 11, 0); // 27C040 with Atmel rapid programming, CE connected to CE#/PGM#
//PromDevice27 prom(32 * 1024L, E27C_PGM_CE, 100L, 25, 0); // W27C257/W27E257 with 100uS program pulse on CE
@ -337,6 +338,7 @@ bool checkForBreak()
word checksumBlock(uint32_t start, uint32_t end)
{
word checksum = 0;
#if 1
for (uint32_t addr = start; (addr <= end); addr += 2)
{
word w = prom.readData(addr);
@ -344,6 +346,25 @@ word checksumBlock(uint32_t start, uint32_t end)
w |= prom.readData(addr + 1);
checksum += w;
}
#else
uint16_t crc = 0xffff;
for (uint32_t addr = start; (addr <= end); addr++)
{
crc = crc ^ (uint16_t(prom.readData(addr)) << 8);
for (int ix = 0; (ix < 8); ix++)
{
if (crc & 0x8000)
{
crc = (crc << 1) ^ 0x1021;
}
else
{
crc <<= 1;
}
}
}
checksum = crc;
#endif
return checksum;
}

View File

@ -30,3 +30,4 @@ exerpt: "What's New in TommyPROM"
|3.4 |2024-04-09 |Support 2316,2332, and 2364 mask-programmed ROMs|
|3.5 |2024-04-12 |jcranes's updates to CLI for better parameter defaults and additional error checking|
|3.6 |2024-04-23 |Remove debug commands by default - can be enabled in Configure.h|
|3.7 |2024-05-03 |Change overwrite algorithm for 27 series to match SEEQ and M27256 datasheets|