JP2010097386A - Data management method - Google Patents

Data management method Download PDF

Info

Publication number
JP2010097386A
JP2010097386A JP2008267288A JP2008267288A JP2010097386A JP 2010097386 A JP2010097386 A JP 2010097386A JP 2008267288 A JP2008267288 A JP 2008267288A JP 2008267288 A JP2008267288 A JP 2008267288A JP 2010097386 A JP2010097386 A JP 2010097386A
Authority
JP
Japan
Prior art keywords
information
data
valid
invalid
flash memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008267288A
Other languages
Japanese (ja)
Inventor
Isamu Nakajima
勇 中島
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Semiconductor Ltd
Original Assignee
Fujitsu Semiconductor Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Semiconductor Ltd filed Critical Fujitsu Semiconductor Ltd
Priority to JP2008267288A priority Critical patent/JP2010097386A/en
Publication of JP2010097386A publication Critical patent/JP2010097386A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To correctly manage data in data management of flash memory. <P>SOLUTION: When power supply interception occurs during program operation on the flash memory, the interrupted processing is determined, when detecting that the processing of program operation has been interrupted by interception of the power supply after restoration of power supply (step S1). The program operation is started from one processing prior to the processing determined that it is interrupted, and a memory cell of an unstable status is returned to a stable memory cell by overwriting data to the memory cell of inadequate writing (step S2). <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

この発明は、フラッシュメモリのデータ管理方法に関する。   The present invention relates to a data management method for a flash memory.

従来、フラッシュメモリをアクセスするファイル管理装置が提案されている。このファイル管理装置では、書き込み処理等の処理内容を示す識別コードを動作履歴記録領域に記録し、その書き込み処理等が正常終了すると、その識別コードを消去する。その後、動作履歴記録領域に識別コードの記録が残されている場合、その識別コードを解析して、そのデータ領域等に格納されているデータを復旧する(例えば、特許文献1参照。)。   Conventionally, a file management apparatus for accessing a flash memory has been proposed. In this file management apparatus, an identification code indicating the processing content such as a writing process is recorded in the operation history recording area, and when the writing process or the like is completed normally, the identification code is deleted. Thereafter, when the identification code is recorded in the operation history recording area, the identification code is analyzed, and the data stored in the data area or the like is restored (see, for example, Patent Document 1).

また、不揮発性メモリを用いた半導体メモリ装置が提案されている。この半導体メモリ装置では、メモリコントローラに読み書きメモリを設け、アドレス管理情報を一時記憶する。不揮発性メモリアクセス部は書き込み命令に応じて、ユーザデータを不揮発性メモリに書き込む。アドレス管理情報制御部は、ユーザデータを書き換える時に、アドレス管理情報の書き換え対象である物理ブロックを無効予定ブロックとする。一連の書き込み処理後に、無効予定を無効ブロックとして読み書きメモリのアドレス管理情報を不揮発性メモリに書き戻す(例えば、特許文献2参照。)。   A semiconductor memory device using a nonvolatile memory has been proposed. In this semiconductor memory device, a memory controller is provided with a read / write memory to temporarily store address management information. The nonvolatile memory access unit writes user data to the nonvolatile memory in response to the write command. When rewriting user data, the address management information control unit sets a physical block that is the target of rewriting address management information as an invalid scheduled block. After a series of writing processes, the address management information of the read / write memory is written back to the nonvolatile memory using the invalid schedule as an invalid block (see, for example, Patent Document 2).

また、不揮発性記憶装置の制御方法が提案されている。この制御方法は、複数の物理ブロックで構成される不揮発性メモリにデータを書き込むときに、物理ブロックの先頭ページの冗長領域にあり、その先頭ページにデータが書き込まれているか否かを示す第1のフラグに、データが書き込まれていることを示す固定値を書き込む第1のフラグ書き込みステップと、その物理ブロックにデータを書き込むデータ書き込みステップと、を有する(例えば、特許文献3参照。)。   Also, a method for controlling the nonvolatile memory device has been proposed. In this control method, when data is written to a nonvolatile memory composed of a plurality of physical blocks, the first method indicates whether the data is in the redundant area of the first page of the physical block and data is written to the first page. The flag includes a first flag writing step for writing a fixed value indicating that data is written, and a data writing step for writing data to the physical block (see, for example, Patent Document 3).

特開2001−84180号公報JP 2001-84180 A 特開2005−243000号公報JP 2005-243000 A 国際公開第2004/031966号パンフレットInternational Publication No. 2004/031966 Pamphlet

フラッシュメモリにデータを書き込んだ後、メモリセル内のデータが確定する前に電源が遮断された場合、データの書き込みが不十分なセル、すなわち電荷量の不十分なセルが発生することがある。このような書き込みが十分でないセルでは、データの読み出し時に1と0を正しく判別できないため、読み出しのたびに1と0が不確定に読み出されることになる。上述した従来の装置や方法では、このような書き込みが十分でないセルを判別することができないため、書き込みが不十分なセルに対してデータの読み出しを行ってしまうので、正しくデータを管理することができない、という問題点がある。   If the power is turned off after data is written to the flash memory and before the data in the memory cell is determined, a cell with insufficient data writing, that is, a cell with insufficient charge may occur. In such a cell in which writing is not sufficient, 1 and 0 cannot be correctly discriminated at the time of reading data, so that 1 and 0 are read indefinitely at every reading. The above-described conventional apparatus and method cannot discriminate such cells that are not sufficiently written, so that data is read from cells that are insufficiently written, so that data can be managed correctly. There is a problem that it is not possible.

このデータ管理方法は、フラッシュメモリのデータを正しく管理することができるデータ管理方法を提供することを目的とする。   An object of this data management method is to provide a data management method capable of correctly managing data in a flash memory.

このデータ管理方法は、フラッシュメモリのプログラム動作中に電源遮断が発生した場合、電源が再投入された後に、電源遮断により中断された処理を判定する。そして、その中断されたと判定された処理の一つ前の処理から回復処理を行う。   In this data management method, when a power interruption occurs during the program operation of the flash memory, the process interrupted by the power interruption is determined after the power is turned on again. Then, the recovery process is performed from the process immediately before the process determined to be interrupted.

このデータ管理方法によれば、実際に電源遮断時に中断された処理が、電源の再投入後に、電源遮断により中断されたと判定された処理の一つ前の処理である場合でも、回復処理によってデータを正しく回復することができる。例えば、電源遮断により中断されたと判定された処理の一つ前の処理でデータの書き込みが不十分なセルが発生した場合、回復処理によってそのセルにデータが上書きされる。   According to this data management method, even if the process that was actually interrupted when the power was turned off is the process immediately before the process that was determined to have been interrupted due to the power being turned off after the power was turned on again, Can be recovered correctly. For example, if a cell with insufficient data writing occurs in the process immediately before the process determined to have been interrupted due to power interruption, the data is overwritten by the recovery process.

このデータ管理方法によれば、フラッシュメモリのデータを正しく管理することができるという効果を奏する。   According to this data management method, there is an effect that data in the flash memory can be correctly managed.

以下に添付図面を参照して、このデータ管理方法の好適な実施の形態を詳細に説明する。   Hereinafter, preferred embodiments of the data management method will be described in detail with reference to the accompanying drawings.

(概略)
図1は、実施の形態にかかるデータ管理方法の概略を示すフローチャートである。図1に示すように、フラッシュメモリのプログラム動作中に電源遮断が発生して処理が中断され、電源の再投入時点、または電源の再投入後にプログラム動作の処理が中断されたことを検出した時点で、どの処理でプログラム動作が中断されたかということを判定する(ステップS1)。そして、その中断されたと判定された処理の一つ前の処理からプログラム動作を開始し、データを回復をする(ステップS2)。
(Outline)
FIG. 1 is a flowchart illustrating an outline of a data management method according to the embodiment. As shown in FIG. 1, when a power interruption occurs during a program operation of the flash memory and the process is interrupted, when the power is turned on again or when it is detected that the program operation process is interrupted after the power is turned on again Thus, it is determined in which process the program operation is interrupted (step S1). Then, the program operation is started from the process immediately before the process determined to be interrupted, and the data is recovered (step S2).

