diff --git a/delay.c b/delay.c new file mode 100644 index 0000000..a04a45b --- /dev/null +++ b/delay.c @@ -0,0 +1,8 @@ +/* + * delay.c + * + * Created on: Dec 4, 2011 + * Author: Doug + */ + +#include "delay.h" diff --git a/delay.h b/delay.h new file mode 100644 index 0000000..7841e05 --- /dev/null +++ b/delay.h @@ -0,0 +1,15 @@ +/* + * delay.h + * + * Created on: Dec 4, 2011 + * Author: Doug + */ + +#ifndef DELAY_H_ +#define DELAY_H_ + +#include + +#define DelayMS(ms) _delay_ms(ms) + +#endif /* DELAY_H_ */ diff --git a/tests/simm_electrical_test.c b/tests/simm_electrical_test.c index c8e569a..91f606a 100644 --- a/tests/simm_electrical_test.c +++ b/tests/simm_electrical_test.c @@ -7,6 +7,7 @@ #include "simm_electrical_test.h" #include "../ports.h" +#include "../delay.h" #define SIMM_HIGHEST_ADDRESS_LINE 18 #define SIMM_ADDRESS_PINS_MASK ((1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1) @@ -14,6 +15,8 @@ #define SIMM_HIGHEST_DATA_LINE 31 #define SIMM_DATA_PINS_MASK (0xFFFFFFFFUL) +#define DELAY_SETTLE_TIME_MS 5 + typedef enum ElectricalTestStage { TestingAddressLines, @@ -38,7 +41,7 @@ int SIMMElectricalTest_Run(void) Ports_AddressPullups_RMW(SIMM_ADDRESS_PINS_MASK, SIMM_ADDRESS_PINS_MASK); Ports_DataPullups_RMW(SIMM_DATA_PINS_MASK, SIMM_DATA_PINS_MASK); - // TODO: Wait a sec? + DelayMS(DELAY_SETTLE_TIME_MS); if (Ports_ReadAddress() != SIMM_ADDRESS_PINS_MASK) { @@ -127,7 +130,8 @@ int SIMMElectricalTest_Run(void) // OK, so now we have set up all lines as needed. Exactly one pin is outputting a 0, and all other pins // are inputs with pull-ups enabled. Read back all the lines, and if any pin reads back as 0, // it means that pin is shorted to the pin we are testing (overpowering its pullup) - // TODO: Wait a bit here for things to settle? + + DelayMS(DELAY_SETTLE_TIME_MS); uint32_t readback = Ports_ReadAddress(); if (curStage == TestingAddressLines)