Playing with Arduino and DRAM

Story

Arduino Protoshield DRAMA few weeks ago I wanted to play with DRAM. I ripped a couple of 4 Bit 4 MB DRAM circuits out from an old printer and tried to connect those to an Arduino with a handmade adapter. That was just a disaster, the legs always broke off and it was impossible to solder those back, so after a few tries I gave up and ordered some DIP-packaged KM4164B-15 64K x 1 Bit DRAM-chips from Ebay.

Datasheet: http://pdf.datasheetcatalog.com/datasheets2/66/669664_1.pdf

I connected DRAM address inputs 0-7 to Arduinos digital pins 0-7, data in to pin 8, data out to pin 9, Row address strobe to 10, Column address strobe to 11 and Read/Write control to 12.DRAM

Code

My write & read test code that first writes 1 to RAM, Reads it from RAM and prints it out and after that it does the same with a 0.

/* samsung_dram.ino
 0 A0 (Address input)
 1 A1 (Address input)
 2 A2 (Address input)
 3 A3 (Address input)
 4 A4 (Address input)
 5 A5 (Address input)
 6 A6 (Address input)
 7 A7 (Address input)
 8 D (Data in)
 9 Q (Data out)
 10 RAS (Row Address Strobe)
 11 CAS (Column Address Strobe)
 12 W (Read/Write input)
 */

 int rd; //Read data

void setup() {
 Serial.begin(9600); //start serial communication at 9600bps
 pinMode(0, OUTPUT); //Address input A0
 pinMode(1, OUTPUT); //Address input A1
 pinMode(2, OUTPUT); //Address input A2
 pinMode(3, OUTPUT); //Address input A3
 pinMode(4, OUTPUT); //Address input A4
 pinMode(5, OUTPUT); //Address input A5
 pinMode(6, OUTPUT); //Address input A6
 pinMode(7, OUTPUT); //Address input A7
 pinMode(8, OUTPUT); //Data in
 pinMode(9, INPUT); //Data out
 pinMode(10, OUTPUT); //RAS Row Address strobe
 pinMode(11, OUTPUT); //CAS Column Address strobe
 pinMode(12, OUTPUT); //Read/Write input
 //Default state
 digitalWrite(10, HIGH);
 digitalWrite(11, HIGH);
 digitalWrite(12, HIGH);
}

void loop() {
 delay(2000); //wait at least 100 microseconds

 //Test address
 digitalWrite(0, HIGH);
 digitalWrite(1, HIGH);
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, HIGH);
 digitalWrite(6, HIGH);
 digitalWrite(7, HIGH);

 //Test data
 digitalWrite(8, HIGH);
 delay(20);

 //DRAM write 1
 Serial.println("RAS to low");
 digitalWrite(10, LOW);
 Serial.println("Read/Write to Write state");
 digitalWrite(12, LOW);
 Serial.println("CAS to low");
 digitalWrite(11, LOW);
 Serial.println("Read/Write back to Read state");
 digitalWrite(12, HIGH);
 Serial.println("CAS to high");
 digitalWrite(11, HIGH);
 Serial.println("RAS to high");
 digitalWrite(10, HIGH);

 //DRAM read
 Serial.println("RAS to low");
 digitalWrite(10, LOW);
 Serial.println("Read/Write to Read state");
 digitalWrite(12, HIGH);
 Serial.println("CAS to low");
 digitalWrite(11, LOW);
 Serial.println("Save data to variable");
 rd=digitalRead(9);
 Serial.println("CAS to high");
 digitalWrite(11, HIGH);
 Serial.println("RAS to high");
 digitalWrite(10, HIGH);
 Serial.print("Read data: ");
 Serial.println(rd);
 //Test data
 digitalWrite(8, LOW);
 delay(20);

 //DRAM write 0
 Serial.println("RAS to low");
 digitalWrite(10, LOW);
 Serial.println("Read/Write to Write state");
 digitalWrite(12, LOW);
 Serial.println("CAS to low");
 digitalWrite(11, LOW);
 Serial.println("Read/Write back to Read state");
 digitalWrite(12, HIGH);
 Serial.println("CAS to high");
 digitalWrite(11, HIGH);
 Serial.println("RAS to high");
 digitalWrite(10, HIGH);

 //DRAM read
 Serial.println("RAS to low");
 digitalWrite(10, LOW);
 Serial.println("Read/Write to Read state");
 digitalWrite(12, HIGH);
 Serial.println("CAS to low");
 digitalWrite(11, LOW);
 Serial.println("Save data to variable");
 rd=digitalRead(9);
 Serial.println("CAS to high");
 digitalWrite(11, HIGH);
 Serial.println("RAS to high");
 digitalWrite(10, HIGH);
 Serial.print("Read data: ");
 Serial.println(rd);
}

Output

Output for one loop looks like:
RAS to low
Read/Write to Write state
CAS to low
Read/Write back to Read state
CAS to high
RAS to high
RAS to low
Read/Write to Read state
CAS to low
Save data to variable
CAS to high
RAS to high
Read data: 1 <- 1 Like it should be
RAS to low
Read/Write to Write state
CAS to low
Read/Write back to Read state
CAS to high
RAS to high
RAS to low
Read/Write to Read state
CAS to low
Save data to variable
CAS to high
RAS to high
Read data: 0 <- 0 Like it should be

Advertisements
This entry was posted in Arduino and tagged , . Bookmark the permalink.

3 Responses to Playing with Arduino and DRAM

  1. Kristoffer Soransen says:

    Hi,

    Did you ever get further with this? Im looking to create a build that can test my old Amiga Ram (V53C104BP70)

    How did you meet the need for the refreshing the DRAM cells ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s