[go: up one dir, main page]

JP2006048585A - Flash memory access method - Google Patents

Flash memory access method Download PDF

Info

Publication number
JP2006048585A
JP2006048585A JP2004232153A JP2004232153A JP2006048585A JP 2006048585 A JP2006048585 A JP 2006048585A JP 2004232153 A JP2004232153 A JP 2004232153A JP 2004232153 A JP2004232153 A JP 2004232153A JP 2006048585 A JP2006048585 A JP 2006048585A
Authority
JP
Japan
Prior art keywords
data
block
physical address
flash memory
old
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.)
Withdrawn
Application number
JP2004232153A
Other languages
Japanese (ja)
Inventor
Hideyuki Furukawa
秀之 古川
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 Ltd
Original Assignee
Fujitsu 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 Ltd filed Critical Fujitsu Ltd
Priority to JP2004232153A priority Critical patent/JP2006048585A/en
Publication of JP2006048585A publication Critical patent/JP2006048585A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

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

Abstract

【課題】フラッシュメモリに格納されているデータが更新されたとき、旧いデータを格納するブロックには“旧”のフラグを書き込んでいた。しかし、多値メモリではフラグに書き込むことが困難であり、新旧を判断する他の方法が求められている。
【解決手段】フラッシュメモリを用いたメモリカードに、論理アドレスに関連付けられて格納されているデータを更新するとき、更新される前のデータが格納されたブロックの物理アドレスを起点に、昇順方向にたどって使用可能で未使用の最初のブロックに最新のデータを格納する。そして、ある論理アドレスの最新のデータが格納されたブロックを求めるときは、フラッシュメモリの使用可能で未使用のブロックの中で物理アドレスが最大の値を求め、降順方向にたどって求める論理アドレスのデータが格納されたブロックの最初のブロックに格納されていると判断する。
【選択図】図1
When data stored in a flash memory is updated, an "old" flag is written in a block storing old data. However, it is difficult to write to a flag in a multi-level memory, and another method for determining whether it is new or old is required.
When updating data stored in association with a logical address in a memory card using a flash memory, the physical address of the block in which the data before the update is stored starts in the ascending order. The latest data is stored in the first unused block that can be traced. Then, when obtaining the block in which the latest data of a certain logical address is stored, the maximum value of the physical address in the usable and unused blocks of the flash memory is obtained, and the logical address obtained in the descending order is obtained. It is determined that the data is stored in the first block of the stored block.
[Selection] Figure 1

Description

本発明は、フラッシュメモリを用いたメモリカードなどファイルストレージデバイスのデータを更新し、更新されたデータの新旧を判別するアクセス方法に関わる。   The present invention relates to an access method for updating data in a file storage device such as a memory card using a flash memory and determining whether the updated data is new or old.

NAND型フラッシュメモリなどの不揮発性メモリは占有する容積が小さく、低消費電力であって、かつ電源を供給しなくてもデータを保持できる。この特性を生かして、メモリカードなど携帯できる形態で電子データを保存するファイルストレージデバイスの用途に広く使われている。   A non-volatile memory such as a NAND flash memory occupies a small volume, has low power consumption, and can hold data without supplying power. Taking advantage of this characteristic, it is widely used for file storage devices that store electronic data in a portable form such as a memory card.

フラッシュメモリは、メモリセルとなるトランジスタのフローティングゲートに電子などの電荷を注入し、保持することで情報を記憶している。データの書き込みは指定されたアドレスに対応するメモリセルを個々に選択し、電荷を注入して書き込んでいる。しかしフラッシュメモリでは注入された電荷を取り除く逆方向の値の書き込み動作は個々のメモリセル毎に行うのではなく、セルアレイ領域を区分する所定のブロック内のメモリセルを一括して行われ、この動作を一括消去と呼んでいる。このため、既にデータが書き込まれたブロックの内容を更新しようとする場合は、全てのメモリセルが消去状態になっている未使用のブロックを選択して修正されたデータを書き込まなければならない。データの更新を行ったときは、更新される前のデータが格納されたブロックには古いデータであることを示すために、新旧フラッグと呼ばれる特定のビットのメモリセルに旧を示す値を書き込んで区別する方法が取られている。   A flash memory stores information by injecting charges such as electrons into a floating gate of a transistor serving as a memory cell and holding it. Data is written by selecting a memory cell corresponding to a specified address and injecting charges. However, in the flash memory, the write operation of the reverse value to remove the injected charge is not performed for each individual memory cell, but is performed collectively for the memory cells in a predetermined block that partitions the cell array region. Is called batch erasure. For this reason, when trying to update the contents of a block in which data has already been written, it is necessary to select an unused block in which all the memory cells are in the erased state and write the corrected data. When data is updated, a value indicating the old is written in a memory cell of a specific bit called a new / old flag to indicate that the old data is stored in the block in which the data before the update is stored. A way to distinguish is taken.

この新旧フラグは、ブロック内の特定のビットが割り当てられ、最初にデータを書き込むときには未書き込みの状態で設定されている。そしてデータの更新が行われ、他のブロックに最新のデータが書き込まれたとき、旧となるブロックの新旧フラグとして割り当てられたビットに追加の書き込みが行われる。   This new / old flag is assigned a specific bit in the block, and is set in an unwritten state when data is first written. When data is updated and the latest data is written in another block, additional writing is performed on the bits assigned as the old / new flag of the old block.

パーソナルコンピュータなどの電子機器をホストとして、メモリカードにデータを書き込んだり、読み出したりする場合、ホストとなる機器で定義するアドレスと、フラッシュメモリが取り扱うアドレスは異なっていて、ホストがデータ処理で取り扱うアドレスを論理アドレスと呼んでいる。フラッシュメモリは、NAND型やNOR型などデバイス固有の構造に合わせたアドレスが振り当てられていて、これを物理アドレスと呼んでいる。   When data is written to or read from a memory card using an electronic device such as a personal computer as the host, the address defined by the host device and the address handled by the flash memory are different, and the address handled by the host for data processing Is called a logical address. The flash memory is assigned an address according to a device-specific structure such as a NAND type or a NOR type, and this is called a physical address.

フラッシュメモリにデータを書き込んだときのデータ構造を図8に示す。フラッシュメモリ800の記憶領域は複数のブロック801で構成され、それぞれに物理アドレス802が与えられている。データ領域803はメイン領域804とスペア領域805に分けられ、メイン領域804にホストから送られてくるデータを記憶する。スペア領域805には、論理アドレス806、新旧フラグ807、およびエラー訂正情報などその他808の情報を記憶している。論理アドレス“579”のデータは物理アドレス“7901”と“7908”のブロックに記憶されているが、物理アドレス“7901”のブロックの新旧フラグ807には“1”の旗が立っていて、旧のデータであることを示している。   FIG. 8 shows the data structure when data is written to the flash memory. The storage area of the flash memory 800 is composed of a plurality of blocks 801, each of which is given a physical address 802. The data area 803 is divided into a main area 804 and a spare area 805, and data sent from the host is stored in the main area 804. The spare area 805 stores other information 808 such as a logical address 806, an old / new flag 807, and error correction information. The data of the logical address “579” is stored in the physical addresses “7901” and “7908” blocks, but the old / new flag 807 of the block of the physical address “7901” is flagged as “1”. It shows that it is data of.

上記からわかるようにメイン領域804、およびスペア領域805の中の論理アドレス806とその他808には、このブロックに最初にデータを書き込んだときに同時にその値画がデータとして書き込まれる。しかし、新旧フラグ807は、任意の論理アドレスに関連づけられたデータが更新されて、未使用のブロックに書き込まれるとき、旧いデータが保持されているブロックの新旧フラグ807に旧の値が書き込まれる。(特許文献1参照)
このように、従来のフラッシュメモリは、一度データが書き込まれたブロックに対しても新旧フラグに対応したビットを未書き込みの状態で用意しておけば、旧のデータになった時点で該当するブロックの新旧フラグの対応するビットを選択して書き込むことができる。従って、データの更新が繰り返されて、同じ論理アドレスのデータが複数存在しても常に最新のデータが書き込まれたブロックを容易に特定することができる。
As can be seen from the above, in the main area 804 and the spare area 805, the logical address 806 and others 808 are simultaneously written as data when data is first written in this block. However, when the data associated with an arbitrary logical address is updated and written in an unused block, the old / new flag 807 is written with an old value in the old / new flag 807 of the block holding the old data. (See Patent Document 1)
As described above, in the conventional flash memory, if a bit corresponding to the new and old flags is prepared in an unwritten state even for a block in which data has been written once, the corresponding block at the time when the old data is obtained. The corresponding bits of the old and new flags can be selected and written. Therefore, the data update is repeated, so that even if there are a plurality of pieces of data having the same logical address, it is possible to easily identify a block in which the latest data is always written.

また、この情報は不揮発性メモリであるフラッシュメモリに保持されているのでメモリカードの電源が切られた後も保持されている。   Further, since this information is held in the flash memory which is a non-volatile memory, it is also held after the memory card is turned off.

