Reading NAND flash with an Arduino

[HC] took a gander around the Googles and saw a number of people trying to read NAND flash chips with an Arduino. It’s an interesting problem; at 16 Megahertz, [HC] is looking at about 60 nanoseconds per instruction cycle, and flash chips normally operate around 20 ns. He got the build working, and was able to read the memory contents and ID of a flash chip.

Right now, it’s just a proof-of-concept to demonstrate that reading flash memory is possible. [HC] used an Arduino Mega to pull the manufacture ID off a flash chip. Because there isn’t exactly a whole lot of storage on an Arduino to hold Megabytes of data, so [HC] is looking for a way to pull data off his flash chip. He’s considering sending it over Ethernet or storing it on an SD card.

This isn’t the first time we’ve seen a roundabout way to use those cheap, ubiquitous NAND flash chips. Considering we’ve got a few dozen of them housed in unused thumb drives, [HC]‘s work shows a lot of potential. He posted a topic on his forum to see if there’s any interest in further developments, something we’d like to see.

Comments

  1. Daid says:

    In general there is no maximum timing for chips. It’s always “minimum X” and no max. (I don’t have NAND datasheets here, but the SDRAM datasheets I have only put requirements on the amount of refreshes you do, and the time between a row/col select and a read, which is in the ms range)

    The fact that there is no datasheet to be found about the nand chip, and that he had to sniff the bus to know how it works is much more interesting and a much bigger feat.

    • nes says:

      True. They have an asynchronous interface which you can read/write to as slow as you like.

      A SmartMedia/XD picture card is just a raw NAND flash without a controller in front of it. You can find a list of the standard commands on the web easily enough. Fair play for reverse engineering it though.

  2. Leo says:

    Maybe it’ll help me recover data from dead pendrive, I was about to do exactly the same thing, but without Arduino library. I also didn’t have idea which method of data transfer to PC to choose. Maybe USB drive emulation with ATmega32u4/32u2 or similar would be good idea?

  3. CoolMod says:

    Sorry for my ignorance with NAND memories, but, can’t you read them as any other memories?

    • Daid says:

      Yes and no. Define “other memories”, because early RAM as found in the C64 for example is just a basic data address, you set the address, set the read/write to read and clock it. However, modern RAM, like SDRAM needs special commands for it to read/write and SDRAM also needs to be refreshed.

      Flash also needs commands, these commands are pretty standard, but differences are there. Modern ARM chips have NAND controllers that handle most of this for you.

    • nes says:

      No, the address, data and command codes are all multiplexed onto the same bus. You select a bank/page, etc first then stream the data in order byte by byte. There some extra spare bytes per page meant for storing error correction and filing system info*, but if you have soldered one into your own system there’s no reason not to use them however you want.

      * ISTR there is still one bit per page reserved for enabling the “panorama” feature on Fuji/Olympus cameras, just so they could set the bits and sell you a panorama card for a premium.

  4. nimrod316 says:

    is this working for EEPROMS as well? cuz on arduino forums they say u gotta rewrite the driver for a 3-wire interface EEPROM.

    • Hardcore says:

      Completely different interface.
      For the Nand Flash chips you need about 16 i/o port wires, since the data & commands are presented on an 8-16 bit interface, with about 8 other control lines used to latch the data in & out of the chip.
      Many of the EEPROMS operate on an SPI interface ,this interface is a doddle because you generally do not need to bit bang it, rather you drop the data into the on-chip SPI interface system and the hardware of the microcontroller chip handles it for you.

  5. luke says:

    As others will have seen before, I do not understand the “interesting problem” of boring a nand with such slow read timing. However that doesn’t make i less interesting in terms of reading nand flash with an arduino…

    • Hardcore says:

      Whilst there may be no ‘maximum’ for waveform setup according to the data sheets, you will find that the device may start to glitch if you try to maintain the signals for any length of time.

      As regards the ‘interesting problem’, it was better than sitting around during New Years day watching my cat lick her butt.

      Seriously though, the interest comes in getting it working and getting the data out to the PC (one of my other projects was related to computer forensics and emulating a full Nand Flash chip)
      I’m going to be using some of the ground breaking research ideas from that project in this project.
      Besides, it is actually a great job interview ‘show and tell’, slap the kit on the table and you are already 80% up on most other candidates.

  6. afshin says:

    hi
    i desoldered a nand flash chip from one 4GB flash disk
    i readed a data of this chip as a bin file, *.bin
    how i can convert this bin file to all of my data?
    please help me!!!! plz

    • Artur Babecki says:

      It is problem but maybe I can help you. Send me information model, memory chip ID and controller (that small chip) ID. The data are usualy iverted/XORed and mixed and the are also service data . Additional problem is that some manufactureres are ciphering internaly data to hide their anti-wearing bits algorithm (Sandisk is en example )

    • hardcore says:

      You cannot…… easily without proprietary software, there is not a 1:1 relationship.

  7. Frank Motos says:

    Afshin it should not be to difficult , did you solve your peoblem >?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,119 other followers