Header Ads

Inside Flash Memory and Drives


In 1984, Dr. Fujio Masuoka of Toshiba announced flash to the world. Today, flash memory is everywhere – pen drives, thumb drives, MP3/MP4 players, digital cameras, PDAs, and virtually all portable electronic devices that need to store data. In fact, they’re slated to replace hard disk drives pretty soon.

Inside a flash drive

Flash drives basically store data on an electronically erasable programmable read only memory (EEPROM) chip. This has a lattice of columns (bitlines) and rows (wordlines). Each point of intersection is a cell. A typical flash chip contains billions of such cells. Each cell is made of a transistor – a MOSFET, to be precise – which has an additional gate called a ‘floating’ gate added on to it.

MOSFETs

A MOSFET (Metal Oxide Semiconductor Field Effect Transistor) is midway between a diode (two p and n type semiconductor layers) and a transistor (sandwiched layers of p-type and n-type semiconductor layers). An n-type semiconductor releases electrons more readily, while and p-type semiconductors allow electrons to flown into them easily. The MOSFET, however, is

set up a little differently from the typical bipolar diode with a base coated with a layer of metal and oxide. The holes in the p-type layer prevent the excess electrons from passing from one n-type semiconductor (source) to the other (drain). But if we just let a positive voltage flow in from the gate, this creates an electric field. Now electrons start moving through the channel from the source to the drain. This makes it unipolar because a single electric charge is enough to get the electrons moving.

The difference between the flash memory transistor and the typical MOSFET is the floating gate. Flash drives use FGMOS cells (Floating Gate Metal Oxide Semiconductor FETs) that are basically MOSFETs with an additional gate. This is an electrically isolated gate, with one or more secondary gates deposited above it, also electrically isolated from it. This floating gate is surrounded by resistive material. This way it is difficult for electrons to pass into the gate. Once they have entered, it also ensures they stay trapped until the bias is reversed. If you apply a positive potential to the control gate, electrons (being negatively charged) are thrust through the layer of oxide (usually silicon dioxide) between the p-type substrate. Some of these are pushed into the floating gate and the electrons are then trapped there until forced out again. The electrons enter the floating gate in two ways:
  1. Fowler-Nordhein Tunneling: This is a phenomenon where electrons are emitted from a semiconductor into a dielectric or a vacuum when persuaded by a powerful electric field. Unlike other forms of emission, electrons pass through a barrier – instead of working around it – because it has not yet lost its wave function and, decaying into the barrier, thus heightening the probability of it emerging on the other side.
  2. Hot Carrier Injection: If an electron or a ‘hole’ ( an absent electron) in a semiconductor can be made to gain sufficient kinetic energy to pass through a barrier, the process is known as ‘Hot Carrier Injection’.
NAND and NOR flash Memory

The two most common kinds of flash memory are NAND and NOR. The terms are from Boolean logic and are immensely useful for the creation of universal Boolean operations.

NAND – which is short for ‘Not AND’ refers to the Boolean logic operation that says that if any one input is false, the conclusion is true. Since computers only understand zeroes and ones, in the language of electronics, if any one input is a 0 (zero), the output must be a 1 (one). NOR (short for ‘Not OR’) is a Boolean which is true if none of the inputs are true – i.e. if any – or both – of the two inputs is a one (1), the result is a zero. Both of these can be used to make NOT, AND, OR XOR or XNOR, and so they’re called ‘Universal Gates’ – and that’s what makes them useful.

NAND and NOR gates are so designed as to function in the above manner. As you can see in the figure, the Control Gate in every cell is connected to the horizontal ‘Word Line’ (WL). The ‘Bit Line’ (BL) connects all the drains together – which is actually the data bus of the chip. The Source Line (SL) connects all the sources to the ground.

NAND vs NOR

NAND and NOR basically differ in architecture and they both have their pros and cons. NAND has its cells arranged in a series – like a NAND gate – and therefore lets you erase and write data faster, uses less space (about 60 per cent of a NOR flash) because it doesn’t need so many ‘grounds’, cuts down on costs and is more robust than a NOR flash. NOR-flash memory, on the other hand, has every cell connected to the ground in parallel to the bit lines and another end to a bit line. This parallel connection is an advantage as every byte can be addressed individually. Yet, NOR is slower in writing and erasing but quicker than NAND in reading data. NAND flash requires that you read, erase or write data on a block wise basis, where a collection of bytes makes a ‘page’ and a collection of pages makes a ‘block’. Actions are performed in chunks and therefore NAND is unsuitable as a replacement for the ROM in your PC which needs random access at the byte level.