近年フラッシュメモリの記憶密度を向上する手段として、多値技術が開発され利用されるようになってきた。多値技術とは、1つのメモリセルに従来のように“0”、“1”の1ビットだけの情報を記憶させるのではなく、注入された電荷の量の多寡についても情報として加え、2ビット以上の情報を記憶させる技術である。図9を用いて多値フラッシュメモリセルの記憶原理について説明する。1つのメモリセルの電荷が注入されることによって、セルの閾値電圧Vthが変化する。図9では、そのVthのレベルを注入されていない消去された状態と合わせて4段階に分割し、2ビットの情報を記憶する例を示している。縦軸はメモリセルの閾値電圧Vthを示し、V1、V2、V3はメモリセルの記憶状態を判定する電圧を示している。横軸はメモリセルの各状態の分布状況を示している。“ ”で挟んだ2つの数字の、左側が上位ビットの値を示し、右側が下位ビットの値を示している。   In recent years, multivalue technology has been developed and used as means for improving the storage density of flash memory. In the multi-value technique, information of only one bit of “0” and “1” is not stored in one memory cell as in the past, but the amount of injected charge is added as information. This is a technique for storing information of bits or more. The storage principle of the multilevel flash memory cell will be described with reference to FIG. When the charge of one memory cell is injected, the threshold voltage Vth of the cell changes. FIG. 9 shows an example in which the Vth level is divided into four stages together with the erased state that is not injected, and 2-bit information is stored. The vertical axis indicates the threshold voltage Vth of the memory cell, and V1, V2, and V3 indicate voltages for determining the memory state of the memory cell. The horizontal axis shows the distribution of each state of the memory cell. Of the two numbers between “”, the left side indicates the value of the upper bit and the right side indicates the value of the lower bit.

消去された状態、すなわち、Vth<V1のとき、2ビットの値を“11”とし、V1<Vth<V2を“10”、V2<Vth<V3を“01”、V3<Vthを“00”と定義することができる。このようにメモリセルの閾値レベルを細かく区分することで2ビットの情報を記憶できることがわかる。   In the erased state, that is, when Vth <V1, the 2-bit value is “11”, V1 <Vth <V2 is “10”, V2 <Vth <V3 is “01”, and V3 <Vth is “00”. Can be defined as Thus, it can be seen that 2-bit information can be stored by finely dividing the threshold level of the memory cell.

ところが、既にデータが書き込まれたブロックで特定のビットの値を書き込むときには手数がかかることになる。例えば、下位ビットの値を“1”から“0”に書換える場合、上位ビットの値が“1”の場合は狙いとする閾値Vthの値がV1<Vth<V2となり、上位ビットの値が“0”の場合は狙いとする閾値Vth<V3となる。このように特定のビットに書き込みを行うためにはメモリセルを共有する他方のビットの値を読み出してから書き込みレベルを指定しなければならない。従って、1ビットの値を単独に書換えることは手間のかかる作業となる。   However, it takes time to write a specific bit value in a block in which data has already been written. For example, when the value of the lower bit is rewritten from “1” to “0”, when the value of the upper bit is “1”, the target threshold value Vth is V1 <Vth <V2, and the value of the upper bit is In the case of “0”, the target threshold value Vth <V3. Thus, in order to write to a specific bit, the write level must be designated after reading the value of the other bit sharing the memory cell. Therefore, rewriting a 1-bit value independently is a laborious operation.

しかも、V1<Vth<V2値を“01”の組合せを選択することも可能であるが、一般に市販のフラッシュメモリではこのようなメモリセルの状態と各ビットの値の関係は公開されていない。また、一般に多値のフラッシュメモリは外部端子から見た仕様は従来の単値のメモリと同じになるように作られているため、メモリカードを設計するメモリの使用者には組み合わせられているビットの関係を知ることができないため、より困難である。   Moreover, it is possible to select a combination of V01 <Vth <V2 values of “01”, but generally, in a commercially available flash memory, the relationship between the state of such a memory cell and the value of each bit is not disclosed. In general, multi-level flash memory is designed so that the specifications viewed from the external terminal are the same as the conventional single-level memory. Therefore, this bit is combined with the memory user who designs the memory card. It is more difficult because you cannot know the relationship.

このように、多値のフラッシュメモリを用いたフラッシュカードを使用する場合、旧のデータを更新して古いデータが書かれたブロックの新旧フラグを表す特定のビットに“0”のデータを書き込むことが困難になる。
米国特許第5479638号
In this way, when using a flash card using a multi-level flash memory, the old data is updated, and data “0” is written to a specific bit indicating the new / old flag of the block in which the old data is written. Becomes difficult.
US Pat. No. 5,479,638

フラッシュメモリを用いたメモリカードなどのようなファイルストレージデバイスの新旧データの管理方法について、データの更新時にはフラッシュメモリは消去されて未使用のブロックへ新しいデータを書き込み、旧のデータがかかれたブロックのスペア領域に設けられている新旧ビットの値を未書き込みの状態“1”から“0”の値に書き込むことで、新旧のデータの識別を行っている。   Regarding the management method of new and old data of file storage devices such as memory cards using flash memory, when updating data, the flash memory is erased and new data is written to unused blocks. The new and old data are identified by writing the value of the new and old bits provided in the spare area from the unwritten state “1” to the value “0”.

しかし、記憶媒体として多値のフラッシュメモリを使用する場合、一つのメモリセルに2ビットのアドレスを振り当てられていため、従来行っていたように既にデータが書き込まれたブロックの中の特定のビットにデータを書き込むことが容易ではなくなる。従来のように、旧のデータが書き込まれたブロック内の特定ビットが割り当てられた新旧フラグに旧のフラグをあらわす値を書き込む場合は、対をなす他方のビットの値を求め、その組合せとして得られたVthの値を狙って書き込む必要がある。   However, when a multi-level flash memory is used as a storage medium, since a 2-bit address is assigned to one memory cell, a specific bit in a block in which data has already been written as has been done conventionally. It is not easy to write data in When writing a value representing the old flag to a new and old flag to which a specific bit in a block in which old data is written is assigned as in the past, the value of the other bit in the pair is obtained and obtained as a combination thereof. It is necessary to write with the target Vth value.

従って、一度データが書き込まれたブロックに追加の書き込みを行うことなく、更新された新旧のデータの中から最も新しいデータを見つけ出す方法が求められている。   Accordingly, there is a need for a method of finding the newest data from the new and old data that has been updated without performing additional writing to the block in which the data has been written.

上記課題に対して本発明では、フラッシュメモリのブロックの一つに既に書き込まれたデータを更新する場合、新たに書き込まれた新のデータの物理アドレスが常に旧のデータが書き込まれた物理アドレスより昇順方向にあり、新旧データが書き込まれた物理アドレスの間には常に使用可能でかつ未使用のブロックが存在しないように書き込みを管理することで解決している。
すなわち、論理アドレスと該論理アドレスに関連づけられたデータを、物理アドレスに関連づけられたブロックに格納するフラッシュメモリの、前記データを新たなデータに変えて格納する更新を、前記データを格納するブロックの物理アドレスを求め、該物理アドレスの値を順次、昇順方向に増加して物理アドレスを生成し、順次、該生成された物理アドレスに関連づけられたブロックが使用可能で未使用のブロックか否かを検証し、該検証結果が使用可能で未使用のブロックであるとき、該ブロックに前記論理アドレスと、前記新たなデータを格納することによって行われる。
In the present invention, when the data already written in one of the blocks of the flash memory is updated, the physical address of the newly written new data is always higher than the physical address where the old data is written. The problem is solved by managing writing so that there is no unused block that is always available between the physical addresses where the old and new data are written in the ascending order.
That is, the update of the flash memory that stores the logical address and the data associated with the logical address in the block associated with the physical address is stored in the block that stores the data. A physical address is obtained, a physical address is generated by sequentially increasing the value of the physical address in the ascending order, and it is sequentially determined whether or not the block associated with the generated physical address is usable and unused. Verification is performed by storing the logical address and the new data in the block when the verification result is a usable and unused block.

このようにして更新されたデータは、所定の論理アドレスに関連づけられて格納されたデータの新旧を、使用可能で未使用のブロックの物理アドレスの中の最大値を求め、該最大値から順次、降順方向に減じて物理アドレスを生成し、順次、該生成された物理アドレスのブロックが格納する論理アドレスを検証し、検証した論理アドレスが前記所定の論理アドレスと一致したとき、該ブロックに格納されたデータが最新のデータと判断される。   The data updated in this way is used to determine the oldest and newest data stored in association with a predetermined logical address, obtain the maximum value among the physical addresses of usable and unused blocks, and sequentially from the maximum value, Decrease in the descending direction to generate a physical address, sequentially verify the logical address stored in the block of the generated physical address, and when the verified logical address matches the predetermined logical address, it is stored in the block Data is determined to be the latest data.