(フラッシュメモリを備えたシステムの例)
フラッシュメモリを備えたシステムとして、マイクロコントローラなどのLSI(Large Scale Integration)にフラッシュメモリが内蔵されたシステム(フラッシュ内蔵マイコン)がある。また、単体のフラッシュメモリを備えたコンピュータシステムがある。前記データ管理方法は、これらのシステムのフラッシュメモリに対するプログラム動作中に処理が中断された場合のデータ管理に適している。データ管理方法の詳細については、データ書き換え時の中断による回復動作およびガーベッジ・コレクション時の中断による回復動作として、後述する。
(Example of system with flash memory)
As a system provided with a flash memory, there is a system (flash built-in microcomputer) in which a flash memory is built in an LSI (Large Scale Integration) such as a microcontroller. There is also a computer system having a single flash memory. The data management method is suitable for data management when processing is interrupted during a program operation on the flash memory of these systems. Details of the data management method will be described later as a recovery operation by interruption at the time of data rewriting and a recovery operation by interruption at the time of garbage collection.

図2は、実施の形態におけるフラッシュ内蔵マイコンの概略を示すブロック図である。図2に示すように、フラッシュ内蔵マイコン1は、内蔵フラッシュメモリ2、CPUコア3および内蔵RAM4を備えている。内蔵フラッシュメモリ2、CPUコア3および内蔵RAM4は、メモリバス5を介して相互に接続されている。内蔵フラッシュメモリ2には、例えばシステムデータもしくはユーザデータ、および内蔵フラッシュメモリ2のドライバソフトウェアを含むソフトウェアが格納されている。内蔵フラッシュメモリ2が複数のバンクを備えた同時実行可能なメモリである場合、CPUコア3は、内蔵フラッシュメモリ2内のソフトウェアを読み出しながら、内蔵フラッシュメモリ2内のシステムデータまたはユーザデータを書き換えることができる。内蔵フラッシュメモリ2、CPUコア3および内蔵RAM4には、外部のバッテリー6から電源が供給される。   FIG. 2 is a block diagram showing an outline of the microcomputer with built-in flash according to the embodiment. As shown in FIG. 2, the flash built-in microcomputer 1 includes a built-in flash memory 2, a CPU core 3, and a built-in RAM 4. The built-in flash memory 2, the CPU core 3, and the built-in RAM 4 are connected to each other via a memory bus 5. The built-in flash memory 2 stores, for example, software including system data or user data and driver software for the built-in flash memory 2. When the built-in flash memory 2 is a simultaneously executable memory having a plurality of banks, the CPU core 3 rewrites the system data or user data in the built-in flash memory 2 while reading the software in the built-in flash memory 2. Can do. Power is supplied from an external battery 6 to the built-in flash memory 2, the CPU core 3, and the built-in RAM 4.

図3は、実施の形態におけるコンピュータシステムの概略を示すブロック図である。図3に示すように、コンピュータシステム11は、フラッシュメモリ12、CPU13、RAM14およびROM17を備えている。フラッシュメモリ12、CPU13、RAM14およびROM17は、メモリバス15を介して相互に接続されている。フラッシュメモリ12には、例えばシステムデータまたはユーザデータが格納されている。フラッシュメモリ12のドライバソフトウェアを含むソフトウェアは、例えばROM17に格納されている。フラッシュメモリ12、CPU13、RAM14およびROM17には、外部のバッテリー16から電源が供給される。   FIG. 3 is a block diagram illustrating an outline of a computer system according to the embodiment. As shown in FIG. 3, the computer system 11 includes a flash memory 12, a CPU 13, a RAM 14, and a ROM 17. The flash memory 12, the CPU 13, the RAM 14, and the ROM 17 are connected to each other via the memory bus 15. For example, system data or user data is stored in the flash memory 12. Software including driver software for the flash memory 12 is stored in the ROM 17, for example. Power is supplied to the flash memory 12, CPU 13, RAM 14, and ROM 17 from an external battery 16.

(フラッシュメモリの構成)
図4は、実施の形態におけるフラッシュメモリの概略を示す説明図である。図4に示すように、フラッシュメモリ21は、複数の消去単位ブロック22,23,24を備えている。消去単位ブロックは、一括してデータが消去される単位である。つまり、消去単位ブロック内の一部のデータを消去する際には、その消去単位ブロック内の全てのデータが消去される。各消去単位ブロック22,23,24には、識別情報、割り当て情報、データおよびアドレス情報が格納される。これらの管理情報を、識別情報A、割り当て情報Bおよびアドレス情報Cとする。識別情報Aは、消去単位ブロックを識別するための情報である。割り当て情報Bは、データの格納状態を表す情報であり、データの書き込みまたは読み出しの単位毎に設けられる。割り当て情報Bには、アドレスに関する情報も含まれる。アドレス情報Cは、物理アドレスと論理アドレスの変換のための情報であり、データの書き込みまたは読み出しの単位毎に設けられる。
(Configuration of flash memory)
FIG. 4 is an explanatory diagram showing an outline of the flash memory in the embodiment. As shown in FIG. 4, the flash memory 21 includes a plurality of erase unit blocks 22, 23, and 24. An erase unit block is a unit from which data is erased in a batch. That is, when erasing a part of the data in the erase unit block, all the data in the erase unit block is erased. Each erase unit block 22, 23, 24 stores identification information, allocation information, data, and address information. These pieces of management information are referred to as identification information A, allocation information B, and address information C. The identification information A is information for identifying the erase unit block. The allocation information B is information representing a data storage state, and is provided for each unit of data writing or reading. The allocation information B includes information regarding addresses. The address information C is information for conversion between a physical address and a logical address, and is provided for each unit of data writing or reading.

図5は、実施の形態における消去単位ブロックの構成例を示す説明図である。図5に示すように、識別情報A、割り当て情報Bおよびアドレス情報Cには、それぞれ、それらの管理情報が有効であるか否かを示す情報(以下、有効/無効情報とする)が付加されている。識別情報Aの有効/無効情報、割り当て情報Bの有効/無効情報およびアドレス情報Cの有効/無効情報を、それぞれ、有効/無効情報A、有効/無効情報Bおよび有効/無効情報Cとする。   FIG. 5 is an explanatory diagram showing a configuration example of the erase unit block in the embodiment. As shown in FIG. 5, each of the identification information A, allocation information B, and address information C is added with information indicating whether or not the management information is valid (hereinafter referred to as valid / invalid information). ing. Valid / invalid information of identification information A, valid / invalid information of allocation information B, and valid / invalid information of address information C are assumed to be valid / invalid information A, valid / invalid information B, and valid / invalid information C, respectively.

(通常時の動作:データ読み出し手順)
図6は、実施の形態におけるデータ読み出し手順を示すフローチャートである。図6に示すように、データの読み出し処理が開始されると、まず、読み出し対象データの論理アドレス情報に対応する有効/無効情報Cを参照し、読み出し対象データの論理アドレス情報に対応するアドレス情報Cの「有効」情報を確認する(ステップS11)。次いで、ステップS11で確認されたアドレス情報Cを参照して読み出し対象データの格納先を特定する(ステップS12)。次いで、ステップS12で特定されたデータ格納先からデータを読み出し(ステップS13)、データの読み出し処理を終了する。
(Normal operation: Data reading procedure)
FIG. 6 is a flowchart illustrating a data read procedure according to the embodiment. As shown in FIG. 6, when the data read process is started, first, the valid / invalid information C corresponding to the logical address information of the read target data is referred to, and the address information corresponding to the logical address information of the read target data The “valid” information of C is confirmed (step S11). Next, the storage location of the read target data is specified with reference to the address information C confirmed in step S11 (step S12). Next, data is read from the data storage location specified in step S12 (step S13), and the data reading process is terminated.

