1
\$\begingroup\$

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?

\$\endgroup\$
5
  • \$\begingroup\$ If it's got enough I/O pins for all the address, data and control signals, yes of course. If it hasn't, you need to add more (perhaps using shift registers to store address bits) \$\endgroup\$
    – user16324
    Commented Sep 21, 2016 at 16:03
  • \$\begingroup\$ For what it's worth: if the modules are really old, the batteries are likely dead. \$\endgroup\$
    – user39382
    Commented Sep 21, 2016 at 16:20
  • \$\begingroup\$ This is another question but I'm not that familiar with memory. What does the "valid" mean in the datasheet I linked. E.g, "Address valid to output valid". I'm working on the timing and will upload some code in a bit for clarity. \$\endgroup\$
    – hybridchem
    Commented Sep 21, 2016 at 17:42
  • \$\begingroup\$ 'valid' means just what it says - output data will be correct when the address has been stable for a certain period of time (much less time than the Arduino will take between setting up the address and reading the data). \$\endgroup\$ Commented Sep 21, 2016 at 18:35
  • \$\begingroup\$ Testing one bit at a time or in bytes will work, but either way you must test every bit for storing both '1' and '0'. So write alternating patterns to each address eg. 0x55 and 0xAA. \$\endgroup\$ Commented Sep 23, 2016 at 20:31

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

No reason why it wouldn't work. It just requires a lot of pins. Depending on the number of I/O pins your chip has, you may have to use port expanders, shift registers, latches/flip flops, or other components to get enough pins. One common method for interfacing with RAMs with wide address buses is to use address latches to multiplex the high order address lines with the low order address lines.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.