このようにフラッシュメモリにアクセスすることで、フラッシュメモリのブロックに新旧フラグを書き込むことなしに新旧の判断を行うことができる。   By accessing the flash memory in this way, it is possible to make a new / old determination without writing a new / old flag in the block of the flash memory.

さらに、データの更新では前記昇順方向に増加して生成した物理アドレスが、前記物理アドレスの最大値を超えたとき、該生成された物理アドレスを、0に置き換え、新旧の判断では、前記降順方向に減じて生成した物理アドレスが、負の値となったとき、該生成された物理アドレスを、前記物理アドレスの最大値に置き換えることで、最新のデータを保持するブロックが使用可能で未使用のブロックの物理アドレスの最大値より大きな物理アドレスを持っていた場合にも見つけ出すことができる。すなわち、物理アドレスの昇順方向で最大値の次を0の値に設定することによって、データの更新時の昇順方向、新旧の判断時の降順方向に物理アドレス値の生成する手順で、開始する物理アドレスの値にかかわらず全ての物理アドレスを生成することができる。従って全てのブロックについて検出することが可能になる。   Further, in the data update, when the generated physical address increases in the ascending order exceeds the maximum value of the physical address, the generated physical address is replaced with 0, and in the old and new judgment, the descending direction When the generated physical address becomes a negative value, the generated physical address is replaced with the maximum value of the physical address, so that the block holding the latest data can be used and unused. It can also be found when the physical address is larger than the maximum physical address of the block. That is, by setting the value next to the maximum value to 0 in the ascending order of the physical address, the physical address starting in the procedure of generating the physical address value in the ascending order at the time of data update and the descending order at the time of new / old judgment All physical addresses can be generated regardless of the address value. Therefore, it is possible to detect all blocks.

また、前記ブロックが格納する論理アドレスに関連づけられて格納されたデータの新旧の判断を、前記フラッシュメモリの始動し、前記フラッシュメモリが格納する情報を揮発性メモリで作成した管理テーブルに転送し、前記管理テーブルの情報を揮発性メモリで作成された判定テーブルを用いて最新データを格納する物理アドレスを判断し、前記判断結果を前記管理テーブルに新の表示を行うことで、始動された後の通常の動作時には、前記管理テーブルを参照することで速やかに最新データを保持するブロックを見つけ出すことが可能となる。   In addition, the new and old judgment of the data stored in association with the logical address stored in the block is started, the flash memory is started, the information stored in the flash memory is transferred to the management table created in the volatile memory, The management table information is determined using a determination table created in a volatile memory to determine a physical address for storing the latest data, and the determination result is newly displayed on the management table. During normal operation, it is possible to quickly find a block that holds the latest data by referring to the management table.

さらに、前記管理テーブルに前記新の表示に応じて、前記管理テーブル上の前記論理アドレスを保持する他の物理アドレスに旧の表示を行うことで、更新される前のデータが保持されたブロックの物理アドレスの全てに旧の表示を行うことができる。また、前記フラッシュメモリのデータの更新を繰り返すことで使用可能で未使用のブロックの数が減少し、所定の数より少なくなると旧のデータを保持したブロックのメモリセルを消去して未使用の状態にすることが必要になる。このときは、前記フラッシュメモリの消去動作が、前記管理テーブル上に旧の値を書き込まれたブロックを全て選択し、選択された全てのブロックを消去する。このように一括消去された後には更新される前の旧のデータを保持するブロックは存在しなくなる。従って、消去によって新たに使用可能で未使用のブロックが生じても、旧のブロックの全てがなくなっているので、前に述べた、新と旧のブロックの間には使用可能で未使用のブロックが存在しない、とういう条件を維持することができる。   Further, according to the new display in the management table, the old display is performed on the other physical address that holds the logical address on the management table, so that the data before the update is stored The old display can be made on all physical addresses. In addition, the number of usable and unused blocks is reduced by repeatedly updating the data in the flash memory. When the number of unused blocks decreases, the memory cells of the blocks holding the old data are erased and unused. It is necessary to make it. At this time, the erase operation of the flash memory selects all the blocks in which old values are written on the management table, and erases all the selected blocks. After such batch erasure, there is no block that holds old data before being updated. Therefore, even if a new usable and unused block is generated by erasing, all of the old blocks are lost, so the usable and unused blocks between the new and old blocks described above can be used. It is possible to maintain the condition that no exists.

本発明は、メモリカードに多値フラッシュメモリを用いたとき、更新されて旧になったブロックに旧を示すフラグを書き込むことなく新旧の判断を可能にする。   According to the present invention, when a multi-level flash memory is used for a memory card, it is possible to make a new / old determination without writing an old flag in an updated block.

新旧の判断は、カードの始動時にフラッシュメモリのスペア領域に保持された情報を揮発性メモリに生成された管理テーブルに転送し、この管理テーブル上で判断が行われるため余計な待ち時間を要しない。   The old and new judgment is made by transferring the information held in the spare area of the flash memory at the time of starting the card to the management table generated in the volatile memory and making the judgment on this management table, so that no extra waiting time is required. .

また、データの更新や読み出す際の最新のデータもこの管理テーブル上で判別できるため高速の動作が可能になる。
In addition, since the latest data when data is updated or read can be determined on the management table, high-speed operation is possible.

以下に、本発明におけるフラッシュメモリカードの新旧データを判別するために、メモリカードの構成を示し、データを更新する際にフラッシュメモリにデータを格納する方法、フラッシュメモリに格納されたデータの中から最新のデータを始動時に判定するための設定方法、ブロック消去の方法、および読み出し方法について述べる。   The following shows the configuration of a memory card for discriminating between old and new data of a flash memory card in the present invention, a method of storing data in the flash memory when updating data, and data stored in the flash memory A setting method, a block erasing method, and a reading method for determining the latest data at start-up will be described.

図1はフラッシュメモリを用いたメモリカードがホストに接続されたメモリカードシステムを示している。   FIG. 1 shows a memory card system in which a memory card using flash memory is connected to a host.

メモリカードシステム100はメモリカード101とホスト151とで構成されている。ホスト151はホストI/F152を備え、データバス153を介して論理アドレスと、データをメモリカードとの間で送受信する。   The memory card system 100 includes a memory card 101 and a host 151. The host 151 includes a host I / F 152, and transmits and receives logical addresses and data to and from the memory card via the data bus 153.

メモリカード101はフラッシュメモリ102とコントローラ103で構成され、データバス104を介して物理アドレスとデータをフラッシュメモリ102とコントローラ103との間で送受する。コントローラ103は、ホスト151との間でデータを交換するメモリカードI/F110、アドレスレジスタ111、データレジスタ112、管理テーブル113、新旧判定テーブル114、空きブロックカウンタ115、およびコントローラを制御するCPU116を備えている。   The memory card 101 includes a flash memory 102 and a controller 103, and transmits and receives physical addresses and data between the flash memory 102 and the controller 103 via a data bus 104. The controller 103 includes a memory card I / F 110 that exchanges data with the host 151, an address register 111, a data register 112, a management table 113, an old / old determination table 114, an empty block counter 115, and a CPU 116 that controls the controller. ing.

メモリカード101にデータを書き込む場合は、ホスト151から送られてきた論理アドレスと、データはそれぞれアドレスレジスタ111とデータレジスタ112に格納される。CPU116はアドレスレジスタ111に格納された論理アドレスを管理テーブル113で参照し、格納しようとするフラッシュメモリの物理アドレスを決定する。データレジスタ112に格納されたデータはフラッシュメモリの決定された物理アドレスのブロックにデータバス153を経由して書き込まれる。   When writing data to the memory card 101, the logical address and data sent from the host 151 are stored in the address register 111 and the data register 112, respectively. The CPU 116 refers to the logical address stored in the address register 111 in the management table 113 and determines the physical address of the flash memory to be stored. The data stored in the data register 112 is written to the block of the determined physical address in the flash memory via the data bus 153.

管理テーブル113は揮発性メモリで構成され、フラッシュメモリ102に書き込まれるデータの論理アドレスと物理アドレスの対応関係や、データが更新されているとき新旧の表示などの管理情報を保持している。また、新旧判定テーブル114は揮発性メモリで構成されている。   The management table 113 is composed of a volatile memory, and holds management information such as the correspondence between the logical address and the physical address of data written to the flash memory 102 and the old and new displays when the data is updated. The old / new determination table 114 is composed of a volatile memory.

フラッシュメモリ102は多値構造のセルが用いられている。そのため、前記のようにブロックに一度データを書き込んだ後には、再び同じブロックに新旧フラグに相当する特定のビットに書き込む動作は行っていない。そのため、フラッシュメモリのスペア領域のどこにもデータの新旧を表す記号は書かれていない。新旧の判断は以下で詳しく説明する。   The flash memory 102 uses multi-valued cells. For this reason, after data is once written in the block as described above, an operation of writing data into a specific bit corresponding to the new / old flag is not performed again in the same block. For this reason, no symbol representing the new or old data is written anywhere in the spare area of the flash memory. The old and new judgment will be explained in detail below.

