Burn a 29LV160 flash chip

Hi, greetings everyone. Im trying to burn a MXIC 29LV160 flash chip with a binary file but after reading the datasheet for this chip im still stuck without any ideas of how to begin. Im good at programming but a total newbie with arduino so any help would be appreciated.

Here is the pinout for this specific chip:

Can post the datasheet too if that helps (but its very easy to find on the net).

Tools I have on hand: - Arduino (UNO and MEGA); - Bus Blaster / Bus Pirate from dangerous prototypes (if that helps) - Usual electronic stuff :P

Thanks in advance!

Do you want to write by bytes or words?

According to the datasheet I can do both (afaik). I guess doing a loop writing it by bytes would be easier. Does this matter depending of my source file (a binary file)?

To write each byte, put the byte address on the 21 address pins (A-1 through A19), put the data on Q0 through Q7, set /WE low, and pulse /CE low. Keep /BYTE low, /RESET and /OE high.

You need 31 output pins so you should use the Mega.

Could you please elaborate a bit in the code? :blush:

When you say I should “put the data on Q0 through Q7” you mean i should write each bit in one different pin and then pulse CE to write these 8 bits? And how should I “put the address on the adress pins”? Sorry if this look like very basic questions but if you could give me an example (in C code or pseudo) that would be great. Thanks

Something like this:

unsigned long int address = 0;

if (Serial.avaialble()) {
    data = Serial.read();
    for (int aPin=0; aPin<21; aPin++)
         digitalWrite(addressPins[aPin], address & (1<<aPin));
    for (int dPin=0; dPin < 8; dPin++)
         digitalWrite(dataPins[dPin], data & (1<<dPin));
    digitalWrite(ChipEnablePin, LOW)
    digitalWrite(ChipEnablePin, HIGH);
    address++;
    }

..most probably you have to check the READY/BUSY pin during the flashing as well..

Yep, looks like the chip returns it status in this pin while flashing. Another question is how do I address the chip using A0~A19 pins? Since the address are in hexadecimal can I just convert it to binary and thats it or do I need to do something else?

TioSolid:
Another question is how do I address the chip using A0~A19 pins? Since the address are in hexadecimal can I just convert it to binary and thats it or do I need to do something else?

You never said anything about hexadecimal addresses. You said it was a BINARY file.

You convert the address from hex to a number. If it’s a byte address you can then use it directly on A-1 through A19. If the address is a word address you can use it directly on A0-A19 and then set A-1 for which of the two bytes of the word you are writing.

Yes it is a bin file, but isnt the addressing related to the flash chip memory address?