The present invention relates to a nonvolatile memory device having a rewritable nonvolatile memory, a memory controller for controlling the storage device, a nonvolatile memory system, and a data writing method.
Demand for nonvolatile memory devices having a rewritable nonvolatile main storage memory is expanding mainly on semiconductor memory cards. The memory card has a flash memory as a nonvolatile memory and a memory controller for controlling the flash memory. In response to reading and writing instructions from an access device such as a digital still camera and a personal computer main body, the memory controller controls the reading and writing to the flash memory. Since the flash memory has larger variation in characteristics of memory cells than volatile memories such as RAMs, a write error occurs relatively often. Therefore, in a memory card having a nonvolatile memory therein, substitute processing of replacing the storage area in which a write error occurs with another storage area is carried out (Patent document 1). Herein, a flash memory such as a single-level NAND flash memory in which each memory cell is closed within 1 page is typically used as the nonvolatile memory.
A multi-level NAND flash memory holds great promise as a low-cost flash memory and has a high possibility to become the main current of a main storage memory of the memory card. Patent document 2 discloses a technique of improved page structure of the multi-level NAND flash memory to realize high-speed access. In a conventional flash memory of the single-level memory, one memory cell holds data of a certain bit in one page. On the contrary, in the multi-level NAND flash memory, each memory cell is composed of multiple pages, for example, striding over two pages, namely, holds data of multiple bits.
For example, in the multi-level NAND flash memory shown in
However, in a case where one memory cell is configured striding over two pages, when an error occurs during writing into one page, data stored in the other page disadvantageously changes. This problem will be described below referring to
From the left, codes “11”, “10”, “00”, “01” are assigned to four distributions in
In a case of the memory card, since power is typically supplied from an access device side, when the power of the access device is turned off carelessly during writing of data or the memory card is forcibly pulled out of the access device, power shutdown occurs.
Patent document 1: Japanese Unexamined Patent Publication No. 2003-76615
Patent document 2: Japanese Unexamined Patent Publication No. 2001-93288
System problems in the case of applying the multi-level NAND flash memory shown in
As shown in
However, when data stored in the page 11 of the PB10 changes, the data is not repaired in a conventional nonvolatile memory device, and thus wrong data is continuously used. In an event that the data is important data such as file system, a fatal problem that reading from the nonvolatile memory device cannot be performed may occur. In other words, when the error restoration processing disclosed in Patent document 1 is applied to the multi-level NAND flash memory disclosed in Patent document 2, disadvantageously, reliability is remarkably lowered.
Then, in consideration of the above-mentioned problem, an object of the present invention is to provide a reliable memory controller, nonvolatile memory device, nonvolatile memory system and data writing method which can restore the error that, due to an error at writing into a predetermined page, data stored in the other page composing the same memory cell with the predetermined page changes.
To solve the problems, a memory controller according to the present invention is a memory controller for writing data given from outside into a nonvolatile memory which is composed of a plurality of pages and in which each memory cell holds data of a plurality of pages composing a group therein and for reading data from the nonvolatile memory comprising: an error restoration part for restoring an error occurring in data stored in another page belonging to the same group as an error occurrence page with a write error, wherein said error restoration part, given that a page which belongs to the same group as a current page to which data is written and stores data therein is a related page, reads related data stored in said related page, temporarily stores the related data in a save area prior to writing of the data, and restores an error using the related data at an occurrence of the error.
Said memory controller may comprise: an error page identification part for identifying, when an error occurs during writing data in a certain page in said nonvolatile memory, a page in which the error occurs, wherein said error page identification part includes: a power shutdown determination part for determining an occurrence of power shutdown; and a memory trouble determination part for determining an occurrence of trouble in said nonvolatile memory.
Said error restoration part may further comprise: a page information instruction part for outputting page information on pages composing the same group in said nonvolatile memory; a related page identification part for identifying a related page based on said current page and page information outputted from said page information instruction part; and a substitute and repair processing part for repairing data stored in said related page by using said related data at an occurrence of an error.
Said nonvolatile memory may be composed of a plurality of physical blocks, and said substitute and repair processing part may perform copy processing for copying data written into an errorless page in a physical block during writing to another invalid physical block in said nonvolatile memory, repair processing for rewriting related data which is miswritten and held in said save area into a repair page of said invalid physical block, and retry processing for rewriting miswritten data in the physical block into said invalid physical block.
Said nonvolatile memory may be composed of multiple physical blocks, said substitute and repair processing part may perform copy processing for copying data written into an errorless page in a physical block during writing to another invalid physical block in said nonvolatile memory and repair processing for rewriting related data which is miswritten and held in said save area into a repair page of said invalid physical block, and said error restoration part may save the related data in a nonvolatile storage area.
Said error restoration part may have a nonvolatile save memory which saves the related data therein.
Said save memory may be a nonvolatile RAM. Said nonvolatile RAM may be composed of any one of a ferroelectric memory (FeRAM), Magnetoresistive Random Access Memory (MRAM), Ovonics Unified Memory (OUM), and Resistive RAM (RRAM).
To solve the problems, a nonvolatile memory device according to the present invention is a nonvolatile memory device comprising: a nonvolatile memory composed of a plurality of pages in which each memory cell holds data of a plurality of pages composing a group therein; and a memory controller for writing data given from outside and for reading data from the nonvolatile memory, wherein said memory controller includes: an error restoration part for restoring an error occurring in data stored in another page belonging to the same group as an error occurrence page with a write error, and said error restoration part, given that a page which belongs to the same group as a current page to which data is written and stores data therein is a related page, reads related data stored in said related page, temporarily stores the related data in a save area prior to writing of the data, and restores an error using the related data at an occurrence of the error.
To solve the problems, a nonvolatile memory system according to the present invention is a nonvolatile memory system comprising: an access device; and a nonvolatile memory device, wherein said access device sends a write command and data to said nonvolatile memory device, and said nonvolatile memory device includes: a nonvolatile memory composed of a plurality of pages in which each memory cell holds data of a plurality of pages composing a group therein; and a memory controller for writing data given from outside and for reading data from the nonvolatile memory, said memory controller includes: an error restoration part for restoring an error occurring in data stored in another page belonging to the same group as an error occurrence page with a write error, and said error restoration part, given that a page which belongs to the same group as a current page to which data is written and stores data therein is a related page, reads related data stored in said related page, temporarily stores the related data in a save area prior to writing of the data, and restores an error using the related data at an occurrence of the error.
To solve the problems, a data writing method according to the present invention is a data writing method for writing data given from outside into a nonvolatile memory which is composed of a plurality of pages and in which each memory cell holds data of a plurality of pages composing a group therein, comprising a step of: restoring errors occurring in data stored in other pages belonging to the same group of an error page in which a writing error occurred, wherein said error restoration step includes, given that a page which belongs to the same group as a current page to which data is written and stores data therein is a related page, reading related data stored in said related page, temporarily storing the related data in a save area prior to writing of the data, and restoring an error using the related data at an occurrence of the error.
According to the present invention, even when a specific error occurs in a memory in which a memory cell stores data of multiple pages therein, an error restoration part can restore the error. Thus, in a memory card using a multi-level NAND flash memory which will be major current of flash memory, as compared with the memory card using the conventional memory in which a memory cell stores data of one page therein, higher reliability can be ensured.
Hereinafter, a nonvolatile memory system in accordance with a first embodiment of the present invention will be described.
The nonvolatile memory device 100 has a nonvolatile memory 110 composed of a flash memory and has a memory controller 120. The nonvolatile memory 110 is a multi-level NAND flash memory in which one memory cell holds data striding over two pages. The nonvolatile memory 110 is composed of 4096 physical blocks PB0 to PB4095, for example, as shown in
The access device 101 issues commands for reading and writing user data (hereinafter, merely referred to as data) to the nonvolatile memory device 100, transmits a logical address at which the data is stored, and transmits and receives the data. In response to the read and write commands from the access device 101, the memory controller 120 writes received data into the nonvolatile memory 110 and reads data from the nonvolatile memory 110 and outputs the read data.
Next, details of the memory controller 120 will be described. The memory controller 120 provided in the nonvolatile memory device 100 has a host IF 121 and a CPU 122 for controlling the whole of the memory controller 120. The memory controller 120 also has a RAM 123 as a work area of the CPU 122 and has a ROM 124 storing a program executed by the CPU 122 therein. The memory controller 120 also has a buffer memory 125 for temporarily storing data in accessing the nonvolatile memory 110 and an address management part 126 for designating an address in the nonvolatile memory 110. The buffer memory 125 is composed of a volatile memory such as SRAM having capacity of one page or of a nonvolatile memory such as FeRAM.
Based on the address designated by the address management part 126, a read-write controller 127 writes data into the nonvolatile memory 110 or reads data from the nonvolatile memory 110.
When an error occurs during writing data into a page in the nonvolatile memory 110, an error page identification part 128 transfers an error type flag to the error restoration part 129. The error type flag is a flag for identifying a physical address of the page (hereinafter referred to as an error page number) and an error type. The error page identification part 128, as shown in a detailed block diagram of
The current block status table 131 is a table for storing a write state of the currently-accessed physical block therein. The current block status table 131 is composed of a nonvolatile RAM such as a ferroelectric memory (FeRAM), Magnetoresistive Random Access Memory (MRAM), Ovonics Unified Memory (OUM) or Resistive RAM (RRAM) and records a currently-written logical block address, physical block address, and the write state of each page.
The power shutdown determination part 132 determines occurrence state of power shutdown that is one of causes of error. Based on a current block status stored in the current block status table 131, a ready-busy flag transferred from the nonvolatile memory 110 after writing of data into the nonvolatile memory 110, and a current page number representing a physical address of the currently-written page which transferred from the address management part 126, the power shutdown determination part 132 identifies the error page number in which the error occurs. Then, the power shutdown determination part 132 transfers the error page number and error type flag to the error restoration part 129.
The flash trouble determination part 133 is a memory trouble determination part for determining trouble occurrence state in the flash memory as one of causes of error. Based on an error status transferred from the nonvolatile memory 110 after writing of data into the nonvolatile memory 110 and the current page number transferred from the address management part 126, the flash trouble determination part 133 identifies the error page number in which the error occurs and transfers the error page number and the error type flag to the error restoration part 129.
The address management part 126 includes a physical area management table 141 and logical-physical conversion table 142. Referring to these tables, the address management part 126 performs so-called address management such as a selection of the physical block to which data transferred from the access device 101 is written, an instruction of the page to which data is written in the concerned physical block, namely, the current page number, and preread processing described later. The physical area management table 141 stores the status flag representing a state of the physical block that is an erasure unit in the nonvolatile memory 110, namely, showing whether or not valid data is stored therein. The logical-physical conversion table 142 is a table necessary for converting the logical address transferred from the access device 101 into the physical address in the nonvolatile memory 110.
When the CPU 122 instructs the address management part 126 to obtain an invalid physical block as the current block according to a write command of the access device 101, the CPU 122 completely clears the current block status table 131. Then, the CPU 122 sets the physical block address PBA at the word 0 and the logical block address LBA at the word 1 and then, sets the identification flag according to write processing for each page of the current block.
The error restoration part 129, as shown in
Based on the error page number, the substitute and repair processing part 151 performs copy processing, retry processing, and repair processing. The copy processing is for copying data already stored in the physical block including an error occurrence page (a block of writing object) to the other erased block. The retry processing is for rewriting data which were tried to be written into the error page of the block of writing object into a page of the other erased block corresponding to the error page. Given that a repair page is another page composing the same memory cell as the error page, the repair processing instructs processing for writing repair data into a first page (related page) corresponding to the repair page of the erased block.
The page information instruction part 153 has a page information table 154. The table 154 is a table for storing page information of the page of data held in the memory cell.
The last word in the page information table 154 stores the number of pages of which one memory cell is composed, namely, 2 therein. The page information table 154 in
The page information table 154 is composed of a volatile RAM such as SRAM, or nonvolatile RAM or ROM such as a ferroelectric memory (FeRAM). In a case of the volatile RAM, in initialization processing at power-on, the CPU 122 may compose the page information table 154 in the SRAM or the like based on a device code read from the nonvolatile memory 110 by the CPU 122. As a specific configuration method, a table may be selectively transferred from the ROM 124 to the SRAM on the basis of the device code after the page information table is previously stored in the ROM 124 by device type. In a case of the multi-level NAND flash memory with relatively simple page structure as shown in
Where 0x represents a hexadecimal number.
The save memory 155 has storage capacity of one page and is used as a save area for data of the first page belonging to the same group of the second page when data is written in the second page of each group. In a case where this memory is composed of a nonvolatile RAM such as the ferroelectric memory (FeRAM), both the troubles of power shutdown and flash trouble can be addressed, thereby restoring the error. In a case where this memory is composed of a volatile RAM such as SRAM, only the flash trouble can be solved.
As described below using a flowchart, based on the current page number received from the address management part 126, the related page identification part 152 refers to the page information table in the page information instruction part 153 or executes calculation according to the equation 1 to determine a page number belonging to the same group. The repair processing of the substitute and repair processing part 151 repairs an error by using the error page number and error type flag which are received from the error page identification part 128, the related page number from the related page identification part 152, and related data temporarily stored in a save memory.
Hereinafter, operations of the nonvolatile memory device 100 will be described.
First, contents of the nonvolatile memory 110 and logical-physical conversion table 142 immediately after shipping will be described. In the nonvolatile memory 110, there are system area which stores system information such as the device code and security information therein and a normal area in which the user reads and writes data. Various information in the system area is written on the manufacturer's side before the shipping.
All good blocks in the normal area of the nonvolatile memory 110 after the shipping have been erased and the status flag and logical block address are set in the management area MR (hatched area in
A value 0xFFF is set as the logical block address. The value 0xFFF does not mean that the physical address of the nonvolatile memory 110 is 0xFFF, but means that no physical address is set. Therefore, the physical block at the physical address 0xFFF in the nonvolatile memory 110 is an unusable physical block, and a logical address managed by the access device 101 designates a space smaller than 4096 addresses from the addresses 0x0000 to 0xFFF in the unit of 256 kbytes as the physical block size.
Next, based on the device code read from the nonvolatile memory 110, the page information table 154 is created in the page information instruction part 153 (S103). Alternatively, the page information instruction part 153 may find page structure information according to the arithmetic function (corresponding to the equation 1) that is based on the device code.
Next, the CPU 122 reads the management area of leading pages of all physical blocks in the nonvolatile memory 110 via the read-write controller 127 (S104). Then, the physical area management table 141 and the logical-physical conversion table 142 are created in the address management part 126 (S105).
Then, the CPU 122 checks whether or not an error due to power shutdown caused by a write operation before power-on occurs by checking the current block status table 131. Here, a case immediately after the shipping, namely, a case where a page in being written does not exist is described, and a case where the page in being written exists will be described later in detail. When the page in being written does not exist, the procedure proceeds from S107, S108 in the flowchart of
After putting into the acceptance permitted state for the commands, in a case where the nonvolatile memory device 100 has not been formatted, the access device 101 formats the nonvolatile memory device 100 on the basis of a FAT file system to compose a logical address space. Then, the procedure proceeds to processing in a normal operation.
Next, processing in the normal operation after initialization will be described. Since the present invention intends to improve error restoration in write processing, here, only write processing will be described. Furthermore, since data is often written in units of clusters from the access device 101, for clarity of description, only writing in units of clusters will be described. Also in writing in units of clusters, data transfer permission control is performed between the access device 101 and the nonvolatile memory device 100 in units of sectors which are minimum write units.
First, the access device 101 transfers a write command of 16 kbytes (of one cluster) of the logical addresses LA0 to LA31 to the nonvolatile memory device 100. When the host IF 121 receives the write command, the host notifies the receipt to the CPU 122, and the CPU 122 writes data into the buffer memory 125 in the order starting from data of the logical address LA0.
Since capacity of the buffer memory 125 has capacity of one page (four sectors), the data of logical addresses LA0 to LA3 is written into the buffer memory 125. When the data of logical addresses LA0 to LA3 is temporarily stored in the buffer memory 125, the CPU 122 writes the data in the buffer memory 125 into the nonvolatile memory 110. When writing of the data into the nonvolatile memory 110 has finished, the CPU 122 issues transfer permission for next data to the access device 101 via the host IF 121. In this manner, the CPU 122 writes data in units of four sectors from the buffer memory 125 into the nonvolatile memory 110. When write processing of data of one cluster from the access device 101 has finished, the CPU 122 notifies that “the corresponding cluster has been normally written” to the access device 101 via the host IF 121.
In parallel with the above-mentioned operations, when the host IF 121 receives the write command from the access device 101, using the write command as a trigger, the CPU 122 instructs the address management part 126 to obtain one physical block to which data is written. The address management part 126 refers to the physical area management table 141, searches an invalid block in ascending order starting from a randomly selected address, and defines a firstly found invalid physical block, for example, PB10 as a physical block of writing target. This enables wear leveling that prevents certain blocks from being designated intensively as the block of the writing target. The CPU 122 transmits an erasure command for the PB10 to the nonvolatile memory 110 through the read-write controller 127 and writes data after erasure of the PB10.
Next, a flow of writing the data temporarily stored in the buffer memory 125 into the physical block in the nonvolatile memory 110 will be described referring to FIG. 17A. The PB10 represents one physical block in the nonvolatile memory 110.
When data of four sectors, namely, one page is temporarily stored in the buffer memory 125, the CPU 122 performs write processing of data to the PB10. The CPU 122 transfers the data LA0 to LA3 stored in the buffer memory 125 to the read-write controller 127. In parallel with the operations, the address management part 126 refers to the logical address LA held by the CPU 122, defines the page number in the logical address format in
The read-write controller 127 writes data into the corresponding page in the PB10 in the nonvolatile memory 110 (corresponding to an arrow A in
If the error does not occur, after receiving the ready-busy flag, the CPU 122 issues transfer permission for next data to the access device 101 via the host IF 121 and the access device 101 transfers data at the logical address LA4 and later.
In this manner, the data stored in the buffer memory 125 is written into the corresponding page in the PB10 in units of pages. When data of one cluster of the logical addresses LA0 to LA31 is stored in pages 0 to 7 in the PB10, the CPU 122 notifies that “the corresponding cluster has been normally written” to the access device 101 via the host IF 121.
In a case where the access device 101 continuously writes data of one cluster of logical addresses LA32 to LA63, the access device 101 performs the similar processing to store the data into pages 8 to 15 in the PB10. In the case where the access device 101 continuously writes data of one cluster at logical addresses LA64 to LA95, the access device 101 performs the above-mentioned series of processing to store the data in pages 16 to 23 into the PB10.
In a series of write processing, as described later, the CPU 122 temporarily stores data stored in the first page into the save memory 155 prior to writing into the second page. For example, in
Here, processing in a case where data could not be normally written into the page 17 in the PB10 due to flash trouble will be described referring to
In
Meanwhile, irrespective of the error occurrence, the address management part 126 transfers the current page number to the related page identification part 152 and the related page identification part 152 gives an instruction of preread processing (save processing) described later as necessary.
In a flowchart in
Next, based on the page type information 154b, it is determined whether or not the page number belonging to the same group is the first page (S303). If the page number is the first page (namely, the related page), the related page number is transferred to the address management part 126 (S304) and the address management part 126 is instructed to perform the preread processing described later. Whether the NAND flash memory is a single-level or multi-level NAND flash memory, data must be written from a side of the lower order address. Accordingly, when the current page number is the first page, the preread instruction is unnecessary.
The preread processing is for storing data stored in the related page transferred from the related page identification part 152 to the address management part 126 into the save memory 155 prior to writing into the current page. In this manner, data held in the save memory 155 as needed is referred to as related data, and using the related data, garbled data in the related page which is caused by the writing error in the current page is repaired. Repair processing will be described later.
After the processing relating to the above-mentioned preread instruction, it is determined whether or not an error occurred (S305). If no error exists, the processing finishes. Pages having an error are shown by a star sign in the right PB10 in
Next, it is determined whether or not the page number belonging to the same group is the first page on the basis of the page type information 154b (S308). If the error page is the first page, repair processing is unnecessary. If the error page is the second page, data in the related page need to be repaired. For example, when the related page number is the page 11 and the error page number is the page 17, the related page number is transferred to the substitute and repair processing part 151 (S309) and control shifts to the substitute and repair processing part 151. In a case where S309 is not performed, namely, the related page identification part 152 does not transfer the related page to the substitute and repair processing part 151, the repair processing is not performed.
When the control shifts to the substitute and repair processing part 151, as shown in
The copy processing is for copying data written into the errorless page in the PB10 to another erased physical block (for example, PB5) in the error restoration processing in
Next, at step S405, the repair processing is performed. The repair processing is for rewriting the related data temporarily stored in the save memory 155 into the related page. For example, in the error restoration processing in
In the error restoration processing in
The above-mentioned substitute processing can restore the error caused by flash trouble. The address management part 126 sets the corresponding status flag in the physical area management table to be an invalid block so that the physical block PB10 can be erased to be available next.
Next, error restoration processing in the case of power shutdown will be described referring to
Since then, whether the new invalid physical block is obtained or not, processing at S505 to S509 is performed in each writing into each page in the PB10. The power shutdown determination part 132 receives the current page number from the address management part 126 (S505), and when reading data temporarily stored in the buffer memory 125, sets the higher order bit of the identification flag in the write state corresponding to the current page to be the value 1 (S506). Immediately after data is written into the nonvolatile memory 110, the read-write controller 127 receives the ready-busy flag (S507). When the state is ready (S508), by setting the lower order bit of the identification flag corresponding to the current page to be the value 1 (S509) the fact that writing into the predetermined page has finished is recorded in the current block status table 131 as a history.
As described above, by recording the write state into each page in the current block status table 131, a page in being written at power shutdown can be identified in the initialization processing at power-on immediately after power shutdown. An example of the current block status table 131 shown in
The case where initialization processing is performed after power shutdown occurs during writing into the page 17 will be described referring to
When an error occurs, the procedure proceeds to
The substitute and repair processing part 151 checks the error type flag transferred from the error occurrence page identification part 128 (S111), and when a value is 0, namely, the error due to power shutdown is determined, error restoration is performed.
In the case of the error due to power shutdown, unlike the error due to flash trouble, the retry processing is not performed. Since concerning the cluster having the error, the CPU 122 does not notify that “the corresponding cluster has been normally written” to the access device 101, the retry processing is unnecessary. In addition, since data to be written into the error occurrence page (page 17) disappears due to power shutdown, the retry processing cannot be performed. Therefore, in the case of power shutdown, the copy processing of at least the cluster which is notified as having been normally written to the access device 101 only needs to be performed. In other words, it is sufficient to perform only the copy processing of the page at lower order address than the address of the error occurrence page (except for the related page) and the repair processing of the related page.
As described above, in the first embodiment of the present invention, since the error restoration part 129 performs the repair processing, the error specific to the nonvolatile memory 110 in which the same memory cell is composed striding over two pages, namely, the error that data stored in the first page changes due to the write error in the second page can be solved.
The nonvolatile memory system in accordance with the embodiment of the present invention can repair data in both cases of the flash trouble and power shutdown by adding the error restoration processing.
Next, a second embodiment of the present invention will be described. In the present embodiment, a part of an area in a nonvolatile memory is used as a save area in place of the save memory.
In a case of writing data into the second page in the present embodiment, before the writing, data stored in the first page corresponding to the second page is temporarily stored in another physical block. For example, as shown in
In the event that trouble occurs due to power shutdown, to solve the trouble, as shown in
In each of the above-mentioned embodiments, the nonvolatile memory 110 is a memory in which each memory cell holds data striding over two pages, however, the present invention can be also applied to a memory which holds data striding over three pages. The single-level NAND flash memory, for example, in which the memory cell is closed in the page may be used as the nonvolatile memory 110. In this case, the page information instruction part 153 returns the page 0 as the related page number to the related page identification part 152 on every occasion, thereby masking an execution of the repair processing. The present invention is not limited to the above-mentioned embodiments.
The memory controller, nonvolatile memory device and nonvolatile memory system according to the present invention can improve reliability of an apparatus using a nonvolatile memory such as a multi-level NAND flash memory in which each memory cell holds data over multiple pages therein. The present invention can be applied to a recording medium for portable AV equipments such as a still image recording and reproduction device and moving image recording and reproduction device or a portable communication equipment such as a mobile phone.
Number | Date | Country | Kind |
---|---|---|---|
2005-239472 | Aug 2005 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP2006/315725 | 8/9/2006 | WO | 00 | 5/23/2008 |