From c68154702669ab337c9535b687bb3c9aebcffaac Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 4 Mar 2012 12:03:02 -0800 Subject: [PATCH] Fixed bug that screwed up reading after doing an electrical test. --- .settings/de.innot.avreclipse.core.prefs | 4 +-- tests/simm_electrical_test.c | 38 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.settings/de.innot.avreclipse.core.prefs b/.settings/de.innot.avreclipse.core.prefs index aa3eb6e..b395909 100644 --- a/.settings/de.innot.avreclipse.core.prefs +++ b/.settings/de.innot.avreclipse.core.prefs @@ -1,4 +1,4 @@ -#Sat Dec 24 19:28:57 PST 2011 +#Sat Mar 03 13:46:14 PST 2012 avrtarget/ClockFrequency=16000000 avrtarget/ExtRAMSize=0 avrtarget/ExtendedRAM=false @@ -21,7 +21,7 @@ avrtarget/avrdude/Locks/FileName= avrtarget/avrdude/Locks/MCUid=at90usb646 avrtarget/avrdude/Locks/UseFile=false avrtarget/avrdude/Locks/Write=false -avrtarget/avrdude/NoChipErase=true +avrtarget/avrdude/NoChipErase=false avrtarget/avrdude/NoSigCheck=false avrtarget/avrdude/NoVerify=false avrtarget/avrdude/NoWrite=false diff --git a/tests/simm_electrical_test.c b/tests/simm_electrical_test.c index 94c79d3..3ba91e1 100644 --- a/tests/simm_electrical_test.c +++ b/tests/simm_electrical_test.c @@ -334,6 +334,44 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t)) testPin++; } + // Restore to a normal state. Disable any pull-ups, return CS/OE/WE to outputs, + // deassert them all, set data as an input, set address as an input, + // assert CS and OE. Should be a pretty normal state. + + // To start, make everything an input so we can disable pullups. + Ports_SetCSDDR(false); + Ports_SetOEDDR(false); + Ports_SetWEDDR(false); + Ports_SetAddressDDR(0); + Ports_SetDataDDR(0); + + // Disable pullups + + Ports_SetCSPullup(false); + Ports_SetOEPullup(false); + Ports_SetWEPullup(false); + Ports_AddressPullups_RMW(0, SIMM_ADDRESS_PINS_MASK); + Ports_DataPullups_RMW(0, SIMM_DATA_PINS_MASK); + + // Set control lines to deasserted outputs (remember ON is deasserted) + Ports_SetCSDDR(true); + Ports_SetOEDDR(true); + Ports_SetWEDDR(true); + Ports_SetCSOut(true); + Ports_SetOEOut(true); + Ports_SetWEOut(true); + + // Set address lines to outputs and set the outputted address to zero + Ports_SetAddressDDR(SIMM_ADDRESS_PINS_MASK); + Ports_SetAddressOut(0); + + // Leave data lines as inputs...(they're already inputs so do nothing...) + + // Now assert CS and OE so we're in normal "read" mode + Ports_SetCSOut(false); + Ports_SetOEOut(false); + + // Now that the final state is restored, return the number of errors found return numErrors; }