How flash drives work

Any data storage device must be able to perform the three basic actions of Write, Read and Erase. Whether it’s NAND or NOR, reading, writing or erasing are all controlled entirely by the voltage combination applied to the WL and the BL. In the case of flash drives, it’s all about setting the status of a cell to ‘charged’ or ‘not charged’ – or alternatively, sensing whether the floating gate in individual cells is set to 0 or 1. If a floating gate has electrons, it hinders the flow of electrons through the transistor (from the control gate to the silicon element), thereby allowing less than 50 per cent of the current to pass through – implying a zero (0). Similarly, if there is no negative charge in the Floating Gate impeding the flow of current, more than 50 per cent is allowed to pass through – indicating a one (1). This can be controlled by deliberately manipulating the voltage applied at the Source, Drain or Control gate to change the delta value If the drive hasn’t been used at all – or if it’s blank – all the cells are set to ‘1’ because the flow of electrons is unhindered. Thus the state of the flash cell is determined by whether or not the Floating Gate contains electrons or not. If it does it’s programmed, if it doesn’t, it’s erased or blank. The changing voltage at every cell is measured by a flash Memory Sense Amplifiers which use a differential amplifier to measure the disparity between the voltage generated by a particular cell current (the flash Bit line voltage) and a reference voltage value. If the Bit Line voltage is higher, it implies that the ‘Data Out’ signal is pulled to a logic high (binary digit 1) and conversely, if it is lower, the ‘Data Out’ signal is pulled to a logic low (binary digit 0). Having understood this, let’s figure out how flash drives perform their individual tasks.

Erasing

Since none of the Floating Gates (FG) contain negative charge to begin with, all the bits will be set to ‘1’. Ergo, if you want to erase a programmed cell, you’ll need to set it back to ‘1’ – or rather, compel the FG to empty itself of electrons. Applying a voltage (between about 9V and 12V) from the source to the control gate along a Word Line would cause the electrons trapped in the Floating Gate to break out and ‘tunnel’ to the Source and the p-type substrate. The Floating Gate is now free of electrons and set again to ‘1’.

Programming

Given that all the cells are already at ‘1’, programming a blank flash memory device becomes restricted to setting a cell to the binary ‘0’ value. To write into a flash drive, then, a high voltage (about 7V) is applied to the Bit Line (the Drain) and a higher one (around 12V) to the Word Line (the Source). Electrons will now flow from the Source to the Drain. Typically, some over-excited electrons will jump and tumble into the FG (remember the ‘Hot Carrier Injection’ process?), getting trapped there, giving a negative charge. Turn the power off and the electrons still stay there, thanks to the insulation of the oxide around the FG. Thus, entire blocks of cells can be programmed into millions of sequences of zeroes and ones, literally, at the speed of light.

Reading

When a current is passed from the Control Gate (about 5V) to the Drain (about 1V), the current begins to flow between the two. The voltage is not high enough to bump electrons into the FG if it is not negatively charged but high enough to detect insulation or conduction at every cell. The cell sensor tracks the current flow and identifies whether a particular cell is conducting or remains insulating. Accordingly, it arrives at a binary code of ones (1s) for every conducting cell and zeroes (0s) for every insulating one.

Types of flash drives

When it comes to flash storage devices these days, NOR flash takes a back seat and it seems to NAND all the way. Two basic forms of NAND are the preferred form of storage in solid state devices today: Single-Level Cells (SLC) and Multi-Level Cells (MLC).

Single-Level Cells


An SLC flash is so designed as to store only one bit-value per cell. So, for example, if the memory is being read, each cell can provide either of two values, depending on the voltage level – 0 (zero) if the cell is programmed or 1 (one) if the cell is blank or erased. Thus, the cell sensor in SLCs has only two voltage levels to bother about.

Multi-Level Cells

Manufacturers, like Intel, use the same transistors for their SLC and MLC flash. The difference is in how data is stored or read. In the case of a Multi-Level Cell, every cell can represent four states:

a) 00 (two zeroes) indicate that the cell is fully programmed:
b) 01 (a zero and a one) represent a partially programmed cell:
c) 10 (a one and a zero) show that the cell is partly erased:
d) 11(two ones) indicate that the cell is fully erased

