# HG changeset patch # User Paul Boddie # Date 1421627198 -3600 # Node ID fd32e1d619ab7cac50cc07c54911c8db3e1c808e # Parent b3a0a3951381572d96f7afaa0c2a3c24cf6b2289 Fixed the command definitions and pin usage; made changes to help debugging. diff -r b3a0a3951381 -r fd32e1d619ab ArduinoAm29F010B.cpp --- a/ArduinoAm29F010B.cpp Sun Jan 18 19:48:44 2015 +0100 +++ b/ArduinoAm29F010B.cpp Mon Jan 19 01:26:38 2015 +0100 @@ -1,4 +1,4 @@ -const int CE = 1, OE = 2, WE = 3, +const int CE = A5, OE = 2, WE = 3, CS1 = 4, CS2 = 5, DQ0 = 6, DQ1 = 7, DQ2 = 8, DQ3 = 9, DQ4 = 10, DQ5 = 11, DQ6 = 12, DQ7 = 13; @@ -47,7 +47,7 @@ int data = 0; setDataIn(); - delayMicroseconds(1); + delay(10); while (1) { @@ -100,10 +100,14 @@ high = (fromHex(buffer[1]) << 4) + (fromHex(buffer[2])); low = (fromHex(buffer[3]) << 4) + (fromHex(buffer[4])); + digitalWrite(CE, LOW); setAddress(high, low); + delay(10); digitalWrite(OE, LOW); data = readData(); + delay(10); digitalWrite(OE, HIGH); + digitalWrite(CE, HIGH); return data; } @@ -119,10 +123,14 @@ low = (fromHex(buffer[3]) << 4) + (fromHex(buffer[4])); data = (fromHex(buffer[5]) << 4) + (fromHex(buffer[6])); + digitalWrite(CE, LOW); setAddress(high, low); + delay(10); digitalWrite(WE, LOW); writeData(data); + delay(10); digitalWrite(WE, HIGH); + digitalWrite(CE, HIGH); return true; } @@ -152,7 +160,7 @@ // Interface loop. - Serial.print("? "); + Serial.println("?"); Serial.setTimeout(3600000); // 1 hour while (nread = Serial.readBytesUntil('\n', buffer, BUFSIZE)) @@ -165,16 +173,15 @@ case 'W': if (writeOutput(nread)) - Serial.println("Written."); + Serial.println("W"); else - Serial.println("Command?"); + Serial.println("C"); break; default: + Serial.println("?"); break; } - - Serial.print("? "); } Serial.println("Done."); diff -r b3a0a3951381 -r fd32e1d619ab README.txt --- a/README.txt Sun Jan 18 19:48:44 2015 +0100 +++ b/README.txt Mon Jan 19 01:26:38 2015 +0100 @@ -56,10 +56,10 @@ Commands ======== -Reset (A=$555; D=$AA); (A=$2AA; D=$55); (A=$555; D=$F0) -Autoselect (manufacturer) (A=$555; D=$AA); (A=$2AA; D=$55); (A=$555; D=$90); (A=$X00; D=$XX) +Reset (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$F0) +Autoselect (manufacturer) (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90); (A=$X00; read) => D=$01 -Autoselect (device) (A=$555; D=$AA); (A=$2AA; D=$55); (A=$555; D=$90); (A=$X01; D=$XX) +Autoselect (device) (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90); (A=$X01; read) => D=$20 Simple reset (A=$XXX; D=$F0) @@ -80,8 +80,8 @@ As a result, only 13 pins are needed on the Arduino. -Arduino 74HC273 #1 74HC273 #2 Am29F010B -------- ---------- ---------- --------- +Arduino 74HC273 #1 74HC273 #2 Am29F010 +------- ---------- ---------- -------- 1 CE# 2 OE# 3 WE#