(通常時の動作:データ書き込み手順)
図7は、実施の形態におけるデータ書き込み手順を示すフローチャートである。図7に示すように、データの書き込み処理が開始されると、まず、割り当て情報Bを読み出し、「未使用」領域を検索する(ステップS21)。次いで、ステップS21での検索により見つかった未使用領域の割り当て情報Bの一つに「使用中」情報を書き込み(ステップS22)、その割り当て情報Bの有効/無効情報Bに「有効」情報を書き込む(ステップS23)。次いで、ステップS23で「有効」情報が書き込まれた割り当て情報Bに対応するデータ領域にデータを書き込む(ステップS24)。次いで、ステップS24でデータが書き込まれた領域のアドレス情報Cを書き込み(ステップS25)、そのアドレス情報Cの有効/無効情報Cに「有効」情報を書き込む(ステップS26)。次いで、ステップS24でデータが格納された領域の割り当て情報Bを「確定」に変更し(ステップS27)、その割り当て情報Bの有効/無効情報Bに「有効」情報を書き込み(ステップS28)、データの書き込み処理を終了する。
(Normal operation: Data writing procedure)
FIG. 7 is a flowchart illustrating a data writing procedure according to the embodiment. As shown in FIG. 7, when the data writing process is started, the allocation information B is first read to search for an “unused” area (step S21). Next, “in use” information is written in one of the allocation information B of the unused area found by the search in step S21 (step S22), and “valid” information is written in the valid / invalid information B of the allocation information B. (Step S23). Next, data is written in the data area corresponding to the allocation information B in which the “valid” information is written in step S23 (step S24). Next, the address information C of the area where the data is written in step S24 is written (step S25), and “valid” information is written in the valid / invalid information C of the address information C (step S26). Next, the allocation information B of the area in which the data is stored in step S24 is changed to “confirmed” (step S27), and “valid” information is written in the valid / invalid information B of the allocation information B (step S28). The writing process is terminated.

(通常時の動作:データ書き換え手順)
図8は、実施の形態におけるデータ書き換え手順を示すフローチャートである。図8に示すように、データの書き換え処理が開始されると、まず、上述したデータ書き込み処理のステップS21〜ステップS24と同様の処理を行う(ステップS31〜ステップS34)。ステップS34で未使用領域に書き込まれるデータが、書き換え後の新データとなる。書き換え前のデータを旧データとする。新データを書き込んだ後、旧データが格納されている領域の割り当て情報Bを「確定」から「書き換え中」情報に変更する(ステップS35)。次いで、新データが書き込まれた領域のアドレス情報Cを書き込み(ステップS36)、そのアドレス情報Cの有効/無効情報Cに「有効」情報を書き込む(ステップS37)。次いで、旧データが格納されている領域のアドレス情報Cの有効/無効情報Cに「無効」情報を書き込み(ステップS38)、そのアドレス情報Cに「削除」情報を書き込む(ステップS39)。次いで、新データが書き込まれた領域の割り当て情報Bを「確定」に変更する(ステップS40)。次いで、旧データが格納されている領域の割り当て情報Bの有効/無効情報Bを「無効」に変更し(ステップS41)、その割り当て情報Bに「削除」情報を書き込み(ステップS42)、データの書き換え処理を終了する。
(Normal operation: Data rewrite procedure)
FIG. 8 is a flowchart showing a data rewrite procedure according to the embodiment. As shown in FIG. 8, when the data rewrite process is started, first, the same processes as those in the above-described data write process in steps S21 to S24 are performed (steps S31 to S34). The data written in the unused area in step S34 becomes new data after rewriting. The old data is the data before rewriting. After writing the new data, the allocation information B of the area in which the old data is stored is changed from “confirmed” to “rewriting” information (step S35). Next, the address information C of the area where the new data is written is written (step S36), and the “valid” information is written in the valid / invalid information C of the address information C (step S37). Next, “invalid” information is written in the valid / invalid information C of the address information C in the area where the old data is stored (step S38), and “deleted” information is written in the address information C (step S39). Next, the allocation information B of the area in which the new data is written is changed to “confirmed” (step S40). Next, the validity / invalidity information B of the allocation information B in the area where the old data is stored is changed to “invalid” (step S41), and “deleted” information is written in the allocation information B (step S42). The rewriting process is terminated.

データ書き換え処理の途中、ステップS38の処理で電源遮断が起きた場合、次の2つのケースが考えられる。第1のケースは、ステップS38の「無効」情報の書き込み開始後早い段階で中断された場合である。第2のケースは、ステップS38の「無効」情報の書き込みが進んだ段階で中断された場合である。第1のケースでは、ステップS38は未処理の状態となり、書き込まれた「無効」情報は不安定な状態となる。第2のケースでは、ステップS38は処理済みの状態となり、書き込まれた「無効」情報は不安定な状態となる。いずれのケースでも、ステップS37は処理済みの状態となり、ステップS39は未処理の状態となる。従って、電源の再投入後、ステップS38で中断されたと判定される。   In the middle of the data rewriting process, the following two cases can be considered when the power interruption occurs in the process of step S38. The first case is a case where the process is interrupted at an early stage after the start of writing of “invalid” information in step S38. The second case is a case where the writing of “invalid” information in step S38 is interrupted at the advanced stage. In the first case, step S38 is in an unprocessed state, and the written “invalid” information is in an unstable state. In the second case, step S38 is in a processed state, and the written “invalid” information is in an unstable state. In any case, step S37 is processed and step S39 is unprocessed. Therefore, after the power is turned on again, it is determined that the operation has been interrupted in step S38.

一方、ステップS37の「有効」情報の書き込みが進んだ段階で電源遮断により処理が中断された場合を第3のケースとする。第3のケースでは、ステップS37は処理済みの状態となり、書き込まれた「有効」情報は不安定な状態となる。ステップS38は、未処理の状態である。従って、第1のケースと第3のケースは、ステップS37まで終了したことで一致するため、両ケースを区別することができない。同様に、ステップS39の「削除」情報の書き込み開始後早い段階で電源遮断により処理が中断された場合を第4のケースとする。第4のケースでは、ステップS38は、処理済みの状態である。ステップS39は未処理の状態となり、書き込まれた「削除」情報は不安定な状態となる。従って、第2のケースと第4のケースは、ステップS38まで終了したことで一致するため、両ケースを区別することができない。本実施の形態にかかるデータ管理方法によれば、このような事態に対しても適切に対処することができる(後述の(データ書き換え時の中断による回復動作)を参照)。   On the other hand, the case where the process is interrupted by power-off at the stage where the writing of the “valid” information in step S37 has progressed is the third case. In the third case, step S37 is in a processed state, and the written “valid” information is in an unstable state. Step S38 is an unprocessed state. Therefore, since the first case and the third case coincide with each other after the process up to step S37, the two cases cannot be distinguished. Similarly, the fourth case is a case where the process is interrupted due to power shutdown at an early stage after the start of writing of the “delete” information in step S39. In the fourth case, step S38 is a processed state. Step S39 is in an unprocessed state, and the written “delete” information is in an unstable state. Therefore, since the second case and the fourth case coincide with each other after the process up to step S38, the two cases cannot be distinguished. According to the data management method according to the present embodiment, it is possible to appropriately cope with such a situation (see (Recovery operation by interruption at the time of data rewriting) described later).

(通常時の動作:ガーベッジ・コレクション手順)
図9は、実施の形態におけるガーベッジ・コレクション手順を示すフローチャートである。図9に示すように、ガーベッジ・コレクション処理が開始されると、まず、対象となる消去単位ブロックを選択する(ステップS51)。選択された消去単位ブロックを対象ブロックとする。次いで、現在のガーベッジ・コレクション用の消去単位ブロックの識別情報Aを、対象ブロックの識別情報Aと同じ値に変更する(ステップS52)。現在のガーベッジ・コレクション用の消去単位ブロックをガーベッジ・コレクション・ブロックとする。次いで、対象ブロックの割り当て情報Bの有効/無効情報Bを確認し、「有効」となっている全ての割り当て情報Bを対象ブロックから読み出す(ステップS53)。次いで、ステップS53で読み出された割り当て情報Bのうち「確定」を示す割り当て情報Bのみを、ガーベッジ・コレクション・ブロックの対応する位置にコピーする(ステップS54)。次いで、ステップS54でコピーされた割り当て情報Bに対応するデータを対象ブロックから読み出し、ガーベッジ・コレクション・ブロックの対応する位置にコピーする(ステップS55)。次いで、ガーベッジ・コレクション・ブロックの識別情報Aの有効/無効情報Aに「有効」情報を書き込む(ステップS56)。次いで、対象ブロックの識別情報Aの有効/無効情報Aに「無効」情報を書き込む(ステップS57)。次いで、対象ブロックを消去し(ステップS58)、対象ブロックの識別情報Aにガーベッジ・コレクション用を示す情報を書き込み(ステップS59)、ガーベッジ・コレクション処理を終了する。
(Normal operation: Garbage collection procedure)
FIG. 9 is a flowchart showing a garbage collection procedure in the embodiment. As shown in FIG. 9, when the garbage collection process is started, first, the target erase unit block is selected (step S51). The selected erase unit block is the target block. Next, the identification information A of the current garbage collection erasure unit block is changed to the same value as the identification information A of the target block (step S52). The erase unit block for the current garbage collection is defined as a garbage collection block. Next, the valid / invalid information B of the allocation information B of the target block is confirmed, and all allocation information B that is “valid” is read from the target block (step S53). Next, only the allocation information B indicating “determined” among the allocation information B read in step S53 is copied to the corresponding position in the garbage collection block (step S54). Next, the data corresponding to the allocation information B copied in step S54 is read from the target block and copied to the corresponding position in the garbage collection block (step S55). Next, “valid” information is written in the valid / invalid information A of the identification information A of the garbage collection block (step S56). Next, “invalid” information is written in the valid / invalid information A of the identification information A of the target block (step S57). Next, the target block is deleted (step S58), information indicating garbage collection is written in the identification information A of the target block (step S59), and the garbage collection process is terminated.

