thalesmaia
Newbie level 1
I have a **broken link removed** flash memory and I need to dump it. It is an old flash memory with address and data lines parallel.
Since it is a 64-ball chip, I designed a pcb wired to Arduino Due pins. Used the same platform for a S29GL as well.
Does some of the Arduino Due Pins can't work with digitalWrite function? 2) How should I set pins to be able to read specific address?
I've tried following the datasheet, other instructions but I always get 0 bits returned from D lines.
Since it is a 64-ball chip, I designed a pcb wired to Arduino Due pins. Used the same platform for a S29GL as well.
Does some of the Arduino Due Pins can't work with digitalWrite function? 2) How should I set pins to be able to read specific address?
I've tried following the datasheet, other instructions but I always get 0 bits returned from D lines.
Code:
static const int pA0 = 52; static const int pA1 = 50;
static const int pA2 = 48; static const int pA3 = 46;
static const int pA4 = 44; static const int pA5 = 42;
static const int pA6 = 40; static const int pA7 = 38;
static const int pA8 = 36; static const int pA9 = 34;
static const int pA10 = 32; static const int pA11 = 30;
static const int pA12 = 28; static const int pA13 = 26;
static const int pA14 = 24; static const int pA15 = 22;
static const int pA16 = 23; static const int pA17 = 25;
static const int pA18 = 27; static const int pA19 = 29;
static const int pA20 = 31; static const int pA21 = 33;
static const int pD0 = 53; static const int pD1 = 51;
static const int pD2 = 49; static const int pD3 = 47;
static const int pD4 = 45; static const int pD5 = 43;
static const int pD6 = 41; static const int pD7 = 39;
static const int pD8 = 2; static const int pD9 = 3;
static const int pD10 = 4; static const int pD11 = 5;
static const int pD12 = 6; static const int pD13 = 7;
static const int pD14 = 8; static const int pD15 = 9;
static const int pCE = 13; static const int pBT = 12;
static const int pWP = 11; static const int pRY = 10;
static const int pCE2 = 17; static const int pCE1 = 18;
static const int pOE = 19; static const int pVpen = 20;
static const int pRST = 37; static const int pWE = 35;
void printPort(){
Serial.print(digitalRead(pD15)); Serial.print(digitalRead(pD14)); Serial.print(digitalRead(pD13)); Serial.print(digitalRead(pD12));
Serial.print(digitalRead(pD11)); Serial.print(digitalRead(pD10)); Serial.print(digitalRead(pD9)); Serial.print(digitalRead(pD8));
Serial.print(digitalRead(pD7)); Serial.print(digitalRead(pD6)); Serial.print(digitalRead(pD5)); Serial.print(digitalRead(pD4));
Serial.print(digitalRead(pD3)); Serial.print(digitalRead(pD2)); Serial.print(digitalRead(pD1)); Serial.println(digitalRead(pD0));
}
void printOut(){
Serial.print(digitalRead(pA21)); Serial.print(digitalRead(pA20)); Serial.print(digitalRead(pA19)); Serial.print(digitalRead(pA18));
Serial.print(digitalRead(pA17)); Serial.print(digitalRead(pA16)); Serial.print(digitalRead(pA15)); Serial.print(digitalRead(pA14));
Serial.print(digitalRead(pA13)); Serial.print(digitalRead(pA12)); Serial.print(digitalRead(pA10)); Serial.print(digitalRead(pA9));
Serial.print(digitalRead(pA8)); Serial.print(digitalRead(pA7)); Serial.print(digitalRead(pA6)); Serial.print(digitalRead(pA5));
Serial.print(digitalRead(pA4)); Serial.print(digitalRead(pA3)); Serial.print(digitalRead(pA2)); Serial.print(digitalRead(pA1));
Serial.print(digitalRead(pA0)); Serial.print(" -> ");
}
void setup(){
delay(10);
pinMode(pRST, OUTPUT);
digitalWrite(pRST, HIGH);
pinMode(pA0, OUTPUT); pinMode(pA1, OUTPUT); pinMode(pA2, OUTPUT);
pinMode(pA3, OUTPUT); pinMode(pA4, OUTPUT); pinMode(pA5, OUTPUT);
pinMode(pA6, OUTPUT); pinMode(pA7, OUTPUT); pinMode(pA8, OUTPUT);
pinMode(pA9, OUTPUT); pinMode(pA10, OUTPUT); pinMode(pA11, OUTPUT);
pinMode(pA12, OUTPUT); pinMode(pA13, OUTPUT); pinMode(pA14, OUTPUT);
pinMode(pA15, OUTPUT); pinMode(pA16, OUTPUT); pinMode(pA17, OUTPUT);
pinMode(pA18, OUTPUT); pinMode(pA19, OUTPUT); pinMode(pA20, OUTPUT);
pinMode(pD0, INPUT); pinMode(pD1, INPUT); pinMode(pD2, INPUT);
pinMode(pD3, INPUT); pinMode(pD4, INPUT); pinMode(pD5, INPUT);
pinMode(pD6, INPUT); pinMode(pD7, INPUT); pinMode(pD8, INPUT);
pinMode(pD9, INPUT); pinMode(pD10, INPUT); pinMode(pD11, INPUT);
pinMode(pD12, INPUT); pinMode(pD13, INPUT); pinMode(pD14, INPUT);
pinMode(pD15, INPUT);
pinMode(pBT, OUTPUT); //BT
digitalWrite(pBT, HIGH);
pinMode(pCE2, OUTPUT); // CE2
pinMode(pCE1, OUTPUT); // CE1
digitalWrite(pCE2, LOW);
digitalWrite(pCE1, LOW);
// Habilitamos as demais portas
pinMode(pWP, OUTPUT);
pinMode(pRY, OUTPUT);
pinMode(pVpen, OUTPUT);
pinMode(pCE, OUTPUT);
pinMode(pWE, OUTPUT);
pinMode(pOE, OUTPUT);
digitalWrite(pCE, HIGH);
digitalWrite(pWE, HIGH);
digitalWrite(pOE, HIGH);
Serial.begin(9600);
delay(2000);
}
void SetAddress(uint32_t addr){
digitalWrite(pA0, (addr & 1)?HIGH:LOW); digitalWrite(pA1, (addr & 2)?HIGH:LOW); digitalWrite(pA2, (addr & 4)?HIGH:LOW);
digitalWrite(pA3, (addr & 8)?HIGH:LOW); digitalWrite(pA4, (addr & 18)?HIGH:LOW); digitalWrite(pA5, (addr & 32)?HIGH:LOW);
digitalWrite(pA6, (addr & 64)?HIGH:LOW); digitalWrite(pA7, (addr & 128)?HIGH:LOW); digitalWrite(pA8, (addr & 256)?HIGH:LOW);
digitalWrite(pA9, (addr & 512)?HIGH:LOW); digitalWrite(pA10, (addr & 1024)?HIGH:LOW); digitalWrite(pA11, (addr & 2048)?HIGH:LOW);
digitalWrite(pA12, (addr & 4096)?HIGH:LOW); digitalWrite(pA13, (addr & 8192)?HIGH:LOW); digitalWrite(pA14, (addr & 16384)?HIGH:LOW);
digitalWrite(pA15, (addr & 32768)?HIGH:LOW); digitalWrite(pA16, (addr & 65536)?HIGH:LOW); digitalWrite(pA17, (addr & 131072)?HIGH:LOW);
digitalWrite(pA18, (addr & 262144)?HIGH:LOW); digitalWrite(pA19, (addr & 524288)?HIGH:LOW); digitalWrite(pA20, (addr & 1048576)?HIGH:LOW);
digitalWrite(pA21, (addr & 2097152)?HIGH:LOW);
}
void ReadID(uint32_t addr){
SetAddress(addr);
digitalWrite(pCE, LOW);
digitalWrite(pOE, LOW);
digitalWrite(pOE, HIGH);
printOut();printPort();
digitalWrite(pCE, HIGH);
}
void loop(){
for (int i = 0; i <6000; i++){
ReadID(i);
}
while (true) {delay(10000);}
}