In short, an MLC can store two bits of information with no difference in requirements of space or power. While the minimum and maximum voltage stay the same in SLCs and MLCs, there are more gradations between the two voltage levels, making the drive sensitive to smaller variations in voltage, allowing it to register two bits per cell. This, of course, would entail better programming algorithms, exact placement of charge and better charge sensing to detect the amount of charge on the floating gate more precisely. In an MLC, it is even possible to store more bits than two in a single cell. As the sensitivity to voltage deltas gets better, the flash drive simply needs to be able to detect 2N states in the cell (where N = the number of desired per cell). So, for example, if you want each cell to hold 4 bits, you’ll need to be able to identify 24 (or sixteen) voltage states in the cell – viz. 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.

SLCs vs. MLCs


Let’s take a better look at the differences between SLC and MLC flash drives.

MLCs take longer time to read and write data because it needs to track more minute gradations. SLCs can read and write data much faster. However, an MLC flash can hold double the number of transistors on the same wafer size as compared to an SLC flash. This allows greater density and thus, more memory on the same size chip bringing down the cost per MB. Cheap thumb drives or pen drives, therefore, prefer MLC.

SLCs, however, score on one parameter – lifespan. Every flash drive has a limited number of erase/programmed cycles. This is because the silicon oxide material that is used to separate the Floating Gate from other parts of the cell suffers wear and tear with the repeated ‘tunneling’ of electrons during erasure or programming. By and by, the material dissipates and electrons don’t move about the way they should. Note that reading does not reduce life of the flash memory because the process does not involve the passage of electrons through the oxide, only detection of voltage difference.

All SSDs erase in blocks (groups of pages) and write in pages (groups of cells). At the rate we go about juggling data in our flash drives, the average drive should wear out really fast. Luckily, SLC flash drives deteriorate only after about 100,000 write/erase cycles – which could last decades, unless you insist on rewriting all day and night for several years at a stretch (MLCs last for only about 10,000 such cycles). Deleting data is different. When you erase data, the drive doesn’t really erase it, but only marks a set of pages as ‘invalid’ and stops showing them up when you open the drive folder on your screen. It then waits until you write in some data, removes the data from the ‘erased’ cells and puts the new bit values into them. This reduces the wear and tear and increases the lifespan of the drive.

Of course, not all drives delete the same way. Some poorly built flash drives have high Write Amplification factors – which is a technical way of talking about how much ‘writing’ actually happens. Therefore, if you want to change just a few pages of data, the drive will erase the entire block that contains those pages, make the changes and write the new block in, thus increasing the number of times ‘tunneling’ happens. This reduces the lifespan of the drive. To put it briefly, MLCs have a high density and can hold more data at cheaper costs and smaller sizes, while SLCs need less power, are more durable and allow faster writing and erasing of data. Choice a particular kind of drive would depend on your requirements.

Flash memory is not without its drawbacks. Some cells get unintentionally programmed while programming other adjacent ones ( a phenomenon called ‘Program Disturb’). Sometimes the threshold value is misread and a ‘1’ is recorded instead of a ‘0’ (called ‘Read Disturb’). Charge may leak out of the FG, affecting data retention. Some question the ability of flash drives to store information when it comes to less than 30 nanometers. Manufacturers all over the world are working to better the existing technology and eliminate the drawbacks of both, MLCs as well as SLCs. For all practical purposes, NAND will do for the average consumer for the next few years at least. Flash is the future.

How to protect your Flash Drive

Never lost your pen drive or got a virus infection in it? You’re kidding me. Given that they’re featherweight and getting tinier by the day, chances of your flash memory device getting into the wrong hands are increasing day by day. And everybody knows how the ‘Autoplay’ function in Windows gets Trojans and worms into the works. Here are a few tips to safeguard your flash data:
  1. Buy a wire protected flash drive: Once a flash drive is write protected, data will only get written if you disable the ‘write protect’ function.
  2. Put in a password: There’s plenty of freeware on the web which allows you to password protect your flash drive, thus ensuring that only you have access to the data in it.
  3. Encrypt the data: If you do this, even after somebody cracks your password, the data will only look like gobbledygook to him.
  4. Anti-virus: Clean your flash drive of malicious software every time you plug it into a computer, using reliable anti-virus software.