管理テーブル113は、メモリカード101の始動時にフラッシュメモリ102が格納する情報を元に作成され、データの書き込み、消去動作に応じて内容が修正される。始動時に更新されたデータの新旧の判断は新旧判定テーブルを用いて行われる。   The management table 113 is created based on information stored in the flash memory 102 when the memory card 101 is started, and the contents are corrected according to data write / erase operations. The new / old judgment of the data updated at the time of starting is performed using the old / new judgment table.

NAND型のフラッシュメモリ102は複数のブロックで構成され、さらに、各ブロックは複数のページで構成されている。読み出しと書き込み動作はページ単位で行われ、消去動作はブロックを単位に一括消去が行われる。それぞれのブロックには物理アドレスが付与れ、各ブロックのデータ領域にはデータと、論理アドレスなどのスペア情報が格納される。   The NAND flash memory 102 is composed of a plurality of blocks, and each block is composed of a plurality of pages. Read and write operations are performed in units of pages, and erase operations are performed in batches in units of blocks. Each block is given a physical address, and data and spare information such as a logical address are stored in the data area of each block.

図2は多値フラッシュメモリ102のデータ構造を示し、
ブロック121にはそれぞれに物理アドレス122が付与されている。データ領域123はメイン領域124とスペア領域125に分けられ、メイン領域124にホストから送られてくるデータを記憶する。スペア領域125には、論理アドレス126、およびエラー訂正情報などその他127の情報を記憶している。基本的構成は図8で示したデータ構造と同じであるが、新旧フラグに相当する領域はなく、それぞれのブロックを構成するメモリ領域は一度値を書き込まれた後は、データが更新された場合も再び書き込まれることはない。
FIG. 2 shows the data structure of the multi-level flash memory 102.
Each block 121 is given a physical address 122. The data area 123 is divided into a main area 124 and a spare area 125, and data sent from the host is stored in the main area 124. The spare area 125 stores 127 information such as a logical address 126 and error correction information. The basic structure is the same as the data structure shown in FIG. 8, but there is no area corresponding to the new and old flags, and the memory area that constitutes each block is updated once the value is written Will not be written again.

物理アドレスの“0”と“1”は予め用途が予約された予約ブロックであって、物理アドレス“0”のブロックのメイン領域には欠陥があるブロックのアドレスが書き込まれている。また、物理アドレス“1”のブロックのメイン領域にはブートデータが書き込まれていて、メモリカードの始動時に自動的に読み出される。   The physical addresses “0” and “1” are reserved blocks whose use has been reserved in advance, and the address of the defective block is written in the main area of the block of the physical address “0”. Further, boot data is written in the main area of the block having the physical address “1”, and is automatically read when the memory card is started.

物理アドレス“2”以降は一般に使用されるブロックで、昇順方向に数字が振り当てられ、図2の例では物理アドレス“9999”が最大値で、最終アドレスと定義する。メイン領域で(未使用)と書かれているブロックは、欠陥がなく予約もされていない使用可能で未使用のブロックであることを表している。   The physical address “2” and later are generally used blocks, and numbers are assigned in the ascending order. In the example of FIG. 2, the physical address “9999” is the maximum value and is defined as the final address. A block written as (unused) in the main area represents a usable and unused block that has no defect and is not reserved.

物理アドレス“2”、“3”のブロックは、一度所用された後に消去されることでランダムに発生する使用可能で未使用のブロックの例を示している。物理アドレス“7903”は欠陥があるブロックで使用することができない。物理アドレス“7900から7906”のブロックには、欠陥ブロックを除いて、論理アドレス“578”から“583”の値が論理アドレス領域126に書き込まれ、それぞれに関連するデータがメイン領域124に書き込まれている。   Blocks with physical addresses “2” and “3” are examples of usable and unused blocks that are randomly generated by being erased after being used once. The physical address “7903” cannot be used in a defective block. In the blocks of physical addresses “7900 to 7906”, except for defective blocks, the values of logical addresses “578” to “583” are written in the logical address area 126, and the data related to each is written in the main area 124. ing.

物理アドレス“7907”にはその後に書き込まれた論理アドレス“810”のデータが書かれている。物理アドレス“7908”のブロックのデータの論理アドレスも“579”であって、物理アドレス“7901”のブロックと同じ値になっている。以下で説明する本発明の判断方法に従えば、物理アドレス“7908”のデータが最新のデータであることがわかる。   In the physical address “7907”, data of the logical address “810” written thereafter is written. The logical address of the data of the block with the physical address “7908” is also “579”, which is the same value as the block with the physical address “7901”. According to the determination method of the present invention described below, it can be seen that the data at the physical address “7908” is the latest data.

図2に示したように、同じ論理アドレスのデータが書き込まれた複数のブロックが存在するが、フラッシュメモリそのものにはどのブロックに最新のデータが書き込まれているかを示す情報は備えていない。   As shown in FIG. 2, there are a plurality of blocks in which data of the same logical address is written, but the flash memory itself does not have information indicating in which block the latest data is written.

次に、管理テーブル113の構成を図3に示す。管理テーブル113は、メモリカードの始動時にフラッシュメモリ102が保持する情報をもとに作成され、論理アドレスと物理アドレスの関係を保持し、動作中のデータの読み出し、書き込み、消去時のフラッシュメモリ102のアドレス情報を管理している。物理アドレス131の“0”から最終アドレス“9999”に対応した行があり、それぞれの行に、論理アドレス132、新旧フラグ133、欠陥フラグ134、および予約フラグ135の値が保持されている。図3では、図2に対応して表示されていて、物理アドレス“7901”の新旧フラグ133には“旧”の表示があり、物理アドレス“7908”には“新”の表示がなされている。この表示方法については、後で説明する。   Next, the configuration of the management table 113 is shown in FIG. The management table 113 is created based on information held in the flash memory 102 when the memory card is started, holds the relationship between logical addresses and physical addresses, and the flash memory 102 at the time of reading, writing, and erasing data during operation. Is managing address information. There are rows corresponding to the physical address 131 from “0” to the final address “9999”, and the values of the logical address 132, the new / old flag 133, the defect flag 134, and the reservation flag 135 are held in each row. In FIG. 3, displayed in correspondence with FIG. 2, “old” is displayed in the new / old flag 133 of the physical address “7901”, and “new” is displayed in the physical address “7908”. . This display method will be described later.

以下に、データの更新があったときのフラッシュメモリへの書き込む方法、更新された複数の同じ論理アドレスが異なる物理アドレスのブロックに保持されている場合、最新の更新されたデータがどのブロックに保持されているかを決定する方法について順に述べる。   The following shows how to write to the flash memory when data is updated. When multiple updated logical addresses are stored in different physical address blocks, the latest updated data is stored in which block. The method for determining whether or not it is done will be described in order.

<データの更新>先ず、メモリカードが始動されていて通常の動作状態にあるとき、ホスト151から、既にフラッシュメモリ102に書き込まれている論理アドレスを割り当てられたデータを更新する要求がなされた場合について説明する。ホスト151から更新するデータの論理アドレスと書き込みデータはホストI/F152、データバス153を経由してメモリカード101に送られ、メモリカードI/F110を経由してアドレスレジスタ111、およびデータレジスタ112に保存される。   <Updating data> First, when the memory card is started and in a normal operation state, the host 151 makes a request to update the data to which the logical address already written in the flash memory 102 is assigned. Will be described. The logical address and write data of data to be updated from the host 151 are sent to the memory card 101 via the host I / F 152 and the data bus 153, and to the address register 111 and the data register 112 via the memory card I / F 110. Saved.

フラッシュメモリ102に更新される新しいデータを書き込むために、管理テーブル113上から、更新する前までは最新のデータが書き込まれているブロックの物理アドレスを求める。そして、物理アドレスを昇順方向にたどって、最初に見つかった使用可能で未使用のブロックに新しいデータを書き込む。同時に、管理テーブルの値を書換えて、最新の状態に書換えてデータの更新を完了する。図2および図3の例では、物理アドレス“7901”には論理アドレス“579”の更新する前の最新のデータが格納されていて、物理アドレス“7901”の新旧フラグ133には”新“の表示がなされている。この段階では物理アドレス“7908”のブロックは未使用の状態で、ここに論理アドレス“579”の更新された最新のデータが書き込まれる。   In order to write new data to be updated in the flash memory 102, the physical address of the block in which the latest data is written is obtained from the management table 113 before the update. Then, the physical address is traced in the ascending order, and new data is written in the first usable and unused block found. At the same time, the value in the management table is rewritten to the latest state, and the data update is completed. In the example of FIGS. 2 and 3, the physical address “7901” stores the latest data before the logical address “579” is updated, and the new / old flag 133 of the physical address “7901” indicates “new”. The display is made. At this stage, the block with the physical address “7908” is unused, and the latest updated data with the logical address “579” is written therein.

