Search Flipkart

Friday, November 6, 2015

Functionalities of flash memory devices





What is flash memory?







Flash memory is a memory storage device for computers and electronics. It is most often used in devices like digital cameras, USB flash drives, and video games. It is quite similar to EEPROM. Flash memory is different from RAM because RAM is volatile (not permanent). When power is turned off, RAM loses all its data.

EEPROM

EEPROM (also written E2PROM and pronounced "e-e-prom", "double-e prom", "e-squared", or simply "e-prom") stands for Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed.
Unlike bytes in most other kinds of non-volatile memory, individual bytes in a traditional EEPROM can be independently read, erased, and re-written.

EEPROM has ability to electrically reprogram cells, whereas the earlier EPROM had better density. These advantages of both ROMs were incorporated into flash memory devices - NAND Flash and NOR flash.

Difference between NAND flash and NOR flash

Here, I'm just noting down the difference between NAND flash and NOR flash:

NOR offers faster read speed and random access capabilities, making it suitable for code storage. However, with NOR technology, write and erase functions are slow compared to NAND.  NOR also has a larger memory cell size than NAND, limiting scaling capabilities and therefore achievable bit density compared to NAND.

1. Read speed - Faster on NOR and Slower on NAND. 
2. Random Access capability : Supported on NOR. Not supported on NAND. 
3. Becauase of the first two points, NOR is suitable for code storage. NAND for file storage, eg: storing applications, files etc. 
4. Write and erase operations - Slow on NOR. Faster on NAND. 
5. Memory cell size - Larger on NOR than NAND. 
6. NAND is typically used for storing large quantities of information in devices such as Flash drives, MP3 players, multi-function cell phones, digital cameras and USB drives.

See :

(image courtesy of eet.com)

Now, coming to NAND flash, let's see how erase and program operation works.

Note: This cycle of programming and erasing is known as the program erase cycle (or PE Cycle)

Reason for ERASE-PROGRAM

When a NAND flash page is empty it is all binary ones, e.g. 11111111. A program operation sets any bit with the value of 1 to 0, so for example 11111111 could become 11110000. This means that later on it is still possible to perform another program operation to set 11110000 to 00110000 for example. Until all bits are zero it’s technical possible to perform another program. After this, the word MUST BE ERASED to bring it back to 11111111.
That is, a binary 1 in NAND can be brought to 0 state using PROGRAM (WRITE) operation, but a binary 0 in NAND can be bought to 1 state only using ERASE operation.

But as you need to write some 2 bytes data all the time, to ensure the proper working, an ERASE is needed before you WRITE (PROGRAM) the NAND flash.

Before looking into the PE cycle, let's see what are different terminologies used:

1. The package is the memory chip.
2. Each package contains one or more dies.
3. Each die contains one or more planes.
4. Each plane contains a number of blocks, which are the smallest unit that can be erased.
5. Each block contains a number of pages, which are the smallest unit that can be programmed.

Below image shows it in diagrammatic way:
(image courtesy of AnandTech)

The important bit here is that program operations (i.e. writes) take place to a page, which might typically be 8-16KB in size, while erase operations take place to a block, which might be 4-8MB in size. Since a block needs to be erased before it can be programmed again, all of the pages in a block need to be candidates for erasure before this can happen.

Program / Erase Cycles

When your flash device arrives fresh from the vendor, all of the pages are “empty”. The first thing you will want to do, I’m sure, is write some data to them – which in the world of memory chips we call a program operation. As discussed, these program operations take place at the page level. You can then read your fresh data back out again with read operations, which also take place at the page level.

(image courtesy of AnandTech)

Where it gets interesting is if you want to update the data you just wrote. There is no update operation for flash, no undo or rewind mechanism for changing what is currently in place, just the erase operation.
An erase operation on a flash chip clears the data from all pages in the block, so if some of the other pages contain active data (stuff you want to keep) you either have to copy it elsewhere first or hold off from doing the erase.
In fact, that second option (don’t erase just yet) makes the most sense, because the blocks on a flash chip can only tolerate a limited number of program and erase options (known as the program erase cycle or PE cycle because for obvious reasons they follow each other in turn). If you were to erase the block every time you wanted to change the contents of a page, your flash would wear out very quickly.
So a far better alternative is to simply mark the old page (containing the unchanged data) as INVALID and then write the new, changed data to an empty page. All that is required now is a mechanism for pointing any subsequent access operations to the new page and a way of tracking invalid pages so that, at some point, they can be “recycled”.
(image courtesy of AnandTech)

Reference

            Understanding Flash

No comments:

Post a Comment