Flash memory

Last updated: April 23, 2007.
Imagine if your memory worked only
while
you were awake. Every
morning when you got up, your mind would be completely blank! You'd
have to relearn everything you ever knew before you could do anything.
It sounds like a nightmare, but it's exactly the problem computers
have. Ordinary computer chips "forget" everything (lose their entire
contents) when the power is switched off. Large personal computers get
around this by having powerful magnetic memories called
hard drives, which can remember things
whether the
power is on or off. But smaller, more portable devices, such as digital cameras and MP3 players,
need smaller and more portable memories. They use special chips called
flash memories to store information permanently.
Flash memories are clever—but rather complex too. How exactly do they
work?
Photo: A 512MB (half a gigabyte) secure digital flash
memory card from a digital camera.
How computers store information
Computers are electronic
machines that process information in
digital format. Instead of understanding words and numbers, as people
do, they change those words and numbers into strings of zeros and ones
called binary code. Inside a computer, a single letter "A" is stored as
seven binary numbers: 1000001. In fact, all the basic characters on
your keyboard (the letters A-Z in upper and lower case, the numbers
0-9, and the symbols) can be represented with different combinations of
just eight binary numbers. A question mark is stored as 111111, a
number 7 as 110111, and a left bracket ([) as 1011011. Virtually all
computers know how to represent information with this "code", because
it's
an agreed, worldwide standard. It's called ASCII
(American Standard
Code for Information Interchange).
Computers can represent information with patterns of zeros and ones,
but how exactly is the information stored inside their memory chips? It
helps to think of a slightly different example. Suppose you're standing
some distance
away, I want to send a message to you, and I have only eight flags with
which to do it. I can set the flags up in a line and then send each
letter of the message to you by raising and lowering a different
pattern of flags. If we both understand the ASCII code, sending
information is easy. If I raise a flag, you can assume I mean a number
1, and if I leave a flag down, you can assume I mean a number 0. So if
I show you this pattern:

You can figure out that I am sending you the code 110111 and
signalling the letter 7.
What does this have to do with memory? It shows that you can store,
or represent, a character like "7" with something like a flag that can
be in two places, either up or down. A computer memory is effectively a
giant box of billions and billions of flags, each of which can be
either up or down. They're not really flags, though—they are
microscopic switches called transistors
that
can be either on or off. It takes eight switches to store a character
like A, 7, or [. It takes one transistor to store each binary digit (which is
called a bit). In most computers, eight of these bits are collectively
called a byte. So when you hear people say a
computer has so many megabytes of memory, it means it can store roughly
that many million characters of information.
Why we need flash memory
Ordinary transistors are electronic switches turned on or off by
electricity—and that's both their
strength and their weakness. It's a
strength, because it means a computer can store information simply by
passing patterns of electricity through its memory circuits. But it's a
weakness too, because as soon as the power
is turned off, all the transistors revert to their original states—and
the computer loses all the information it has stored. It's like a giant
attack of electronic amnesia!
Memory that "forgets" when the power goes off is called Random Access Memory (RAM). There is another kind
of memory called Read-Only Memory (ROM) that
doesn't suffer from this problem. ROM chips are prestored with
information when they are manufactured, so they don't "forget" what
they know when the power is switched on and off. However, the
information they store is there permanently: they can never be
rewritten again. In practice, a computer uses a mixture of different
kinds of memory for different purposes. The things it needs to remember
all the time—like what to do when you first switch it on—are stored on
ROM chips. When you're working on your computer and it needs temporary
memory for processing things, it uses RAM chips; it doesn't matter that
this information is lost later. Information you (or the computer) wants
to remember indefinitely is stored on its hard drive. It takes longer
to read and write information from a hard drive than from memory chips,
so hard drives are not generally used as temporary memory. In gadgets
like digital cameras and small MP3 players,
flash memory is used instead of a hard drive. It has certain things in
common with both RAM and ROM. Like ROM, it remembers information when
the power is off; like RAM, it can be erased and rewritten more or less
as many times as you like.
How flash memory works—the simple explanation

Photo: Turn a digital camera's flash memory
card over and you can see the electrical contacts that let the camera
connect to the memory chip inside the protective plastic case.
Flash works using an entirely different kind of transistor that
stays switched on (or switched off) even when the power is turned off.
A normal transistor has three connections (wires that control it)
called the source, drain, and
gate. Think of a transistor as a pipe through which
electricity can flow like water. One end of the pipe is called the
source—think of that as a tap or faucet. The other end of the pipe is
called the drain—where the water drains into and flows away. In between
the source and drain, blocking the pipe, there's a gate. When the gate
is closed, the pipe is shut off, no
electricity can flow and the transistor is off. In this state, the
transistor stores a
zero. When the gate is opened, electricity flows, the transistor is on,
and it stores a one. But when the power is turned off, the transistor
switches off too. When you switch the power back on, the transistor is
still off, and since you can't know whether it was on or off before the
power was removed, you can see why we say it "forgets" any information
it stores.
A flash transistor has a second gate above the first one. When the
gate opens, some electricity leaks up the first gate and stays there,
in between the first gate and the second one, recording a number one.
Even if the power is turned off, the electricity is still there between
the two gates. That's how the transistor stores its information whether
the power is on or off. The information can be erased by making the
"trapped electricity" drain back down again.
How flash memory works—a more complex explanation
That's a very glossed over, highly simplified explanation of
something that's extremely complex. If you want more detail, it helps
if you read our article about transistors
first, especially the bit at the bottom about MOSFETs—and then read on.
The transistors in flash memory are like MOSFETs only they have two
gates on top instead of one. This is what a flash transistor looks like
inside. You can see it's an n-p-n sandwich with two gates on top, one
called a control gate and one called a floating gate. The two gates are
separated by oxide layers through which current cannot normally pass:

In this state, the transistor is switched off—and effectively
storing a zero.
How do we switch it on? Both the source and the
drain regions are rich in electrons (because they're made of n-type
silicon), but electrons cannot flow from source to drain because of the
electron deficient, p-type material between them. But if we apply a
positive voltage to the transistor's two contacts, called the bitline
and
the wordline, electrons get pulled in a rush from source to drain. A
few also manage to wriggle through the oxide layer by a process called
tunnelling and get stuck between the two gates:

The presence of electrons between the gates is how a flash
transistor stores a one. The electrons will stay there indefinitely,
even when the positive voltages are removed and whether there is power
supplied to the circuit or not. The electrons can be flushed out by
putting a negative voltage on the wordline—which repels the electrons
back the way they came, clearing the space between the gates and making
the transistor store a zero again.
Not an easy process to understand,
but that's how flash memory works its magic!
Go shop