ガーベッジ・コレクション処理の途中、ステップS57の処理で電源遮断が起きた場合、次の2つのケースが考えられる。第5のケースは、ステップS57の「無効」情報の書き込み開始後早い段階で中断された場合である。第6のケースは、ステップS57の「無効」情報の書き込みが進んだ段階で中断された場合である。第5のケースでは、ステップS57は未処理の状態となり、書き込まれた「無効」情報は不安定な状態となる。第6のケースでは、ステップS57は処理済みの状態となり、書き込まれた「無効」情報は不安定な状態となる。いずれのケースでも、ステップS56は処理済みの状態となり、ステップS58は未処理の状態となる。従って、電源の再投入後、ステップS57で中断されたと判定される。   In the middle of the garbage collection process, the following two cases are conceivable when the power interruption occurs in the process of step S57. The fifth case is a case where the process is interrupted at an early stage after the start of writing of “invalid” information in step S57. The sixth case is a case where the writing of “invalid” information in step S57 is interrupted at the advanced stage. In the fifth case, step S57 is in an unprocessed state, and the written “invalid” information is in an unstable state. In the sixth case, step S57 is in a processed state, and the written “invalid” information is in an unstable state. In any case, step S56 is processed, and step S58 is unprocessed. Therefore, after the power is turned on again, it is determined that the operation has been interrupted in step S57.

一方、ステップS56の「有効」情報の書き込みが進んだ段階で電源遮断により処理が中断された場合を第7のケースとする。第7のケースでは、ステップS56は処理済みの状態となり、書き込まれた「有効」情報は不安定な状態となる。ステップS57は、未処理の状態である。従って、第5のケースと第7のケースは、ステップS56まで終了したことで一致するため、両ケースを区別することができない。同様に、ステップS58の消去開始後早い段階で電源遮断により処理が中断された場合を第8のケースとする。第8のケースでは、ステップS57は、処理済みの状態である。ステップS58は未処理の状態となり、不安定な消去状態となる。従って、第6のケースと第8のケースは、ステップS57まで終了したことで一致するため、両ケースを区別することができない。本実施の形態にかかるデータ管理方法によれば、このような事態に対しても適切に対処することができる(後述の(ガーベッジ・コレクション時の中断による回復動作)を参照)。   On the other hand, the case where the process is interrupted by power-off at the stage where the writing of the “valid” information in step S56 proceeds is the seventh case. In the seventh case, step S56 is in a processed state, and the written “valid” information is in an unstable state. Step S57 is an unprocessed state. Therefore, since the fifth case and the seventh case coincide with each other after the process up to step S56, the two cases cannot be distinguished. Similarly, the case where the processing is interrupted due to power interruption at an early stage after the start of erasure in step S58 is defined as an eighth case. In the eighth case, step S57 is a processed state. Step S58 is in an unprocessed state and an unstable erase state. Therefore, since the sixth case and the eighth case coincide with each other after the completion of step S57, the two cases cannot be distinguished. According to the data management method according to the present embodiment, it is possible to appropriately cope with such a situation (see later (recovery operation by interruption at the time of garbage collection)).

(データ書き換え時の中断による回復動作)
図10は、実施の形態にかかる第1の判定処理の概略を示すフローチャートである。第1の判定処理は、システムの電源投入後、フラッシュメモリにアクセスする際、すなわちシステムの起動時か、またはシステムの起動後にフラッシュメモリに対してデータの読み出し処理もしくは書き込み処理を行う前またはその処理中に実施される。データの読み出し処理または書き込み処理の際に第1の判定処理を実施する場合には、第1の判定処理のアルゴリズムは、データの読み出し処理または書き込み処理のアルゴリズムに組み込まれる。
(Recovery action due to interruption during data rewrite)
FIG. 10 is a flowchart illustrating an outline of the first determination process according to the embodiment. The first determination process is performed when the flash memory is accessed after the system is turned on, that is, at the time of starting the system, or before the data read process or the write process is performed on the flash memory after the system is started. Implemented during. When the first determination process is performed during the data reading process or the writing process, the algorithm of the first determination process is incorporated in the algorithm of the data reading process or the writing process.

図10に示すように、第1の判定処理が開始されると、まず、論理アドレス情報に対応する旧データのアドレス情報Cの有効/無効情報Cを読み出す(ステップS61)。ステップS61で読み出された有効/無効情報Cが「有効」情報である場合(ステップS61:有効)、新データのアドレス情報Cの有効/無効情報Cを読み出す(ステップS62)。ステップS62で読み出された有効/無効情報Cが「有効」情報である場合(ステップS62:有効)、後述する回復処理Pを実施する。回復処理Pは、上述した第1のケースと第3のケースを区別できない場合に実施される。新データのアドレス情報Cの有効/無効情報Cが書き込まれていないが(ステップS62:書込なし)、新データのアドレス情報Cが書き込まれている場合には(ステップS63:書込あり)、後述する回復処理Rを実施する。回復処理Rは、電源遮断により前記ステップS37の処理が中断され、ステップS37が未処理の状態となる場合に実施される。新データのアドレス情報Cが書き込まれていない場合には(ステップS63:書込なし)、データの書き換え処理中に電源の遮断が発生していないか、またはデータを正しく読み出すことができる状態にあるので、第1の判定処理を終了する。   As shown in FIG. 10, when the first determination process is started, first, valid / invalid information C of the address information C of the old data corresponding to the logical address information is read (step S61). If the valid / invalid information C read in step S61 is “valid” information (step S61: valid), the valid / invalid information C of the address information C of the new data is read (step S62). When the valid / invalid information C read in step S62 is “valid” information (step S62: valid), a recovery process P described later is performed. The recovery process P is performed when the first case and the third case described above cannot be distinguished. When the valid / invalid information C of the new data address information C is not written (step S62: no writing), but when the new data address information C is written (step S63: with writing), A recovery process R described later is performed. The recovery process R is performed when the process of step S37 is interrupted due to power-off and step S37 is in an unprocessed state. When the address information C of the new data is not written (step S63: no writing), the power is not shut off during the data rewriting process, or the data can be read correctly. Therefore, the first determination process is terminated.

また、ステップS61で読み出された有効/無効情報Cが「無効」情報である場合(ステップS61:無効)、新データのアドレス情報Cの有効/無効情報Cを読み出す(ステップS64)。ステップS64で読み出された有効/無効情報Cが「有効」情報であり(ステップS64:有効)、かつ旧データのアドレス情報Cが削除されている場合(ステップS65:削除)、データの書き換え処理中に電源の遮断が発生していないか、またはデータを正しく読み出すことができる状態にあるので、第1の判定処理を終了する。旧データのアドレス情報Cが残っている場合(ステップS65:あり)、後述する回復処理Qを実施する。回復処理Qは、上述した第2のケースと第4のケースを区別できない場合に実施される。一方、ステップS64で新データのアドレス情報Cの有効/無効情報Cが書き込まれていない場合には(ステップS64:書込なし)、データの書き換えアルゴリズム上、起こり得ない状態であるので、例えば所定のエラー処理などを実施する。   If the valid / invalid information C read in step S61 is “invalid” information (step S61: invalid), the valid / invalid information C of the address information C of the new data is read (step S64). When the valid / invalid information C read in step S64 is “valid” information (step S64: valid) and the address information C of the old data has been deleted (step S65: deleted), data rewrite processing Since the power supply is not interrupted or the data can be read correctly, the first determination process is terminated. When the address information C of the old data remains (step S65: present), a recovery process Q described later is performed. The recovery process Q is performed when the second case and the fourth case described above cannot be distinguished. On the other hand, when the valid / invalid information C of the address information C of the new data is not written in step S64 (step S64: no writing), it is in a state that cannot occur due to the data rewrite algorithm. Implement error handling, etc.

