I'm currently trying to test some old NVSRAMs
to make sure they work before I put them to use. Id like to test them independently and I'm thinking a arduino might do the trick. In theory, should a arduino mega be able to handle this?
PORTC = DQ0-DQ7
PORTA = A0-A7
#define E 2
#define G 3
#define W 4
void fillOne();
void setup() {
Serial.begin(9600);
pinMode(E, OUTPUT);
pinMode(G, OUTPUT);
pinMode(W, OUTPUT);
DDRA = B11111111; // sets port a to output
DDRC = B11111111; // set port c to output
digitalWrite(E, HIGH);
digitalWrite(G, HIGH);
digitalWrite(W, HIGH);
}
void loop() {
fillOne();
}
//Test One
void fillOne()
{
int fail = 0;
int address = 0;
PORTC = B11111111; // Sets Dataline to one
Serial.print("Test Start");
for (address = 0; address < 256; address++)
{
PORTA = address;
digitalWrite(W, LOW);
digitalWrite(E, LOW);
digitalWrite(W, HIGH);
}
//Read Back and check for One
// Sets Datalines to one
digitalWrite(W, HIGH);
digitalWrite(E, HIGH);
PORTC = 0x00;
DDRC = 0x00;
for(address = 0; address < 256; address++)
{
PORTA = address;
digitalWrite(G, LOW);
digitalWrite(E, LOW);
if(PORTC != B11111111)
fail ++;
digitalWrite(G, HIGH);
}
if(fail > 0)
{
Serial.print("FAIL");
Serial.print(fail);
while(1);
}
Serial.print("PASS");
while(1);
}
Update: I set it up to only use A0-A7 until I get it working, then will expand to other bits. I'm also only programming it with 1's so it's easier to debug for now. It's not quite working, I think it's the addressing.. I have Address set to a INT and it's going from 0 to 256.. If I send the int to a PORT, it should send out that number in binary, correct?
Best Answer
Yes, you should be able to do that. The part you are using requires 21 pins for addressing, 8 pins for data, and a couple of pins for write enable and so forth. The Arduino Mega has 54 digital IO pins, so you should be able to pretty much just wire it up and go.
Things you should verify though: check the expected voltages for the pins on the SRAM to see how they define high/low logic levels, and make sure that corresponds to what your Arduino is sending. Worst case you might need some level conversion in between. You might also need pulldown resistors on the SRAM pins to make sure things are 0 when you expect them to be. And check the internal resistance / current draw on the chip to make sure it doesn't try to sink more current than the Arduino digital IO pins can deliver. Otherwise it could damage the Arduino.