Flash Memory - Changing Storage
Written by Harry Fairhead   
Monday, 05 December 2011
Article Index
Flash Memory - Changing Storage
Real Devices

Flash memory is a technology that has had a big impact. Without it there would be no digital cameras, mobile phones and anything based on a SIM would be very different. Knowing how Flash works can help you understand why it is better than traditional disk storage and what the potential problems are.

 

Flash memory is a technology that has changed more things than we give it credit for. It is arguable that without it there would be no digital cameras or mobile phones, and that smart ID cards, digital encryption and anything based on a SIM would be very different. Knowing how Flash works can help you understand why it is better than traditional disk storage and what the potential problems are.

In science fiction the ultimate in data storage is always portrayed as some kind of small card-like block that just plugs in and works. Each time a new storage technology has been invented it has been suggested that the future is just around the corner and we’ll all be plugging in memory crystals any day.

Well the future arrived some time ago and few seem to have noticed or celebrated it. Flash memory, packed into memory sticks small enough to be attached to key rings, looks a lot like the science fiction devices of a few years ago. Today flash memory finds itself in use in digital cameras, on motherboards to hold the BIOS, in memory cards for game consoles, as solid state disks and of course in the mobile phone.

So how does it all work?

Flash memory

Flash memory is like other types of solid-state memory in that it stores data using electrical charge. It was invented by Intel but it’s not new in the sense that it’s a development of EEPROM – Electrically Erasable Programmable Read Only Memory.

This is memory that spends most of its life being read and normally any attempt to write new data to it simply fails. However when it’s really necessary a special programming circuit can be activated and the existing data can be erased and new data can be written. Because of the way that EEPROM works erasing and writing data is a slow processes.

RAM on the other hand is comparatively fast to read and write but it has the unfortunate property of erasing itself when you turn the power off. This is why we need something like EEPROM in a computer system because it keeps its data even if the power is removed. 

You can think of Flash memory as offering the best of both EEPROM and RAM. It is reasonably fast to read and write and it doesn't lose data when the power is removed.

It works by storing a zero or a one as an accumulation of electrical charge. The basic arrangement is just like other memory devices in that storage cells are arranged into a grid and control lines are used to pick out which cell is being used.

What is different about Flash memory is that each cell consists of an electronic device that can be thought of as a Field Effect Transistor (FET) with two control gates.

An FET is a very simple device in that the amount of current that can flow through it – from the source to the drain - depends on the voltage applied to the gate.

 

 

FET

 

 

In the case of a Flash memory cell the FET has two gates, a control gate and a floating gate, separated by an insulating layer.

The cell is read by placing a voltage on the control gate. If a current flows then the cell stores a 1 and if it doesn't then the cell stores a 0.

What makes the difference is the charge stored on the floating gate. If there is a charge on the floating gate then it interferes with the control gate, which now has a much smaller effect on the current flow in the transistor. That’s all there is to it – a charge on the floating gate means the cell stores a 0 and if there is no charge on the floating gate it stores a 1.

 

TwoGateFET

 

The clever part is how the charge on the floating gate is manipulated.

To write a 0 to a cell the control gate is switched on and a larger voltage, anything from 10 to 20V, is applied across the source and drain. The electrons that make up the current leak through the insulating layer and get stuck on the floating gate so charging it up.

To be more accurate, the electrons “tunnel” through the insulating layer and this is a quantum mechanical effect that has no equivalent in classical physics. If it was just a matter of the insulation being leaky then the charge on the floating gate would leak away far to quickly to make Flash memory useful as a storage device.

It takes approximately 50,000 electrons to store a 0 in the cell. Once there they stay on the floating gate for roughly ten years without leaking away through the insulation – unless the cell is erased.

To erase the cell the same technique is used but with the current through the device reversed so as to encourage the electrons on the floating gate to tunnel back through to the insulating layer.

The only problem with writing and erasing is that each time it is performed the insulating layer is slightly damaged and slowly but surely the Flash memory cell does wear out. Don’t worry too much about your digital photos, though, because it takes tens of thousands of erase cycles before it happens.

There are two different ways of organizing FETs into memory cells and these produce two different types of Flash memory - Nand and Nor.  Nand Flash works with blocks of data. It is fast and it is cheap and hence it is the most commonly used form of Flash. Nor on the other hand is more expensive but you can read and write blocks as small as a single byte.

The Write Problem

Reading a Flash memory is relatively quick (about 100ns) but writing to a cell is a slow process between 5us to 1 second depending on the design. The reason is that during writing or erasing we have to allow enough time for the electrons to tunnel through the insulating layer. It is possible to reduce the time needed to program the cell but this increases the time it takes to erase the data in the cell.

The solution is to build the Flash memory so that blocks of cells can be erased in one operation while still allowing data to be written to individual cells.

For example, if the erase operation takes 1 second then erasing a 128KByte block achieves a throughput of 128KBytes per second, which is reasonable. However, the use of block erase creates a unique type of storage device that needs some special methods to use efficiently. In other words, you can't treat a block erase device using traditional file system methods.

To use a block of memory you first have to erase it - which usually results in each location being set to one. Then you can write to any location you care to - this modifies any bits that should be zero and leaves the ones alone. However to rewrite a particular location it has first to be erased and  this means erasing the entire block.

Suppose the Flash memory is organised into 64KByte blocks. Then, if what you want to store is always 64KBytes in size, the problem is simple. The system erases the original 64KByte block and writes the new data byte-by-byte into the block. This is efficient.

Now consider the problem of updating a single byte of data in the Flash memory. One way of doing this is to erase the entire 64KByte block and then write a single byte. This is inefficient.

A better way is to find a way of marking the original data as invalid and simply writing a new version into the 64KByte block. Using this technique you can update the single byte 64 thousand times before needing to erase the entire bloc- but you have to keep track of where the data is actually being stored.

It took some time before the software and hardware was developed enough to make this method work well.

Today’s Flash memory supports various read modes to help speed up the downloading of large blocks of data such as digital photos. Page mode and burst page mode read a block of data in one go and then transfer it byte-by-byte at top speed – typically 66MBytes-per-second.



Last Updated ( Monday, 16 April 2012 )