図11は、実施の形態にかかる第1の回復処理Pの概略を示すフローチャートである。図11に示すように、回復処理Pが開始されると、まず、上述したデータ書き換え処理のステップS37と同様に、新データが書き込まれた領域のアドレス情報Cの有効/無効情報Cに「有効」情報を書き込む(ステップS71)。次いで、旧データのアドレス情報Cに付加されている回復処理フラグ(第1フラグ)を「開始状態」に設定する(ステップS72)。次いで、上述したデータ書き換え処理のステップS38〜ステップS42と同様の処理を行い(ステップS73〜ステップS77)、回復処理Pを終了する。   FIG. 11 is a flowchart illustrating an outline of the first recovery process P according to the embodiment. As shown in FIG. 11, when the recovery process P is started, first, as in the above-described step S37 of the data rewriting process, the valid / invalid information C of the address information C in the area where the new data is written is set to “valid. "Is written (step S71). Next, the recovery processing flag (first flag) added to the address information C of the old data is set to “start state” (step S72). Next, the same processing as Step S38 to Step S42 of the data rewriting processing described above is performed (Step S73 to Step S77), and the recovery processing P is terminated.

ステップS71を行うことによって、前記第3のケースの場合に、新データのアドレス情報Cの有効/無効情報Cに書き込まれた「有効」情報が上書きされて安定化する。また、前記ステップS38に相当するステップS73を行うことによって、前記第1のケースの場合に、旧データのアドレス情報Cの有効/無効情報Cに書き込まれた「無効」情報が上書きされて安定化する。従って、第1のケースと第3のケースを区別できない場合でも、回復処理Pを実施することによって、不安定なセルデータがなくなり、これ以降、不安定なデータの読み出しが発生しなくなる。   By performing step S71, in the third case, the “valid” information written in the valid / invalid information C of the address information C of the new data is overwritten and stabilized. Further, by performing step S73 corresponding to step S38, the “invalid” information written in the valid / invalid information C of the address information C of the old data is overwritten and stabilized in the case of the first case. To do. Therefore, even when the first case and the third case cannot be distinguished, by performing the recovery process P, unstable cell data is eliminated, and thereafter, unstable data reading does not occur.

回復処理Pにおいて回復処理フラグを設定する理由は、回復処理が開始されたことを記録することができるからである。回復処理の開始を記録することによって、回復処理中に電源の遮断が発生し、再度、電源を投入した場合に、回復処理中に処理が中断されたことを検知することができる。また、回復処理の最初の書き込み(ステップS71)が完了した後に回復処理フラグを設定する理由は、電源遮断によって処理が中断されたことを発見した後、不安定なメモリセルの状態をできるだけ早く安定化させることができるからである。なお、回復処理の最初の書き込み(ステップS71)を行う前、すなわち回復処理の開始後、直ちに回復処理フラグを設定してもよい。また、回復処理フラグを設定する処理を省略してもよい。回復処理フラグの設定については、後述する他の回復処理Q、SおよびTにおいても同様である。   The reason for setting the recovery process flag in the recovery process P is that it is possible to record that the recovery process has started. By recording the start of the recovery process, it is possible to detect that the process is interrupted during the recovery process when the power is interrupted during the recovery process and the power is turned on again. The reason for setting the recovery process flag after the completion of the first write of the recovery process (step S71) is that the state of the unstable memory cell is stabilized as soon as possible after it is discovered that the process has been interrupted by power-off. It is because it can be made. Note that the recovery process flag may be set immediately before the first writing of the recovery process (step S71), that is, after the recovery process is started. Further, the process of setting the recovery process flag may be omitted. The setting of the recovery process flag is the same in the other recovery processes Q, S, and T described later.

図12は、実施の形態にかかる第2の回復処理Qの概略を示すフローチャートである。図12に示すように、回復処理Qが開始されると、まず、上述したデータ書き換え処理のステップS38と同様に、旧データが書き込まれた領域のアドレス情報Cの有効/無効情報Cに「無効」情報を書き込む(ステップS81)。次いで、旧データのアドレス情報Cに付加されている回復処理フラグを「開始状態」に設定する(ステップS82)。次いで、上述したデータ書き換え処理のステップS39〜ステップS42と同様の処理を行い(ステップS83〜ステップS86)、回復処理Qを終了する。   FIG. 12 is a flowchart illustrating an outline of the second recovery process Q according to the embodiment. As shown in FIG. 12, when the recovery process Q is started, first, the invalid / invalid information C of the address information C in the area where the old data is written is set to “invalid” as in step S38 of the data rewrite process described above. "Information is written (step S81). Next, the recovery processing flag added to the address information C of the old data is set to “start state” (step S82). Next, the same processing as Step S39 to Step S42 of the data rewriting processing described above is performed (Step S83 to Step S86), and the recovery processing Q is ended.

ステップS81を行うことによって、前記第2のケースの場合に、旧データのアドレス情報Cの有効/無効情報Cに書き込まれた「無効」情報が上書きされて安定化する。また、前記ステップS39に相当するステップS83を行うことによって、前記第4のケースの場合に、旧データのアドレス情報Cに書き込まれた「削除」情報が上書きされて安定化する。従って、第2のケースと第4のケースを区別できない場合でも、回復処理Qを実施することによって、不安定なセルデータがなくなり、これ以降、不安定なデータの読み出しが発生しなくなる。   By performing step S81, in the case of the second case, the “invalid” information written in the valid / invalid information C of the address information C of the old data is overwritten and stabilized. Further, by performing step S83 corresponding to step S39, in the case of the fourth case, the “deletion” information written in the address information C of the old data is overwritten and stabilized. Therefore, even when the second case and the fourth case cannot be distinguished, by performing the recovery process Q, unstable cell data is eliminated, and thereafter, unstable data reading does not occur.

図13は、実施の形態にかかる第3の回復処理Rの概略を示すフローチャートである。図13に示すように、回復処理Rでは、新データのアドレス情報Cの無効化フラグ領域に「無効」情報を書き込む(ステップS91)。無効化フラグ領域は、各アドレス情報Cに確保されている。これ以降、無効化フラグ(第2フラグ)が「無効」となっているアドレス情報Cおよび有効/無効情報Cを読み出さないようにするとよい。また、上述した第1の判定処理において、アドレス情報Cを読み出す際に、各アドレス情報Cの無効化フラグを確認することによって、すでに回復処理が済んでいる箇所を第1の判定処理から容易に除外することができる。また、回復処理に限らず、書き込みが不十分であることによって読み出しデータが不安定となる可能性のある領域の読み出しを禁止する場合にも、そのデータのアドレス情報Cの無効化フラグを「無効」に設定してもよい。   FIG. 13 is a flowchart illustrating an outline of the third recovery process R according to the embodiment. As shown in FIG. 13, in the recovery process R, “invalid” information is written in the invalidation flag area of the address information C of the new data (step S91). The invalidation flag area is secured in each address information C. Thereafter, it is preferable not to read the address information C and the valid / invalid information C whose invalidation flag (second flag) is “invalid”. Further, in the first determination process described above, when the address information C is read, the invalidation flag of each address information C is checked, so that a portion that has already been recovered can be easily found from the first determination process. Can be excluded. Further, not only in the recovery process, but also in the case where reading of an area where read data may become unstable due to insufficient writing is prohibited, the invalidation flag of the address information C of the data is set to “invalid” May be set.

