Got rid of my weird "inverse data" hack for verification and turned on

the pull-up resistors on every read instead. That's a better technique
and also makes other things more consistent -- e.g. reading back 0xFF
if a chip identification is attempted when a chip isn't installed.
This commit is contained in:
Doug Brown 2012-09-30 20:58:07 -07:00
parent 2c8e7e7184
commit d484d126e5
1 changed files with 3 additions and 9 deletions

View File

@ -88,6 +88,9 @@ void ExternalMem_SetAddressAndData(uint32_t address, uint32_t data)
void ExternalMem_SetDataAsInput(void)
{
Ports_SetDataDDR(0);
// enable pull-ups as well -- this will give default values if a chip is
// not responding.
Ports_DataPullups_RMW(0xFFFFFFFFUL, 0xFFFFFFFFUL);
}
uint32_t ExternalMem_ReadData(void)
@ -346,15 +349,6 @@ 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...