上記のデータの更新の手順を図4のフローチャートを用いて説明する。先ず、管理テーブル113上で、論理アドレス132の中から更新する論理アドレスの値を見つけ出す。論理アドレスに対応する物理アドレスが複数個ある場合、その中から新旧フラグ133が“新”になっている行の物理アドレス131を見つけ出し、Nの値をその物理アドレスに設定する(S111)。さらに、新旧フラグ133の値を“新”から“旧”に変更する(S112)。   The procedure for updating the data will be described with reference to the flowchart of FIG. First, a logical address value to be updated is found from the logical address 132 on the management table 113. If there are a plurality of physical addresses corresponding to the logical address, the physical address 131 of the row in which the old / new flag 133 is “new” is found out, and the value of N is set as the physical address (S111). Further, the value of the new / old flag 133 is changed from “new” to “old” (S112).

次に、Nの値をN=N+1に昇順方向に置き換える(S113)。置き換えたNの値と最終ブロックの値を比較する(S114)。Nの値が最終ブロックの値より大きくなったときは、Nの値をN=0に置き換える(S115)。このステップは、物理アドレスを昇順方向に順次増加させたときの、最終ブロックの次を“0”と定義しているからである。   Next, the value of N is replaced with N = N + 1 in the ascending order (S113). The replaced N value is compared with the final block value (S114). When the value of N becomes larger than the value of the last block, the value of N is replaced with N = 0 (S115). This step is because “0” is defined next to the last block when the physical address is sequentially increased in the ascending order.

次に、管理テーブル113上で、物理アドレスがNのブロックが使用可能で未使用かどうかを検証する(S116)。該当しない場合は、再びステップS113にもどり、物理アドレスを昇順方向に使用可能で未使用のブロックが見つかるまでこれを繰り返す。   Next, it is verified on the management table 113 whether the block with the physical address N is usable and unused (S116). If not, the process returns again to step S113, and this is repeated until an unused block that can use the physical address in the ascending order is found.

ステップS116で使用可能で未使用のブロックに該当したとき、このブロックに更新する新しいデータを書き込む。すなわち、フラッシュメモリ102の物理アドレスがNのブロックの論理アドレス126にアドレスレジスタ111に保持されている論理アドレスを書き込み、データレジスタ112に保持されたデータをメイン領域124に書き込む(S117)。   When it corresponds to a usable and unused block in step S116, new data to be updated is written in this block. That is, the logical address held in the address register 111 is written into the logical address 126 of the block having the physical address N of the flash memory 102, and the data held in the data register 112 is written into the main area 124 (S117).

引き続いて管理テーブル113の物理アドレスがNの行の論理アドレス132にアドレスレジスタ111に保持されている論理アドレスを書き込み、さらに新旧フラグ133を“新”に変更する(S118)。   Subsequently, the logical address held in the address register 111 is written to the logical address 132 of the row where the physical address of the management table 113 is N, and the new / old flag 133 is changed to “new” (S118).

次に空きブロックカウンタ115の値Mを1減じてM=M−1に置き換える(S119)。そして、置き換えられたMの値が指定されている最小値Mminと比較して(S120)大きいか等しい場合ステップS123に進んでデータの更新を完了する。   Next, the value M of the empty block counter 115 is decremented by 1 and replaced with M = M−1 (S119). If the replaced M value is greater than or equal to the designated minimum value Mmin (S120), the process proceeds to step S123 to complete the data update.

ステップS120でMの値が最小値Mminよりも小さくなったときは、管理テーブル113の新旧フラグ133に“旧”の表示がある物理アドレスのブロックを全て消去する(S121)。次いで、管理テーブル上の消去したブロックに該当する行の論理アドレス132、新旧フラグ133のデータを削除する(S122)。こうしてデータの更新を完了する(S123)。   When the value of M becomes smaller than the minimum value Mmin in step S120, all blocks of physical addresses having “old” displayed in the new / old flag 133 of the management table 113 are deleted (S121). Next, the data of the logical address 132 and the new / old flag 133 in the row corresponding to the erased block on the management table are deleted (S122). Thus, the data update is completed (S123).

メモリカード101がホスト151に接続された使用状態で引き続きデータを読み出す場合は更新された最新のデータは、管理テーブル113の上の新旧フラグ133に“新”の表示があるので正しく識別できる。しかし、一度メモリカード101の電源が一度切断されると、揮発性メモリで構成された管理テーブル113のデータは消滅する。従って、始動時にはフラッシュメモリ102が保持している情報をもとに管理テーブル113を作成する必要がある。以下に始動時に管理テーブルに管理情報を設定する方法について説明する。   When data is continuously read while the memory card 101 is connected to the host 151, the latest updated data can be correctly identified because “new” is displayed in the new / old flag 133 on the management table 113. However, once the power of the memory card 101 is turned off, the data in the management table 113 composed of volatile memory disappears. Therefore, it is necessary to create the management table 113 based on information stored in the flash memory 102 at the time of startup. A method for setting management information in the management table at startup will be described below.

<始動時の設定>メモリカード101をホスト151に接続するとコントローラ103が起動し、フラッシュメモリ102の予約ブロックから、ブートデータを読み出してCPU116にメモリカードの管理プログラムを与える。次にフラッシュメモリ102のそれぞれのブロックのスペアエリア125の情報を順次読み出し、管理テーブル113に転送する。   <Setting at Startup> When the memory card 101 is connected to the host 151, the controller 103 is activated, reads the boot data from the reserved block of the flash memory 102, and gives the CPU 116 a memory card management program. Next, the information in the spare area 125 of each block of the flash memory 102 is sequentially read and transferred to the management table 113.

フラッシュメモリの予約ブロックのメイン領域124と、各ブロックのスペア領域125に書き込まれたデータを順番に読み出してコントローラに転送し、管理テーブルを作成する手順を図5に示すフローチャートを用いて説明する。   The procedure for sequentially reading out the data written in the main area 124 of the reserved block of the flash memory and the spare area 125 of each block and transferring it to the controller to create a management table will be described with reference to the flowchart shown in FIG.

先ず、フラッシュメモリの物理アドレス“0”のブロックに書き込まれている欠陥アドレス情報を読み出して、管理テーブル113の対応する物理アドレスの行の欠陥フラグ134の列に欠陥表示を書き込む。引き続き、予約ブロックの予約フラグ134に予約の表示を行う。(S131)
次に、物理アドレスを指定するNの値をN=0に設定し(S132)、次いで、空きブロックカウンタ115の値Mをフラッシュメモリ102のブロックの数に設定する(S133)。次に、物理アドレスがNのブロックが、使用可能なブロックかどうかを判断する(S134)。ここで、使用可能なブロックとは、欠陥が無くかつ予約されていないブロックである。使用可能なブロックであれば、そのブロックが既に使用済みであるかどうかを判断する(S135)。既に使用済みであれば、割り当てられている論理アドレス126の値を管理テーブル113の論理アドレス132に保管する(S136)。この場合、空きブロックの数が1減少しているので、Mの値をM=M−1に置き換える(S137)。
First, the defect address information written in the block of the physical address “0” of the flash memory is read, and the defect indication is written in the column of the defect flag 134 in the row of the corresponding physical address in the management table 113. Subsequently, the reservation is displayed in the reservation flag 134 of the reservation block. (S131)
Next, the value of N designating the physical address is set to N = 0 (S132), and then the value M of the free block counter 115 is set to the number of blocks in the flash memory 102 (S133). Next, it is determined whether or not the block whose physical address is N is a usable block (S134). Here, the usable block is a block which has no defect and is not reserved. If it is a usable block, it is determined whether the block is already used (S135). If already used, the value of the assigned logical address 126 is stored in the logical address 132 of the management table 113 (S136). In this case, since the number of empty blocks is decreased by 1, the value of M is replaced with M = M−1 (S137).

次に、Nの値が最終アドレスの値に等しいかどうかを判断する(S138)。等しくないときは、Nの値をN=N−1に置き換えて(S139)ステップS134に戻って、再び同じ判断を繰り返す。ステップS134で物理アドレスNのブロックが使用可能でない場合は、ステップS137に跳び、空きブロックの数Mを1減じる。   Next, it is determined whether the value of N is equal to the value of the final address (S138). If they are not equal, the value of N is replaced with N = N−1 (S139), the process returns to step S134, and the same determination is repeated again. If the block of the physical address N is not usable in step S134, the process jumps to step S137, and the number M of free blocks is reduced by one.

また、ステップS135で物理アドレスNのブロックが未使用の場合は、ステップS138に跳び、Nの値が最終アドレスと一致していないかどうかを判定する。   If the block at the physical address N is unused in step S135, the process jumps to step S138 to determine whether the value of N does not match the final address.