(ガーベッジ・コレクション時の中断による回復動作)
図14は、実施の形態にかかる第2の判定処理の概略を示すフローチャートである。第2の判定処理は、システムの電源投入後、フラッシュメモリにアクセスする際(システムの起動時)に実施される。
(Recovery action due to interruption during garbage collection)
FIG. 14 is a flowchart illustrating an outline of the second determination processing according to the embodiment. The second determination process is performed when the flash memory is accessed after the system is turned on (when the system is activated).

図14に示すように、第2の判定処理が開始されると、まず、全ての消去単位ブロックの識別情報Aを確認し、ガーベッジ・コレクション用の識別情報Aがあるか否かを判断する(ステップS101)。ガーベッジ・コレクション用の識別情報Aがある場合(ステップS101:Yes)、ガーベッジ・コレクション処理中に電源の遮断が発生していないので、第2の判定処理を終了する。ガーベッジ・コレクション用の識別情報Aがない場合には(ステップS101:No)、識別情報Aが同じで、かつその識別情報Aの有効/無効情報Aがともに「有効」である消去単位ブロックが2つあるか否かを判断する(ステップS102)。そのような消去単位ブロックが2つある場合(ステップS102:Yes)、後述する回復処理Sを実施する。回復処理Sは、上述した第5のケースと第7のケースを区別できない場合に実施される。   As shown in FIG. 14, when the second determination process is started, first, identification information A of all the erasure unit blocks is confirmed to determine whether or not there is garbage collection identification information A ( Step S101). If there is the garbage collection identification information A (step S101: Yes), the power supply is not shut off during the garbage collection process, so the second determination process is terminated. When there is no identification information A for garbage collection (step S101: No), there are two erasure unit blocks having the same identification information A and both valid / invalid information A of the identification information A being “valid”. It is determined whether there is one (step S102). When there are two such erase unit blocks (step S102: Yes), a recovery process S described later is performed. The recovery process S is performed when the fifth case and the seventh case described above cannot be distinguished.

「有効」で同一の識別情報Aが2つない場合(ステップS102:No)、識別情報Aが別の消去単位ブロックの識別情報Aと同じであるが、識別情報Aの有効/無効情報Aが書き込まれていない消去単位ブロックがあるか否かを判断する(ステップS103)。そのような消去単位ブロックがある場合(ステップS103:Yes)、後述する回復処理Uを実施する。回復処理Uは、電源遮断により前記ステップS56以前の処理が中断された場合に実施される。識別情報Aが他と同じで、かつ有効/無効情報Aが書き込まれていない消去単位ブロックがない場合(ステップS103:No)、後述する回復処理Tを実施する。回復処理Tは、上述した第6のケースと第8のケースを区別できない場合に実施される。   When “valid” and two identical identification information A are not present (step S102: No), the identification information A is the same as the identification information A of another erase unit block, but the valid / invalid information A of the identification information A is written. It is determined whether there is an unerased erase unit block (step S103). When there is such an erase unit block (step S103: Yes), a recovery process U described later is performed. The recovery process U is performed when the process before step S56 is interrupted due to power-off. When there is no erase unit block in which the identification information A is the same as the other and the valid / invalid information A is not written (step S103: No), a recovery process T described later is performed. The recovery process T is performed when the above-described sixth case and the eighth case cannot be distinguished.

図15は、実施の形態にかかる第4の回復処理Sの概略を示すフローチャートである。図15に示すように、回復処理Sが開始されると、まず、上述したガーベッジ・コレクション処理のステップS56と同様に、ガーベッジ・コレクション・ブロックの識別情報Aの有効/無効情報Aに「有効」情報を書き込む(ステップS111)。次いで、ガーベッジ・コレクション・ブロック識別情報Aに付加されている回復処理フラグ(第1フラグ)を「開始状態」に設定する(ステップS112)。次いで、上述したガーベッジ・コレクション処理のステップS57〜ステップS59と同様の処理を行い(ステップS113〜ステップS115)、回復処理Sを終了する。   FIG. 15 is a flowchart illustrating an outline of the fourth recovery process S according to the embodiment. As shown in FIG. 15, when the recovery process S is started, first, “valid” is set in the valid / invalid information A of the garbage collection block identification information A as in the above-described step S56 of the garbage collection process. Information is written (step S111). Next, the recovery process flag (first flag) added to the garbage collection block identification information A is set to “start state” (step S112). Next, the same processing as steps S57 to S59 of the above-described garbage collection processing is performed (step S113 to step S115), and the recovery processing S is terminated.

ステップS111を行うことによって、前記第7のケースの場合に、ガーベッジ・コレクション・ブロックの識別情報Aの有効/無効情報Aに書き込まれた「有効」情報が上書きされて安定化する。また、前記ステップS57に相当するステップS113を行うことによって、前記第5のケースの場合に、対象ブロックの識別情報Aの有効/無効情報Aに書き込まれた「無効」情報が上書きされて安定化する。従って、第5のケースと第7のケースを区別できない場合でも、回復処理Sを実施することによって、ガーベッジ・コレクション・ブロックと対象ブロックを正しく区別することができる。   By performing step S111, the “valid” information written in the valid / invalid information A of the garbage collection block identification information A is overwritten and stabilized in the case of the seventh case. Also, by performing step S113 corresponding to step S57, in the case of the fifth case, the “invalid” information written in the valid / invalid information A of the identification information A of the target block is overwritten and stabilized. To do. Therefore, even when the fifth case and the seventh case cannot be distinguished, the garbage collection block and the target block can be correctly distinguished by performing the recovery process S.

図16は、実施の形態にかかる第5の回復処理Tの概略を示すフローチャートである。図16に示すように、回復処理Tが開始されると、まず、上述したガーベッジ・コレクション処理のステップS57と同様に、対象ブロックの識別情報Aの有効/無効情報Aに「無効」情報を書き込む(ステップS121)。次いで、ガーベッジ・コレクション・ブロック識別情報Aに付加されている回復処理フラグを「開始状態」に設定する(ステップS122)。次いで、上述したガーベッジ・コレクション処理のステップS58〜ステップS59と同様の処理を行い(ステップS123〜ステップS124)、回復処理Tを終了する。   FIG. 16 is a flowchart illustrating an outline of the fifth recovery process T according to the embodiment. As shown in FIG. 16, when the recovery process T is started, first, “invalid” information is written in the valid / invalid information A of the identification information A of the target block, as in step S57 of the garbage collection process described above. (Step S121). Next, the recovery processing flag added to the garbage collection block identification information A is set to “start state” (step S122). Next, the same processing as steps S58 to S59 of the garbage collection process described above is performed (steps S123 to S124), and the recovery process T is terminated.

ステップS121を行うことによって、前記第6のケースの場合に、対象ブロックの識別情報Aの有効/無効情報Aに書き込まれた「無効」情報が上書きされて安定化する。また、前記ステップS58に相当するステップS123を行うことによって、前記第8のケースの場合に、対象ブロックが完全に消去される。従って、第6のケースと第8のケースを区別できない場合でも、ガーベッジ・コレクション処理を正しく継続して実施することができる。   By performing step S121, in the case of the sixth case, the “invalid” information written in the valid / invalid information A of the identification information A of the target block is overwritten and stabilized. Further, by performing step S123 corresponding to step S58, the target block is completely erased in the case of the eighth case. Therefore, even when the sixth case and the eighth case cannot be distinguished, the garbage collection process can be correctly continued.

図17は、実施の形態にかかる第6の回復処理Uの概略を示すフローチャートである。図17に示すように、回復処理Uでは、有効/無効情報Aが書き込まれていない識別情報Aの無効化フラグ領域に「無効」情報を書き込む(ステップS131)。無効化フラグ領域は、各消去単位ブロックの識別情報Aに確保されている。これ以降、無効化フラグ(第2フラグ)が「無効」となっている識別情報Aおよび有効/無効情報Aを読み出さないようにするとよい。また、上述した第2の判定処理において、識別情報Aを読み出す際に、各識別情報Aの無効化フラグを確認することによって、すでに回復処理が済んでいる箇所を第2の判定処理から容易に除外することができる。   FIG. 17 is a flowchart illustrating an outline of the sixth recovery process U according to the embodiment. As shown in FIG. 17, in the recovery process U, “invalid” information is written in the invalidation flag area of the identification information A in which the valid / invalid information A is not written (step S131). The invalidation flag area is secured in the identification information A of each erase unit block. Thereafter, it is preferable not to read the identification information A and the valid / invalid information A whose invalidation flag (second flag) is “invalid”. Further, in the second determination process described above, when the identification information A is read, the invalidation flag of each identification information A is confirmed, so that a portion that has already been recovered can be easily identified from the second determination process. Can be excluded.

