JP3755626B2 - Method for writing data in nonvolatile storage medium - Google Patents

Method for writing data in nonvolatile storage medium Download PDF

Info

Publication number
JP3755626B2
JP3755626B2 JP19706297A JP19706297A JP3755626B2 JP 3755626 B2 JP3755626 B2 JP 3755626B2 JP 19706297 A JP19706297 A JP 19706297A JP 19706297 A JP19706297 A JP 19706297A JP 3755626 B2 JP3755626 B2 JP 3755626B2
Authority
JP
Japan
Prior art keywords
data
state
storage area
storage
written
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.)
Expired - Fee Related
Application number
JP19706297A
Other languages
Japanese (ja)
Other versions
JPH1139889A (en
Inventor
達也 福田
隆哉 小堀
健司 新井
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Holdings 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 Fuji Electric Holdings Ltd filed Critical Fuji Electric Holdings Ltd
Priority to JP19706297A priority Critical patent/JP3755626B2/en
Publication of JPH1139889A publication Critical patent/JPH1139889A/en
Application granted granted Critical
Publication of JP3755626B2 publication Critical patent/JP3755626B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術の分野】
本発明は、不揮発性記憶媒体にデータを書き込む不揮発性記憶媒体のデータ書込方法に係り、特に、書き込み動作中に異常が発生したときに、データを好適に保護することのできる不揮発性記憶媒体のデータ書込方法に関する。
【0002】
【従来の技術】
従来、フラッシュROMなどの不揮発性記憶媒体にデータを書き込む方法としては、所定データ量の記憶領域に記憶されているデータを一括して消去してから、その記憶領域に1バイトづつデータを書き込むようにしていた。
【0003】
【発明が解決しようとする課題】
しかしながら、従来、不揮発性記憶媒体にデータを書き込む方法にあっては、書き込み動作中に電源遮断などの異常が発生すると、書き込む前に記憶されていたデータはもとより、書き込んだデータまでもが失われる可能性があった。データの書き込みは、比較的大きなデータ量の記憶領域に渡って行われるため、書き込む前に記憶されていたデータや書き込んだデータが失われると、その損害も著しいものであった。
【0004】
そこで、本発明は、このような従来の問題を解決することを課題としており、書き込み動作中に異常が発生しても、データを好適に保護することのできる不揮発性記憶媒体のデータ書込方法を提供することを目的としている。
【0008】
【課題を解決するための手段】
上記目的を達成するために、本発明に係る請求項記載の不揮発性記憶媒体のデータ書込方法は、電気的にデータを読み出しおよび書き込み可能で、かつデータを独立に消去可能な2つの記憶領域を有する不揮発性記憶媒体に、データを書き込む不揮発性記憶媒体のデータ書込方法において、データを記憶するデータ記憶領域と、前記記憶領域の状態を識別するための状態データを記憶する状態データ記憶領域と、を前記記憶領域ごとに定め、前記一方の記憶領域に最新データが書き込まれており、前記他方の記憶領域に更新データを書き込もうとするときには、まず、前記他方の記憶領域のデータの消去および前記他方の記憶領域の前記状態データ記憶領域を第1の状態とする処理を実行し、次いで、前記一方の記憶領域の前記状態データ記憶領域を第2の状態とする処理を実行し、次いで、前記他方の記憶領域の前記データ記憶領域への前記更新データの書き込みを実行し、そして、前記他方の記憶領域の前記状態データ記憶領域を第3の状態とする処理を実行し、書き込み動作中に異常が発生したときには、前記各状態データ記憶領域に記憶されている前記状態データに基づいて、いずれか一方の前記記憶領域に記憶されているデータを最新データであると判定する。
【0009】
このような構成であれば、一方の記憶領域に最新データが書き込まれており、他方の記憶領域に更新データを書き込もうとするときには、まず、他方の記憶領域のデータの消去および他方の記憶領域の状態データ記憶領域を第1の状態とする処理が実行され、次いで、一方の記憶領域の状態データ記憶領域を第2の状態とする処理が実行され、次いで、他方の記憶領域への更新データの書き込みが実行され、そして、他方の記憶領域の状態データ記憶領域を第3の状態とする処理が実行される。この場合に、他方の記憶領域の状態データ記憶領域を第1の状態とする処理としては、他方の記憶領域のデータを消去したときの初期化データを第1の状態であることを示す状態データとして設定してもよいし、これとは別のデータを第1の状態であることを示す状態データとして設定してもよい。
【0010】
一方、このような書き込み動作中に電源遮断などの異常が発生したときには、状態データ記憶領域に記憶されている状態データに基づいて、例えば、状態データ記憶領域の状態が高い方の記憶領域に記憶されているデータが最新のものとして判別される。このとき、状態データ記憶領域の状態は、第3、第2、第1の状態の順序で高い状態である。
【0011】
すなわち、他方の記憶領域のデータが消去されている最中に異常が発生したときには、他方の記憶領域の状態データ記憶領域が第1の状態とされていることにより、少なくとも一方の記憶領域の状態の方が高い状態であるので、一方の記憶領域に記憶されているデータが最新のものであると判定される。また、他方の記憶領域にデータが書き込まれている最中に異常が発生したときには、一方の記憶領域の状態データ記憶領域が第2の状態とされ、かつ、他方の記憶領域の状態データ記憶領域が第1の状態とされているので、一方の記憶領域に記憶されているデータが最新のものであると判定される。また、他方の記憶領域にデータが書き込まれた後に異常が発生したときには、一方の記憶領域の状態データ記憶領域が第2または第1の状態とされ、かつ、他方の記憶領域の状態データ記憶領域が第3の状態とされているので、他方の記憶領域に記憶されているデータが最新のものであると判定される。
【0012】
また、本発明に係る請求項記載の不揮発性記憶媒体のデータ書込方法は、請求項記載の不揮発性記憶媒体のデータ書き込み方法において、前記第1の状態であることを示す前記状態データは、前記記憶領域のデータを消去したときの初期化データであり、前記第3の状態であることを示す前記状態データは、前記第1の状態であることを示す前記状態データを消去せずに上書き設定することができるデータであり、前記第2の状態であることを示す前記状態データは、前記第3の状態であることを示す前記状態データを消去せずに上書き設定することができるデータである。
【0013】
このような構成であれば、第1の状態であることを示す前記状態データは、記憶領域のデータを消去したときの初期化データが利用され、第3の状態であることを示す状態データは、第1の状態であることを示す状態データが消去されずに上書き設定され、第2の状態であることを示す状態データは、第3の状態であることを示す状態データが消去されずに上書き設定される。
【0014】
各記憶領域の状態データ記憶領域には、データが消去されるのに応じて、第1の状態であることを示す状態データが設定され、次いで、新たなデータが書き込まれるのに応じて、第3の状態であることを示す状態データが設定され、最後に、他の記憶領域に新たなデータが書き込まれようとするのに応じて、第2の状態であることを示す状態データが設定され、これらが繰り返される。すなわち、このように第1、第3、第2の状態の順に上書き設定できるようにすれば、第2の状態から第1の状態に移行するときにのみ、データを消去するようにすればよい。
【0015】
【発明の実施の形態】
以下、本発明の実施の形態を図面を参照しながら説明する。図1は、本発明に係る不揮発性記憶媒体のデータ書込方法による実施の形態を示すブロック図である。
【0016】
この実施の形態は、本発明に係る不揮発性記憶媒体のデータ書込方法を、図1に示すように、データを独立に消去可能な2つの記憶領域を有するフラッシュROMにデータを書き込み、書き込み動作中に異常が発生したときには、更新前データおよび更新データの少なくともいずれか一方を復旧するのに適用したものである。
【0017】
図中、演算およびシステム全体を制御する演算処理装置1と、データの読み出しおよび書き込みが可能でかつデータを独立に消去可能な2つの記憶領域を有するフラッシュROM2と、データの読み出しおよび書き込みが可能な主記憶装置3とは、データを伝送するための信号線であるバスで相互に接続されている。
【0018】
フラッシュROM2は、図2に示すように、外部からの制御信号を入力してフラッシュROM内に備える回路の動作を制御する制御部2aと、データを記憶する記憶部2bと、外部から入力するアドレスデータを記憶部2bに記憶されているデータの位置を特定する信号に変換するデコーダ2cと、外部とデータの入出力を行う入出力部2dと、で構成されている。
【0019】
制御部2aは、外部からの制御信号WE、OE、CEを入力する入力信号バッファ2aaと、入出力バッファ2aaに接続し入出力部2dを介して外部からの制御コマンドを入力するコマンドレジスタCRと、入出力バッファ2aaに接続してコマンドレジスタCRが入力した制御コマンドに基づいて動作モードを設定するコマンドデコーダCDと、コマンドデコーダCDに接続して動作モードがベリファイモードに設定されたときにベリファイ動作電圧を発生するベリファイ電圧発生回路2abと、ベリファイ電圧発生回路2abに接続して動作モードが書き込みモードに設定されたときに書き込み動作電圧を発生するプログラム電圧発生回路2acと、で構成されている。
【0020】
記憶部2bは、行方向および列方向にマトリクス状に配列された複数のメモリセルMCを備えるメモリアレイ2baと、入出力部2dとメモリアレイ2baとの間のデータの通過を制御するYゲート2bbと、動作モードが消去モードに設定されたときにメモリアレイ2ba内の共通のソース線に供給する消去動作電圧のスイッチングを行うソース線スイッチ2bcと、で構成されている。
【0021】
デコーダ2cは、外部からアドレスデータを入力するアドレスレジスタARと、Yゲート2bbおよびメモリアレイ2baに接続しアドレスレジスタARが入力するアドレスデータを解読してメモリアレイ2ba内に記憶されているデータの位置を特定するXデコーダ2caおよびYデコーダ2cbと、で構成されている。
【0022】
入出力部2dは、外部からの制御コマンドや外部との入出力データを保持する入出力バッファ2daと、入出力バッファ2daが入力したデータをYゲート2bbに受け渡す入力データレジスタ2dcと、Yゲート2bbからの出力データを入出力バッファ2daに受け渡すセンスアンプ2dcと、で構成されている。
【0023】
メモリアレイ2baは、図3に示すように、3行×3列のマトリクス状に配列された9個のメモリセルMCからなり、各メモリセル行を構成するFAMOSトランジスタのコントロールゲートに共通に接続するワード線WL1〜WL3と、各メモリセル列を構成するFAMOSトランジスタのドレインに共通に接続するビット線BL1〜BL3と、メモリセルMCを構成するすべてのFAMOSトランジスタのソースに共通に接続するソース線SLと、で構成されている。
【0024】
ワード線WL1〜WL3は、Xデコーダ2caに接続され、ビット線BL1〜BL3は、Yゲート2bbに接続されている。Yゲート2bbは、入力データレジスタ2dbおよびセンスアンプ2dcに接続する入出力線2beと、入出力線2beとメモリアレイ2ba内のビット線BL1〜BL3のそれぞれとの間にトランスファゲートとして設けられる複数のNチャネルMOSトランジスタ2bdと、で構成されている。トランジスタ2bdの各ゲートは、互いに異なる接続線Y1〜Y3を介してYデコーダ5に接続されている。
【0025】
データを消去する際には、まず、Xデコーダ2caを非アクティブ状態にし、メモリアレイ2ba内のすべてのワード線WL1〜WL3を接地電位にすると、すべてのメモリセルMCのコントロールゲート2gが接地電位となる。同様に、Yデコーダ2cbを非アクティブ状態にし、Yゲート2bb内のすべてのトランジスタ2bdに接続する接続線Y1〜Y3をローレベルにすると、Yゲート2bb内のすべてのトランジスタ2bdがOFF状態となり、各ドレインがフローティング状態となる。
【0026】
ソース線スイッチ2bcは、ソース線SLをハイレベルにする。そうすると、すべてのメモリセルMCでフローティングゲートおよびソース間にソースを高電位側とする高電界が発生し、トンネル現象が生じる。このため、フローティングゲートから電子が流出し、メモリセルアレイ2ba内のすべてのメモリセルMCに記憶されているデータが一括して消去される。
【0027】
データを書き込む際には、まず、Xデコーダ4が、メモリアレイ2ba内のワード線WL1〜WL3のうちのいすれか1本を選択的にハイレベルにする。Yデコーダ2cbは、Yゲート2bb内のトランジスタ2bdのうちのいずれか1つを選択的にON状態とするために、接続線Y1〜Y3のうちのいずれか1本が選択的にハイレベルにされる。これにより、メモリアレイ2ba内のハイレベルにされた接続線に対応する1本のビット線が、入出力線2beに電気的に接続する。
【0028】
入力データレジスタ2dbは、入出力バッファ2aaからの制御信号に応じてアクティブ状態となり、入出力線2beをハイレベルにする。入出力線2beは、1本のビット線にのみ電気的に接続するため、すなわち、その1本のビット線もハイレベルになる。一方、ソース線スイッチ2bcは、接地電位をソース線SLに与え、入出力バッファ2aaは、入出力端子O0 〜O7 に外部からの制御信号を増幅して入力データレジスタ2dbに与える。
【0029】
したがって、1本のワード線およびビット線によって特定されたメモリアレイ2ba内のメモリセルMCでは、そのコントロールゲートおよびドレインの両方がハイレベルとなる。このとき、ホットエレクトロンが発生し、フローティングゲートに注入され、この1つのメモリセルMCにデータ“0”が書き込まれることになる。
【0030】
なお、入出力バッファ2aaから入力データレジスタ2dbに与えられた制御信号が“1”であるならば、入力データレジスタ2dbはアクティブ状態とならない。したがって、Yデコーダ2cbによってハイレベルにされた1本の接続線に対応する1本のビット線もハイレベルとならない。このため、その1本のビット線とXデコーダ2caによってハイレベルにされた1本のワード線とに接続するメモリセルMCでは、ホットエレクトロンが発生しない。したがって、このメモリセルMCに記憶されているデータは、書換えが行われず“1”のままである。
【0031】
データを読み出す際には、まず、Xデコーダ2caが、メモリアレイ2ba内のワード線WL1〜WL3のうちいずれか1本を選択的にハイレベルにし、他のワード線をすべてローレベルにする。そうすると、選択された1本のワード線に接続するすべてのメモリセルMCのコントロールゲートがハイレベルとなる。
【0032】
Yデコーダ2cbは、Yゲート2bb内のトランジスタ2bdのうちいずれか1つのゲートを選択的にハイレベルにする。そうすると、この1つのトランジスタ2bdに接続するビット線は、入出力線2beを介してセンスアンプ2dcに電気的に接続する。一方、ソース線スイッチ2bcは、接地電位をソース線SLに与える。
【0033】
したがって、このとき、Yデコーダ2cbによってハイレベルにされた1本のビット線とXデコーダ2caによってハイレベルにされた1本のワード線とで特定された1つのメモリセルMCから、センスアンプ2dcにより、記憶されているデータが読み出される。
【0034】
また一方、フラッシュROM2は、図4(a)に示すように、データを独立に消去可能な2つの記憶領域3a,3bとを有し、各記憶領域3a,3bは、データを記憶するデータ記憶領域と、記憶領域3a,3bの状態を識別するための状態データを記憶する状態データ記憶領域と、で構成されている。
【0035】
状態データは、図4(b)に示すように、第1の状態であることを示す状態データ“0xFF”と、第2の状態であることを示す状態データ“0x00”と、第3の状態であることを示す状態データ“0x55”と、からなっており、各状態は、第3、第2、第1の状態の順序で高い状態とされる。
【0036】
主記憶装置3は、あらかじめ演算処理装置1の制御プログラム等が格納されているROMと、演算処理装置1の演算過程で必要な演算結果を格納するRAMと、で構成されている。
【0037】
演算処理装置1は、マイクロプロセスユニットMPU等からなり、フラッシュROM2にデータを書き込もうとするときには、主記憶装置3のROMの所定領域に格納されている所定のプログラムを起動させ、図5のフローチャートに示す処理を実行し、フラッシュROM2にデータを書き込んでいる最中に異常が発生し、更新前データまたは更新データを復旧させようとするときには、図6のフローチャートに示す処理を実行するようになっている。
【0038】
つまり、演算処理装置1で、フラッシュROM2にデータを書き込もうとするときに実行される処理は、次のように構成されている。まず、図5に示すように、ステップS1に移行して、記憶領域2Pに設定されている状態データを参照し、記憶領域2Pの状態が第3の状態(0x55)であるか否かを判定し、第3の状態であると判定されたときには、ステップS2に移行して、記憶領域2Qに記憶されているデータを消去し、ステップS3に移行するようになっている。なお、ステップS2で、記憶領域2Qに記憶されているデータを消去すると、記憶領域2Qに記憶されているすべてのビットは、“1”になるので、同時に、記憶領域2Qの状態が第1の状態(0xFF)に設定されることになる。
【0039】
ステップS3では、記憶領域2Pの状態を第2の状態(0x00)に設定し、ステップS4に移行して、記憶領域2Qにデータを書き込み、ステップS5に移行して、記憶領域2Qの状態を第3の状態に設定し、一連の処理を終了するようになっている。
【0040】
一方、ステップS1で、記憶領域2Pの状態が第3の状態ではないと判定されたときには、ステップS6に移行して、記憶領域2Qに設定されている状態データを参照し、記憶領域2Qの状態が第3の状態であるか否かを判定し、第3の状態であると判定されたときには、ステップS7に移行して、記憶領域2Pに記憶されているデータを消去し、ステップS8に移行するようになっている。なお、ステップS7で、記憶領域2Pに記憶されているデータを消去すると、同時に、記憶領域2Pの状態が第1の状態に設定されることになる。
【0041】
ステップS8では、記憶領域2Qの状態を第2の状態に設定し、ステップS9に移行して、記憶領域2Pにデータを書き込み、ステップS10に移行して、記憶領域2Pの状態を第3の状態に設定し、一連の処理を終了するようになっている。
【0042】
一方、ステップS6で、記憶領域2Qの状態が第3の状態ではないと判定されたときには、ステップS11に移行して、記憶領域2Pに記憶されているデータを消去し、ステップS12に移行して、記憶領域2Pにデータを書き込み、ステップS13に移行して、記憶領域2Pの状態を第3の状態に設定し、一連の処理を終了するようになっている。
【0043】
また、演算処理装置1で、フラッシュROM2にデータを書き込んでいる最中に異常が発生し、更新前データまたは更新データを復旧させようとするときに実行される処理は、次のように構成されている。まず、図6に示すように、ステップS21に移行して、記憶領域2Pに設定されている状態よりも記憶領域2Qに設定されている状態の方が高いか否かを判定し、高いと判定されたときには、ステップ22に移行して、記憶領域2Qに記憶されているデータを最新データと判定し、一連の処理を終了するようになっている。例えば、記憶領域2Pの状態が第3の状態に設定され、記憶領域2Qの状態が第2の状態に設定されているときは、ステップS21で、記憶領域2Pに設定されている状態よりも記憶領域2Qに設定されている状態の方が高いと判定される。
【0044】
しかし、ステップS21で、記憶領域2Pに設定されている状態よりも記憶領域2Qに設定されている状態の方が高くないと判定されたときには、ステップS23に移行して、記憶領域2Pに記憶されているデータを最新データと判定し、一連の処理を終了するようになっている。
【0045】
次に、上記実施の形態の動作を説明する。
始めに、フラッシュROM2にデータを書き込む場合について説明する。
まず、記憶領域2P,2Qのいずれにもデータが記憶されていないときに、フラッシュROM2にデータを書き込もうとすると、記憶領域2Pがデータを書き込むための記憶領域として選択される。
【0046】
そうすると、記憶領域2Pを確実に初期化状態とするために記憶領域2Pに対してデータの消去が実行され、記憶領域2Pにデータが書き込まれ、記憶領域2Pの状態が第3の状態に設定される。
【0047】
このように記憶領域2Pにデータが書き込まれたのち、さらにそのデータが更新されたものとし、その更新データをフラッシュROM2に書き込もうとすると、この場合、記憶領域2Pの状態が第3の状態に設定されているので、第3の状態に設定されていない記憶領域2Qが更新データを書き込むための記憶領域として選択される。
【0048】
そうすると、記憶領域2Qを確実に初期化状態とするために記憶領域2Qに対してデータの消去が実行されるとともに、記憶領域2Qの状態が第1の状態に設定され、記憶領域2Pの状態が第2の状態に設定される。次いで、記憶領域2Qに更新データが書き込まれ、記憶領域2Qの状態が第3の状態に設定される。
【0049】
このように記憶領域2Qにデータが書き込まれたのち、さらにそのデータが更新されたものとし、その更新データをフラッシュROM2に書き込もうとすると、この場合、記憶領域2Qの状態が第3の状態に設定されているので、第3の状態に設定されていない記憶領域2Pが更新データを書き込むための記憶領域として選択される。
【0050】
そうすると、記憶領域2Pに記憶されているデータが消去されるとともに、記憶領域2Pの状態が第1の状態に設定され、記憶領域2Qの状態が第2の状態に設定される。次いで、記憶領域2Pに更新データが書き込まれ、記憶領域2Pの状態が第3の状態に設定される。
【0051】
その次に、フラッシュROM2に更新データを書き込んでいる最中に電源遮断などの異常が発生し、更新前データおよび更新データのいずれか一方を復旧する場合について説明する。
【0052】
まず、記憶領域2Qが更新データを記憶するための記憶領域として選択されているときであって、記憶領域2Qに記憶されているデータを消去している最中に異常が発生したときには、記憶領域2Pの状態が第3の状態に設定されているので、記憶領域2Pに記憶されている更新前データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Pに記憶されている更新前データが読み込まれる。
【0053】
次いで、記憶領域2Qに更新データを書き込んでいる最中に異常が発生したときには、記憶領域2Pの状態が第2の状態に設定され、かつ、記憶領域2Qの状態が第1の状態に設定されているので、記憶領域2Pに記憶されている更新前データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Pに記憶されている更新前データが読み込まれる。
【0054】
次いで、記憶領域2Qに更新データを書き込んだ後に異常が発生したときには、記憶領域2Pの状態が第2または第1の状態に設定され、かつ、記憶領域2Qの状態が第3の状態に設定されているので、記憶領域2Qに記憶されている更新データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Qに記憶されている更新データが読み込まれる。
【0055】
次いで、記憶領域2Pが更新データを記憶するための記憶領域として選択されているときであって、記憶領域2Pに記憶されているデータを消去している最中に異常が発生したときには、記憶領域2Qの状態が第3の状態に設定されているので、記憶領域2Qに記憶されている更新前データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Qに記憶されている更新前データが読み込まれる。
【0056】
次いで、記憶領域2Pに更新データを書き込んでいる最中に異常が発生したときには、記憶領域2Pの状態が第1の状態に設定され、かつ、記憶領域2Qの状態が第2の状態に設定されているので、記憶領域2Qに記憶されている更新前データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Qに記憶されている更新前データが読み込まれる。
【0057】
次いで、記憶領域2Pに更新データを書き込んだ後に異常が発生したときには、記憶領域2Pの状態が第3の状態に設定され、かつ、記憶領域2Qの状態が第2または第1の状態に設定されているので、記憶領域2Pに記憶されている更新データが最新データであると判定される。そうすると、演算処理装置1がフラッシュROM2から主記憶装置3にデータを読み込むときには、記憶領域2Pに記憶されている更新データが読み込まれる。
【0058】
このようにして、データを独立に消去可能な2つの記憶領域2P,2Qに、データを記憶するデータ記憶領域と、記憶領域の状態を識別するための状態データを記憶する状態データ記憶領域と、それぞれを定め、記憶領域2Pに更新前データが書き込まれており、記憶領域2Qに更新データを書き込もうとするときには、まず、記憶領域2Qに記憶されているデータを消去し、データの消去により記憶領域2Qを第1の状態に設定し、次いで、記憶領域2Pを第2の状態に設定し、次いで、記憶領域2Qに更新データを書き込み、そして、記憶領域2Qを第3の状態に設定し、書き込み動作中に異常が発生したときには、各状態データ記憶領域に記憶されている状態データに基づいて、状態が高い方の記憶領域2P,2Qに記憶されているデータを最新データであると判定するようにしたから、書き込み動作中に異常が発生しても、更新前データおよび更新データが両方とも失われる可能性を低減することができるとともに、いずれの記憶領域に記憶されているデータが最新のものであるかを判定することができる。
【0059】
また、第3の状態であることを示す状態データは、第1の状態であることを示す状態データ“0xFF”を消去せずに上書き設定することができるデータ“0x55”であり、第2の状態であることを示す状態データは、第3の状態であることを示す状態データ“0x55”を消去せずに上書き設定することができるデータ“0x00”であるから、上記のように第1、第3、第2と状態が移行していくときに、データを一度だけ消去すればよく、消去する動作回数を低減することができる。
【0060】
さらに、第1の状態であることを示す状態データは、データを消去したときの初期化データ“0xFF”であるから、データ記憶領域に記憶されているデータを消去するのと同時に第1の状態に設定することができる。このため、データを書き込む動作回数を低減することができる。
【0061】
なお、上記実施の形態においては、不揮発性記憶媒体としてフラッシュROM2を用いて構成したが、これに限らず、不揮発性記憶媒体としてUV−ROM(紫外線消去型PROM)、EEPROM(電気的消去型PROM)を用いて構成してもよい。
【0062】
また、上記実施の形態においては、データを独立に消去可能な2つの記憶領域を有するフラッシュROM2を用いて構成したが、これに限らず、データを独立に消去可能な多数の記憶領域を有するフラッシュROM2を用いて構成してもよい。すなわち、ある記憶領域に記憶されている更新前データに新たな更新データを上書きしようとするときには、上記のような方法で更新データを書き込むようにすればよく、データを独立に消去可能なn+1個の記憶領域を有している場合には、1個の記憶領域を更新データを記憶するための記憶領域として用い、n個の記憶領域にデータを記憶するようにすればよい。
【0063】
さらに、上記実施の形態において、演算処理装置1で、図5および図6のフローチャートに示す処理を実行するにあたってはいずれも、主記憶装置3のROMにあらかじめ格納されているプログラムを実行する場合について説明したが、これに限らず、これらの手順を示したプログラムが記憶された記憶媒体から、そのプログラムを主記憶装置3のRAMに読み込んで実行するようにしてもよい。
【0064】
ここで、記憶媒体とは、RAM、ROM、FD、コンパクトディスク、ハードディスク、光磁気ディスクまたは紙等の記憶媒体であって、電子的、磁気的、光学的等の読み取り方法のいかんにかかわらず、コンピュータで読み取り可能な記憶媒体であれば、あらゆる記憶媒体を含むものである。
【0065】
さらに、上記実施の形態において、演算処理装置1で、図5および図6のフローチャートに示す処理はいずれも、ソフトウェアで構成した場合について説明したが、これに代えて、比較回路、演算回路、論理回路等の電子回路を組み合わせるように構成してもよい。
【0066】
【発明の効果】
以上説明したように、本発明に係る不揮発性記憶媒体のデータ書込方法によれば、書き込み動作中に異常が発生しても、更新前データおよび更新データが両方とも失われる可能性を低減することができるとともに、いずれの記憶領域に記憶されているデータが最新のものであるかを判定することができるという効果が得られる。
【0067】
また、本発明に係る請求項記載の不揮発性記憶媒体のデータ書込方法によれば、記憶領域の状態を移行させるときに、データを消去する動作回数およびデータを書き込む動作回数を低減することができるという効果も得られる。
【図面の簡単な説明】
【図1】実施の形態の構成を示すブロック図である。
【図2】フラッシュROM2の構成を示すブロック図である。
【図3】フラッシュROM2の記憶部2bの構成を示すブロック図である。
【図4】フラッシュROM2の記憶領域および状態データ格納領域に記憶される情報データの構成を示すブロック図である。
【図5】フラッシュROM2にデータを書き込むときに実行される処理を示すフローチャートである。
【図6】書き込み動作中に異常が発生したときに実行される処理を示すフローチャートである。
【符号の説明】
1 演算処理装置
2 フラッシュROM
2a 制御部
2b 記憶部
2c デコーダ
2d 入出力部
2P,2Q 記憶領域
3 主記憶装置
[0001]
[Field of the Invention]
The present invention relates to a data writing method for a non-volatile storage medium for writing data to a non-volatile storage medium, and in particular, a non-volatile storage medium capable of suitably protecting data when an abnormality occurs during a write operation. The present invention relates to a data writing method.
[0002]
[Prior art]
Conventionally, as a method of writing data to a nonvolatile storage medium such as a flash ROM, data stored in a storage area having a predetermined amount of data is erased all at once, and then data is written byte by byte in the storage area. I was doing.
[0003]
[Problems to be solved by the invention]
However, in the conventional method of writing data to a nonvolatile storage medium, when an abnormality such as a power interruption occurs during the writing operation, not only the data stored before writing but also the written data is lost. There was a possibility. Since data writing is performed over a storage area having a relatively large amount of data, if the data stored before writing or the written data is lost, the damage is significant.
[0004]
Therefore, the present invention has an object to solve such a conventional problem, and even when an abnormality occurs during a write operation, a data write method for a nonvolatile storage medium that can suitably protect data The purpose is to provide.
[0008]
[Means for Solving the Problems]
To achieve the above objective, Claims related to the present invention 1 The data writing method of the described non-volatile storage medium, Data for storing data in a data storage method of a nonvolatile storage medium for writing data to a nonvolatile storage medium having two storage areas that can electrically read and write data and that can be erased independently A storage area and a state data storage area for storing state data for identifying the state of the storage area are determined for each storage area, When the latest data is written in the one storage area and update data is to be written in the other storage area, first, the data in the other storage area is erased and the state data is stored in the other storage area. A process for setting the area to the first state is executed, then a process for setting the state data storage area of the one storage area to the second state is executed, and then the data storage area of the other storage area The update data is written to the other storage area, and the state data storage area of the other storage area is set to the third state. When an abnormality occurs during the write operation, each state data Based on the state data stored in the storage area, it is determined that the data stored in any one of the storage areas is the latest data.
[0009]
In such a configuration, when the latest data is written in one storage area and the update data is written in the other storage area, first, the data in the other storage area is erased and the other storage area is written. A process for setting the state data storage area to the first state is executed, then a process for setting the state data storage area of one storage area to the second state is executed, and then the update data to the other storage area is Writing is executed, and processing for setting the state data storage area of the other storage area to the third state is executed. In this case, as a process for setting the state data storage area of the other storage area to the first state, the initialization data when the data of the other storage area is erased is the state data indicating the first state. Or data different from this may be set as state data indicating the first state.
[0010]
On the other hand, when an abnormality such as power interruption occurs during such a write operation, for example, the state data storage area is stored in the higher storage area based on the state data stored in the state data storage area. Is determined as the latest data. At this time, the state of the state data storage area is high in the order of the third, second, and first states.
[0011]
That is, when an abnormality occurs while the data in the other storage area is being erased, the state data storage area in the other storage area is in the first state, so that the state of at least one storage area Since is higher, it is determined that the data stored in one storage area is the latest. When an abnormality occurs while data is being written to the other storage area, the state data storage area of one storage area is set to the second state, and the state data storage area of the other storage area Is in the first state, it is determined that the data stored in one of the storage areas is the latest. When an abnormality occurs after data is written to the other storage area, the state data storage area of one storage area is set to the second or first state, and the state data storage area of the other storage area Is in the third state, it is determined that the data stored in the other storage area is the latest.
[0012]
Moreover, the claim concerning this invention 2 The method of writing data in the nonvolatile storage medium described in claim 1 In the data writing method of the nonvolatile storage medium described above, the state data indicating the first state is initialization data when data in the storage area is erased, and is the third state The state data indicating that the state data indicating the first state can be overwritten without erasing the state data indicating the first state, and the state data indicating the second state is This is data that can be overwritten without erasing the state data indicating the third state.
[0013]
With such a configuration, the state data indicating the first state uses the initialization data when the data in the storage area is erased, and the state data indicating the third state is The state data indicating the first state is overwritten without being erased, and the state data indicating the second state is not erased without the state data indicating the third state. Overwrite is set.
[0014]
In the state data storage area of each storage area, state data indicating the first state is set according to the data being erased, and then the new data is written in accordance with the first data. The state data indicating the state 3 is set, and finally, the state data indicating the second state is set in response to the new data being written to another storage area. These are repeated. That is, if the overwrite setting can be performed in the order of the first, third, and second states in this way, data should be erased only when the second state is shifted to the first state. .
[0015]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing an embodiment according to a data writing method of a nonvolatile storage medium according to the present invention.
[0016]
In this embodiment, the data writing method of the nonvolatile storage medium according to the present invention is performed by writing data to a flash ROM having two storage areas in which data can be erased independently as shown in FIG. This is applied to recover at least one of pre-update data and update data when an abnormality occurs.
[0017]
In the figure, an arithmetic processing unit 1 that controls the operation and the entire system, a flash ROM 2 that has two storage areas that can read and write data and can independently erase data, and can read and write data The main storage device 3 is mutually connected by a bus which is a signal line for transmitting data.
[0018]
As shown in FIG. 2, the flash ROM 2 receives a control signal from the outside and controls the operation of a circuit provided in the flash ROM, a storage unit 2b for storing data, and an address input from the outside. A decoder 2c that converts data into a signal that specifies the position of data stored in the storage unit 2b, and an input / output unit 2d that inputs / outputs data from / to the outside.
[0019]
The control unit 2a includes an input signal buffer 2aa for inputting control signals WE, OE, CE from the outside, a command register CR connected to the input / output buffer 2aa and for inputting a control command from the outside via the input / output unit 2d, The command decoder CD that is connected to the input / output buffer 2aa and sets the operation mode based on the control command input by the command register CR, and the verify operation when the operation mode is set to the verify mode by connecting to the command decoder CD A verify voltage generating circuit 2ab that generates a voltage, and a program voltage generating circuit 2ac that is connected to the verify voltage generating circuit 2ab and generates a write operation voltage when the operation mode is set to the write mode.
[0020]
The storage unit 2b includes a memory array 2ba including a plurality of memory cells MC arranged in a matrix in the row direction and the column direction, and a Y gate 2bb that controls passage of data between the input / output unit 2d and the memory array 2ba. And a source line switch 2bc for switching an erase operation voltage supplied to a common source line in the memory array 2ba when the operation mode is set to the erase mode.
[0021]
The decoder 2c is connected to the address register AR for inputting address data from the outside, and the position of the data stored in the memory array 2ba by decoding the address data input to the address register AR connected to the Y gate 2bb and the memory array 2ba. And an X decoder 2ca and a Y decoder 2cb.
[0022]
The input / output unit 2d includes an input / output buffer 2da that holds external control commands and external input / output data, an input data register 2dc that transfers data input by the input / output buffer 2da to the Y gate 2bb, and a Y gate And a sense amplifier 2dc for passing output data from 2bb to the input / output buffer 2da.
[0023]
As shown in FIG. 3, the memory array 2ba is composed of nine memory cells MC arranged in a matrix of 3 rows × 3 columns, and is commonly connected to the control gates of the FAMOS transistors constituting each memory cell row. Word lines WL1 to WL3, bit lines BL1 to BL3 commonly connected to the drains of the FAMOS transistors constituting each memory cell column, and source lines SL commonly connected to the sources of all the FAMOS transistors constituting the memory cell MC And is composed of.
[0024]
The word lines WL1 to WL3 are connected to the X decoder 2ca, and the bit lines BL1 to BL3 are connected to the Y gate 2bb. Y gate 2bb includes a plurality of input / output lines 2be connected to input data register 2db and sense amplifier 2dc, and a plurality of transfer gates provided between input / output line 2be and bit lines BL1 to BL3 in memory array 2ba. N channel MOS transistor 2bd. Each gate of the transistor 2bd is connected to the Y decoder 5 via different connection lines Y1 to Y3.
[0025]
When erasing data, first, when the X decoder 2ca is deactivated and all the word lines WL1 to WL3 in the memory array 2ba are set to the ground potential, the control gates 2g of all the memory cells MC are set to the ground potential. Become. Similarly, when the Y decoder 2cb is deactivated and the connection lines Y1 to Y3 connected to all the transistors 2bd in the Y gate 2bb are set to the low level, all the transistors 2bd in the Y gate 2bb are turned off. The drain is in a floating state.
[0026]
The source line switch 2bc sets the source line SL to the high level. As a result, a high electric field with the source at the high potential side is generated between the floating gate and the source in all memory cells MC, and a tunnel phenomenon occurs. For this reason, electrons flow out of the floating gate, and data stored in all the memory cells MC in the memory cell array 2ba are erased collectively.
[0027]
When writing data, the X decoder 4 first selectively sets one of the word lines WL1 to WL3 in the memory array 2ba to a high level. The Y decoder 2cb selectively turns one of the connection lines Y1 to Y3 to the high level in order to selectively turn on one of the transistors 2bd in the Y gate 2bb. The As a result, one bit line corresponding to the high-level connection line in the memory array 2ba is electrically connected to the input / output line 2be.
[0028]
The input data register 2db becomes active in response to the control signal from the input / output buffer 2aa, and sets the input / output line 2be to high level. The input / output line 2be is electrically connected to only one bit line, that is, that one bit line is also at a high level. On the other hand, the source line switch 2bc applies a ground potential to the source line SL, and the input / output buffer 2aa 0 ~ O 7 The control signal from the outside is amplified and applied to the input data register 2db.
[0029]
Therefore, in the memory cell MC in the memory array 2ba specified by one word line and bit line, both of its control gate and drain become high level. At this time, hot electrons are generated and injected into the floating gate, and data “0” is written in this one memory cell MC.
[0030]
If the control signal applied from the input / output buffer 2aa to the input data register 2db is “1”, the input data register 2db is not in the active state. Accordingly, one bit line corresponding to one connection line set to high level by the Y decoder 2cb does not become high level. For this reason, hot electrons are not generated in the memory cells MC connected to the one bit line and one word line which is set to the high level by the X decoder 2ca. Therefore, the data stored in the memory cell MC is not rewritten and remains “1”.
[0031]
When reading data, first, the X decoder 2ca selectively sets any one of the word lines WL1 to WL3 in the memory array 2ba to a high level and sets all other word lines to a low level. Then, the control gates of all the memory cells MC connected to the selected one word line are set to the high level.
[0032]
The Y decoder 2cb selectively sets any one of the transistors 2bd in the Y gate 2bb to the high level. Then, the bit line connected to the one transistor 2bd is electrically connected to the sense amplifier 2dc via the input / output line 2be. On the other hand, source line switch 2bc applies a ground potential to source line SL.
[0033]
Therefore, at this time, from one memory cell MC specified by one bit line set to high level by the Y decoder 2cb and one word line set to high level by the X decoder 2ca, the sense amplifier 2dc The stored data is read out.
[0034]
On the other hand, as shown in FIG. 4A, the flash ROM 2 has two storage areas 3a and 3b that can independently erase data, and each storage area 3a and 3b stores data. An area and a state data storage area for storing state data for identifying the states of the storage areas 3a and 3b.
[0035]
As shown in FIG. 4B, the state data includes state data “0xFF” indicating the first state, state data “0x00” indicating the second state, and the third state. State data “0x55” indicating that each state is set to a high state in the order of the third, second, and first states.
[0036]
The main storage device 3 is composed of a ROM in which a control program for the arithmetic processing device 1 is stored in advance, and a RAM in which arithmetic results required in the arithmetic process of the arithmetic processing device 1 are stored.
[0037]
The arithmetic processing unit 1 includes a microprocess unit MPU and the like, and when data is to be written to the flash ROM 2, a predetermined program stored in a predetermined area of the ROM of the main storage device 3 is activated, and the flowchart of FIG. When an abnormality occurs while data is being written to the flash ROM 2 and the pre-update data or the update data is to be restored, the process shown in the flowchart of FIG. 6 is executed. Yes.
[0038]
That is, the processing executed when the arithmetic processing unit 1 tries to write data into the flash ROM 2 is configured as follows. First, as shown in FIG. 5, the process proceeds to step S1, and it is determined whether or not the state of the storage area 2P is the third state (0x55) by referring to the state data set in the storage area 2P. However, when it is determined that the state is the third state, the process proceeds to step S2, the data stored in the storage area 2Q is erased, and the process proceeds to step S3. If the data stored in the storage area 2Q is erased in step S2, all the bits stored in the storage area 2Q are “1”. At the same time, the state of the storage area 2Q is changed to the first state. The state (0xFF) will be set.
[0039]
In step S3, the state of the storage area 2P is set to the second state (0x00), the process proceeds to step S4, data is written to the storage area 2Q, the process proceeds to step S5, and the state of the storage area 2Q is changed to the first state. A state of 3 is set, and a series of processing is terminated.
[0040]
On the other hand, when it is determined in step S1 that the state of the storage area 2P is not the third state, the process proceeds to step S6, where the state data set in the storage area 2Q is referred to, and the state of the storage area 2Q Is determined to be in the third state, and if it is determined to be in the third state, the process proceeds to step S7, the data stored in the storage area 2P is erased, and the process proceeds to step S8. It is supposed to be. If the data stored in the storage area 2P is erased in step S7, the state of the storage area 2P is set to the first state at the same time.
[0041]
In step S8, the state of the storage area 2Q is set to the second state, the process proceeds to step S9, data is written to the storage area 2P, the process proceeds to step S10, and the state of the storage area 2P is changed to the third state. To complete the series of processing.
[0042]
On the other hand, when it is determined in step S6 that the state of the storage area 2Q is not the third state, the process proceeds to step S11, the data stored in the storage area 2P is erased, and the process proceeds to step S12. Then, data is written in the storage area 2P, the process proceeds to step S13, the state of the storage area 2P is set to the third state, and the series of processes is terminated.
[0043]
Further, the processing executed when an abnormality occurs while data is being written to the flash ROM 2 in the arithmetic processing unit 1 and an attempt is made to restore pre-update data or update data is configured as follows. ing. First, as shown in FIG. 6, the process proceeds to step S21 to determine whether or not the state set in the storage area 2Q is higher than the state set in the storage area 2P. If it has been done, the process proceeds to step 22 where the data stored in the storage area 2Q is determined to be the latest data, and the series of processing ends. For example, when the state of the storage area 2P is set to the third state and the state of the storage area 2Q is set to the second state, in step S21, the storage area 2P is stored more than the state set to the storage area 2P. It is determined that the state set in the region 2Q is higher.
[0044]
However, when it is determined in step S21 that the state set in the storage area 2Q is not higher than the state set in the storage area 2P, the process proceeds to step S23 and is stored in the storage area 2P. Is determined to be the latest data, and a series of processing ends.
[0045]
Next, the operation of the above embodiment will be described.
First, a case where data is written to the flash ROM 2 will be described.
First, when data is to be written into the flash ROM 2 when no data is stored in either of the storage areas 2P and 2Q, the storage area 2P is selected as a storage area for writing data.
[0046]
Then, in order to surely initialize the storage area 2P, data is erased from the storage area 2P, data is written to the storage area 2P, and the state of the storage area 2P is set to the third state. The
[0047]
In this case, when data is written to the storage area 2P and then the data is further updated, and the update data is written to the flash ROM 2, the state of the storage area 2P is set to the third state in this case. Therefore, the storage area 2Q not set to the third state is selected as a storage area for writing update data.
[0048]
Then, in order to surely initialize the storage area 2Q, data is erased from the storage area 2Q, the state of the storage area 2Q is set to the first state, and the state of the storage area 2P is changed to Set to the second state. Next, update data is written to the storage area 2Q, and the state of the storage area 2Q is set to the third state.
[0049]
In this case, when data is written to the storage area 2Q and the data is further updated, and the update data is written to the flash ROM 2, the state of the storage area 2Q is set to the third state. Therefore, the storage area 2P that is not set to the third state is selected as a storage area for writing update data.
[0050]
Then, the data stored in the storage area 2P is erased, the state of the storage area 2P is set to the first state, and the state of the storage area 2Q is set to the second state. Next, update data is written to the storage area 2P, and the state of the storage area 2P is set to the third state.
[0051]
Next, a description will be given of a case where an abnormality such as a power interruption occurs while update data is being written to the flash ROM 2 to restore either pre-update data or update data.
[0052]
First, when the storage area 2Q is selected as a storage area for storing update data, and an abnormality occurs while erasing the data stored in the storage area 2Q, the storage area Since the state of 2P is set to the third state, it is determined that the pre-update data stored in the storage area 2P is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the pre-update data stored in the storage area 2P is read.
[0053]
Next, when an abnormality occurs while writing update data to the storage area 2Q, the state of the storage area 2P is set to the second state, and the state of the storage area 2Q is set to the first state. Therefore, it is determined that the pre-update data stored in the storage area 2P is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the pre-update data stored in the storage area 2P is read.
[0054]
Next, when an abnormality occurs after writing update data in the storage area 2Q, the state of the storage area 2P is set to the second or first state, and the state of the storage area 2Q is set to the third state. Therefore, it is determined that the update data stored in the storage area 2Q is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the update data stored in the storage area 2Q is read.
[0055]
Next, when the storage area 2P is selected as a storage area for storing update data, and an abnormality occurs while erasing the data stored in the storage area 2P, the storage area Since the 2Q state is set to the third state, it is determined that the pre-update data stored in the storage area 2Q is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the pre-update data stored in the storage area 2Q is read.
[0056]
Next, when an abnormality occurs while writing update data in the storage area 2P, the state of the storage area 2P is set to the first state, and the state of the storage area 2Q is set to the second state. Therefore, it is determined that the pre-update data stored in the storage area 2Q is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the pre-update data stored in the storage area 2Q is read.
[0057]
Next, when an abnormality occurs after writing update data in the storage area 2P, the state of the storage area 2P is set to the third state, and the state of the storage area 2Q is set to the second or first state. Therefore, it is determined that the update data stored in the storage area 2P is the latest data. Then, when the arithmetic processing device 1 reads data from the flash ROM 2 into the main storage device 3, the update data stored in the storage area 2P is read.
[0058]
In this way, in the two storage areas 2P and 2Q capable of independently erasing data, the data storage area for storing data, the state data storage area for storing state data for identifying the state of the storage area, When data is determined and the pre-update data is written in the storage area 2P and the update data is to be written in the storage area 2Q, first, the data stored in the storage area 2Q is erased, and then the data is erased. 2Q is set to the first state, then the storage area 2P is set to the second state, then update data is written to the storage area 2Q, and the storage area 2Q is set to the third state and written When an abnormality occurs during operation, based on the state data stored in each state data storage area, the data stored in the storage areas 2P and 2Q having the higher state is stored. Since the data is determined to be the latest data, even if an abnormality occurs during the write operation, the possibility that both the pre-update data and the update data will be lost can be reduced, and any storage area It is possible to determine whether the data stored in is the latest.
[0059]
The state data indicating the third state is data “0x55” that can be overwritten without erasing the state data “0xFF” indicating the first state. Since the state data indicating the state is data “0x00” that can be overwritten without erasing the state data “0x55” indicating the third state, the first, When the state is shifted from the third state to the second state, the data has to be erased only once, and the number of erase operations can be reduced.
[0060]
Further, since the state data indicating the first state is the initialization data “0xFF” when the data is erased, the first state is simultaneously with erasing the data stored in the data storage area. Can be set to Therefore, the number of operations for writing data can be reduced.
[0061]
In the above embodiment, the flash ROM 2 is used as a nonvolatile storage medium. However, the present invention is not limited to this, and UV-ROM (ultraviolet erasable PROM), EEPROM (electrically erasable PROM) are not limited to this. ) May be used.
[0062]
In the above embodiment, the flash ROM 2 having two storage areas capable of independently erasing data is used. However, the present invention is not limited to this, and a flash having a large number of storage areas capable of erasing data independently. You may comprise using ROM2. That is, when new update data is to be overwritten on pre-update data stored in a certain storage area, it is only necessary to write the update data by the above method, and n + 1 data that can be erased independently. In the case of having two storage areas, one storage area may be used as a storage area for storing update data, and data may be stored in n storage areas.
[0063]
Further, in the above embodiment, when the arithmetic processing device 1 executes the processing shown in the flowcharts of FIGS. 5 and 6, the program stored in advance in the ROM of the main storage device 3 is executed. Although described above, the present invention is not limited to this, and the program may be read from the storage medium storing the program showing these procedures into the RAM of the main storage device 3 and executed.
[0064]
Here, the storage medium is a storage medium such as a RAM, a ROM, an FD, a compact disk, a hard disk, a magneto-optical disk, or paper, regardless of the reading method such as electronic, magnetic, or optical. Any storage medium that can be read by a computer is included.
[0065]
Furthermore, in the above embodiment, the processing shown in the flowcharts of FIG. 5 and FIG. 6 in the arithmetic processing device 1 has been described as being configured by software, but instead of this, a comparison circuit, arithmetic circuit, logic You may comprise so that electronic circuits, such as a circuit, may be combined.
[0066]
【The invention's effect】
As described above, according to the data writing method of the nonvolatile storage medium according to the present invention, even if an abnormality occurs during the writing operation, the possibility that both pre-update data and update data are lost is reduced. In addition, it is possible to obtain an effect that it is possible to determine which storage area is the latest data.
[0067]
Moreover, the claim concerning this invention 2 According to the data writing method of the described nonvolatile storage medium, it is also possible to reduce the number of operations for erasing data and the number of operations for writing data when the state of the storage area is changed.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration of an embodiment.
2 is a block diagram showing a configuration of a flash ROM 2. FIG.
3 is a block diagram showing a configuration of a storage unit 2b of the flash ROM 2. FIG.
4 is a block diagram showing a configuration of information data stored in a storage area and a state data storage area of the flash ROM 2. FIG.
FIG. 5 is a flowchart showing processing executed when data is written to the flash ROM 2;
FIG. 6 is a flowchart showing a process executed when an abnormality occurs during a write operation.
[Explanation of symbols]
1 arithmetic processing unit
2 Flash ROM
2a Control unit
2b storage unit
2c decoder
2d input / output unit
2P, 2Q storage area
3 Main memory

