Interfacing with CMOS flash memory Winbond w49f002u-12b

I would like to make some use of this chip (which was taken from burned motherboard, the chip is used to hold BIOS) or just have fun.

I was trying to find anything on the internet. I found only this:
this guy has connected such Winbond via shift registers (I don't have them).

I've read some documentation && that guy's blog article, but I still cannot get it.
As far as I understand:

  1. A0-A17 used to point to particular cell in the chip memory;
  2. DQ0-DQ7 used to read/write data from that particular cell which A0-A17 are pointed to;
  3. CE - chip enabled, OE - output enabled, WE - write enabled;
  4. if I connect A0-A17 and DQ0-DQ7 to digital pins of Mega2560 -> set some data to A0-A17 using digitalWrite() -> then make OE HIGH/WE HIGH ==> I could possible to read/write data.

Could anybody confirm that? If it's not going to work, could anybody help me figure out how to connect in to Arduino Mega2560?

is it amazing coincidence you are duplicating this thread http://forum.arduino.cc/index.php?topic=380473.0 or just loneliness? sometimes better to continue in the original than clutter with new threads. having experience i mentioned reading is easy but writing takes additional special commands. in any case better to ask for more details there.

Datasheet says, that in order to write data, some commands must be sent (page 6).
Some commands need to be executed during 6 cycles. But the chip itself does not have any oscillator pin. Does anybody know what is a cycle in this chip?

john1993:
is it amazing coincidence you are duplicating this thread http://forum.arduino.cc/index.php?topic=380473.0 or just loneliness? sometimes better to continue in the original than clutter with new threads. having experience i mentioned reading is easy but writing takes additional special commands. in any case better to ask for more details there.

That thread doesn't cover anything I am looking for. This current thread is supposed to explain to the reader how to connect Arduino Mega2560 to Winbond w49f002u-12b.

that is exactly what somedude was attempting. you and buddy you linked are off to a bad start by referring to this flash chip as "eeprom" which is a completely different technology. i would be glad to answer any technical questions in the original thread. maybe somebody else will offer assistance in this hijacked thread.

I wrote this code:

int A_pins[18] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39};
int DQ_pins[8] = {40, 41, 42, 43, 44, 45, 46, 47};
int CE = 50;
int OE = 49;
int WE = 48;

unsigned long address;
unsigned int result;
void setup() {
  Serial.begin(9600);
  for(int i=0; i<18; ++i)
      pinMode(A_pins[i], INPUT);
  for(int i=0; i<8; ++i)
      pinMode(DQ_pins[i], OUTPUT);
  pinMode(CE, INPUT);
  pinMode(OE, INPUT);
  pinMode(WE, INPUT);
  digitalWrite(WE, HIGH);
  digitalWrite(OE, HIGH);
  digitalWrite(CE, LOW);

}

void func(unsigned long adr)
{
  delay(100);
  for(int i=0; i<18; ++i){
    if(adr & (1ul << i)){
      digitalWrite(A_pins[i], HIGH);}
    else{
      digitalWrite(A_pins[i], LOW);}}
  delay(100);
  digitalWrite(OE, LOW);
  delay(100);
  for(int i=0; i<8; ++i){
    if(digitalRead(DQ_pins[i]) == HIGH){
      result|=1<<i;}}
  Serial.println(result);
  digitalWrite(OE, HIGH);
}

void loop() {
  if (Serial.available() > 0)
  {
    address = (unsigned long)Serial.parseInt();
    func(address);
  }
}

It always responds zeros. I tried:

  1. 0 (0x00000) - beginning of Main Memory Block2
  2. 131072 (0x20000) - beginning of Main Memory Block1
  3. 229376 (0x38000) - Parameter Block2
  4. 237568 (0x3A000) - Parameter Block1
  5. 245760 (0x3C000) - Boot Block
  6. lots of another addresses
    Every time it returned zero.

Could anybody please help me?

I modified the code to debug it:

int A_pins[18] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39};
int DQ_pins[8] = {40, 41, 42, 43, 44, 45, 46, 47};
int CE = 50;
int OE = 49;
int WE = 48;