上述した各種の処理は、例えば、図2に示すフラッシュ内蔵マイコン1においては、CPUコア3が内蔵フラッシュメモリ2のドライバソフトウェアを実行することにより実現される。また、図3に示すコンピュータシステム11においては、CPU13がフラッシュメモリ12のドライバソフトウェアを実行することにより実現される。   For example, in the flash built-in microcomputer 1 shown in FIG. 2, the various processes described above are realized by the CPU core 3 executing the driver software of the built-in flash memory 2. Further, the computer system 11 shown in FIG. 3 is realized by the CPU 13 executing the driver software of the flash memory 12.

以上説明したように、本実施の形態によれば、実際に電源遮断時に中断された処理が、電源の再投入後に、電源遮断により中断されたと判定された処理の一つ前の処理である場合でも、回復処理によって、書き込みが不十分であるメモリセルにデータを上書きするので、不安定な状態のメモリセルを安定したメモリセルに戻すことができる。従って、データを正しく回復することができるので、フラッシュメモリのデータを正しく管理することができる。   As described above, according to the present embodiment, when the process that was actually interrupted when the power was turned off is the process immediately before the process that was determined to have been interrupted by the power shutdown after the power was turned on again However, since the data is overwritten in the memory cell in which writing is insufficient by the recovery process, the memory cell in an unstable state can be returned to the stable memory cell. Therefore, the data can be correctly recovered, so that the data in the flash memory can be correctly managed.

上述した実施の形態に関し、さらに以下の付記を開示する。   The following additional notes are disclosed with respect to the embodiment described above.

(付記1)フラッシュメモリのプログラム動作中に電源遮断が発生した後、電源が再投入されたときのフラッシュメモリのデータ管理方法において、前記フラッシュメモリに格納されている、書き換え前の旧データのアドレスに関する第1情報、該第1情報が有効であるか無効であるかを示す第2情報、書き換え後の新データのアドレスに関する第3情報および該第3情報が有効であるか無効であるかを示す第4情報に基づいて、処理部により、前記電源遮断により中断された処理を判定する判定ステップと、前記処理部により、前記判定ステップにより判定された処理の一つ前の処理から前記プログラム動作をやり直す回復ステップと、を含むことを特徴とするデータ管理方法。 (Supplementary note 1) In the flash memory data management method when the power is turned off and then turned on again after the flash memory is being programmed, the address of the old data stored in the flash memory before rewriting First information on the second information, second information indicating whether the first information is valid or invalid, third information on the address of the new data after rewriting, and whether the third information is valid or invalid Based on the fourth information shown, the processing unit determines the process interrupted by the power shutdown, and the program operation from the process immediately before the process determined by the determination step by the processing unit A data management method, comprising:

(付記2)フラッシュメモリのプログラム動作中に電源遮断が発生した後、電源が再投入されたときのフラッシュメモリのデータ管理方法において、前記フラッシュメモリに格納されている、消去単位ブロックの識別に関する第5情報および該第5情報が有効であるか無効であるかを示す第6情報に基づいて、処理部により、前記電源遮断により中断された処理を判定する判定ステップと、前記処理部により、前記判定ステップにより判定された処理の一つ前の処理から前記プログラム動作をやり直す回復ステップと、を含むことを特徴とするデータ管理方法。 (Supplementary Note 2) In the flash memory data management method when power is turned on again after a power interruption occurs during a program operation of the flash memory, a second process for identifying an erase unit block stored in the flash memory is described. A determination step of determining a process interrupted by the power-off by the processing unit based on the fifth information and the sixth information indicating whether the fifth information is valid or invalid; and A data management method comprising: a recovery step of redoing the program operation from the processing immediately before the processing determined by the determination step.

(付記3)前記回復ステップでは、不安定なメモリセルにデータを上書きすることを特徴とする付記1または2に記載のデータ管理方法。 (Supplementary note 3) The data management method according to supplementary note 1 or 2, wherein in the recovery step, data is overwritten in an unstable memory cell.

(付記4)前記回復ステップでは、前記プログラム動作のやり直しが開始されたか否かを示す第1フラグに、前記プログラム動作のやり直しが開始されたことを示す値を書き込むことを特徴とする付記1または2に記載のデータ管理方法。 (Supplementary note 4) In the recovery step, a value indicating that the re-execution of the program operation is started is written in a first flag indicating whether or not the re-execution of the program operation is started. 2. The data management method according to 2.

(付記5)前記回復ステップでは、不安定なメモリセルの、データの読み出しを行うか否かを示す第2フラグに、データの読み出しを行わないことを示す値を書き込むことを特徴とする付記1または2に記載のデータ管理方法。 (Additional remark 5) In the said recovery step, the value which shows not reading data is written in the 2nd flag which shows whether the data read of an unstable memory cell is performed. Additional remark 1 characterized by the above-mentioned. Or the data management method of 2.

(付記6)前記判定ステップで、前記第2情報が有効であり、かつ前記第4情報が有効である場合、前記回復ステップでは、前記第4情報を有効とし、前記第2情報を無効とし、前記第1情報を削除することを特徴とする付記1に記載のデータ管理方法。 (Appendix 6) In the determination step, when the second information is valid and the fourth information is valid, the recovery step makes the fourth information valid, invalidates the second information, The data management method according to appendix 1, wherein the first information is deleted.

(付記7)前記判定ステップで、前記第2情報が無効であり、かつ前記第4情報が有効であり、さらに前記第1情報が残っている場合、前記回復ステップでは、前記第2情報を無効とし、前記第1情報を削除することを特徴とする付記1に記載のデータ管理方法。 (Supplementary note 7) When the second information is invalid, the fourth information is valid, and the first information remains in the determination step, the second information is invalidated in the recovery step. The data management method according to appendix 1, wherein the first information is deleted.

(付記8)前記第1情報を削除した後、前記フラッシュメモリに格納されている、前記新データの格納状態に関する第7情報を確定とし、前記旧データの格納状態に関する第8情報が有効であるか無効であるかを示す第9情報を無効とし、前記第8情報を削除することを特徴とする付記6または7に記載のデータ管理方法。 (Supplementary Note 8) After the first information is deleted, the seventh information related to the storage state of the new data stored in the flash memory is confirmed, and the eighth information related to the storage state of the old data is valid. The data management method according to appendix 6 or 7, wherein the ninth information indicating whether or not is invalid is invalidated and the eighth information is deleted.

(付記9)前記判定ステップで、複数の消去単位ブロックの前記第5情報にガーベッジ・コレクション用の情報がなく、かつ第1消去単位ブロックの前記第5情報と第2消去単位ブロックの前記第5情報が同じであり、さらに前記第1消去単位ブロックの前記第6情報と前記第2消去単位ブロックの前記第6情報がともに有効である場合、前記回復ステップでは、前記第1消去単位ブロックの前記第6情報を有効とし、前記第2消去単位ブロックの前記第6情報を無効とし、前記第2消去単位ブロックを消去し、前記第2消去単位ブロックの前記第5情報にガーベッジ・コレクション用を示す情報を書き込むことを特徴とする付記2に記載のデータ管理方法。 (Supplementary Note 9) In the determination step, there is no information for garbage collection in the fifth information of a plurality of erase unit blocks, and the fifth information of the first erase unit block and the fifth information of the second erase unit block If the information is the same, and if the sixth information of the first erase unit block and the sixth information of the second erase unit block are both valid, the recovery step includes the information of the first erase unit block Validate sixth information, invalidate the sixth information in the second erase unit block, erase the second erase unit block, and indicate garbage collection in the fifth information in the second erase unit block The data management method according to appendix 2, wherein information is written.