Claims (2)

電気的にデータを読み出し及び書き込み可能で、且つデータを独立に消去可能な2つの記憶領域を有する不揮発性記憶媒体に、データを書き込む不揮発性記憶媒体のデータ書込方法において、
データを記憶するデータ記憶領域と、前記記憶領域の状態を識別するための状態データを記憶する状態データ記憶領域と、を前記記憶領域ごとに定め、
前記一方の記憶領域に最新データが書き込まれており、前記他方の記憶領域に更新データを書き込もうとするときには、まず、前記他方の記憶領域のデータの消去及び前記他方の記憶領域の前記状態データ記憶領域を第1の状態とする処理を実行し、次いで、前記一方の記憶領域の前記状態データ記憶領域を第2の状態とする処理を実行し、次いで、前記他方の記憶領域の前記データ記憶領域への前記更新データの書き込みを実行し、そして、前記他方の記憶領域の前記状態データ記憶領域を第3の状態とする処理を実行し、
書き込み動作中に異常が発生したときには、前記各状態データ記憶領域に記憶されている前記状態データに基づいて、いずれか一方の前記記憶領域に記憶されているデータを最新データであると判定することを特徴とする不揮発性記憶媒体のデータ書込方法。
In a data writing method for a non-volatile storage medium in which data is written to a non-volatile storage medium having two storage areas that are electrically readable and writable and independently erasable.
A data storage area for storing data and a state data storage area for storing state data for identifying the state of the storage area are determined for each storage area,
When the latest data is written in the one storage area and update data is to be written in the other storage area, first, the data in the other storage area is erased and the state data is stored in the other storage area. A process for setting the area to the first state is executed, then a process for setting the state data storage area of the one storage area to the second state is executed, and then the data storage area of the other storage area Writing the update data to the storage area, and executing the process of setting the state data storage area of the other storage area to the third state,
When an abnormality occurs during the write operation, it is determined that the data stored in any one of the storage areas is the latest data based on the state data stored in each of the state data storage areas method of writing data nonvolatile storage medium characterized.
前記第1の状態であることを示す前記状態データは、前記記憶領域のデータを消去したときの初期化データであり、前記第3の状態であることを示す前記状態データは、前記第1の状態であることを示す前記状態データを消去せずに上書き設定することができるデータであり、前記第2の状態であることを示す前記状態データは、前記第3の状態であることを示す前記状態データを消去せずに上書き設定することができるデータであることを特徴とする請求項記載の不揮発性記憶媒体のデータ書込方法。The state data indicating the first state is initialization data when data in the storage area is erased, and the state data indicating the third state is the first data The state data indicating the state is data that can be overwritten without erasing the state data, and the state data indicating the second state is the third state data writing method of a nonvolatile memory medium according to claim 1, characterized in that the data that can be overwritten set without erasing the state data.
JP19706297A 1997-07-23 1997-07-23 Method for writing data in nonvolatile storage medium Expired - Fee Related JP3755626B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19706297A JP3755626B2 (en) 1997-07-23 1997-07-23 Method for writing data in nonvolatile storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19706297A JP3755626B2 (en) 1997-07-23 1997-07-23 Method for writing data in nonvolatile storage medium

