I have just bought a 4Mbit flash memory chip.

But I cannot figure out how to use it with the Arduino Uno or Mega.

Can someone show me how to hook it up and use it.

  • \$\begingroup\$ You bought parallel flash. You should have bought serial flash, since parallel flash is tedious to use with a device that doesn't have an external memory bus. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 4 '15 at 7:39
  • \$\begingroup\$ The Atmega2560 on the Arduino Mega definitely has an external memory interface that works with parallel flash, but I haven't seen any Arduino code that interfaces with it. Sounds like you'll be either a) finding a 4Mbit serial flash with pre-existing Arduino libraries (easy) or b) wading through the datasheet (boring, but probably educational) \$\endgroup\$ – stefandz Sep 4 '15 at 9:38
  • 1
    \$\begingroup\$ @stefandz: While the ATmegaXXX0 does have an external memory bus, but the Arduino Mega/2560 doesn't expose all of it. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 4 '15 at 16:56
  • \$\begingroup\$ Ah fair enough - I know they do expose enough to use external SRAM, didn't realise they didn't include the rest. Good to know. \$\endgroup\$ – stefandz Sep 4 '15 at 17:05

Assuming you got the 5 volt version, hook up should be straight forward, although a bit cumbersome and it will likely require you to write some code.

Connect the address, data, and enable pins from the flash to digital IO pins on the Arduino. Also connect the chip's Vdd to the Arduino +5VDC pin and the chip's Vss to an Arduino ground pin.

Configure all the pins connected to chip's address lines and enable lines to be digital out.

To read a byte from the memory:

1) Configure the pins connected to the chip's data lines as digital input. 2) Set the pins connected to the address lines to the address you want to read. 3) Set the enable lines to CE=0, OE=0. 4) Read the data byte from selected address from the pins connected to the data lines.

To write to the memory is similar but more complicated because flash requires you to erase a whole sector before you can start writing bytes inside that bank. You also need to wait for the write operation to complete, which typically takes ~20us for this chip.

All the reading and writing sequences are well documented in the data sheet here...


Be sure to publish your code so others in the same situation will not have to start from scratch!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.