(付記10)前記判定ステップで、複数の消去単位ブロックの前記第5情報にガーベッジ・コレクション用の情報がなく、かつ第1消去単位ブロックの前記第5情報と第2消去単位ブロックの前記第5情報が同じであるが、前記第2消去単位ブロックの前記第6情報が書き込まれていない場合、前記回復ステップでは、前記第2消去単位ブロックの前記第6情報を無効とし、前記第2消去単位ブロックを消去し、前記第2消去単位ブロックの前記第5情報にガーベッジ・コレクション用を示す情報を書き込むことを特徴とする付記2に記載のデータ管理方法。 (Supplementary Note 10) In the determination step, there is no information for garbage collection in the fifth information of a plurality of erase unit blocks, and the fifth information of the first erase unit block and the fifth information of the second erase unit block If the information is the same but the sixth information of the second erase unit block has not been written, the recovery step invalidates the sixth information of the second erase unit block, and the second erase unit The data management method according to appendix 2, wherein a block is erased and information indicating garbage collection is written in the fifth information of the second erase unit block.

実施の形態にかかるデータ管理方法の概略を示すフローチャートである。It is a flowchart which shows the outline of the data management method concerning embodiment. 実施の形態におけるフラッシュ内蔵マイコンの概略を示すブロック図である。It is a block diagram which shows the outline of the microcomputer with a built-in flash in embodiment. 実施の形態におけるコンピュータシステムの概略を示すブロック図である。It is a block diagram which shows the outline of the computer system in embodiment. 実施の形態におけるフラッシュメモリの概略を示す説明図である。It is explanatory drawing which shows the outline of the flash memory in embodiment. 実施の形態における消去単位ブロックの構成例を示す説明図である。It is explanatory drawing which shows the structural example of the erasure | elimination unit block in embodiment. 実施の形態におけるデータ読み出し手順を示すフローチャートである。It is a flowchart which shows the data read-in procedure in embodiment. 実施の形態におけるデータ書き込み手順を示すフローチャートである。It is a flowchart which shows the data write-in procedure in embodiment. 実施の形態におけるデータ書き換え手順を示すフローチャートである。It is a flowchart which shows the data rewriting procedure in embodiment. 実施の形態におけるガーベッジ・コレクション手順を示すフローチャートである。It is a flowchart which shows the garbage collection procedure in embodiment. 実施の形態にかかる第1の判定処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 1st determination process concerning embodiment. 実施の形態にかかる第1の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 1st recovery process concerning embodiment. 実施の形態にかかる第2の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 2nd recovery process concerning embodiment. 実施の形態にかかる第3の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 3rd recovery process concerning embodiment. 実施の形態にかかる第2の判定処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 2nd determination process concerning embodiment. 実施の形態にかかる第4の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 4th recovery process concerning embodiment. 実施の形態にかかる第5の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 5th recovery process concerning embodiment. 実施の形態にかかる第6の回復処理の概略を示すフローチャートである。It is a flowchart which shows the outline of the 6th recovery process concerning embodiment.

符号の説明Explanation of symbols

2,12,21 フラッシュメモリ
22,23,24 消去単位ブロック
2, 12, 21 Flash memory 22, 23, 24 Erase unit block

Claims (5)

フラッシュメモリのプログラム動作中に電源遮断が発生した後、電源が再投入されたときのフラッシュメモリのデータ管理方法において、
前記フラッシュメモリに格納されている、書き換え前の旧データのアドレスに関する第1情報、該第1情報が有効であるか無効であるかを示す第2情報、書き換え後の新データのアドレスに関する第3情報および該第3情報が有効であるか無効であるかを示す第4情報に基づいて、処理部により、前記電源遮断により中断された処理を判定する判定ステップと、
前記処理部により、前記判定ステップにより判定された処理の一つ前の処理から前記プログラム動作をやり直す回復ステップと、
を含むことを特徴とするデータ管理方法。
In the flash memory data management method when the power is turned on again after the power shutdown occurs during the program operation of the flash memory,
First information relating to the address of the old data before rewriting stored in the flash memory, second information indicating whether the first information is valid or invalid, and third information relating to the address of the new data after rewriting A determination step of determining, by the processing unit, the process interrupted by the power shutdown based on the information and the fourth information indicating whether the third information is valid or invalid;
A recovery step of redoing the program operation from the previous process of the process determined by the determination step by the processing unit;
A data management method comprising:
フラッシュメモリのプログラム動作中に電源遮断が発生した後、電源が再投入されたときのフラッシュメモリのデータ管理方法において、
前記フラッシュメモリに格納されている、消去単位ブロックの識別に関する第5情報および該第5情報が有効であるか無効であるかを示す第6情報に基づいて、処理部により、前記電源遮断により中断された処理を判定する判定ステップと、
前記処理部により、前記判定ステップにより判定された処理の一つ前の処理から前記プログラム動作をやり直す回復ステップと、
を含むことを特徴とするデータ管理方法。
In the flash memory data management method when the power is turned on again after the power shutdown occurs during the program operation of the flash memory,
Based on the fifth information stored in the flash memory relating to the identification of the erasure unit block and the sixth information indicating whether the fifth information is valid or invalid, the processing unit interrupts the power supply shut-off. A determination step for determining the processed processing;
A recovery step of redoing the program operation from the previous process of the process determined by the determination step by the processing unit;
A data management method comprising:
前記回復ステップでは、不安定なメモリセルにデータを上書きすることを特徴とする請求項1または2に記載のデータ管理方法。   3. The data management method according to claim 1, wherein in the recovery step, data is overwritten in an unstable memory cell. 前記回復ステップでは、前記プログラム動作のやり直しが開始されたか否かを示す第1フラグに、前記プログラム動作のやり直しが開始されたことを示す値を書き込むことを特徴とする請求項1または2に記載のデータ管理方法。   3. The recovery step according to claim 1, wherein a value indicating that the re-execution of the program operation is started is written in a first flag indicating whether or not the re-execution of the program operation is started. Data management method. 前記回復ステップでは、不安定なメモリセルの、データの読み出しを行うか否かを示す第2フラグに、データの読み出しを行わないことを示す値を書き込むことを特徴とする請求項1または2に記載のデータ管理方法。   3. The recovery step according to claim 1, wherein a value indicating that data reading is not performed is written in a second flag indicating whether or not data reading is performed in an unstable memory cell. The data management method described.
JP2008267288A 2008-10-16 2008-10-16 Data management method Pending JP2010097386A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008267288A JP2010097386A (en) 2008-10-16 2008-10-16 Data management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008267288A JP2010097386A (en) 2008-10-16 2008-10-16 Data management method

Publications (1)

Publication Number Publication Date
JP2010097386A true JP2010097386A (en) 2010-04-30

Family

ID=42259025

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008267288A Pending JP2010097386A (en) 2008-10-16 2008-10-16 Data management method

Country Status (1)

Country Link
JP (1) JP2010097386A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014206905A (en) * 2013-04-15 2014-10-30 株式会社デンソー Writing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014206905A (en) * 2013-04-15 2014-10-30 株式会社デンソー Writing device

Similar Documents

Publication Publication Date Title
US7558904B2 (en) Controller, data memory system, data rewriting method, and computer program product
JP3692313B2 (en) Nonvolatile memory control method
KR102259256B1 (en) Data storage device and operating method thereof
US20100023675A1 (en) Wear leveling method, and storage system and controller using the same
JP2004152302A (en) Method and device for executing block cache in nonvolatile memory system
US7904637B2 (en) Information processing apparatus, lifetime monitoring method and program for monitoring lifetime of storage device including flash memory
US7441085B2 (en) Memory control method for restoring data in a cache memory
JP4046877B2 (en) Batch erase nonvolatile memory and mobile phone
JP4146006B2 (en) Electronic device having flash memory
WO2023116346A1 (en) Method and system for recovering trim data under abnormal power failure, and solid-state drive
CN117931091A (en) Abnormal power failure processing method, device, equipment, medium and product
JP4661369B2 (en) Memory controller
JP4794530B2 (en) Semiconductor device and mobile phone
JP2010097386A (en) Data management method
JP6040895B2 (en) Microcomputer and non-volatile memory block management method
JP2004341783A (en) Data storage method and data storage device
JP2011175361A (en) Data storage device and method
JP2009276883A (en) Semiconductor auxiliary storage device
JP5491201B2 (en) Semiconductor recording apparatus and semiconductor recording system
JP2008251063A (en) Storage device
JP2013003655A (en) Control device for writing data in flash memory
JP6241373B2 (en) Storage device, flash memory control device, and program
JP2009211223A (en) Memory system
JP4421659B2 (en) Electronic device having flash memory
JP2010134822A (en) Semiconductor memory device