JP2011175428A - Storage device - Google Patents
Storage device Download PDFInfo
- Publication number
- JP2011175428A JP2011175428A JP2010038639A JP2010038639A JP2011175428A JP 2011175428 A JP2011175428 A JP 2011175428A JP 2010038639 A JP2010038639 A JP 2010038639A JP 2010038639 A JP2010038639 A JP 2010038639A JP 2011175428 A JP2011175428 A JP 2011175428A
- Authority
- JP
- Japan
- Prior art keywords
- user data
- written
- page
- block
- flag
- 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
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
本発明は、書き換え可能なメモリを有する記憶装置に関する。 The present invention relates to a storage device having a rewritable memory.
近年、電子機器の不揮発性メモリとしてフラッシュメモリが市場に流通している。このフラッシュメモリは、近年大容量化が著しく進み、例えば、携帯電話機等に用いられている(例えば、特許文献1を参照)。 In recent years, flash memories have been distributed on the market as nonvolatile memories of electronic devices. The flash memory has been remarkably increased in capacity in recent years, and is used in, for example, a cellular phone (see, for example, Patent Document 1).
ところで、フラッシュメモリは、ページという単位でデータの書き込み及び読み出しが行われ、また、複数のページから構成されるブロックという単位でデータの消去が行われる。ところで、フラッシュメモリは、物理的な不良等によって、一部のページが使用できなくなることがある。具体的には、フラッシュメモリは、ページの一部がビット化けを起こしてしまうと、正確なデータの読み出し及び書き込みができなくなる問題がある。 In the flash memory, data is written and read in units of pages, and data is erased in units of blocks composed of a plurality of pages. By the way, in the flash memory, some pages may become unusable due to a physical defect or the like. Specifically, the flash memory has a problem that accurate data reading and writing cannot be performed if a part of a page is garbled.
この問題に対して、例えば、ビット化けを起こしたページが生じた場合、当該ページを有するブロックのデータを予備ブロックへコピーして、コピー元のブロックをリセット消去する技術等が広く知られている。 To deal with this problem, for example, when a bit-garbled page is generated, a technique for copying the block data having the page to a spare block and resetting and erasing the copy source block is widely known. .
しかしながら、前述した技術では、ビット化けを起こしたページを有するブロックのデータは、全て予備ブロックへコピーされてしまい、予備ブロックを大量に消費してしまう問題がある。 However, the above-described technique has a problem in that all the data of the block having the page that is garbled is copied to the spare block and consumes a large amount of the spare block.
本発明では、メモリの負担軽減化を図ることができる記憶装置を提供することを一つの目的とする。 An object of the present invention is to provide a storage device that can reduce the burden on the memory.
本発明に係る記憶装置は、上記課題を解決するために、所定数のページからなるブロックを複数個有し、データの読み出し及び書き込みをページ単位で受け付け、データの消去をブロック単位で受け付ける不揮発性メモリと、前記不揮発性メモリに対して、データの読み出し、書き込み及び消去を行う制御部を備え、前記不揮発性メモリのブロックは、ユーザデータを記憶する複数のユーザデータ用ブロックと、当該ユーザデータ用ブロックを管理する複数の管理用ブロックによって構成され、前記制御部は、ユーザデータを前記ユーザデータ用ブロックに書き込みを開始する時、前記管理用ブロックの第1ページに前記ユーザデータに対応する第1フラグを書き込み、当該ユーザデータの書き込みが終了した場合に、前記第1ページとは異なる前記管理用ブロックの第2ページに当該ユーザデータに対応する第2フラグを書き込み、前記第1ページ及び前記第2ページにそれぞれ第1フラグと第2フラグが書き込まれている場合には、当該ユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていると判断して、当該ユーザデータが書き込まれているブロックに対して消去処理を行わず、前記第1ページには第1フラグが書き込まれているものの、前記第2ページには第2フラグが書き込まれていない場合には、当該ユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていないと推定する。 In order to solve the above-described problem, the storage device according to the present invention has a plurality of blocks each including a predetermined number of pages, accepts reading and writing of data in units of pages, and accepts erasing of data in units of blocks. A control unit for reading, writing, and erasing data from and to the nonvolatile memory, wherein the block of the nonvolatile memory includes a plurality of user data blocks for storing user data and the user data When the control unit starts writing user data to the user data block, a first page corresponding to the user data is displayed on the first page of the management block. When the flag is written and the writing of the user data is completed, it is different from the first page. When the second flag corresponding to the user data is written in the second page of the management block, and the first flag and the second flag are written in the first page and the second page, respectively, It is determined that the user data is normally written in the user data block, and the erase process is not performed on the block in which the user data is written, and the first flag is written in the first page. However, when the second flag is not written in the second page, it is estimated that the user data is not normally written in the user data block.
また、記憶装置では、前記第2ページは、前記第1ページの次のページであることが好ましい。 In the storage device, it is preferable that the second page is a page next to the first page.
また、記憶装置では、前記制御部は、所定の期間又は前記不揮発性メモリの各ブロックの使用頻度に基づいて、一のブロックに書き込まれているデータを他のブロックに移動する処理を行うことが好ましい。 In the storage device, the control unit may perform a process of moving data written in one block to another block based on a predetermined period or a use frequency of each block of the nonvolatile memory. preferable.
また、記憶装置では、前記第2ページには、データが書き込まれる前においては、予め規定値が書き込まれており、前記制御部は、前記第2ページの一部に前記第2フラグを書き込む場合、当該第2フラグが書き込まれる領域以外の領域に前記規定値以外の値を書き込み、前記第1ページには第1フラグが書き込まれているものの、前記第2ページには第2フラグが書き込まれていない場合には、当該第1フラグに対応するユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていないと推定した上で、前記第2ページの第2フラグが書き込まれる領域以外の所定領域に前記規定値が書き込まれているかどうかを判定し、前記所定領域に前記規定値が書き込まれていると判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていないと判断し、前記所定領域に前記規定値が書き込まれていないと判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていると判断し、当該ユーザデータが書き込まれているブロックに対して消去処理を行わないことが好ましい。 In the storage device, a predetermined value is written in advance in the second page before data is written, and the control unit writes the second flag in a part of the second page. A value other than the specified value is written in an area other than the area where the second flag is written, and the first flag is written in the first page, but the second flag is written in the second page. If not, it is estimated that the user data corresponding to the first flag is not normally written in the user data block, and then a predetermined area other than the area where the second flag of the second page is written. If the specified value is written in the predetermined area, and if it is determined that the specified value is written in the predetermined area, the user data corresponding to the first flag If it is determined that the normal value is not written, and it is determined that the specified value is not written in the predetermined area, it is determined that the user data corresponding to the first flag is normally written, It is preferable not to perform an erasing process on a block in which user data is written.
また、記憶装置では、前記制御部は、前記第2ページに前記規定値が書き込まれていると判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていないと判断し、その後、ユーザデータ用ブロックに対して所定回数前記ユーザデータの読み出しを行い、前記所定回数以内に前記ユーザデータを有意なデータとして読み出せた場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行わず、前記所定回数以内に前記ユーザデータを有意なデータとして読み出せない場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行うことが好ましい。 In the storage device, when the control unit determines that the specified value is written in the second page, the control unit determines that the user data corresponding to the first flag is not normally written. Then, when the user data is read out from the user data block a predetermined number of times and the user data can be read as significant data within the predetermined number of times, the user data is written to the block in which the user data is written. On the other hand, when the user data cannot be read as significant data within the predetermined number of times without performing the erase process, it is preferable to perform the erase process on the block in which the user data is written.
本発明によれば、メモリの負担軽減化を図ることができる。 According to the present invention, it is possible to reduce the memory load.
以下、本発明の実施の形態について説明する。図1は、本発明に係る記憶装置5を内蔵する携帯電話装置1の外観斜視図を示す。なお、図1は、いわゆる折り畳み型の携帯電話装置の形態を示しているが、本発明に係る携帯電話装置の形態としては特にこれに限られない。例えば、両筐体を重ね合わせた状態から一方の筐体を一方向にスライドさせるようにしたスライド式や、重ね合せ方向に沿う軸線を中心に一方の筐体を回転させるようにした回転式(ターンタイプ)や、操作部と表示部とが一つの筐体に配置され、連結部を有さない形式(ストレートタイプ)でも良い。 Embodiments of the present invention will be described below. FIG. 1 is an external perspective view of a mobile phone device 1 incorporating a storage device 5 according to the present invention. 1 shows a form of a so-called foldable mobile phone device, the form of the mobile phone device according to the present invention is not particularly limited to this. For example, a sliding type in which one casing is slid in one direction from a state in which both casings are overlapped, or a rotary type in which one casing is rotated around an axis along the overlapping direction ( Turn type), or a type (straight type) in which the operation unit and the display unit are arranged in one housing and does not have a connecting unit.
携帯電話装置1は、操作部側筐体部2と、表示部側筐体部3を備えて構成される。操作部側筐体部2は、表面部10に、操作部11と、携帯電話装置1の使用者が通話時に発した音声が入力されるマイク12を備えて構成される。操作部11は、各種設定や電話帳機能やメール機能等の各種機能を作動させるための機能設定操作キー13と、電話番号の数字やメール等の文字等を入力するための入力操作キー14と、各種操作における決定やスクロール等を行う決定操作キー15から構成されている。
また、表示部側筐体部3は、表面部20に、各種情報を表示するためのLCD(Liquid Crystal Display)表示部21と、通話の相手側の音声を出力するスピーカ22を備えて構成されている。
The mobile phone device 1 includes an operation
Further, the display unit
また、操作部側筐体部2の上端部と表示部側筐体部3の下端部とは、ヒンジ機構4を介して連結されている。また、携帯電話装置1は、ヒンジ機構4を介して連結された操作部側筐体部2と表示部側筐体部3とを相対的に回転することにより、操作部側筐体部2と表示部側筐体部3とを互いに開いた状態(開放状態)にしたり、操作部側筐体部2と表示部側筐体部3とを折り畳んだ状態(折畳み状態)にしたりできる。
Further, the upper end of the operation
また、図2は、携帯電話装置1の機能を示す機能ブロック図である。携帯電話装置1は、図2に示すように、操作部11と、マイク12と、メインアンテナ40と、RF回路部41と、LCD制御部42と、音声処理部43と、メモリドライバ44と、メモリ45と、制御部46が操作部側筐体部2に備えられ、LCD表示部21と、スピーカ22と、LCDドライバ23が表示部側筐体部3に備えられている。なお、以下では、メモリドライバ44と、メモリ45と、制御部46を包括して、記憶装置5という。
FIG. 2 is a functional block diagram showing functions of the mobile phone device 1. As shown in FIG. 2, the mobile phone device 1 includes an
メインアンテナ40は、第1の使用周波数帯(例えば、800MHz)で基地局等と通信を行い、GPS通信のための第2の使用周波数帯(例えば、1.5GHz)に対応できるデュアルバンド対応構成である。なお、本実施の形態では、第1の使用周波数帯として、800MHzとしたが、これ以外の周波数帯であっても良い。また、メインアンテナ40は、第1の使用周波数帯で外部装置と通信を行い、GPS通信のための第2の使用周波数帯に対応できるアンテナを別途設けても良い。
The
RF回路部41は、メインアンテナ40によって受信した信号を復調処理し、処理後の信号を制御部46に供給する。そして、制御部46から供給された信号を変調処理し、メインアンテナ40を介して外部装置(基地局)に送信する。また、その一方で、メインアンテナ40によって受信している信号の強度を制御部46に通知する。
The
LCD制御部42は、制御部46の制御にしたがって、所定の画像処理を行い、処理後の画像データをLCDドライバ23に出力する。LCDドライバ23は、LCD制御部42から供給された画像データをフレームメモリに蓄え、所定のタイミングでLCD表示部21又はサブLCD表示部30に出力する。
The
音声処理部43は、制御部46の制御にしたがって、RF回路部41から供給された信号に対して所定の音声処理を行い、処理後の信号をスピーカ22に出力する。スピーカ22は、音声処理部43から供給された信号を外部に出力する。
The
また、音声処理部43は、制御部46の制御にしたがって、マイク12から入力された信号を処理し、処理後の信号をRF回路部41に出力する。RF回路部41は、音声処理部43から供給された信号に所定の処理を行い、処理後の信号をメインアンテナ40に出力する。
In addition, the
メモリドライバ44は、メモリ45に対するアクセス(データの書き込み、読み出し及び消去)を行う。
メモリ45は、不揮発性メモリ(例えば、NAND型フラッシュメモリである。)により構成されている。メモリ45は、メモリドライバ44によってアクセスされ、画像データや文書データ等のユーザデータが格納される。
制御部46は、携帯電話装置1の全体を制御しており、中央処理装置(CPU)等を用いて構成される。
The
The
The
ここで、NAND型フラッシュメモリ(以下、NAND型という。)とNOR型フラッシュメモリ(以下、NOR型という。)の違いについて説明する。
NOR型とNAND型の共通点は、(1)データの書き込み時において、ビット「1」からビット「0」の書き換えのみが行われること、(2)データの消去時において、決められたブロック単位でしか消去ができないこと等である。
Here, a difference between a NAND flash memory (hereinafter referred to as a NAND type) and a NOR flash memory (hereinafter referred to as a NOR type) will be described.
The common points of the NOR type and the NAND type are (1) only rewriting from bit “1” to bit “0” is performed at the time of data writing, and (2) block unit determined at the time of erasing data. It can only be erased.
(1)については、フラッシュメモリは、データが書き込まれていない状態において、規定値としてビット「1」が書き込まれており、データを書き込むときに、ビット「1」を書き込む場合には、規定値を維持し、ビット「0」を書き込む場合には、ビット「1」をビット「0」に書き換える処理が行われる。 As for (1), the bit “1” is written as a specified value in the flash memory in a state where no data is written, and when writing the bit “1” when writing data, the specified value is used. Is maintained and bit “0” is written, a process of rewriting bit “1” to bit “0” is performed.
(2)については、フラッシュメモリの回路構成上、消去処理は、ブロック単位での可能になっている。なお、フラッシュメモリでは、データが消去されるということは、ビットが全て「1」(規定値)になるということを意味している。 Regarding (2), due to the circuit configuration of the flash memory, the erasing process can be performed in units of blocks. In the flash memory, erasing data means that all bits are “1” (specified value).
また、NAND型には、ページの概念があり、基本的にページ単位でデータの書き込みを行う。また、ページには、データを書き込む回数に制限(数千回乃至数十万回程度)がある。NAND型は、複数のページから構成されるブロックが複数個で構成されている。例えば、1ページは、2kバイトであり、1ブロックは、64ページ(128kバイト)で構成されている。 The NAND type has a concept of pages, and data is basically written in units of pages. Further, a page has a limit on the number of times data is written (several thousands to several hundred thousand times). The NAND type includes a plurality of blocks each including a plurality of pages. For example, one page is 2 kbytes, and one block is composed of 64 pages (128 kbytes).
また、NOR型は、データの書き込み中の電源断対策として、フラグを使用している。NOR型は、回路構成上ビット単位までデータの書き込みが可能であるので、例えば、データを書き込む際に、初期状態の所定のビット(管理エリア)を「0」から「1」に書き換え、データの書き込み終了時に、当該所定のビットを「1」から「0」に書き換える処理を行う。また、NOR型は、所定のビットの状態を確認し、所定のビットが「1」であれば、データの書き込み中に電源断が生じ、データが正常に書き込めなかったと判断を行っている。 Further, the NOR type uses a flag as a countermeasure against power interruption during data writing. In the NOR type, data can be written up to a bit unit because of the circuit configuration. For example, when data is written, a predetermined bit (management area) in an initial state is rewritten from “0” to “1”. At the end of writing, a process of rewriting the predetermined bit from “1” to “0” is performed. In the NOR type, the state of the predetermined bit is confirmed, and if the predetermined bit is “1”, it is determined that the data could not be normally written because the power was cut off during the data writing.
しかし、NAND型は、上述したように、ページ単位でデータの書き込みが可能であるため、単純に、NOR型の処理方法を採用すると、管理エリアがページ単位になってしまい、ユーザデータエリアが不足してしまうおそれがある。 However, since the NAND type can write data in units of pages as described above, simply adopting the NOR type processing method causes the management area to be in units of pages, and the user data area is insufficient. There is a risk of it.
また、NOR型は、管理エリアとユーザデータエリアが一対一に固定で対応している。したがって、NAND型は、例えば、管理エリアに書き込むフラグの数が物理的なブロックサイズの制限によりm個(mページ)までとすれば、ユーザデータの個数も制限されてしまうおそれがある。 In the NOR type, the management area and the user data area are fixed in one-to-one correspondence. Therefore, in the NAND type, for example, if the number of flags to be written in the management area is set to m (m pages) due to a physical block size limitation, the number of user data may be limited.
また、NAND型において、単純にNOR型の処理方法を採用してしまうと、データを書き込み始める時に管理エリアの所定のページに対して書き換えを行い、データの書き込みが終了した場合に、当該所定のページが属するブロック全体の消去処理を行うことになる。NAND型は、上述したように書き換え回数に制限があるため、データの書き込みの度にブロック全体の消去処理を行ってしまうと、寿命が短くなるおそれがある。 In addition, in the NAND type, if the NOR type processing method is simply adopted, when the data writing is completed after rewriting the predetermined page in the management area when the data writing is started, the predetermined processing is performed. The entire block to which the page belongs is erased. Since the NAND type has a limit on the number of rewrites as described above, the lifetime may be shortened if the entire block is erased each time data is written.
また、NAND型は、NOR型の処理方法のように、ユーザデータをユーザデータエリアから読み出す直前に管理エリアからフラグを読み出し、電源断により不正なデータの書き込みが発生しているか否かの処理を、ユーザデータにアクセスする度にチェックするのは処理速度的に不利となる。 In the NAND type, as in the NOR type processing method, the flag is read from the management area immediately before the user data is read from the user data area, and whether or not illegal data is written due to the power-off is determined. Checking every time user data is accessed is disadvantageous in terms of processing speed.
また、NAND型は、回路構成上、ビットエラーの起こりやすいデバイスであるため、一般的に、ECC(Error Check and Correct)コードが付加される。また、ECCは、1ビットエラーに対しては、対応可能(訂正可能)であるが、2ビット以上のエラーに対しては、対応不可能(訂正不可能)である。なお、ECCは、2ビット以上のエラーに対しては、エラーが生じていることは検出可能である。 In addition, the NAND type is a device in which a bit error is likely to occur due to the circuit configuration, and therefore an ECC (Error Check and Correct) code is generally added. The ECC can cope with (correctable) a 1-bit error, but cannot cope with (correctable) an error of 2 bits or more. The ECC can detect that an error has occurred for an error of 2 bits or more.
また、NAND型は、あるブロックのデータを読み出す際にECCを行って、2ビット以上のエラーの発生を検出した場合には、そのブロックを消去処理(規定値の書き込み処理)しない限り再使用が禁止となる。 In the NAND type, when data of a block is read out, ECC is performed and when an error of 2 bits or more is detected, the block can be reused unless the block is erased (specified value write processing). Prohibited.
また、NAND型は、一つのブロックが複数のページから構成されており、ユーザデータの書き込みは通常、ページと呼ばれる単位で行われるが、書き込み中に電源断が発生すると、その書き込み中のページ内のデータが不定値(FFh等の規定値ではなく、ランダムな値)になることが分かっている。ここで、電源断とは、バッテリーの残量が無くなったり、携帯電話装置1を落下させる等により、電源の供給が途絶え、処理の続行ができない状態を意味する。 In the NAND type, one block is composed of a plurality of pages, and writing of user data is normally performed in units called pages. However, if a power interruption occurs during writing, the user data is written in the page being written. It is known that the data of the above becomes an indefinite value (not a specified value such as FFh but a random value). Here, the power interruption means a state in which the supply of power is interrupted due to the remaining battery level or the mobile phone device 1 being dropped, and the processing cannot be continued.
また、制御部46は、不定値が書き込まれているページ(以下、不定ページという。)のデータを読み出すと、ECCにより2ビット以上のエラーを検出することになる。しかし、システム上、不定ページは、ディスカード(破棄)して使用しない、すなわち制御部46によってアクセスされないようにする必要がある。
Further, when the
ここで、一般的に発生する2ビットエラーと、電源断が起因して発生する不定ページによる2ビットエラーを区別する必要がある。前者の2ビットエラーは、ブロックの再使用が物理的に不可能な場合があるが、後者の2ビットエラーは、単なる書き込み時のエラーなので、ブロックの再使用が可能である。 Here, it is necessary to distinguish between a 2-bit error that generally occurs and a 2-bit error due to an indefinite page that occurs due to a power failure. In the former 2-bit error, there is a case where the block cannot be reused physically. However, since the latter 2-bit error is an error at the time of writing, the block can be reused.
記憶装置5は、メモリ45としてNAND型を採用し、メモリ45をFFS(フラッシュファイルシステム)でデータの読み出し及び書き込みを制御する際に信頼性を確保し、メモリ45に書き込まれているユーザデータが正常に書き込まれたものか否かの判断を、メモリ45の負担を最小限にして行う機能を有している。
The storage device 5 adopts a NAND type as the
以下に、上述した機能を発揮するための制御部46の動作について詳述する。
メモリ45は、所定数のページからなるブロックを複数個有し、データの読み出し及び書き込みをページ単位で受け付け、データの消去をブロック単位で受け付ける。メモリ45は、図3に示すように、ユーザデータエリアUAと、管理用エリアMAとから構成されている。ユーザデータエリアUAは、ユーザデータを記憶する複数のユーザデータ用ブロックUB1乃至UBnにより構成されている。管理用エリアMAは、ユーザデータ用ブロックUB1乃至nを管理する複数の管理用ブロックMB1乃至MBnによって構成されている。また、メモリ45は、固有のアドレスが付されている。
Hereinafter, the operation of the
The
また、上述したように、ブロックは、128kバイトのサイズとし、ページは、2kバイトのサイズとする。また、一つのブロックには、64個のページが含まれているものとする。また、ユーザデータエリアUAは、ユーザデータを格納するために使用する。管理用エリアMAは、ユーザデータの書き込み管理のために使用する。 As described above, the block has a size of 128 kbytes, and the page has a size of 2 kbytes. In addition, it is assumed that one block includes 64 pages. The user data area UA is used for storing user data. The management area MA is used for user data writing management.
なお、詳細は後述するが、ユーザデータエリアUA及び管理用エリアMAに属する各ブロックの物理的な位置は、固定である必要はなく、ガベージコレクション機能や、ウェアレベリング機能を利用することによって、各ブロックが適宜入れ替えられる構成であっても良い。 Although the details will be described later, the physical positions of the blocks belonging to the user data area UA and the management area MA do not need to be fixed, and by using the garbage collection function or the wear leveling function, The structure by which a block is replaced suitably may be sufficient.
制御部46は、メモリ45に対して、データの読み出し、書き込み及び消去を行う。
ここで、制御部46による具体的な処理方法について説明する。なお、ユーザデータを書き込む際には、所定の方法に基づいて所定のユーザデータ用ブロック内の所定のページが指定されるが、以下では、便宜的に、ユーザデータをユーザデータ用ブロックUB2に書き込むことを想定して説明する。
The
Here, a specific processing method by the
制御部46は、図3に示すように、ユーザデータをユーザデータ用ブロックUB2に書き込みを開始する時、管理用ブロックMB1の第1ページP1にユーザデータに対応する第1フラグ(書き込み中フラグ)F1を書き込む処理を行う。そして、制御部46は、ユーザデータの書き込みが終了した場合に、第1ページP1とは異なる第2ページP2にユーザデータに対応する第2フラグ(書き込み終了フラグ)F2を書き込む処理を行う。
As shown in FIG. 3, when the
また、制御部46は、第1ページP1に第1フラグF1を書き込む際に、ユーザデータを書き込むページ(所定のユーザデータ用ブロック内の所定のページ)のアドレス(書き込みアドレス)A1を書き込む。
Further, when writing the first flag F1 to the first page P1, the
制御部46は、第2ページP2に第2フラグF2を書き込む際に、ユーザデータを書き込んだページ(所定のユーザデータ用ブロック内の所定のページであって、複数ページに渡ってユーザデータが書き込まれている場合には、先頭のページ)のアドレス(書き込みアドレス)A1を書き込む。そして、詳細は後述するが、制御部46は、第2フラグF2及び書き込みアドレスA1を第2ページP2に書き込む場合、第2ページP2の残りの領域にユニーク値(例えば、55h)を書き込む。
When writing the second flag F2 to the second page P2, the
また、制御部46は、第1ページP1において、書き込みアドレスA1と第1フラグF1が書き込まれた以外のエリアについては、他のデータを書き込まずに全て規定値(FFh)のままにしておく。
In addition, in the first page P1, the
ここで、管理用エリアMAにアクセスした際に、ECCにより2ビットエラーを検出した場合においても、一般的に発生する2ビットエラーであるのか、又は、電源断が起因して発生する不定ページによる2ビットエラーであるのかを区別する必要がある。 Here, even when a 2-bit error is detected by ECC when the management area MA is accessed, it is a 2-bit error that generally occurs or due to an indefinite page that occurs due to a power failure. It is necessary to distinguish whether it is a 2-bit error.
そこで、制御部46は、図3に示すように、第2ページP2において、書き込みアドレスA1と第2フラグF2を書き込んだ以外のエリアについては、全て所定のユニーク値(例えば、55h)を書き込む処理を行う。
Therefore, as shown in FIG. 3, the
このような構成によれば、制御部46は、第2ページP2にアクセスし、ECCにより2ビットエラーを検出した場合には、第2ページP2に書き込まれている値を読み出し、読み出した値が所定のユニーク値と一致するか否かの処理を行う。
According to such a configuration, when the
制御部46は、読み出した値にユニーク値が含まれていない、又は含まれているが少ない場合(ユニーク値に不一致が多くデータが崩れている場合)には、ユニーク値の書き込み中に電源断が生じたと判断して、当該第2ページP2を不定ページであると判定し、また、一定数以上のユニーク値が含まれている場合には、一般的に発生する2ビットエラーであると判定する。
If the read value does not contain a unique value or contains a small number of unique values (if there are many mismatches in the unique value and the data is corrupted), the
制御部46は、第2ページP2が不定ページであると判定した場合には、ユーザデータを正常に書き込んだ後、第2ページP2に第2フラグF2を書き込んだ後のユニーク値の書き込みの最中に電源断が発生したと考え、第2ページP2が属するブロックに対して消去処理を行わない。
When the
また、制御部46は、第2ページP2に一般的な2ビットエラーが生じていると判断した場合には、その管理用ブロックのページを全て破棄(ディスカード)し、ガーベッジコレクション機能の利用によって、第2ページP2が属するブロックの消去処理を行う。
If the
また、一つのページが4つのセクタから構成されていると仮定した場合、制御部46は、各セクタに対してECCを行う。つまり、制御部46は、1ビットエラーの場合には訂正を行い、2ビットエラーの場合には、エラーの検出を行う。
When it is assumed that one page is composed of four sectors, the
また、制御部46は、目安として、ユニーク値(55h)のパターンが2ビット不一致になっているセクタが、2セクタ以上ある場合に、不定ページと判断する。これは、1セクタだけが2ビット不一致であれば、一般的な2ビットエラーが生じている可能性があるためである。
Further, as a guideline, the
このようにして、記憶装置5は、ユーザデータが正常にユーザデータ用ブロックに書き込んだ場合には、同一の書き込みアドレスAが書き込まれている第1ページP1と第2ページP2のペアを生成し、かつ、第2ページP2には、書き込みアドレスA1と、第2フラグF2と、所定のユニーク値を書き込む処理を行う。 In this way, when the user data is normally written in the user data block, the storage device 5 generates a pair of the first page P1 and the second page P2 in which the same write address A is written. In addition, a process of writing the write address A1, the second flag F2, and a predetermined unique value is performed on the second page P2.
また、制御部46は、電源の投入時において、管理用エリアMAにアクセスし、書き込みアドレスA1に基づいて、第1ページP1と第2ページP2のペアを検出し、第1ページP1及び第2ページP2にそれぞれ第1フラグF1と第2フラグF2が書き込まれている場合には、当該第1フラグF1に対応するユーザデータがユーザデータ用ブロックUB2に正常に書き込まれていると判断して、当該ユーザデータが書き込まれているユーザデータ用ブロックUB2に対して消去処理を行わない。
Further, when the power is turned on, the
また、制御部46は、電源の投入時において、管理用エリアMAにアクセスし、第1ページP1には第1フラグF1が書き込まれているものの、第2ページP2には第2フラグF2が書き込まれていない場合には、ユーザデータ用ブロックUB2にユーザデータを書き込み中に電源断が発生したと推定し、当該第1フラグF1に対応するユーザデータがユーザデータ用ブロックUB2に正常に書き込まれていないと推定する。
Further, the
なお、制御部46は、電源の投入時において、書き込みアドレスA1に基づいて、第1ページP1と第2ページP2のペアを検出し、第1ページP1には第1フラグF1が書き込まれているものの、第2ページP2にはユニーク値が書き込まれていないときでも、当該第1フラグF1に対応するユーザデータがユーザデータ用ブロックUB2に正常に書き込まれていると判断して、当該ユーザデータが書き込まれているユーザデータ用ブロックUB2に対して消去処理を行わない構成であっても良い。
When the power is turned on, the
第2ページP2に書き込みアドレスA1を書き込めたということは、ユーザデータは、正常に書き込めた状態であることを意味する。このような状態は、ユーザデータを正常に書き込み、第2ページP2に書き込みアドレスA1及び第2フラグF2を書き込んだ後のユニーク値を書き込んでいる最中に電源断が発生したものと考えられる。よって、第1フラグF1に対応するユーザデータは、ユーザデータ用ブロックUB2に正常に書き込まれていると判断される。 The fact that the write address A1 has been written to the second page P2 means that the user data has been written normally. In such a state, it is considered that the power interruption occurred while writing the user data normally and writing the unique value after writing the write address A1 and the second flag F2 to the second page P2. Therefore, it is determined that the user data corresponding to the first flag F1 is normally written in the user data block UB2.
このように構成されることによって、記憶装置5は、ユーザデータの書き込みを開始する時に、第1ページに書き込みアドレスと共に第1フラグを書き込み、ユーザデータの書き込みを終了した場合に、第2ページP2に書き込みアドレスと第2フラグを書き込むので、電源投入時に、管理用エリアMAにアクセスし、第1ページと第2ページのペアを検出し、第1フラグと第2フラグが書き込まれていることを確認した場合には、ユーザデータが正常に書き込まれていると判断でき、ユーザデータが書き込まれているユーザデータ用ブロックに対して消去処理を行わない。
したがって、記憶装置5は、メモリ45に書き込まれているユーザデータが正常に書き込まれたものか否かの判断を、メモリ45の負担を最小限にして行うことができる。
With this configuration, when starting to write user data, the storage device 5 writes the first flag together with the write address to the first page, and when the user data has been written, the second page P2 Since the write address and the second flag are written in, when the power is turned on, the management area MA is accessed, the pair of the first page and the second page is detected, and the first flag and the second flag are written. If it is confirmed, it can be determined that the user data has been normally written, and the erasure process is not performed on the user data block in which the user data is written.
Therefore, the storage device 5 can determine whether or not the user data written in the
なお、管理用ブロックMBの状態をチェックするのは、電源投入後の起動時の一回だけで良く、ユーザデータを読み出す度にチェックする必要はない。 The state of the management block MB is checked only once at the start-up after the power is turned on, and does not need to be checked every time user data is read.
また、記憶装置5は、電源断が発生したと判定されれば、その不定データが含まれているブロックを使用しないようにするために、ディスカード(破棄)処理を行っても良い。例えば、詳細は後述する、ガベージコレクション機能等の利用により、ディスカード処理したブロックの消去処理(規定値を書き込む処理)が行われ、当該ブロックの再利用が可能となる。 Further, if it is determined that a power interruption has occurred, the storage device 5 may perform a discarding (discarding) process so as not to use the block including the indefinite data. For example, by using a garbage collection function or the like, which will be described in detail later, an erase process (a process for writing a specified value) of a discarded block is performed, and the block can be reused.
また、管理用ブロックMBは、ユーザデータ用ブロックUBと一対一に対応させているわけではない。よって、記憶装置5では、ユーザデータ用ブロックUBとは独立に順次空いている下方のページに対してフラグ等の書き込みを行う。また、一度チェックされた第1フラグF1や第2フラグF2は、不要になるので、後述するガベージコレクション機能を利用することによって順次削除する。よって、記憶装置5では、管理用ブロックMBとしては見かけ上、サイズ制限はなく、全データ用ブロックのサイズにも制限はない。 Further, the management block MB does not correspond one-to-one with the user data block UB. Therefore, the storage device 5 writes a flag or the like to the lower pages that are sequentially vacant independently of the user data block UB. Further, the first flag F1 and the second flag F2 that have been checked once become unnecessary, and are sequentially deleted by using a garbage collection function described later. Therefore, in the storage device 5, the management block MB apparently has no size limitation, and there is no limitation on the size of all data blocks.
また、第2ページP2は、第1ページの次のページであることが好ましい。
このような構成によれば、制御部46は、第1ページと第2ページが連続しているので、管理用エリアMAにアクセスする際に、ペアとなるページを簡易に検索することが可能となる。
The second page P2 is preferably the next page after the first page.
According to such a configuration, since the first page and the second page are continuous, the
ここで、管理用ブロックMBにおいて、特定のブロックの使用頻度が高くなり、所定の使用回数に達すると、当該ブロックが使用不能になり、結果、メモリ45全体の容量が低減してしまう。
そこで、制御部46は、所定の期間又はメモリ45の各ブロックの使用頻度に基づいて、一のブロックに書き込まれているデータを他のブロックに移動する処理を行うことが好ましい。
Here, in the management block MB, the frequency of use of a specific block increases, and when the predetermined number of uses is reached, the block becomes unusable, and as a result, the capacity of the
Therefore, the
制御部46は、ガベージコレクション機能やウェアレベリング機能を有している。
ガベージコレクション機能とは、プログラムが使用しなくなったメモリ領域や、プログラム間の隙間のメモリ領域を集めて、連続した利用可能なメモリ領域を増やす機能である。ガベージコレクション機能によれば、有限の容量であるメモリ45を有効に活用することができる。
The
The garbage collection function is a function for collecting memory areas that are no longer used by a program or memory areas in the gaps between programs to increase a continuously usable memory area. According to the garbage collection function, the
また、ウェアレベリング機能とは、データの書き換えを行うブロック(ページ)を、特定のブロック(ページ)に集中させないようにできるだけ均等に分散させる機能である。ウェアレベリング機能によれば、特定のページに対する書き込みと消去の繰り返しを防ぐことができるので、メモリ45の寿命を延ばすことができる。
The wear leveling function is a function that distributes blocks (pages) for data rewriting as evenly as possible so as not to concentrate on specific blocks (pages). According to the wear leveling function, repeated writing and erasing on a specific page can be prevented, so that the life of the
制御部46は、所定の期間が経過したことを条件として、ガベージコレクション機能を利用して、一のブロックに書き込まれているデータを他のブロックに移動する処理を行う。また、制御部46は、メモリ45の各ブロックの使用頻度に基づいて、ウェアレベリング機能を利用して、一のブロックに書き込まれているデータを他のブロックに移動する処理を行っても良い。
The
このように構成されることによって、記憶装置5は、連続した利用可能なメモリ領域を増やすことができ、かつ、メモリ45の寿命を延ばすことができる。
With this configuration, the storage device 5 can increase the continuous usable memory area and can extend the life of the
また、上述したように、管理用ブロックMBにデータの書き込みを行っていくと、そのブロックに書き込む空きスペースがなくなってくる。ここで、メモリ45は、回路構成上、ブロック単位でしか消去が行えない。
したがって、制御部46は、ガベージコレクション機能やウェアレベリング機能を利用して、管理用のブロックに管理用データを書き込み、全てのページを使い切ると、別個に存在するスペア用のブロックに必要な管理用データをコピーし、管理用のブロックを消去処理する。したがって、制御部46は、スペア用のブロックを管理用ブロックとして使用し、当初管理用として使用していたブロックをスペア用として利用する。
Further, as described above, when data is written to the management block MB, there is no free space to be written to the block. Here, the
Therefore, the
また、管理用ブロックMBは、頻繁にページの書き込みが行われ、使用頻度が高いブロックである。よって、制御部46は、管理用ブロックMBをウェアレベリングの対象となるように制御する。
The management block MB is a block that is frequently used and frequently used. Therefore, the
また、管理用ブロックMBに書き込まれる管理データは、電源投入時にユーザデータが正常に書き込まれたか否かの判断に使用された後は、利用されないため、事実上無効データとなる。したがって、厳密にいえば、制御部46は、現在の管理用ブロックMBに書き込まれている管理データをスペア用のブロックへコピーする必要はない。よって、管理データをスペア用のブロックへコピーしない場合には、スペア用のブロックは、最初から全領域が空き状態の管理用ブロックとなる。
The management data written to the management block MB is effectively invalid data because it is not used after it is used to determine whether or not user data has been normally written when the power is turned on. Therefore, strictly speaking, the
また、管理用ブロックMBに対して過去に書込んだページデータは、二度とアクセスする必要のないデータである。制御部46は、システムがアイドル状態(携帯電話装置1が不使用状態)になったときに、破棄(ディスカード)する。その後、制御部46は、ガベージコレクション機能を利用することによって、新しい管理用ブロックMBが再生されることになる。
The page data written in the past to the management block MB is data that does not need to be accessed again. The
なお、システムがアイドル状態になることなく、連続的なユーザデータの書き込みが行われた場合、管理用ブロックMBに空き容量がなくなってしまうことがある。制御部46は、管理用データを書き込むためのページが無くなった場合、強制的にガベージコレクション機能を利用し、仮に破棄(ディスカード)されていなくてもページデータのコピーは行わないこととする。記憶装置5は、このように強制的にガベージコレクション機能を利用して、管理用データを書き込むための空きスペースを確保する機能も有している。
Note that if continuous writing of user data is performed without the system becoming idle, the management block MB may run out of free space. When there is no page for writing management data, the
また、記憶装置5は、管理用ブロックのみが書き込み頻度が高く、スペア用のブロックと入替えにガベージコレクション機能を利用することも想定される。そうすると、何度もデータの入替えを繰り返すブロックは、使用頻度が高くなってしまう。 Further, it is assumed that only the management block has a high writing frequency in the storage device 5, and that the garbage collection function is used to replace the spare block. If it does so, the block which repeats replacement of data many times will become frequently used.
そこで、記憶装置5は、各ブロックに対して、消去(イレーズ)回数を数えるイレーズカウンタを設ける。制御部46は、メモリ45の全ブロックに対してイレーズカウンタのカウント値を起動時にチェックしておき、カウント値の最大と最小の差がある一定値を超えたらウェアレベリング機能を実行するものとする。このように構成することにより、記憶装置5は、カウント値の小さい静的なブロックが次のスペア用ブロックとなり、メモリ45全体を均一に使用することができる。
Therefore, the storage device 5 is provided with an erase counter that counts the number of erases for each block. The
また、ガベージコレクション機能を利用した場合の模式図を図4に示す。図4では、ガベージコレクション機能を利用して、管理用ブロックMBが処理された場合を示している。メモリ45は、ガベージコレクション機能を利用した後は、図4に示すように、使用するブロック位置が相互に入れ替わるイメージとなる。
Moreover, the schematic diagram at the time of utilizing a garbage collection function is shown in FIG. FIG. 4 shows a case where the management block MB is processed using the garbage collection function. After the garbage collection function is used, the
また、ガベージコレクション機能を利用するには、データを移動するためのスペア用のブロック(スペアブロックSB)が必要になる。ここで、あるブロックを新規にスペアブロックSBにするためには、当該ブロックに対して消去の処理を行う必要がある。よって、制御部46は、あるブロックを新規にスペアブロックSBにする場合には、当該ブロックのビットを全て規定値(ビット「1」)にする。
In order to use the garbage collection function, a spare block (spare block SB) for moving data is required. Here, in order to make a block a new spare block SB, it is necessary to perform an erasing process on the block. Accordingly, when a block is newly set as a spare block SB, the
また、ガベージコレクション機能とウェアレベリング機能を利用した場合の模式図を図5に示す。
メモリ45のデータブロックB1は、書換え頻度の少ないデータが格納されているデータブロックであり、ブロック消去される回数も少なくなっている(以下、データブロックB1を静的データブロックB1という。)。制御部46は、ウェアレベリング機能を利用する際に、この静的データブロックB1に着目する。
FIG. 5 shows a schematic diagram when the garbage collection function and the wear leveling function are used.
The data block B1 of the
制御部46は、ウェアレベリング機能を利用して、静的データブロックB1とスペアブロックSBを入れ替える処理を行う(図5(a)、(b)を参照。)。なお、制御部46は、ガベージコレクション機能を利用して、当該入れ替え処理を行っても良い。
The
結果として、制御部46は、ウェアレベリング機能を発揮する前にスペアブロックSBとして存在していた使用頻度の高いブロックを、ウェアレベリング機能又はガベージコレクション機能を利用することによって、静的データを格納するブロックにし、使用頻度の低いブロックにすることができる。
As a result, the
次に、制御部46は、ウェアレベリング機能又はガベージコレクション機能を利用して、管理用ブロックMBとスペアブロックSBを入れ替える処理を行う(図5(b)、(c)を参照。)。
Next, the
このようにして、メモリ45では、管理用ブロックMBとなったブロック位置は、当初、ウェアレベリング機能を利用する前に静的データが格納されていたブロックであり、今まで使用頻度が少なかったブロックが管理用ブロックに変更することができる。よって、記憶装置5は、メモリ45全体を均等に使用することになり、寿命を延ばすことができる。
In this way, in the
また、メモリ45のブロックには、上述したように、何もデータが書き込まれていない場合には、予め規定値(例えば、ビット「1」)が書き込まれている。
制御部46は、第2ページの一部に第2フラグを書き込む場合、当該第2フラグが書き込まれる領域以外の領域に規定値以外の値を書き込み、第1ページには第1フラグが書き込まれているものの、第2ページには第2フラグが書き込まれていない場合には、当該第1フラグに対応するユーザデータがユーザデータ用ブロックUBに正常に書き込まれていないと推定した上で、第2ページの第2フラグが書き込まれる領域以外の所定領域に規定値(例えば、FFh)が書き込まれているかどうかを判定する構成であっても良い。
Further, as described above, when no data is written in the block of the
When writing the second flag to a part of the second page, the
このような構成の場合には、制御部46は、第2ページの所定領域に規定値が書き込まれていると判定した場合には、第1フラグに対応するユーザデータが正常に書き込まれていないと判断する。これは、第1ページに第1フラグが書き込まれているが、第2ページが規定値のままであるので、ユーザデータを書き込んでいる最中に電源断が発生し、ユーザデータがユーザデータ用ブロックに対して正常に書き込めなかったものと判断できるからである。
In such a configuration, when the
また、制御部46は、第2ページの所定領域に規定値が書き込まれていないと判定した場合には、第1フラグに対応するユーザデータが正常に書き込まれていると判断し、当該ユーザデータが書き込まれているブロックに対して消去処理を行わない。これは、第2ページに第2フラグも書き込まれておらず、かつ規定値にもなっていなければ、第2ページにユニーク値を書き込んでいる最中に電源断が生じたものと考えられる。したがって、このような場合には、ユーザデータは、ユーザデータ用ブロックに対して正常に書き込めたものと判断することができる。
If the
このように構成されることによって、記憶装置5は、電源投入時に、管理用エリアMAにアクセスし、第1ページに第1フラグが書き込まれていることを確認し、第2ページには第2フラグが書き込まれておらず、かつ規定値にもなっていないことを確認した場合には、ユーザデータが正常に書き込まれていると判断し、ユーザデータが書き込まれているユーザデータ用ブロックに対して消去処理を行わない。
したがって、記憶装置5は、メモリ45に書き込まれているユーザデータが正常に書き込まれたものか否かの判断を、メモリ45の負担を最小限にして行うことができる。
With this configuration, when the power is turned on, the storage device 5 accesses the management area MA, confirms that the first flag is written on the first page, and stores the second flag on the second page. If it is confirmed that the flag has not been written and has not reached the specified value, it is determined that the user data has been written normally, and the user data block to which the user data has been written is determined. Do not erase.
Therefore, the storage device 5 can determine whether or not the user data written in the
また、制御部46は、第2ページに規定値が書き込まれていると判定した場合には、第1フラグF1に対応するユーザデータが正常に書き込まれていないと判断し、その後、ユーザデータ用ブロックUBに対して所定回数ユーザデータの読み出しを行う構成であっても良い。
Further, when it is determined that the specified value is written in the second page, the
このような構成の場合には、制御部46は、所定回数以内にユーザデータを有意なデータとして読み出せた場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行わない。
また、制御部46は、所定回数以内にユーザデータを有意なデータとして読み出せない場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行う。
In the case of such a configuration, when the user data can be read as significant data within a predetermined number of times, the
In addition, when the user data cannot be read as significant data within a predetermined number of times, the
ここで、第1ページには第1フラグが書き込まれているが、第2ページが規定値のままであるということは、ユーザデータをユーザデータ用ブロックUBに書き込んでいる最中に電源断が発生したものと考えられるが、理論的には、ユーザデータをユーザデータ用ブロックUBに書き終わった直後に電源断が発生したことも考えられる。 Here, the first flag is written in the first page, but the second page remains at the specified value. This means that the power is cut off while the user data is being written to the user data block UB. Although it is thought that it occurred, theoretically, it is conceivable that the power interruption occurred immediately after the user data was written in the user data block UB.
そこで、制御部46は、ユーザデータに対して所定回数アクセスを行い、有意なデータとして読み出せた場合には、ユーザデータを書き終わった後に電源断が生じたものと判断し、ユーザデータが書き込まれているブロックに対して消去処理を行わない。
また、制御部46は、ユーザデータに対して所定回数アクセスを行い、有意なデータとして読み出せなかった場合には、ユーザデータをユーザデータ用ブロックUBに書きこんでいる最中に電源断が発生したものと判断し(つまり、ユーザデータは壊れていると判断し)、ユーザデータが書き込まれているブロックに対して消去処理を行う。
Therefore, if the
In addition, the
したがって、記憶装置5は、メモリ45に書き込まれているユーザデータが正常に書き込まれたものか否かの判断を、メモリ45の負担を最小限にして行うことができ、正常にユーザデータの書き込みが行えなかった場合のみ、ユーザデータ用ブロックUBに対して消去処理を実行するので、メモリ45の負担を最小限にして消去処理を行うことができる。
Therefore, the storage device 5 can determine whether or not the user data written in the
ここで、データの書き込み処理について、図6に示すフローチャートを参照して説明する。
ステップST1において、制御部46は、管理用ブロックMBの所定のページに書き込みアドレスA1と第1フラグ(書き込み中フラグ)F1の書き込みを行う。
ステップST2において、制御部46は、ユーザデータ用ブロックUBのページにユーザデータの書き込みを行う。
Here, the data writing process will be described with reference to the flowchart shown in FIG.
In step ST1, the
In step ST2, the
ステップST3において、制御部46は、ステップST2の工程によるユーザデータの書き込みを終了した場合には、ステップST1の工程により第1フラグF1を書き込んだページ(第1ページP1)の次のページ(第2ページP2)に書き込みアドレスA1と第2フラグ(書き込み終了フラグ)F2の書き込みを行う。そして、制御部46は、書き込みアドレスA1と第2フラグF2の第2ページへの書き込みと同時に、第2ページP2の残りの領域にユニーク値を書き込む。
In step ST3, when the writing of the user data in step ST2 is completed, the
また、ページのデータを読み出す処理について、図7に示すフローチャートを参照して説明する。
ステップST11において、制御部46は、ユーザデータが正常にユーザデータ用ブロックUBに書き込みの確認ができたことを条件に、指定されたユーザデータをユーザデータ用ブロックUBから読み出す。
Further, the process of reading page data will be described with reference to the flowchart shown in FIG.
In step ST11, the
制御部46は、具体的には、ユーザデータと当該ユーザデータが書き込まれている場所を示すアドレスが関連付けられているテーブルを参照することにより、指定されたユーザデータを所定のユーザデータ用ブロックの所定のページから読み出す処理を行う。
Specifically, the
このようにして、制御部46は、ユーザデータが正常にユーザデータ用ブロックUBに書き込みの確認ができたことを条件に、管理用ブロックMBを意識することなくデータ用ブロックから指定のページデータを読み出すことができる。
In this way, the
また、ページの破棄(ディスカード)処理について、図8に示すフローチャートを参照して説明する。また、上述したように、第2ページP2は、正常に書き込み処理が終了した場合には、書き込みアドレスA1と第2フラグF2(書込み終了フラグ)が書き込まれ、他のエリアには、ユニーク値(55h)が書き込まれている。なお、以下では、第2ページP2の確認と、ディスカード処理に焦点を絞って説明する。 The page discarding (discarding) process will be described with reference to the flowchart shown in FIG. As described above, the second page P2 is written with the write address A1 and the second flag F2 (write end flag) when the write process is normally completed, and a unique value ( 55h) is written. Note that the following description focuses on the confirmation of the second page P2 and the discard process.
ステップST21において、制御部46は、第2ページP2にアクセスし、ECCにより2ビットエラーが生じているか否かを判断する。2ビットエラーが生じていない場合(No)には、ステップST22に進む。また、2ビットエラーが生じている場合(Yes)には、ステップST23へ進む。
In step ST21, the
ステップST22において、制御部46は、通常処理を行う。具体的には、制御部46は、書き込みアドレスA1と第2フラグF2の有無の確認を行う。
In step ST22, the
ステップST23において、制御部46は、第2ページP2の他のエリアをチェックし、ユニーク値と一致するか否かの比較処理を行う。
In step ST23, the
ステップST24において、制御部46は、ステップST23の工程による比較処理の結果から不定ページか否かの判断を行う。制御部46は、ユニーク値に不一致が多く、データが崩れている場合には、不定ページであると判断し、不定ページではない場合には、一般的に発生する2ビットエラーであると判断する。不定ページであると判断した場合(Yes)には、ステップST25に進み、不定ページではないと判断した場合(No)には、ステップST26に進む。
In step ST24, the
ステップST25において、制御部46は、第2ページP2が不定ページであると判断した場合には、ユーザデータを正常に書き込み、その後、第2ページP2に第2フラグF2を書き込んでいる最中に電源断が発生したと考えられるので、管理用ブロックMBに対して消去処理を行わない。
In step ST25, when the
ステップST26において、制御部46は、第2ページP2が不定ページではないと判断した場合には、第2ページP2に一般的な2ビットエラーが生じていると考えられるので、管理用ブロックMBを全て破棄(ディスカード)し、ガーベッジコレクション機能の利用によって、管理用ブロックMBに対して消去処理を行う。
In step ST26, when the
このようにして、記憶装置5は、第2ページP2がECCにより2ビットエラーが生じていると判断した場合、不定ページであるか否かを判断し、不定ページの場合には、消去処理を行わず、不定ページの場合には、消去処理を行うので、不必要な消去処理が発生せず、ECCによる2ビットエラーに対して、メモリ45の負担を最小限にして対応することができる。
In this way, the storage device 5 determines whether or not the second page P2 is an indefinite page when it determines that a 2-bit error has occurred due to the ECC. In the case of an indefinite page, an erasure process is performed. Therefore, an unnecessary erasure process does not occur, and a 2-bit error caused by ECC can be dealt with with a minimum load on the
つぎに、電源投入後の処理について、図9に示すフローチャートを参照して説明する。ここで、電投入後の処理とは、記憶装置5を通常に起動したときの電源オン後の処理、及び電源断に再起動したときの電源オン後の処理のことである。 Next, processing after power-on will be described with reference to a flowchart shown in FIG. Here, the processing after power-on is processing after power-on when the storage device 5 is normally activated, and processing after power-on when the storage device 5 is restarted due to power-off.
ステップST31において、制御部46は、管理用ブロックMBをチェックし、第1ページP1のペアである第2ページP2が第2フラグF2(書込み終了フラグ)を含むページで終わっている否かを確認する。第2フラグF2が書き込まれている場合(Yes)には、ユーザデータが正常にユーザデータ用ブロックUBに書き込まれていると考えられるので、処理を終了する。また、第2フラグF2が書き込まれていない場合(No)には、ステップST32に進む。なお、ステップST31の工程では、第2ページP2には、第2フラグF2が書き込まれていないのか、又は、2ビットエラーにより第2フラグF2が書き込まれていないのかの判断ができない。後者であれば、ユーザデータは、正常にユーザデータ用ブロックUBに書き込まれていると考えられる。
In step ST31, the
ステップST32において、制御部46は、第2ページP2が全て規定値(FFh)か否かを確認する。全て規定値の場合(Yes)には、ステップST33に進み、全て規定値ではない場合(No)には、ステップST34に進む。なお、第2ページが全て規定値ではないということは、第2ページP2への書き込み処理があったと考えられ、ユーザデータは、正常にユーザデータ用ブロックUBに書き込まれていると考えられる。
In step ST32, the
ステップST33において、制御部46は、第2ページP2が全て規定値であるので、ユーザデータを一のユーザデータ用ブロックUBに書き込み中に電源断が発生したと考えられ、不定値となっている当該一のユーザデータ用ブロックUBに対してディスカード処理を行って、処理を終了する。ここで、ディスカード処理されたブロックは、再使用されても良いし、再使用を禁止にしても良い。
In step ST33, since all of the second page P2 are specified values, the
ステップST34において、制御部46は、第2ページP2のユニーク値が多数化けているか否かを確認する。ユニーク値が多数化けている、すなわちユニーク値が一定数以上含まれていない場合(Yes)には、第2ページP2に第2フラグF2等を書き込んでいる最中に電源断が発生したものと考えられ、消去処理を行わず、処理を終了する。また、ユニーク値が多数化けていない、すなわちユニーク値が一定数以上含まれている場合(No)には、ステップST35に進む。
In step ST34, the
ステップST35において、制御部46は、第2ページP2に一般的な2ビットエラーが生じていると考えられ、管理用ブロックの全ページを破棄(ディスカード)する。この管理用ブロックを再使用する場合には、制御部46は、ガーベッジコレクション機能の利用によって、ブロックの消去処理を行い、処理を終了する。
In step ST35, the
また、エラーページが属するブロックに対して消去処理を行うか否かについて、図10に一覧を示す。
制御部46は、読み出したページが電源断が起因してエラーページであった場合には、読み出したページをディスカードし、ブロックを消去しない。
In addition, FIG. 10 shows a list of whether or not the erasure process is performed on the block to which the error page belongs.
When the read page is an error page due to power failure, the
また、制御部46は、読み出したページがメモリ45の不良が起因してエラーページであった場合には、所定回数(例えば、10回)読み出しをリトライして、所定回数以内に読み出しに成功した場合には、正常なページとして取り扱い、ブロックの消去を行わない。
Further, when the read page is an error page due to a defect in the
また、制御部46は、読み出したページがメモリ45の不良が起因してエラーページであった場合には、所定回数(例えば、10回)読み出しをリトライして、全てエラーであった場合には、エラーページが属するブロックに対して、エラーを起こしたページを除いて予備ブロックへコピーし、当該ブロックを消去する。又は、制御部46は、当該ブロックを2度と使用しないようにしても良い(バッドブロック化)。
In addition, when the read page is an error page due to a defect in the
このようにして、記憶装置5は、NAND型のメモリ45に対しても最小限の負担によって、電源断対策が可能となる。また、記憶装置5は、データの書き込み途中の不正なページデータを認識し、問題が発生しないようにできる。また、記憶装置5は、ユーザデータの書き込み途中で電源断が生じたかどうかの判断ができるだけでなく、管理用のページデータの書き込み途中で電源断が生じたかどうかの判定も行うことができる。また、記憶装置5は、使用頻度の高い管理用ブロックをメモリ45の任意のブロック位置にすることができ、メモリ45の寿命を延ばすことができる。
In this way, the storage device 5 can take measures against power interruption with a minimum burden on the
また、管理用ブロックMBは、一つのブロックとして割り当てるが、ユーザデータ用ブロックUBと重複しないようにする必要がある。よって、記憶装置5は、論理アドレスの小さい位置にユーザデータ用ブロックUBを割り当て、論理アドレスが大きい位置に管理用ブロックMBを割り当てる。なお、ブロックサイズのバウンダリに合わせる必要があるので、論理アドレスの割り当ての際に、この点に留意する必要がある。 The management block MB is allocated as one block, but it is necessary not to overlap with the user data block UB. Therefore, the storage device 5 assigns the user data block UB to the position where the logical address is small, and assigns the management block MB to the position where the logical address is large. Since it is necessary to match the boundary of the block size, it is necessary to pay attention to this point when assigning logical addresses.
1 携帯電話装置
5 記憶装置
44 メモリドライバ
45 メモリ
46 制御部
UA ユーザデータエリア
MA 管理用エリア
UB ユーザデータ用ブロック
MB 管理用ブロック
1 Mobile phone device 5
Claims (5)
前記不揮発性メモリに対して、データの読み出し、書き込み及び消去を行う制御部を備え、
前記不揮発性メモリのブロックは、ユーザデータを記憶する複数のユーザデータ用ブロックと、当該ユーザデータ用ブロックを管理する複数の管理用ブロックによって構成され、
前記制御部は、ユーザデータを前記ユーザデータ用ブロックに書き込みを開始する時、前記管理用ブロックの第1ページに前記ユーザデータに対応する第1フラグを書き込み、当該ユーザデータの書き込みが終了した場合に、前記第1ページとは異なる前記管理用ブロックの第2ページに当該ユーザデータに対応する第2フラグを書き込み、
前記第1ページ及び前記第2ページにそれぞれ第1フラグと第2フラグが書き込まれている場合には、当該ユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていると判断して、当該ユーザデータが書き込まれているブロックに対して消去処理を行わず、
前記第1ページには第1フラグが書き込まれているものの、前記第2ページには第2フラグが書き込まれていない場合には、当該ユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていないと推定する記憶装置。 A non-volatile memory having a plurality of blocks each having a predetermined number of pages, accepting reading and writing of data in units of pages, and accepting erasing of data in units of blocks;
A control unit that reads, writes, and erases data with respect to the nonvolatile memory,
The non-volatile memory block includes a plurality of user data blocks for storing user data and a plurality of management blocks for managing the user data blocks.
When the controller starts writing user data to the user data block, the controller writes a first flag corresponding to the user data to the first page of the management block, and the writing of the user data is completed. And writing a second flag corresponding to the user data on a second page of the management block different from the first page,
When the first flag and the second flag are respectively written in the first page and the second page, it is determined that the user data is normally written in the user data block, and the user Do not erase the block where data is written,
When the first flag is written in the first page, but the second flag is not written in the second page, the user data is not normally written in the user data block. Storage device that estimates.
前記第2ページは、前記第1ページの次のページである記憶装置。 The storage device according to claim 1,
The storage device, wherein the second page is the next page of the first page.
前記制御部は、所定の期間又は前記不揮発性メモリの各ブロックの使用頻度に基づいて、一のブロックに書き込まれているデータを他のブロックに移動する処理を行う記憶装置。 The storage device according to claim 1,
The said control part is a memory | storage device which performs the process which moves the data currently written in one block to another block based on the predetermined period or the usage frequency of each block of the said non-volatile memory.
前記第2ページには、データが書き込まれる前においては、予め規定値が書き込まれており、
前記制御部は、前記第2ページの一部に前記第2フラグを書き込む場合、当該第2フラグが書き込まれる領域以外の領域に前記規定値以外の値を書き込み、前記第1ページには第1フラグが書き込まれているものの、前記第2ページには第2フラグが書き込まれていない場合には、当該第1フラグに対応するユーザデータが前記ユーザデータ用ブロックに正常に書き込まれていないと推定した上で、前記第2ページの第2フラグが書き込まれる領域以外の所定領域に前記規定値が書き込まれているかどうかを判定し、
前記所定領域に前記規定値が書き込まれていると判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていないと判断し、
前記所定領域に前記規定値が書き込まれていないと判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていると判断し、当該ユーザデータが書き込まれているブロックに対して消去処理を行わない記憶装置。 The storage device according to claim 1,
Before the data is written to the second page, a specified value is written in advance.
When the control unit writes the second flag in a part of the second page, the control unit writes a value other than the specified value in an area other than the area in which the second flag is written, If the flag is written but the second flag is not written in the second page, it is estimated that the user data corresponding to the first flag is not normally written in the user data block. And determining whether the specified value is written in a predetermined area other than the area where the second flag of the second page is written;
If it is determined that the specified value is written in the predetermined area, it is determined that the user data corresponding to the first flag is not normally written;
When it is determined that the specified value is not written in the predetermined area, it is determined that the user data corresponding to the first flag is normally written, and the block in which the user data is written is determined. A storage device that does not perform erasure processing.
前記制御部は、前記第2ページに前記規定値が書き込まれていると判定した場合には、前記第1フラグに対応するユーザデータが正常に書き込まれていないと判断し、その後、ユーザデータ用ブロックに対して所定回数前記ユーザデータの読み出しを行い、
前記所定回数以内に前記ユーザデータを有意なデータとして読み出せた場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行わず、
前記所定回数以内に前記ユーザデータを有意なデータとして読み出せない場合には、当該ユーザデータが書き込まれているブロックに対して消去処理を行う記憶装置。 The storage device according to claim 4,
When it is determined that the specified value is written in the second page, the control unit determines that the user data corresponding to the first flag is not normally written, and thereafter, for the user data Read the user data a predetermined number of times to the block,
If the user data can be read as significant data within the predetermined number of times, the erasure process is not performed on the block in which the user data is written,
A storage device that performs an erasure process on a block in which the user data is written when the user data cannot be read as significant data within the predetermined number of times.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010038639A JP2011175428A (en) | 2010-02-24 | 2010-02-24 | Storage device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010038639A JP2011175428A (en) | 2010-02-24 | 2010-02-24 | Storage device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011175428A true JP2011175428A (en) | 2011-09-08 |
Family
ID=44688234
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010038639A Pending JP2011175428A (en) | 2010-02-24 | 2010-02-24 | Storage device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2011175428A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016038778A (en) * | 2014-08-08 | 2016-03-22 | 株式会社デンソー | Storage medium management apparatus |
-
2010
- 2010-02-24 JP JP2010038639A patent/JP2011175428A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016038778A (en) * | 2014-08-08 | 2016-03-22 | 株式会社デンソー | Storage medium management apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10552311B2 (en) | Recovery for non-volatile memory after power loss | |
JP5819610B2 (en) | Method and apparatus for writing data to different storage devices | |
JP4722839B2 (en) | MEMORY CONTROL CIRCUIT, NONVOLATILE MEMORY DEVICE, AND MEMORY CONTROL METHOD | |
EP2162822B1 (en) | Emerging bad block detection | |
JP4560408B2 (en) | Method for controlling nonvolatile memory device | |
CN101026848B (en) | Mobile terminal and software update method | |
US20120198137A1 (en) | Logical-to-Physical Address Translation for a Removable Data Storage Device | |
US20120324299A1 (en) | Flash storage wear leveling device and method | |
US8402204B2 (en) | Methods for measuring usable lifespan and replacing an in-system programming code of a memory device, and data storage system using the same | |
JP2014241158A (en) | Improvement of lifetime of plurality of blocks of memory | |
JP2011503741A5 (en) | ||
JP2011503768A5 (en) | ||
KR20080037283A (en) | System comprising flash memory device and data recovery method thereof | |
US8775758B2 (en) | Memory device and method for performing a write-abort-safe firmware update | |
TWI633428B (en) | Data storage device and methods for processing data in the data storage device | |
JP2008040701A (en) | Memory management method and portable terminal equipment | |
JP2000222292A (en) | Data managing method utilizing flash memory | |
JP2007241618A (en) | Nonvolatile storage device and its write determination method | |
JP4158526B2 (en) | Memory card and data writing method to memory | |
JP4586469B2 (en) | MEMORY CONTROL DEVICE, MEMORY CONTROL METHOD, PROGRAM | |
JP2011059907A (en) | Terminal device, method of managing nonvolatile memory used therein, and program therefor | |
US9443604B2 (en) | Electronic device and data-management method thereof | |
JP2011175428A (en) | Storage device | |
JP2009134672A (en) | Memory management method and portable terminal equipment | |
JP2006126919A (en) | Data management device for flash memory and control method of flash memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20120803 |