ステップS138でNの値が最終アドレスと一致すれば、全ての物理アドレスに対する調査が終わり、始動時にフラッシュメモリ102から管理情報を転送する管理テーブル113の作成が完了する(S140)。   If the value of N matches the final address in step S138, the investigation for all physical addresses is completed, and the creation of the management table 113 for transferring management information from the flash memory 102 at the start is completed (S140).

次に、同一論理アドレスが指定された複数のブロックが存在したとき、どちらのブロックのデータが最新のデータであるかを判断する必要がある。以下に、管理テーブル113に読み出した情報を用いて、新旧フラグ133の列にフラグを立てる手順を図6のフローチャートを用いて説明する。   Next, when there are a plurality of blocks to which the same logical address is specified, it is necessary to determine which block data is the latest data. Hereinafter, a procedure for setting a flag in the column of the new and old flags 133 using the information read in the management table 113 will be described with reference to the flowchart of FIG.

本フローにおいては、揮発性メモリ上に設けた新旧判定テーブル114を用いる。新旧判定テーブル114は図7に示すように、論理アドレス141、最新物理ブロック142、および最新ブロック発見済みフラグ143から構成されていて、上記図5のフローチャートに従って作成された管理テーブル113を用いて作成し、論理アドレス141の昇順方向に並べておく。同じ論理アドレスが複数個ある場合は物理アドレス142は昇順方向に並べ、最初の状態では最新ブロック発見済みフラグ143は全て値が未入力にしておく。   In this flow, an old / new determination table 114 provided on a volatile memory is used. As shown in FIG. 7, the new / old determination table 114 includes a logical address 141, the latest physical block 142, and the latest block found flag 143, and is created using the management table 113 created according to the flowchart of FIG. Then, the logical addresses 141 are arranged in the ascending order. When there are a plurality of the same logical addresses, the physical addresses 142 are arranged in the ascending order, and in the initial state, all the latest block found flags 143 are left uninput.

先ず、図6の最初のステップS151でNの値をN=最終アドレスに設定する。通常の場合は、図5の管理テーブル作成手順に引き続いて行うのでNは最終アドレスに設定された状態で終了している。次に、管理テーブル113を参照して物理アドレスの値がNのブロックが使用可能でかつ未使用のブロックかどうかを判断する(S152)。いずれにも該当しない場合はNの値をN=N−1に置き換え(S153)、再びステップS152の判断を繰り返す。このようにして、物理アドレスの値Nを最大値から降順方向に1ずつ減じながら設定して点検し、使用可能で未使用の条件に最初に該当するブロックを見つけ出す。   First, in the first step S151 in FIG. 6, the value of N is set to N = final address. In a normal case, the process is performed subsequent to the management table creation procedure of FIG. 5, and thus N is completed with the final address set. Next, referring to the management table 113, it is determined whether or not the block whose physical address value is N is usable and unused (S152). If none of these apply, the value of N is replaced with N = N−1 (S153), and the determination in step S152 is repeated again. In this way, the value N of the physical address is set and inspected while decreasing by 1 in the descending order from the maximum value, and a block corresponding to the usable and unused condition is found first.

ステップS152で該当するブロックが見つかったとき、そのNの値をNstartとする(S154)。このようにして定めたNstartは、使用可能で未使用のブロックの中で最大の物理アドレスであって一意的に定めることができ、この物理アドレスを起点にして以下の手順に従って最新のデータが格納されたブロックを判断していく。   When the corresponding block is found in step S152, the value of N is set to Nstart (S154). The Nstart thus determined is the largest physical address among usable and unused blocks and can be uniquely determined. The latest data is stored in accordance with the following procedure starting from this physical address. Judge the block that was made.

メモリカードの使用開始時点では、このNstartは最終アドレスとは一致するが、データの更新と、ブロックの消去を繰り返すことで、最終アドレスまで使用され、未使用のブロックの物理アドレスの値が小さくなる状態が生じるが、上記の手順で求めることで対処することが可能となっている。   At the start of use of the memory card, this Nstart coincides with the final address. However, by repeating the data update and the block erasing, the Naddress is used up to the final address, and the physical address value of the unused block becomes small. Although a situation arises, it can be dealt with by obtaining the above procedure.

ステップS154に続いて、Nの値をN=N−1に降順方向に置き換える(S155)。そして置き換えたNの値が負かどうかを判定し(S156)、負になっていない場合、引き続きNの値とNstartとを比較し(S157)、等しくない場合、ステップS159で物理アドレスがNのブロックが使用可能でかつ論理アドレスが書き込まれているブロックかどうかを判断する。判定条件に一致しない場合は、ステップS155にもどる。使用可能で論理アドレスがある場合は、新旧判定テーブル114の論理アドレス141と新旧ブロック発見済みフラグ143を参照し、該当する論理アドレスの物理ブロックが既に見つかっているかどうかを判断する(S160)。その論理アドレスが発見済みではない場合、ステップS162に移り、管理テーブル113の新旧フラグ133に“新”の表示を行い、新旧判定テーブル114の最新ブロック発見済みフラグ143に“済み”を表示する。そして、再びステップS155にもどる。   Subsequent to step S154, the value of N is replaced in the descending order by N = N−1 (S155). Then, it is determined whether or not the replaced N value is negative (S156). If it is not negative, the N value is continuously compared with Nstart (S157). If not, the physical address is N in step S159. Determine if the block is usable and has a logical address written to it. If the determination condition is not met, the process returns to step S155. If the logical address is usable and there is a logical address, the logical address 141 and the new / old block found flag 143 in the new / old determination table 114 are referred to and it is determined whether a physical block of the corresponding logical address has already been found (S160). If the logical address has not been found, the process proceeds to step S162, where “new” is displayed in the new / old flag 133 of the management table 113, and “done” is displayed in the latest block found flag 143 of the new / old determination table 114. And it returns to step S155 again.

ステップS160で該当する論理アドレスが発見済みの場合、管理テーブル113の該当するブロックの新旧フラグ133を“旧”の表示に変更し、新旧判定テーブル114の最新ブロック発見済みフラグを済みに表示する。   If the corresponding logical address has been found in step S160, the new / old flag 133 of the corresponding block in the management table 113 is changed to “old” and the latest block found flag in the new / old determination table 114 is displayed as “completed”.

図7に示した新旧判定テーブル114の場合、論理アドレス“579”に対応する物理アドレスの新旧判断では、降順方向に物理アドレスをたどり、物理アドレス“7908”で論理アドレス“579”を始めて発見したので、管理テーブル113の新旧フラグ133に“新”の表示がされている。同時に新旧判定テーブル114の最新ブロック発見済みフラグには済みの表示がされる。従って、さらに物理アドレスの値を降順方向に減じて、“7901”になったときには、該当する論理アドレス“579”は既に発見済みになっているので、管理テーブル113の新旧フラグ133には”旧“の表示がされている。   In the case of the new / old determination table 114 shown in FIG. 7, in the new / old determination of the physical address corresponding to the logical address “579”, the physical address is traced in the descending order, and the logical address “579” is first discovered with the physical address “7908”. Therefore, “new” is displayed in the new / old flag 133 of the management table 113. At the same time, “completed” is displayed in the latest block found flag in the new / old determination table 114. Accordingly, when the value of the physical address is further decreased in the descending direction and becomes “7901”, since the corresponding logical address “579” has already been discovered, the old / old flag 133 of the management table 113 indicates “old” “Is displayed.

ステップS155で降順方向にNの値を1ずつ減じる操作を繰り返していると、ついにはNが負の値が生成される。この場合、ステップS156の判定でステップS158へ進み、ここでNの値を最終アドレスの値に置き換える。そして引き続きステップS157へ進みフローに従った手順が繰り返される。   If the operation of decreasing the value of N by 1 in the descending order is repeated in step S155, finally a negative value of N is generated. In this case, the determination in step S156 proceeds to step S158, where the value of N is replaced with the value of the final address. Then, the process proceeds to step S157 and the procedure according to the flow is repeated.

そして、Nの値がN=Nstartになったとき、ステップS157で全ての物理アドレスの検証が終了したと判断し、管理テーブル113の新旧フラグ133への書き込みが完了する(S163)。   When the value of N becomes N = Nstart, it is determined in step S157 that all physical addresses have been verified, and writing to the new / old flag 133 in the management table 113 is completed (S163).

ステップS156でNが負の値になったときにNの値を最終アドレスの値に置き換えることで物理アドレスを連続して降順方向に順番に置き換えることができる。そして、ステップS157でN=Nstartと判定されたとき、全物理アドレスの降順方向の検証が行われたことが判る。   When N becomes a negative value in step S156, the physical address can be sequentially replaced in the descending order by replacing the value of N with the value of the final address. When it is determined in step S157 that N = Nstart, it is understood that all physical addresses have been verified in the descending order.

