Fixed the problem that caused no chip present to verify OK after a write

The problem was that the data bus would "remember" the last data I wrote
to it if a chip was not driving the data bus on a read, so it would
think that the chip had returned the correct data. I fixed it by writing
the opposite data to the data bus before a verification read.
This commit is contained in:
Doug Brown 2012-09-30 16:27:01 -07:00
parent 667c2c5a2d
commit 2c8e7e7184
1 changed files with 9 additions and 0 deletions

View File

@ -346,6 +346,15 @@ uint8_t ExternalMem_Write(uint32_t startAddress, uint32_t *buf, uint32_t len, ui
ExternalMem_WriteByteToChips(startAddress, *buf, chipsMask);
if (doVerify)
{
// Write the opposite data to the data bus before attempting to read
// the chips for verification. At this point, the OE and WE lines
// will be deasserted (due to WriteByteToChips()) so writing a value
// to the data bus won't do anything. But if there's no chip on
// a data line, reading back seems to "remember" the last value
// written. So writing the opposite of what we expect will ensure
// that the readback will fail if a chip isn't responding.
ExternalMem_SetData(~(*buf));
#define VERIFY_EXTRA_READ_TRIES 2
// Read back the word we just wrote to make sure it's OK...