char ch;
char addrs[5];
unsigned long address;
unsigned int result;
void setup() {
  Serial.begin(9600);
  for(int i=0; i<18; ++i)
      pinMode(A_pins[i], INPUT);
  for(int i=0; i<8; ++i)
      pinMode(DQ_pins[i], OUTPUT);
  pinMode(CE, INPUT);
  pinMode(OE, INPUT);
  pinMode(WE, INPUT);
  digitalWrite(WE, HIGH);
  digitalWrite(OE, HIGH);
  digitalWrite(CE, LOW);

}

void func(unsigned long adr)
{
  //for(int i=0; i<18; ++i){
  //  digitalWrite(A_pins[i], LOW);}
  //delay(100);
  for(int i=0; i<18; ++i){
    if(adr & (1ul << i)){
      digitalWrite(A_pins[i], HIGH);
      Serial.print("A_pins[");
      Serial.print(i);
      Serial.println("] = HIGH");}
    else{
      digitalWrite(A_pins[i], LOW);}}
  //delay(100);
  digitalWrite(OE, LOW);
  delay(100);
  for(int i=0; i<8; ++i){
    if(digitalRead(DQ_pins[i]) == HIGH){
      result|=1<<i;
      Serial.print("DQ_pins[");
      Serial.print(i);
      Serial.println("] = HIGH");}}
  Serial.println(result);
  digitalWrite(OE, HIGH);
}

void loop() {
  //byte buffer[5];
  if (Serial.available() > 0)
  {
   //while(Serial1.available() > 0){
     //int i=0;
     //ch += Serial.read();0
     //addrs[i]=ch;
     address = (unsigned long)Serial.parseInt();
     //delay(1);
   //}
   //addrs = atol(addrs);
   //String str = "address = " + address;
   Serial.print("address = ");
   Serial.println(address);
   func(address);
   
   }
}

Serial Monitor with input/output stuff:

address = 0
0
address = 1232
A_pins[4] = HIGH
A_pins[6] = HIGH
A_pins[7] = HIGH
A_pins[10] = HIGH
0
address = 131072
A_pins[17] = HIGH
0
address = 245760
A_pins[14] = HIGH
A_pins[15] = HIGH
A_pins[16] = HIGH
A_pins[17] = HIGH
0

My Arduino Mega2560 is working 100%. I even checked pins with multimeter when high or low.
I manually grounded OE and CE, made WE high. There is no voltage on DQ pins anyway (its actually very low 0.03-0.18V).
What am I doing wrong?

I’ve made a stupid mistake in setup section. Now it is working.

int A_pins[18] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39};
int DQ_pins[8] = {40, 41, 42, 43, 44, 45, 46, 47};
int CE = 50;
int OE = 49;
int WE = 48;

unsigned long address;
unsigned int result;
void setup() {
  Serial.begin(9600);
  for(int i=0; i<18; ++i)
      pinMode(A_pins[i], OUTPUT);
  for(int i=0; i<8; ++i)
      pinMode(DQ_pins[i], INPUT);
  pinMode(CE, OUTPUT);
  pinMode(OE, OUTPUT);
  pinMode(WE, OUTPUT);
  digitalWrite(WE, HIGH);
  digitalWrite(OE, HIGH);
  digitalWrite(CE, LOW);

}

void func(unsigned long adr)
{
  result = 0;
  for(int i=0; i<18; ++i){
    if(adr & (1ul << i)){
      digitalWrite(A_pins[i], HIGH);
    }
    else{
      digitalWrite(A_pins[i], LOW);}}
  digitalWrite(OE, LOW);
  //delay(100);
  for(int i=0; i<8; ++i){
    if(digitalRead(DQ_pins[i]) == HIGH){
      result|=1<<i;
    }}
  Serial.println(result);
  digitalWrite(OE, HIGH);
}

void loop() {
  if (Serial.available() > 0)
  {
   address = (unsigned long)Serial.parseInt();
   Serial.print(address);
   Serial.print(": ");
   func(address);
   }
}