データ更新の項で説明したように、同じ論理アドレスのデータを保持しているブロックが複数個あった場合、更新された最新のデータの物理アドレスは必ず更新される前の物理アドレスから昇順方向にたどるブロックの中の最初の使用可能で未使用のブロックに書き込まれている。従って、データの更新が複数回繰り返して行われた場合も、最も旧のデータが保持されているブロックと最新のデータが保持されているブロックの間には使用可能で未使用のブロックは存在しないことがわかる。   As explained in the section on data update, if there are multiple blocks holding data of the same logical address, the physical address of the latest updated data is always in ascending order from the physical address before the update. It is written to the first available and unused block in the block to follow. Therefore, even when data is updated several times, there is no usable and unused block between the block holding the oldest data and the block holding the latest data. I understand that.

このような順番で新旧のデータが保持されているので、複数箇所に保持された論理アドレスの最新のデータは、使用可能で未使用のブロックから物理アドレスを降順方向にたどって最初に発見されたブロックに保持されていることがわかる。さらに、使用可能で未使用のブロックが多数、分散して存在する状態が存在する。このような場合、使用可能で未使用のブロックの中で物理アドレスが最大値を持ったブロックを起点にすることで、一意的に見つけ出すことができる。   Since the old and new data are held in this order, the latest data of the logical address held in multiple locations was first discovered by tracing the physical address in descending order from the available and unused block. It can be seen that it is held in the block. Furthermore, there exists a state in which many usable and unused blocks are distributed. In such a case, it is possible to uniquely find a block having a maximum physical address among usable and unused blocks as a starting point.

次に、ブロック消去について説明する。   Next, block erase will be described.

<ブロック消去>ステップS122で示したように空きブロックカウンタ115の値が規定値より少なくなった場合は、旧のデータが格納されたブロックの消去を行う。消去動作は管理テーブル113の新旧フラグ133の中で旧の表示がある全ての物理アドレスを指定し、フラッシュメモリ102が備えるブロック消去機能を利用し一括消去する。消去動作はデータの読み出しや、書き込みに比べて時間を要するので、必ずしもステップS122の時に限らず、メモリカードが待ちの状態にあるときを利用して行っても良い。   <Block Erase> When the value of the empty block counter 115 becomes smaller than the specified value as shown in step S122, the block in which the old data is stored is erased. In the erase operation, all the physical addresses having the old display are designated in the new and old flags 133 of the management table 113, and the block erase function provided in the flash memory 102 is used for batch erase. Since the erasing operation takes more time than data reading or writing, the erasing operation is not necessarily performed at the time of step S122, and may be performed using the time when the memory card is in a waiting state.

この消去動作で注意を要するのは、管理テーブル113上の新旧フラグ133の中で“旧”の表示があるブロックを全て消去しなければならないという点である。なぜなら、フラッシュメモリのスペア領域には新旧フラグに相当する記録がないため、同じ論理アドレスの表示を持つ物理アドレスが複数存在するとき、データが保持されているブロックの物理アドレスの順序が厳しく限定されているからである。   What should be noted in this erasing operation is that all blocks with “old” displayed in the new / old flag 133 on the management table 113 must be erased. Because there is no record corresponding to the old and new flags in the spare area of the flash memory, the order of the physical addresses of the blocks holding the data is strictly limited when there are multiple physical addresses with the same logical address indication. Because.

すなわち、データの更新のところで述べたように、同じ論理アドレスのデータを記憶したブロックが複数存在する場合は、最新のデータが書き込まれたブロックと更新される前の旧のデータが書き込まれたブロックとの間には、使用可能で未使用のブロックが存在しないということを基本条件としている。消去動作で旧のブロックの一部が消去されずに残った場合、旧のデータを保持する物理ブロックと新のデータを保持するブロックの間にあった別の旧のデータを保持するブロックが消去され使用可能で未使用のブロックとなって、上記の前提条件が満たせなくなってしまうからである。   That is, as described in the data update, when there are a plurality of blocks storing data of the same logical address, the block in which the latest data is written and the block in which the old data before the update is written are written. The basic condition is that there are no usable and unused blocks. If a part of the old block remains unerased during the erase operation, another block that holds the old data between the physical block that holds the old data and the block that holds the new data is erased and used This is because the block becomes possible and unused, and the above preconditions cannot be satisfied.

<データの読み出し>次に、メモリカードからデータを読み出すときの手順について説明する。メモリカード101はホスト151からは読み出すデータの論理アドレスをインターフェース152を経由して受信し、アドレスレジスタ111に保持する。管理テーブル113の中から保存された論理アドレスと一致し、新旧フラグ133に新の表示のあるブロックの物理アドレス131を見つけ出す。そして、フラッシュメモリ102から対応するブロックのデータを読み出し、データレジスタ112に保持する。引き続きインターフェース110を経由してホスト151へ読み出したデータを送る。   <Reading Data> Next, the procedure for reading data from the memory card will be described. The memory card 101 receives the logical address of data to be read from the host 151 via the interface 152 and holds it in the address register 111. The physical address 131 of the block that matches the logical address stored in the management table 113 and has a new display in the new / old flag 133 is found. Then, the corresponding block data is read from the flash memory 102 and held in the data register 112. Subsequently, the read data is sent to the host 151 via the interface 110.

以上述べたように、本発明では、フラッシュメモリのデータの更新を旧のデータを保持するブロックから物理アドレスの昇順方向にある使用可能で未使用の最初のブロックに書き込むことに特徴がある。従って、最新のデータが使用可能で未使用のブロックの中で物理アドレスが最大のブロックを降順方向にたどり、最初に目的とする論理アドレスを保持するブロックが最新のデータを保持していることがわかる。   As described above, the present invention is characterized in that the update of the data in the flash memory is written from the block holding the old data to the first usable and unused block in the ascending order of the physical address. Therefore, the latest data can be used and the block with the largest physical address in the unused block is traced in the descending order, and the block that holds the target logical address first holds the latest data. Recognize.

なお、本発明の実施において、昇順方向と降順方向を置き換えて実施してもなんら問題がないことも明らかである。   It is obvious that there is no problem even if the ascending order and descending direction are replaced in the practice of the present invention.

フラッシュメモリを用いたメモリカードなどのファイルシステムでは、多値フラッシュメモリの利用が拡大している。しかし、多値フラッシュメモリは一度データを書き込まれたブロックの特定のビットに対してデータを追記することが困難である。本発明によれば、データの更新が繰り返されることで、同じ論理アドレスを持った複数のブロックの新旧判断を従来のように、旧になったブロックに追記することなく、容易に新旧を判断することができる。新旧の情報はメモリカードに記録されたデータの物理アドレスの順番によって判断されるので、電源の供給が無くても保持することができ、また物理アドレスの順番から新旧の判断はメモリカードが備えるコントローラによって自動的に行われる。   In a file system such as a memory card using a flash memory, the use of a multi-value flash memory is expanding. However, it is difficult for a multi-level flash memory to add data to a specific bit of a block in which data has been written once. According to the present invention, by repeatedly updating data, it is possible to easily determine whether a plurality of blocks having the same logical address are new or old without adding the old and new blocks to the old block as in the prior art. be able to. Since the old and new information is judged by the order of the physical addresses of the data recorded on the memory card, it can be held without power supply, and the old and new judgment can be made from the order of the physical addresses. Done automatically.

本発明の実施例となるメモリカードシステム説明する図である。It is a figure explaining the memory card system used as the Example of this invention. 多値フラッシュメモリに書き込むデータの構成を示す図である。It is a figure which shows the structure of the data written in a multi-value flash memory. 管理テーブルを示す図である。It is a figure which shows a management table. データの更新を行う手順を示すフローチャートである。It is a flowchart which shows the procedure which updates data. 管理テーブルの作成を行う手順を示すフローチャートである。It is a flowchart which shows the procedure which produces a management table. 新旧フラグの作成を行う手順を示すフローチャートである。It is a flowchart which shows the procedure which produces a new and old flag. 新旧判定テーブルを示す図である。It is a figure which shows an old and new determination table. フラッシュメモリに書き込む従来のデータ構成を示す図である。It is a figure which shows the conventional data structure written in flash memory. 多値メモリのVthと2ビットの値の関係を説明する図である。It is a figure explaining the relationship between Vth of a multi-value memory, and a 2-bit value.

符号の説明Explanation of symbols

100 メモリカードシステム
101 メモリカード
102 フラッシュメモリ
103 コントローラ
104 データバス
110 メモリカードI/F
111 アドレスレジスタ113 管理テーブル
112 データレジスタ
113 管理テーブル
114 新旧判定テーブル
115 空きブロックカウンタ
116 CPU
151 ホスト
153 データバス
100 Memory Card System 101 Memory Card 102 Flash Memory 103 Controller 104 Data Bus 110 Memory Card I / F
111 Address register 113 management table 112 data register 113 management table 114 old / new determination table 115 free block counter 116 CPU
151 Host 153 Data bus

Claims (5)

