Nand Design Guide
Nand Design Guide
TOSHIBA AMERICA ELECTRONIC COMPONENTS, INC. Copyright 2003 by Toshiba America Electronic Components, Inc. All Rights Reserved.
This NAND Flash Applications Design Guide and the information and know-how it contains constitute the exclusive property and trade secrets of Toshiba America Electronic Components, Inc. ("TAEC"), and may not be reproduced or disclosed to others without the express prior written permission of TAEC. Any permitted reproductions, in whole or in part, shall bear this notice. The information in this NAND Flash Applications Design Guide has been checked, and is believed to be reliable; however, the reader understands and agrees that TAEC MAKES NO WARRANTY WITH RESPECT TO THIS DESIGN GUIDE, ITS CONTENTS OR THEIR ACCURACY, AND EXCLUDES ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. The reader further understands that he or she is solely responsible for all use of the information contained within, including, but not limited to, securing any necessary intellectual property rights, however denominated. All information in this NAND Flash Applications Design Guide is subject to change without prior notice, at TAEC's sole discretion. All trademarks, trade names, product, and/or brand names are the property of their respective holders.
Table of Contents
1. HISTORY OF FLASH AT TOSHIBA ....................................................................................................................... 4 2. HOW FLASH WORKS ............................................................................................................................................... 5 2.1 NAND VS NOR FLASH ............................................................................................................................................. 5 3. THE NAND FLASH INTERFACE ............................................................................................................................ 8 3.1 PAGE READ ............................................................................................................................................................... 9 3.2 PAGE PROGRAM .......................................................................................................................................................10 3.3 BLOCK ERASE ..........................................................................................................................................................12 4. HARDWARE INTERFACING..................................................................................................................................13 5. LARGE BLOCK VS. SMALL BLOCK NAND .......................................................................................................19 6. FAILURE MODE OVERVIEW ................................................................................................................................20 6.1 BAD BLOCK IDENTIFICATION (INITIAL BAD BLOCKS) ..............................................................................................20 6.2 BLOCKS THAT FAIL DURING USE.............................................................................................................................21 6.3 FAILURE MODES MECHANISM AND SYMPTOMS .......................................................................................................22 Permanent Failure.....................................................................................................................................................22 Soft Errors .................................................................................................................................................................22 7. MANAGING NAND FLASH .....................................................................................................................................25 7.1 BAD BLOCK MANAGEMENT .....................................................................................................................................25 7.2 ERROR CORRECTING CODE ......................................................................................................................................25 7.3 WEAR LEVELING ......................................................................................................................................................25 7.4 SOFTWARE DRIVERS.................................................................................................................................................26 7.5 HARDWARE CONTROLLERS ......................................................................................................................................26 8. TIPS FOR USING NAND FLASH ...........................................................................................................................27 8.1 MROM / NOR REPLACEMENT .................................................................................................................................27 8.2 TO PARTITION OR NOT TO PARTITION ......................................................................................................................28 8.3 CONSIDERATIONS FOR PREPROGRAMMING NAND...................................................................................................28 8.4 CONSIDERING MEMORY CARDS ...............................................................................................................................28 9. INTRODUCTION TO COMPACTFLASH..............................................................................................................29
Seeqs cell could be realized by a dual polysilicon structure while Toshibas Flash EEPROM cell used a triple polysilicon structure due to the formation of the erase gate. Intel presented a 256k bit Flash EEPROM at the 88 ISSCC. Intel adopted the same cell structure as that of the UV-EPROM. It is programmed by the hot electron injection like a UV-EPROM and erased by the field emission from the floating gate to the source. In principal, this concept is quite similar to that of the first proposed Flash EEPROM by Toshiba.
The most important item regarding memories is the bit cost. In the case of a semiconductor memory, the bit cost is dependent on the memory cell area per bit. Since the cell area of NAND Flash is smaller than that of NOR Flash, NAND Flash always had the potential from the start to be less expensive than NOR Flash. However, it takes a rather long time for a NAND Flash to read out the first data byte compared to NOR Flash because of the resistance of the NAND cell array, although it is much faster than the seek time for a hard disc by several orders of magnitude. Therefore, the aim of NAND Flash is to replace hard disks. NAND
Bit line Word line Word line
NOR
Bit line Contact
Cell
Array
2F Layout Cross-section Cell size 4F2 Figure 1. NAND Flash vs. NOR Flash 2F 5F
2F
10F2
The advantages of NAND Flash are that the erasing and programming times are short. The programming current is very small into the floating gate because NAND Flash uses FowlerNordheim tunneling for both erasing and programming. Therefore, the power consumption for programming does not significantly increase even as the number of memory cells being programmed is increased. As a result, many NAND Flash memory cells can be programmed simultaneously so that the programming time per byte becomes very short. Conversely, the NOR Flash can be programmed only by byte or word, and since it uses the hot electron injection mechanism for programming, it also consumes more power and the programming time per byte is longer. The programming time for NOR Flash is typically more than a order of magnitude greater than that of NAND Flash. The power consumption of NAND Flash or NOR Flash is about one tenth that of a hard disk drive. Also, the seek time for semiconductor memories is much faster than that of a hard disk. However, NAND Flash or NOR Flash must be erased before reprogramming while a hard disk
requires no erasure. Therefore, in the case of continuous programming where the seek time is negligibly small, a hard disk drive can be programmed more quickly. For both for NOR Flash and NAND Flash, the endurance (which means the number of cycles a block or chip can be reprogrammed) is limited. In order to replace the UV-EPROM with Flash, and endurance of 1000 cycles was sufficient. It is estimated that at least 1,000,000 cycles are required to replace a hard disk drive. NOR Flash is typically limited to around 100,000 cycles. Since the electron flow-path due to the hot electron injection for programming is different from the one due to tunneling from the floating gate to the source for erasing, degradation is enhanced. However, in NAND Flash, both the programming and erasing is achieved by uniform FowlerNordheim tunneling between the floating gate and the substrate. This uniform programming and uniform erasing technology guarantees a wide cell threshold window even after 1,000,000 cycles. Therefore, NAND Flash has better characteristics with respect to program/erase endurance. In some recent scaled NOR Flash memories, their erasing scheme has been changed from source side erasing to uniform channel erasing, which is the same as the NAND Flash. From a practical standpoint, the biggest difference a designer will notice when comparing NAND Flash and NOR Flash is the interface. NOR Flash has a fully memory-mapped random access interface like an EPROM, with dedicated address lines and data lines. Because of this, it is easy to boot a system using NOR Flash. On the other hand, NAND Flash has no dedicated address lines. It is controlled using an indirect I/O-like interface and is controlled by sending commands and addresses through a 8 bit bus to an internal command and address register. For example, a typical read sequence consists of the following: writing to the command register the read command, writing to the address register 4 byte of address, waiting for the device to put the requested data in the output data register, and reading a page of data (typically 528 bytes) from the data register. The NAND Flashs operation is similar to other I/O devices like the disk drive it was originally intended to replace. But because of its indirect interface, it is generally not possible to boot from NAND without using a dedicated state machine or controller. However, the indirect interfaces advantage is that the pinout does not change with different device densities since the address register is internal. Because NAND Flash is optimized for solid-state mass storage (low cost, high write speed, high erase speed, high endurance), it is the memory of choice for memory cards such as the SmartMediaTM, SDTM card, CompactFlashTM, and MemoryStickTM. 20V 0V 0V 20V
0V
20V
(Tunneling)
(Tunneling)
P (Si-Sub)
0V Programming
P (Si-Sub)
20V Erasing
7
CLE: Command Latch Enable ALE: Address Latch Enable CE#: Chip Enable WE#: Write Enable RE#: Read Enable WP#: Write Protect R/B: Ready/Busy GND: Test Input (grounded) I/O: Input Output Vcc: Positive Supply (core) Vccq: Positive Supply (I/O) Vss: Negative supply (ground)
Figure 3. NAND Flash Pinout. The basic interface is fairly simple. When asserted low, the chip enable (CE#) pin enables the NAND flash to accept bytes written to the chip when write enable (WE#) is asserted low or enable the output of a data byte when read enable (RE#) is asserted low. When CE# is high, the chip ignores RE# and WE# and the I/O is tri-stated. The Command Latch Enable (CLE) pin and the Address Latch Enable (ALE) pin act as multiplexer select pins by selecting which internal register is connected to the external I/O pins. There are only three valid states as shown in the table below: ALE 0 0 1 1 CLE 0 1 0 1 Register Selected Data register Command register Address register Not defined
The key to understanding how the NAND flash operates is the realization that in the NAND flash, the read and program operation takes place on a page basis (i.e. 528 bytes at a time for most NAND devices) rather than on a byte or word basis like NOR flash. A page is the size of the data register. The erase operation takes place on a block basis (for most NAND devices, the block size is 32 pages). There are only three basic operations in a NAND flash: read a page, program a page, and erase a block. Lets examine each of these operations in more detail.
3.1 Page Read In a page read operation, a page of 528 bytes is transferred from memory into the data register for output. The sequence is as follows:
t R Registe r
Address N
Data-Out
Command phase: With CLE=1, ALE=0, the command byte 00h is placed on the I/O pins and WE# is brought low, then high. This stores the read mode 1 command into the command register. Address phase: With CLE=0, ALE=1, the first address byte is placed on the I/O pins and WE# is toggled. This first address byte N (called the column byte in the figure below) is usually set to 0 in order to start reading from the beginning of the page. It is possible to set N to any value between 0 and 255. Because the page is actually 528 bytes long, a different read command is used if you want output data to start from byte 256-511 (read mode 2 command byte 01h is used instead of 00h). A third read command is used if you want output data to come from bytes 512-527 (read mode 3 command byte 50h is used instead of 00h). It should be noted that the full page is read from memory into the register. The value N, in conjunction with the read command used, simply sets the output data pointer within the register. The address bytes which follow after column byte N, indicated by Row1 and Row2 in the figure, are used to set the page within a block (lowest 5 bits in byte Row1), and the block within the device. In the higher density NAND devices, the address phase is 4 bytes long rather than 3.
low
Comman d 00
Col
Row 1
Row 2
Wait(tR)
DN
DN+1
D527
Data-Out Data-Out
Data-Out
Data Transfer phase: CLE and ALE are set to zero while the chip goes busy in preparation for data readout. During the busy period, the ready/busy pin (R/B) goes low for up to 25 microseconds while data is being read from the memory array and transferred into the data register. During this period, it is important that chip enable is held low to keep the read operation from being stopped mid-cycle (note: this restriction is removed in a new family of NAND flash devices known as CE dont care). Read Out phase: Once R/B returns high, data is available in the data register for read out. The first data byte output is byte N. Each RE# pulse reads out the next byte in the register. Once the last byte (D527) is read out, standard NAND flash will automatically go busy (another data transfer phase) in preparation for reading out the next page (with no additional command or address input). In the datasheet, this is called sequential read. If this is not desired, chip enable must be brought high (note: for the CE dont care family of NAND flash, the automatic sequential read function does not exist).
Why is a page 528 bytes long? Since the original intent of the NAND flash was to replace magnetic hard disk drives, the intention was for the page to be big enough to store 1 sector (512 bytes) worth of data with 16 bytes extra for overhead such as error correcting code. Because the use of ECC is common with NAND flash (sample code is in the appendix), read mode 1 is the most often used read command because it enables one to read the entire 528 byte page. 3.2 Page Program In a page program operation, a page of 528 bytes is written into the data register and then programmed into the memory array. The sequence is as follows:
10
Register
Data-In
tPROG
Command phase: With CLE=1, ALE=0, the command byte 80h is placed on the I/O pins and WE# is brought low, then high. This stores the serial data input command into the command register. This command also resets the register to all 1s (all FFh). Address phase: With CLE=0, ALE=1, the first address byte is placed on the I/O pins and WE# is toggled. This first address byte N (called the column byte in the figure below) is usually set to 0 in order to start writing from the beginning of the page. However, like the read command, it is also possible to set N to any value between 0 and 255. The first byte that is written in the data phase will then overwrite the FFh at location N in the register. If you desire to overwrite the register values starting at byte N (N=256-527), you need to
low
high
Command Col 80 H
Row 1
Row 2
D0
D 1
D527 Data-In
Command 10 H Wait(tPROG)
precede the 80h command with either 01h or 50h (the read mode 2 and read mode 3 commands). It should be noted that the full page is programmed from the register into the memory each time the program command (10h) is received. However, since the serial data input command (80h) resets the register to all 1s, bytes in the register that are not overwritten with data will remain 1 and should not will not affect the memory. Like the read mode, the address bytes which follow after column byte N, indicated by Row1 and Row2 in the figure, are used to set the page within a block (lowest 5 bits in byte Row1), and the block within the device. In the higher density NAND devices, the address phase is 4 bytes long rather than 3. Data Input phase: CLE and ALE are set to zero, and data bytes are written into the data register. If you try to write more bytes than the page size, the last byte in the register will contain the last byte written.
11
Program phase: With CLE=1, ALE=0, the auto program command (10h) is written to the command register. The device then goes busy for tPROG (typically 250us). During this busy period, even if chip enable goes high, the device will finish programming. Timeout Check phase: Although not shown on the diagram, it is typical to check the status after programming. If the device was unable to program a bit from 1 to 0 within the time allowed, the pass/fail bit returned by the status read command will indicate a failure. If this happens, the block should be considered bad because the device has already attempted to program the bit multiple times before the internal timeout occurred.
3.3 Block Erase In a block erase operation, a group of consecutive pages (typically 32) is erased in a single operation. While programming turns bits from 1 to 0, block erasure is necessary to turn bits from 0 back to 1. In a brand new device, all usable (good) blocks are in the erased state.
Register Erase
Command phase: With CLE=1, ALE=0, the command byte 60h is placed on the I/O pins and WE# is brought low, then high. This stores the auto block erase command into the command register. Address phase: With CLE=0, ALE=1, two address bytes are written into the address register. Notice that only two address bytes are required. There is no column byte as in the read and program operations. In the first address byte (Row1), only the upper 3 bits are used. The lower 5 bits of Row1are reserved for the page within the block (for device with 32 pages per block) and during a block erase operation, all pages within the block will be erased; therefore, the value of the least significant 5 bits are actually dont care. The upper 3 bits of Row1 and the 8 bits of Row2 determine the block that will be erased. Because this is only 11 bits (2048 blocks max.), higher density NAND devices require 3 address bytes.
low
high
Command
Command
60H
Row1
Row2
D0H
Address Addres s
Wait(tERASE )
12
Erase phase: With CLE=1, ALE=0, the auto block erase confirm command (D0h) is written to the command register. The device then goes busy for tERASE (typically 2ms). During this busy period, even if chip enable goes high, the device will finish erasing the block. Timeout Check phase: Although not shown on the diagram, it is typical to check the status after erasing to make sure a timeout (erase failure) did not occur. If the device was unable to erase the block successfully within the time allowed, the pass/fail bit returned by the status read command will indicate a failure. If this happens, the block should be considered bad because the device has already attempted to erase the block (and verify it is erased) multiple times before the internal timeout occurred.
4. Hardware Interfacing
When you examine the timing diagrams in the datasheets for standard NAND flash devices, you will notice that there was the expectation that NAND flash would be connected to a controller chip or specialized interface state machine because of two characteristics: The chip enable is shown asserted low continuously during the period of the operation. Actually, chip enable can be deasserted in between individual write cycles and read cycles; however, it must remain continuously asserted low during the read cycle busy period. For chip enable dont care NAND, this restriction is removed. Signal ALE is shown to be high continuously between individual write cycles. Actually, in between write cycles, ALE can go low as long as the setup and hold times are met.
These timing diagrams are relatively easy to achieve if you connect the NAND flash to a state machine. However, if you intend to connect the NAND to a microprocessor bus directly, some glue logic will be necessary. There are several ways to connect the NAND flash to the host: 1) Using general purpose input/output (GPIO) pins 2) Using a memory-mapped interface with glue logic 3) Using a chip-enable dont care NAND
13
The key requirement in all cases will be to meet the timing diagram restrictions. For example, the setup and hold times for CLE, ALE, CE#, and data input with respect to WE# are shown below. Note that CLE, ALE, and CE# are not required to be held in a particular state outside the interval. The practical implication is that CLE and ALE can be connected to the host address lines in order to select the internal register connected: data register, command register, or address register.
The data read cycle is shown below. Not shown on the diagram are CLE and ALE, which are both assumed to be low. This diagram is for the chip enable dont care NAND; notice that the chip enable state is dont care during the busy period preceding the data read cycle. For standard NAND, chip enable must be held low during the busy period preceding data read out.
Command In / Address In
/ ALE
tCLS / tALS tCLH / tALH
Set up time for ALE, CLE, -CE is based on the falling edge of -WE, hold time based on the rising edge of -WE.
Set up time for I/O is based only on the rising edge of -WE. Figure 4-1. NAND Timing Requirement for Address/Command Spec Inputs. Symbol
Setup
tALS / tCLS tALH / tCLH
/ CLE
Hold
Other
14
Data Read
tCEA
Figure 4-2. NAND Timing Requirement for Data Reads. Using GPIO Pins Using GPIO pins to control the NAND signals (such as ALE, CLE, /CE, /WE, and /RE) offers great flexibility in meeting the NAND timing requirements. However, unless the speed requirements are relatively low, the performance is likely to be a fraction of the NANDs potential performance. Also, GPIO pins are often scarce in a system, so this may not be an acceptable use of a scarce resource. However, although adding GPIO pins to the interface may involve additional cost, it may be easier to control the NAND for some platforms.
/RB /CE ALE CLE Standard or /RE Chip Enable DC NAND /WE I/O 1 - 8 : Connected only to NAND : Shared by other memory devices
15
Memory-Mapped Interfacing using Glue Logic In order to interface to standard NAND devices, it is necessary to use a latched signal to drive the NANDs chip enable. The simplest approach is to use a latched GPIO pin.
Figure 4-4. Physical Connection when Memory-Mapped. The GPIO pin controlling the chip enable is asserted low at the beginning of the NAND read, program, or erase cycle and is not deasserted until the end of the entire cycle. Note that the read enable and write enable to the NAND is qualified by an address decoded chip select. In this way, only read or writes intended for the NAND actually toggle the NANDs read enable or write enable pins. When /CS is deasserted, the glue logic deasserts /RE and /WE, which tri-state the NANDs outputs. Using a Chip Enable Dont Care NAND Perhaps the simplest method to connect NAND to a microprocessor bus is the use of a chip enable dont care CEDC) NAND instead of standard NAND. The main difference between standard NAND and chip enable dont care NAND is that chip enable does not need to be continuously asserted low during the read busy period. The removal of this restriction allows chip enable to be deasserted between individual read or write cycle and enables the direct connection of the NAND to a microprocessor with no glue logic. The NAND chip enable will work as expected and qualify the read enable and write enable signals. The only function that was removed from standard NAND to make this possible was the elimination of the automatic sequential read function, which was rarely used anyway.
16
/RB /CE ALE TC582562AXB CLE CEDC NAND /RE /WE I/O 1 - 8 : Connected only to NAND : Shared by other memory devices
Unlike NOR flash, the NAND flash does not have any dedicated address pins to be connected to the microprocessor address pins. Therefore, most people think that a direct interface between NAND and a microprocessor is difficult. However, as shown in figure 4.5, the interface does not require any glue logic. Toshiba has demonstrated this glueless NAND connection between the Toshiba TX4927 MIPS processor and the Toshiba TC582562AXB NAND flash. On the TX4927 demonstration board, the timing for the chip select (/CS) of the TX4927 was modified as described in figure 4-6 and 4-7 below. This was easily be done by changing the register values
which controlled the timing for /CS. Most high end processors with integrated chip select circuitry have programmable timing. With CLE connected to A0 and ALE connected to A1, the software driver for the NAND need only access 3 address locations. Access to the base address for /CS accesses the NAND data register by setting
CLE=0 (A0=0) and ALE=0 (A1=0). Writes to base address+1 writes the NAND command register by setting CLE=1 (A0=1) and ALE=0 (A1=0). Writes to base address+2 writes the NAND address register by setting CLE=0 (A0=0) and ALE=1 (A1=1). With the introduction of the chip enable dont care NAND, interfacing to NAND flash has never been easier.
17
GBUSCLK = 100MHz = 10ns The bus speed is set to 1/4 of the GBUSCLK
SYSCLK = 40ns.
Setup
Hold
Other
Figure 4-6. Command In, Address Timing Generated by TX4927. Data Read ( 120ns / cycle )
40ns 40ns 40ns
Symbol tRC tRP tREH tREA tCEA tOH Spec 50ns 35ns 15ns 35ns 45ns 10ns 4927 120ns 40ns 80ns approx 80ns approx 80ns - (*1)
Data Latch
*) BWE, BE, ACK is not used. (*1) : Data latch point is within OE low, so not an issue.
Although the internal architecture will be different, the external physical interface will be the same. Therefore, in most cases, only the flash software needs to be updated in order to use these new devices. The effective read speed of the large block NAND devices is similar to the small block devices: Read Time = 6 cycles x 50ns + 25 s + 2112 cycles x 50ns = 131 s Read Speed = 2112 bytes / 131 s = 16.1 Mbytes /sec The effective write speed of the large block NAND devices is more than 3 times faster. Write Time = 5 cycles x 50ns + 2112 cycles x 50ns + 1 cycle x 50ns + 200s = 306 s Write Speed = 2112 bytes / 306s = 6.9 Mbytes / sec The effective erase speed is nearly 8 times faster. Erase Time = 4 cycles x 50ns + 2ms = 2ms Erase Speed = 128kB / 2ms = 64 Mbytes / sec
19
20
Once you erase a block, the non-FF bytes will be also be erased. If this occurs, re-identifying the bad blocks will be difficult without testing at different temperatures and voltages and running multiple test patterns, so if the list of bad blocks is lost, recovering bad block locations are extremely difficult. 6.2 Blocks that Fail During Use As mentioned in the previous section, all flash memory has a finite lifetime and will eventually wear out. Since each block is an independent unit, each block can be erased and reprogrammed without affecting the lifetime of the other blocks. For NAND memory, each good block can be erased and reprogrammed more than 100,000 to 1,000,000 times typically before the end of life. This is described in the datasheet. The primary wear out mechanism is believed to be excess charge trapped in the oxide of a memory cell and the net effect is that erase times increase until an internal timer times out (Narrowing Effect). The programming time seen by the user actually decreases slightly with increasing number of total write/erase cycles, so the devices end of life is not characterized by program failures. Generally, only a severe device failure could cause a page program failure. Therefore, blocks should be marked as bad and no longer accessed if there is either a block erase failure or a page program failure. This can be determined by doing a status read after either operation. The status read command is used to determine the outcome of the previous erase or program operation. Block erase operations are automatically verified, so the entire block is FFh if the status bit indicates the erase operation passed. For programming, the status bit indicates the program operation passed if all zeros (0) in the data register are correctly programmed into memory. One (1) bits in the data register are not verified and are ignored. Therefore, if 0s are already programmed into a page in memory, all program operations to that page, regardless of the data in the data register, would pass. By not verifying 1s, partial page programming is possible.
21
6.3 Failure Modes Mechanism and Symptoms Although random bit errors may occur during use, this does not necessarily mean that a block is bad. Generally, a block should be marked as bad only if there is a program or erase failure. The four main failure modes that can be distinguished as permanent failures or soft errors are described below. Permanent Failure Write/Erase Cycle Endurance - This error may be manifested as a cell, page, or block failure which can be detected by status read after either auto program or auto block erase (Figure 6.3.1).
Vpp (Program)
n p-well
n p-well
Vpp(Erase)
Soft Errors Over Programming - This is caused when the threshold voltage of a 0 data cell becomes too high as a result of excess programming current. Normally, all threshold voltages are below a bias voltage (Vbias) so that the application of Vbias to unselected pages will enable them to turn on (figure 6.3.2). If the threshold voltage of a cell is too high (Figure 6.3.3), the bias voltage that is supposed to be high enough to turn on any cell during the read cycle is insufficient, so the cell never turns on (figure 6.3.4).
22
Therefore the error occurs during a program, but can only be detected by reads. The resultant error symptom is that all cells on that bit line in the block read out as 0, so in the worse case scenario, if this bit is supposed to be 1 for all other pages in the block, there will be a one bit failure for each page in the block. This condition is cleared by a block erase.
Bit Line
Unselected page = Vbias : Tr = ON Unselected page = Vbias : Tr = ON Selected page = 0 Volt : Tr = ON if 1 data OFF if 0 data
1 Time The S/A senses the bit line voltage and determines 1 and 0
Vth
VBias
Data 0
0V
Data 1
23
Bit Line
Selected page = 0 Volt : Tr = ON but because above cell does not turn on, the current does not flow. Unselected page = Vbias : Tr = ON
Time The S/A senses 0 data for cells that are affected by over programmed cell.
Figure 6.3.3. Read Operation with over programmed cell Program Disturb - In this failure mode, a bit is unintentionally programmed from 1 to 0 during the programming of a page. The bit error may occur either on the page being programmed or on another page in the block. Bias voltage conditions in the block during page programming can cause a small amount of current to tunnel into memory cells. Multiple partial page programming attempts in a block can aggravate this error symptom. Since this error is caused by soft programming of memory cells, the condition is removed by block erasure. Program disturb effects are also worsened by randomly programming pages in a block. Therefore, the datasheets for NAND flash now require programming pages in sequential order only (from lowest page address to highest page address). Understanding these error mechanisms is useful in order to understand how to interpret the NAND flash reliability report. Interpreting the reliability report is the subject of appendix A.
24
erases in the allotted amount of time. Because the design of typical file systems assumed the characteristics of magnetic media, certain physical locations may be repeatedly rewritten. For example, in the DOS FAT file system, the FAT and directory areas must be modified multiple times each time a file is written or appended. When multiplied by the thousands of files in a typical file system, the FAT and directory areas of the disk will experience vastly more writes than any other area of the disk. When flash memory is used to emulate a disk drive, the physical areas of the flash that contain the FAT and directory would be worn out first, leading to early failure of the file system stored on the flash. In order to spread out the writes across as much of the flash as possible, a wear leveling algorithm is implemented by the controller (software or firmware in a hardware controller) which translates a logical address to different physical addresses for each write. Generally, this logical to physical lookup table is implemented in RAM and is initialized at power up by reading each physical block in the NAND flash to determine its logical block value. Ideally, wear leveling is intrinsic to the file system itself. Several new file system exist which write new data sequentially rather than overwriting a fixed location. These file systems use a technique known as journaling. For flash memory, JFFS2 (Journaling Flash File System 2) and YAFFS (Yet Another Flash File System) exist which automatically spread out wear by writing sequentially to free flash space. 7.4 Software Drivers Software drivers for managing NAND flash are becoming available from a variety of sources. There are open source developments such as JFFS2 and YAFFS, as well as a number of drivers available from third parties. The table below lists the sources of NAND flash driver software we are currently aware of or have discovered on the web. Product Name F1Pack Angel & Jet FlashFX JFFS2 NAND File system smxFFS TargetFFS-NAND TrueFFS YAFFS Company/Sponsor Tokyo Electron Datalight Red Hat Kyoto Software Research Micro Digital Blunk Microsystems Wind River Systems Toby Churchill Website http://tmg-eng.teldevice.co.jp/f1pack.html http://www.datalight.com http://sources.redhat.com/jffs2/ Contact Toshiba http://www.toshiba.com/taec/ http://www.smxinfo.com http://www.blunkmicro.com/ffs http://www.windriver.com/products/true_ffs/ http://www.aleph1.co.uk/armlinux/projects/yaffs/
7.5 Hardware Controllers There are a number of sources for hardware controllers for NAND flash. To date, the main application for these controllers have been for use inside flash memory cards such as CompactFlash, USB drives, or flash memory card reader/writers. Manufacturers include SST, Cypress, Standard Microsystems Corp., and many others.
26
8.2 To Partition or Not to Partition In the previous section, the NAND flash is used exclusively as a ROM in which a file system is unnecessary. However, many applications may wish to use part of the NAND flash as a ROM, and part as a file system. In this case, there are basically two approaches. In the first case, we can partition the NAND flash into two separate distinct regions in which code is stored in one partition and the file system is stored in the other. In the second case, we could use the entire NAND flash as a file system and store the code as a special file within it. The first case will be simpler to implement because the bootstrap loader program will not have to understand the file system in order to retrieve code from the NAND flash. However, the second case is more versatile. If code should grow in the future, there is no need to repartition the NAND flash. Development is easy because one can simply reload a new ROM image as a file. However, a more sophisticated bootstrap loader program requiring more space will be necessary. 8.3 Considerations for Preprogramming NAND Preprogramming NAND flash is different than programming NOR flash primarily because the existence of bad blocks prevents the use of fixed physical addressing. Programmers that support NAND flash program complete blocks and skip over bad blocks. All overhead bytes (including ECC bytes) must be included in the data file itself. In the data file, every 518th byte (byte 517) out of every 528 bytes should be left as 0xFFh. As discussed in section 6.1, this byte is reserved as the bad block flag byte. A separate white paper describing the issues in preprogramming NAND flash is available from Toshiba America. If the NAND flash is divided into 2 partitions as described in section 8.2, it will be necessary to program the NAND flash in two operations. In the first operation, the code portion is programmed. Since the bad block distribution will vary from chip to chip, the last physical block programmed will differ. If the second partition (i.e. file system partition) is to be written starting at the same physical address in every chip during the second program operation, several spare blocks (1-2%) typically needs to be added to the code partition to allow for bad blocks to enable the second partition to start at a fixed block location. Of course, there is still a possibility that in a particular chip, the bad blocks are concentrated in the code partition section. If this happens, there would be an insufficient number of good blocks in the physical block range allocated for code storage to actually store the code. Also, the hassle of dealing with two separate files (code and file system) to be programmed can lead to errors. Therefore, it will be more convenient to avoid partitioning the flash and implement case 2 in section 8.2 by storing the code as a special file in the file system and program a single file into the flash. 8.4 Considering Memory Cards If portable storage is necessary, the easiest solution is to use one of the removable memory cards available. The advantage of using a memory card is that all memory cards (except SmartMedia) have a built-in memory controller chip. Toshiba, as the inventor of SmartMedia, coinventor of the SD card, and a major manufacturer of CompactFlash cards, offers a variety of possible solutions. For further information on these cards, see: SmartMedia http://www.ssfdc.or.jp SD Card http://www.sdcard.org
28
CompactFlash http://www.compactflash.org
9. Introduction to CompactFlash
The CompactFlashTM card is a small, removable, storage and I/O card. Invented by Sandisk, the specifications are now determined by the CompactFlash Association (CFA) (http://www.compactflash.org), an organization that promotes the adoption of CompactFlash. The CompactFlash can be used in such applications as portable and desktop computers, digital cameras, handheld data collection scanners, PDAs, Pocket PCs, handy terminals, personal communicators, advanced two-way pagers, audio recorders, monitoring devices, set-top boxes, and networking equipment. A CompactFlash card is essentially a small form factor card version of an ATA PC Card (AT Attachment) specification and includes a True IDE (Integrated Drive Electronics) mode which is compatible with the ATA/ATAPI-4 specification. As such, there are 3 distinct interface modes that a CompactFlash card can use: PC Card Memory Mode (uses WE#, OE# to access memory locations) PC Card I/O Mode (uses IOWR#, IORD# to access I/O locations) True IDE Mode (uses IOWR#, IORD# to access I/O locations)
The CompactFlash card is essentially a solid state ATA disk drive. To control an ATA disk drive, one writes to the task file registers. The values put into these task file registers control the drive (the ANSI T13 committee defines these registers and the commands used to control all ATA/IDE drives see http://www.t13.org). These task file registers can be mapped into either memory or I/O address space. A typical CompactFlash card consists of a controller and several NAND flash memory chips. The convenient aspect of using them is that the controller typically implements ECC in hardware and the NAND flash management in firmware offering both high reliability and high performance. Two application notes describing a reference interface between the CompactFlash card and either the MPC8260 or PPC405 are available from Toshiba.
29