Publications (2)

Publication Number Publication Date
JPH1139889A JPH1139889A (en) 1999-02-12
JP3755626B2 true JP3755626B2 (en) 2006-03-15

Family

ID=16368089

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19706297A Expired - Fee Related JP3755626B2 (en) 1997-07-23 1997-07-23 Method for writing data in nonvolatile storage medium

Country Status (1)

Country Link
JP (1) JP3755626B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8341371B2 (en) * 2005-01-31 2012-12-25 Sandisk Il Ltd Method of managing copy operations in flash memories

Also Published As

Publication number Publication date
JPH1139889A (en) 1999-02-12

Similar Documents

Publication Publication Date Title
US6469928B2 (en) Nonvolatile semiconductor memory device with concurrent memory access and data locking
US6522581B2 (en) Semiconductor storage device
KR100521826B1 (en) Semiconductor memory system having data copy function and data copy method thereof
JP4652319B2 (en) Nonvolatile semiconductor memory device having program and erase verification function
US20060268610A1 (en) Nonvolatile memory system, semiconductor memory, and writing method
JP3411186B2 (en) Nonvolatile semiconductor memory device
KR20020071713A (en) Non-volatile semiconductor memory device
JP2007140733A (en) Semiconductor processor and semiconductor integrated circuit
KR960005355B1 (en) Nonvolatile semiconductor storage and storage system using that
JP3137993B2 (en) Nonvolatile semiconductor memory device
JP3611280B2 (en) Nonvolatile semiconductor memory device
JP4346211B2 (en) Nonvolatile semiconductor memory device
JP4373057B2 (en) Sector protection circuit and method for flash memory device
JP3143161B2 (en) Non-volatile semiconductor memory
JP4467371B2 (en) Nonvolatile semiconductor memory device and method for setting replacement information of nonvolatile semiconductor memory device
JP3755626B2 (en) Method for writing data in nonvolatile storage medium
JP2001109666A (en) Non-volatile semiconductor storage device
JPH03259499A (en) Nonvolatile semiconductor memory device
JP3838401B2 (en) Nonvolatile memory and system
JPH05290585A (en) Nonvolatile memory writable electrically
JP2004030849A (en) Semiconductor nonvolatile memory having rewritable function for part of data
JPH10188577A (en) Semiconductor non-volatile memory
KR20000004214A (en) Method and circuit for erasing flash memory cell
JP3028567B2 (en) Microcomputer with built-in EEPROM
KR100965079B1 (en) Non volatiel memory device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050624

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050705

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050823

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20051129

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20051214

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees