1. Field of the Invention
The present invention relates to a semiconductor memory device using a non-volatile memory, a memory controller, and a data recording method.
2. Description of the Related Art
Memory cards such as SD memory cards and Compact Flash™ are small among semiconductor memory devices, so they are used practically as removable memory devices for portable equipment such as digital still cameras.
Generally, in a practically used semiconductor memory device, a flash memory is built in as a non-volatile memory, and further a memory controller LSI which is a control circuit thereof is incorporated. In recent years, due to increasing demands for larger capacity of a semiconductor memory device, the capacity of a non-volatile memory chip itself is also increasing by means of multi-valued cell. Further, due to advancement in the mounting technique, the number of chips of non-volatile memory mounted on a semiconductor memory device is increased, whereby one having a memory space exceeding 1 GB is coming into practical use as a semiconductor memory device.
As address management methods in semiconductor memory devices, there are disclosed two methods, that is, a distributed management method and a centralized management method. In the distributed management method, a flag showing the logical address and the state of a page is stored in the management area of a page which is a writing unit, and when initializing, an address management table and the like are formed in a RAM within the controller LSI. In the centralized management method, a special block for an address management table is prepared on the non-volatile memory, and when initializing, this block is read out to a RAM within the memory controller LSI.
In the distributed management method, it is required to read the management areas of all address spaces at the time of initialization, which causes a problem of a relatively long period being required for initialization. On the other hand, in the centralized management method, as an address space becomes larger, the capacity of the address management table, that is, the capacity of a read/write memory (such as RAM) within the memory controller LSI becomes enormous, which causes a problem of a relatively high cost. In order to solve the problem in the centralized management method, there is proposed a method in which all memory spaces are divided into a plurality of logical address ranges, and address management information such as an address management table is stored for each logical address range. (For example, see Japanese Patent Application Laid-open No. 2001-142774.)
However, a problem still remains in its reliability, because this art does not disclose a method to restore to the state before data writing, if power supply interruption is caused during data writing to a non-volatile memory or data rewriting.
The present invention has been developed in view of these conventional problems. An object of the invention is to enable the memory device to be restored to the state before data writing, if power supply interruption is caused during data writing to a non-volatile memory or data rewriting, as described above.
A semiconductor memory of the present invention is used by connecting with an access device and reads and writes data according to a command and a logical address given by the access device. The semiconductor memory comprises: a non-volatile memory, composed of a plurality of physical blocks, for storing address management information and user data; and a memory controller, wherein the memory controller includes: a volatile read/write memory for reading out the address management information retained in the non-volatile memory and storing it temporarily; a non-volatile memory access unit for writing user data onto the non-volatile memory according to a write instruction from the access device, and upon completion of a series of write processing, rewriting the address management information temporarily stored in the read/write memory to the non-volatile memory; an address management information controller for sequentially updating the address management information temporarily stored in the read/write memory according to the write processing of the user data to the non-volatile memory; and a controller for controlling reading/writing of the user data from/to the non-volatile memory based on the address management information retained in the read/write memory, wherein when the user data is rewritten, the address management information controller causes a physical block, which is an object to which the user data is rewritten, to be a to-be-invalid block until completion of a series of write processing in the address management information temporarily stored in the read/write memory to thereby prohibit writing onto the to-be-invalid physical block.
A memory controller of the present invention is composed of a plurality of physical blocks and is used for a semiconductor memory device in which data is written onto and read from a non-volatile memory for storing address management information and user data. The memory controller comprises: a volatile read/write memory for reading out the address management information retained in the non-volatile memory and storing it temporarily; a non-volatile memory access unit for writing user data onto the non-volatile memory according to a write instruction from the access device, and upon completion of a series of writing process, rewriting the address management information temporarily stored in the read/write memory to the non-volatile memory; an address management information controller for sequentially updating the address management information temporarily stored in the read/write memory according to the writing process of the user data to the non-volatile memory; and a controller for controlling read/write of the user data from/to the non-volatile memory based on the address management information retained in the read/write memory, wherein when the user data is rewritten, the address management information controller causes a physical block, which is an object to which the user data is rewritten, to be a to-be-invalid block until completion of a series of write processing in the address management information temporarily stored in the read/write memory to thereby prohibit writing onto the to-be-invalid physical block.
A data recording method in a semiconductor memory device is the method that data is written on and read from a non-volatile memory storing address management information and user data. The method comprises the steps of: reading the address management information retained in the non-volatile memory and storing it temporarily in a volatile read/write memory; according to a write instruction of an access device, writing/reading the user data onto/from the non-volatile memory, based on the address management information retained in the read/write memory; sequentially updating the address management information temporarily stored in the read/write memory according to writing process of the user data to the non-volatile memory; and when rewriting the user data, causing a physical block, which is an object to which the user data is rewritten, to be a to-be-invalid block until completion of a series of writing process in the address management information temporarily stored in the read/write memory to thereby prohibit writing onto the to-be-invalid physical block; and upon completion of the series of writing process, rewriting the address management information temporarily stored in the read/write memory to the non-volatile memory.
According to the present invention, during a series of data writing, address management information corresponding to a physical area in which old data is rewritten is set to be in a to-be-invalid state, and writing is prohibited until a process of data writing ends. Thereby, even if a power supply interruption is caused during data writing, it is possible to be restored to the state before writing, that is, the state where the old data remains. As a result, it is possible to provide a semiconductor memory device, a memory controller and a data recording method with high reliability.
The non-volatile memory 111 is a non-volatile main storage memory for storing address management information and user data, consisting of, for example, a flash memory. The non-volatile memory 111 is, for example, divided into four logical address ranges (LAU) 0-3 designated by the access device. In each of the logical address ranges 0-3, a plurality of physical blocks are formed, including an area for storing user data and an area for storing address management information. User data areas 112-115 are retained in the respective logical address ranges 0-3 designated by the access device 100, and are formed of a plurality of physical blocks. Pieces of address management information 116-119 corresponds to the logical address ranges 0-3, respectively, and are formed of a plurality of physical blocks. Note that a physical block means a minimum unit erasable selectively.
In the read/write memory 109, any one of address management information in the non-volatile memory 111 has been read at the time of initialization. The address management information of the non-volatile memory 111 has an address conversion table and a physical area management table which are almost same as that of the read/write memory. However, a to-be-invalid block within the physical area management table is set temporarily on the read/write memory 109, whereby it is not reflected in the address management information within the non-volatile memory 111.
Explanation will be given for the operation of the semiconductor memory device of the present embodiment, configured as described above, by using
The CPU 102 issues a read instruction to the non-volatile memory access unit 106, reads address management information corresponding to the logical address range 0 from the non-volatile memory 111, and transfers the information to the address conversion table 107 and the physical area management table 108 on the read/write memory 109. The address management information read at this point is the latest address management information existing in four physical blocks in the shaded area 116 within the logical address range 0 in
The address management information lower-order than the physical block retaining the latest address management information (upper left direction in the Figure) may be erased as invalid blocks so as to be usable later. Since this is not essential processing in the present invention, explanation is omitted. An AT read period TATR in
Each data writing period consists of a period of erasing a physical block which is the object of writing, that is, an erase busy period, and a period of writing onto the erased physical block, that is, a program busy period, based on transferring period (not shown) of a write command, an address and data. Since the data writing period Ta is a time period of newly writing data DataA on the logical address, old data does not exist. In such a case, the CPU 102 obtains an invalid physical block of “11” in binary number by referring to the physical area management table 108 on the read/write memory 109 shown in
Next, in the data write period Tb, the data DataB is rewritten to DataB′ on the logical address. In such a case, the old data DataB exists in the physical block 202 corresponding to the designated logical address, as shown in
In view of the above, at the timing when the data write period Tb starts, the physical block 202 corresponding to the logical address for rewriting object, that is, the physical block 202 which has an old data DataB, is set to be a to-be-invalid block, or “01” in binary number. A to-be-invalid block is a prohibited physical block during the period of writing a series of user data. Then, a physical block in the invalid state, or a physical block 203 in this case, is selected in order to write new data, and a write command and an address and data are transferred. Then, data of the selected physical block 203 is erased in Tb1. Next, as shown in
Next, the data write periods Tc and Td are for new writing, so processing similar to that in the data write period Ta is performed. At this time, a to-be-invalid block is not selected as a new data write area.
The data write period Te is for rewriting, so processing similar to that in the data write period Tb is performed. At this time, the physical block where the old data exists is set to be a to-be-invalid block on the physical area management table 108, and new data is written on another invalid physical block. Even in this case, a to-be-invalid block is not selected as a new data write area.
Then, in the AT write period TATW in
Now, explanation will be given for a case where the power supply is interrupted during a series of writing. For example, when the power supply is interrupted in the state where rewriting of the data DataB is completed, the contents of the tables 107 and 108 of the read/write memory 109 are not retained. Accordingly, when the power supply is recovered from the interruption, the content of the physical area management table within the address management information retained in the non-volatile memory 111 is read again into the physical area management table 108 of the read/write memory 109 by initialization processing. In such a case, it is restored to the original state shown in
As described above, according to the present invention, address management information corresponding to the physical area in which old data has been rewritten is made to be in a to-be-invalid state during writing of a series of data, and writing is prohibited until the series of writing ends, whereby it is possible to restore to the state before writing, that is, the state where the old data remains, even though a failure such as a power supply interruption is caused during data writing. As a result, it is possible to provide a semiconductor memory device with high reliability. Further, since information of the physical area management table is not rewritten in the address management information area within the non-volatile memory 111 during a series of writing, a series of write processing can be carried out at a higher speed comparing with the case of rewriting to the non-volatile memory one by one.
As the address conversion table 107 and the physical area management table 108, volatile read/write memories other than RAMs may be used if they can access at a relatively high speed. Further, the non-volatile memory 111 may incorporate a plurality of non-volatile memory chips. Further, as the non-volatile memory 111, a non-volatile memory other than a flash memory may be used. Further, although the pieces of address management information shown by the shaded blocks in
The semiconductor memory device of the present invention can be used advantageously for various apparatuses which requires reading/writing of a large amount of data and high speed accessing, using a non-volatile memory. Such apparatuses include digital video cameras, digital still cameras, portable audio recording/playing back apparatuses.
Number | Date | Country | Kind |
---|---|---|---|
2004-022671 | Jan 2004 | JP | national |