論理アドレスと該論理アドレスに関連づけられたデータを、物理アドレスに関連づけられたブロックに格納するフラッシュメモリの、前記データを新たなデータに変えて格納する更新を、
前記データを格納するブロックの物理アドレスを求め、
該物理アドレスの値を順次、昇順方向に増加して物理アドレスを生成し、
順次、該生成された物理アドレスに関連づけられたブロックが使用可能で未使用のブロックか否かを検証し、
該検証結果が使用可能で未使用のブロックであるとき、該ブロックに前記論理アドレスと、前記新たなデータを格納することによって行い、
所定の論理アドレスに関連づけられて格納されたデータの新旧を、
使用可能で未使用のブロックの物理アドレスの中の最大値を求め、
該最大値から順次、降順方向に減じて物理アドレスを生成し、
順次、該生成された物理アドレスのブロックが格納する論理アドレスを検証し、
検証した論理アドレスが前記所定の論理アドレスと一致したとき、該ブロックに格納されたデータが最新のデータとすることによって判断することを特徴とするフラッシュメモリのアクセス方法。
Update of a flash memory that stores a logical address and data associated with the logical address in a block associated with a physical address, and stores the data instead of the new data.
Find the physical address of the block that stores the data,
Generate the physical address by sequentially increasing the value of the physical address in the ascending order direction,
Sequentially, verify whether the block associated with the generated physical address is a usable and unused block,
When the verification result is a usable and unused block, the logical address and the new data are stored in the block,
The old and new data stored in association with a given logical address
Find the maximum physical address of available and unused blocks,
A physical address is generated by sequentially subtracting from the maximum value in the descending order direction,
Sequentially, the logical address stored in the generated block of physical addresses is verified,
An access method for a flash memory, characterized in that, when a verified logical address matches the predetermined logical address, the data stored in the block is determined to be the latest data.
前記、昇順方向に増加して生成した物理アドレスが、前記物理アドレスの最大値を超えたとき、該生成された物理アドレスを、0に置き換えることを特徴とする請求項1記載のフラッシュメモリのアクセス方法。   2. The flash memory access according to claim 1, wherein when the physical address generated by increasing in the ascending order exceeds the maximum value of the physical address, the generated physical address is replaced with zero. Method. 前記、降順方向に減じて生成した物理アドレスが、負の値となったとき、該生成された物理アドレスを、前記物理アドレスの最大値に置き換えることを特徴とする請求項1記載のフラッシュメモリのアクセス方法。   2. The flash memory according to claim 1, wherein when the physical address generated by decreasing in the descending order becomes a negative value, the generated physical address is replaced with the maximum value of the physical address. how to access. 前記ブロックが格納する論理アドレスに関連づけられて格納されたデータの新旧の判断を、
前記フラッシュメモリの始動し、
前記フラッシュメモリが格納する情報を揮発性メモリで作成した管理テーブルに転送し、
前記管理テーブルの情報を揮発性メモリで作成された判定テーブルを用いて最新データを格納する物理アドレスを判断し、
前記判断結果を前記管理テーブルに新の表示を行うことを特徴とする請求項1乃至3のいずれかに記載のフラッシュメモリのアクセス方法。
New or old judgment of data stored in association with the logical address stored in the block,
Starting the flash memory;
Transfer the information stored in the flash memory to a management table created in volatile memory,
Determine the physical address for storing the latest data using the determination table created in the volatile memory for the information in the management table,
4. The flash memory access method according to claim 1, wherein the determination result is newly displayed in the management table.
前記管理テーブルに前記新の表示に応じて、
前記管理テーブル上の前記論理アドレスを保持する他の物理アドレスに旧の表示を行い、
前記フラッシュメモリの消去動作が、前記管理テーブル上に旧の値を書き込まれたブロックを全て選択し、
選択された全てのブロックを消去することを特徴とする請求項1乃至4のいずれかに記載のフラッシュメモリのアクセス方法。
According to the new display in the management table,
Perform the old display on the other physical address holding the logical address on the management table,
The erase operation of the flash memory selects all blocks in which old values are written on the management table,
5. The flash memory access method according to claim 1, wherein all the selected blocks are erased.
JP2004232153A 2004-08-09 2004-08-09 Flash memory access method Withdrawn JP2006048585A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004232153A JP2006048585A (en) 2004-08-09 2004-08-09 Flash memory access method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004232153A JP2006048585A (en) 2004-08-09 2004-08-09 Flash memory access method

Publications (1)

Publication Number Publication Date
JP2006048585A true JP2006048585A (en) 2006-02-16

Family

ID=36027033

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004232153A Withdrawn JP2006048585A (en) 2004-08-09 2004-08-09 Flash memory access method

Country Status (1)

Country Link
JP (1) JP2006048585A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008159013A (en) * 2006-11-28 2008-07-10 Hitachi Ltd Semiconductor memory device
US7685356B2 (en) 2006-05-30 2010-03-23 Tdk Corporation Chronological identification in flash memory using cyclic numbers
JP2010198592A (en) * 2009-01-29 2010-09-09 Nec Corp Mobile terminal apparatus, software update method, operation control method, and program
CN102880562A (en) * 2011-05-20 2013-01-16 株式会社东海理化电机制作所 Flash memory device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1091490A (en) * 1996-09-12 1998-04-10 Sanyo Electric Co Ltd Storage device using flash memory
JPH11272444A (en) * 1998-03-25 1999-10-08 Sony Corp Device and method for writing data in nonvolatile memory
JPH11511879A (en) * 1995-09-27 1999-10-12 メモリー・コーポレーシヨン・ピー・エル・シー Memory system
WO2003030180A1 (en) * 2001-09-28 2003-04-10 M-Systems Flash Disk Pioneers Ltd. Flash management system using only sequential write
JP2003208352A (en) * 2002-01-17 2003-07-25 Fujitsu Ltd Flash memory with limited number of writes and wear leveling

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11511879A (en) * 1995-09-27 1999-10-12 メモリー・コーポレーシヨン・ピー・エル・シー Memory system
JPH1091490A (en) * 1996-09-12 1998-04-10 Sanyo Electric Co Ltd Storage device using flash memory
JPH11272444A (en) * 1998-03-25 1999-10-08 Sony Corp Device and method for writing data in nonvolatile memory
WO2003030180A1 (en) * 2001-09-28 2003-04-10 M-Systems Flash Disk Pioneers Ltd. Flash management system using only sequential write
JP2003208352A (en) * 2002-01-17 2003-07-25 Fujitsu Ltd Flash memory with limited number of writes and wear leveling

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7685356B2 (en) 2006-05-30 2010-03-23 Tdk Corporation Chronological identification in flash memory using cyclic numbers
JP2008159013A (en) * 2006-11-28 2008-07-10 Hitachi Ltd Semiconductor memory device
JP2010198592A (en) * 2009-01-29 2010-09-09 Nec Corp Mobile terminal apparatus, software update method, operation control method, and program
CN102880562A (en) * 2011-05-20 2013-01-16 株式会社东海理化电机制作所 Flash memory device
US9021184B2 (en) 2011-05-20 2015-04-28 Kabushiki Kaisha Tokai Rika Denki Seisakusho Flash memory device
CN102880562B (en) * 2011-05-20 2015-08-05 株式会社东海理化电机制作所 Flash memory device

Similar Documents

Publication Publication Date Title
CN105701021B (en) Data storage device and data writing method thereof
CN103425588B (en) Block management method of data storage device and flash memory
US9645895B2 (en) Data storage device and flash memory control method
US9019770B2 (en) Data reading method, and control circuit, memory module and memory storage apparatus and memory module using the same
JP2008009919A (en) Card controller
CN103577342B (en) Method for managing data stored in flash memory and related memory device and controller
US20140082259A1 (en) Data storing method, memory controller and memory storage apparatus
KR101731408B1 (en) Method for writing data into flash memory and associated memory device and flash memory
CN107015886A (en) The method and operation for operating storage device include the method for its data handling system
US9563508B2 (en) Memory management method, memory control circuit unit and memory storage apparatus
US20140068383A1 (en) Method of storing system data, and memory controller and memory storage apparatus using the same
CN106598479A (en) Method and device for fail-safe erase of flash memory
US9009442B2 (en) Data writing method, memory controller and memory storage apparatus
JP2005190288A (en) Memory controller, flash memory system therewith, and method for controlling flash memory
US9383929B2 (en) Data storing method and memory controller and memory storage device using the same
CN106445401B (en) Table updating method, memory storage device, and memory control circuit unit
JP4158526B2 (en) Memory card and data writing method to memory
JP4153535B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
CN104102598B (en) Data reading method, control circuit, memory module and memory storage device
JP2006048585A (en) Flash memory access method
CN103984635A (en) Data writing method, memory controller and memory storage device
US9021184B2 (en) Flash memory device
US7500081B2 (en) Power-up implementation for block-alterable memory with zero-second erase time
US20090300272A1 (en) Method for increasing reliability of data accessing for a multi-level cell type non-volatile memory
CN103425586B (en) Storage unit management method, memory controller and memory storage device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070720

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20080731

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100921

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100928

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101119

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20101203