Fixed a bug in the address line tests, updated fusebits for now [with no bootloader yet], started working on getting all the tests working

This commit is contained in:
Doug Brown 2011-12-07 21:17:47 -08:00
parent bfeadc7e3a
commit b475c28040
5 changed files with 53 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#Fri Nov 25 16:20:41 PST 2011 #Wed Dec 07 17:06:43 PST 2011
avrtarget/ClockFrequency=16000000 avrtarget/ClockFrequency=16000000
avrtarget/ExtRAMSize=0 avrtarget/ExtRAMSize=0
avrtarget/ExtendedRAM=false avrtarget/ExtendedRAM=false
@ -11,7 +11,7 @@ avrtarget/avrdude/EEPROMFile=
avrtarget/avrdude/EEPROMFromConfig=true avrtarget/avrdude/EEPROMFromConfig=true
avrtarget/avrdude/FlashFile= avrtarget/avrdude/FlashFile=
avrtarget/avrdude/FlashFromConfig=true avrtarget/avrdude/FlashFromConfig=true
avrtarget/avrdude/Fuses/ByteValues=223\:210\:248 avrtarget/avrdude/Fuses/ByteValues=223\:211\:248
avrtarget/avrdude/Fuses/FileName= avrtarget/avrdude/Fuses/FileName=
avrtarget/avrdude/Fuses/MCUid=at90usb646 avrtarget/avrdude/Fuses/MCUid=at90usb646
avrtarget/avrdude/Fuses/UseFile=false avrtarget/avrdude/Fuses/UseFile=false

44
main.c
View File

@ -5,9 +5,51 @@
* Author: Doug * Author: Doug
*/ */
#include <avr/io.h>
#include <util/delay.h>
#include "tests/simm_electrical_test.h"
int main(void) int main(void)
{ {
while (1); DDRD |= (1 << 7);
PORTD &= ~(1 << 7);
int result = SIMMElectricalTest_Run();
if (result == 0)
{
while (1)
{
_delay_ms(200);
PIND = (1 << 7);
}
}
else
{
while (1)
{
int tmpResult = result;
while (tmpResult)
{
int thisDigit = (tmpResult % 10) + 1;
while (thisDigit--)
{
PIND = (1 << 7);
_delay_ms(500);
PIND = (1 << 7);
_delay_ms(500);
}
_delay_ms(2000);
tmpResult /= 10;
}
_delay_ms(5000);
}
}
return 0; return 0;
} }

View File

@ -7,6 +7,7 @@
#include "mcp23s17.h" #include "mcp23s17.h"
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h>
#include <stdbool.h> #include <stdbool.h>
static bool MCP23S17_Inited = false; static bool MCP23S17_Inited = false;
@ -89,6 +90,8 @@ void MCP23S17_Init()
// so it won't activate during AVR ISP programming) // so it won't activate during AVR ISP programming)
PORTB |= MCP23S17_RESET; PORTB |= MCP23S17_RESET;
_delay_ms(50);
// All done! // All done!
MCP23S17_Inited = true; MCP23S17_Inited = true;
} }

View File

@ -9,13 +9,13 @@
#include "../ports.h" #include "../ports.h"
#include "../delay.h" #include "../delay.h"
#define SIMM_HIGHEST_ADDRESS_LINE 18 #define SIMM_HIGHEST_ADDRESS_LINE 20
#define SIMM_ADDRESS_PINS_MASK ((1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1) #define SIMM_ADDRESS_PINS_MASK ((1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1)
#define SIMM_HIGHEST_DATA_LINE 31 #define SIMM_HIGHEST_DATA_LINE 31
#define SIMM_DATA_PINS_MASK (0xFFFFFFFFUL) #define SIMM_DATA_PINS_MASK (0xFFFFFFFFUL)
#define DELAY_SETTLE_TIME_MS 5 #define DELAY_SETTLE_TIME_MS 20
typedef enum ElectricalTestStage typedef enum ElectricalTestStage
{ {
@ -34,6 +34,8 @@ int SIMMElectricalTest_Run(void)
Ports_Init(); Ports_Init();
DelayMS(DELAY_SETTLE_TIME_MS);
// First check for anything shorted to ground. Set all lines as inputs with a weak pull-up resistor. // First check for anything shorted to ground. Set all lines as inputs with a weak pull-up resistor.
// Then read the values back and check for any zeros. This would indicate a short to ground. // Then read the values back and check for any zeros. This would indicate a short to ground.
Ports_SetAddressDDR(0); Ports_SetAddressDDR(0);

View File

@ -8,5 +8,6 @@
#ifndef SIMM_ELECTRICAL_TEST_H_ #ifndef SIMM_ELECTRICAL_TEST_H_
#define SIMM_ELECTRICAL_TEST_H_ #define SIMM_ELECTRICAL_TEST_H_
int SIMMElectricalTest_Run(void);
#endif /* SIMM_ELECTRICAL_TEST_H_ */ #endif /* SIMM_ELECTRICAL_TEST_H_ */