JP2001318836A - Method for managing data of non-volatile memory - Google Patents

Method for managing data of non-volatile memory

Info

Publication number
JP2001318836A
JP2001318836A JP2000135833A JP2000135833A JP2001318836A JP 2001318836 A JP2001318836 A JP 2001318836A JP 2000135833 A JP2000135833 A JP 2000135833A JP 2000135833 A JP2000135833 A JP 2000135833A JP 2001318836 A JP2001318836 A JP 2001318836A
Authority
JP
Japan
Prior art keywords
data
volatile memory
area
ram
nonvolatile memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2000135833A
Other languages
Japanese (ja)
Other versions
JP4596602B2 (en
Inventor
Tanitake Hirano
平野晋健
Yasuhiro Ito
伊藤泰宏
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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co 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 Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2000135833A priority Critical patent/JP4596602B2/en
Publication of JP2001318836A publication Critical patent/JP2001318836A/en
Application granted granted Critical
Publication of JP4596602B2 publication Critical patent/JP4596602B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

PROBLEM TO BE SOLVED: To reduce the probability of data destruction, and to make it possible to restore data. SOLUTION: Data on a non-volatile memory are copied on a volatile memory (RAM) and updated, and a check code is calculated, and the updated data on the RAM and the check code are written altogether on the non-volatile memory so that the data can be rewritten, and the data are stored in the different areas of the non-volatile memory so as to be backed-up. Moroever, a back-up area is arranged in the non-volatile memory, and at the time of rewriting the data, the data before rewriting are copied on the back-up area, and the back-up area is initialized under a condition that the updating is normally operated.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、ICカードのよう
な携帯可能な情報処理装置に使用される不揮発性メモリ
を有するICモジュールにおける不揮発性メモリのデー
タ管理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data management method for a nonvolatile memory in an IC module having a nonvolatile memory used in a portable information processing device such as an IC card.

【0002】[0002]

【従来の技術】まず、ICモジュールが装填される例と
して、ICカードの機能について説明すると、図7に示
すように、リーダ/ライタ1からICカード2に対して
コマンド(命令)を送信し、これを受信したICカード
は、命令を解釈して書き込み/読み出し等の処理を実行
し、処理結果をレスポンスとしてリーダ/ライタ1へ返
すようになっている。
2. Description of the Related Art First, the function of an IC card will be described as an example in which an IC module is loaded. As shown in FIG. 7, a command (command) is transmitted from a reader / writer 1 to an IC card 2, The IC card that receives the instruction interprets the instruction, executes processing such as writing / reading, and returns the processing result to the reader / writer 1 as a response.

【0003】図8に示すように、ICカード2は、CP
U11、RAM12、ROM13、不揮発性メモリ14
を有しており、ROM12に記憶されているプログラム
をCPU11に読み込んでリーダ/ライタ1から送信さ
れる命令をI/Oポートを通して受信すると、命令とと
もに送信されたデータを読み込み、不揮発性メモリ14
内に格納されているデータを読み出して処理し、データ
更新してI/Oポートを通してリーダ/ライタ1に対し
てレスポンスを出力する。
As shown in FIG. 8, an IC card 2 has a CP
U11, RAM12, ROM13, nonvolatile memory 14
When a program stored in the ROM 12 is read into the CPU 11 and a command transmitted from the reader / writer 1 is received through the I / O port, the data transmitted with the command is read and the nonvolatile memory 14 is read.
It reads and processes the data stored in it, updates the data, and outputs a response to the reader / writer 1 through the I / O port.

【0004】ICカード内の不揮発性メモリにデータを
記憶させる場合には、通常、データの整合性を確認する
ためのチェックコードも同様にメモリ上に記憶させる。
そして、データの読み出し/書き込みの前には必ずこの
チェックコードとの整合性を確認し、整合がとれなかっ
た場合には、読み出し/書き込みを中止し、メモリ上の
データに異常が発生していることをリーダ/ライタへ知
らせている。
When data is stored in a nonvolatile memory in an IC card, a check code for confirming data consistency is also stored in the memory in the same manner.
Then, before reading / writing data, the consistency with the check code is always checked. If the consistency is not obtained, the reading / writing is stopped, and an error has occurred in the data on the memory. To the reader / writer.

【0005】[0005]

【発明が解決しようとする課題】従来、新規の書き込み
やデータの一部更新などデータをメモリへ書き込む際、
次の2段階に処理を分割している。 当該データを書き込む。 書き込んだデータのチェックコードを算出して所定の
位置に書き込む。 このようにメモリへのデータの書き込みを2回に分けて
行っているため、処理と処理の間で、供給電源が断
たれる等の事象が発生した場合には、データとそのチェ
ックコードの整合性が保たれなくなる。特に、非接触式
ICカードの場合にはリーダ/ライタに対して電波の領
域外に外れて供給電源が断たれるケースが起こる可能性
が大きい。このようなデータとチェックコードの整合性
が保たれていない場合は、データが信用できないため、
場合によっては読み出し/書き込みを中止する。
Conventionally, when writing data to a memory such as new writing or partial updating of data,
The processing is divided into the following two stages. Write the data. A check code of the written data is calculated and written to a predetermined position. As described above, the data writing to the memory is performed twice, so if an event such as a power supply cutoff occurs between the processes, the data and its check code are matched. Sex is not maintained. In particular, in the case of a non-contact type IC card, there is a high possibility that the power supply to the reader / writer goes out of the radio wave range and is cut off. If the data and check code are not consistent, the data cannot be trusted,
In some cases, the reading / writing is stopped.

【0006】本発明は上記課題を解決するためのもの
で、データとチェックコードの不一致というデータ破壊
の確率を低く抑えるとともに、壊れる前のデータを復元
できるようにすることを目的とする。
SUMMARY OF THE INVENTION The present invention has been made to solve the above problems, and has as its object to reduce the probability of data destruction due to mismatch between data and a check code, and to restore data before the destruction.

【0007】[0007]

【課題を解決するための手段】本発明は、図7、図8で
説明したICカード等に装填されるICモジュールに使
用される不揮発性メモリにおけるデータ管理方法であ
り、元のデータに上書きしてデータを記憶する際、不揮
発性メモリへの書き込み回数を減らして処理速度を向上
させ、データとチェックコードの不一致というデータ破
壊が起こる確率を低く抑え、さらにデータの破壊を検出
した際には、壊れる前のデータを復元できるようにした
ものである。
The present invention relates to a data management method in a nonvolatile memory used in an IC module mounted on an IC card or the like described with reference to FIGS. When storing data, the number of times of writing to the non-volatile memory is reduced to improve the processing speed, the probability of data destruction of mismatch between data and check code is reduced, and when data destruction is detected, It is designed to be able to restore the data before it was destroyed.

【0008】そのためのデータ管理方法を以下に説明す
る。 (a)不揮発性メモリ上のデータを書き換える際には、
揮発性メモリ(RAM)上に不揮発性メモリ上のデータ
を一旦コピーし、以下の手順で処理する。 RAM上のデータを更新し、チェックコードを算出す
る。さらに、算出したチェックコードもデータとともに
RAM上に格納する。 RAM上の更新したデータとチェックコードをまとめ
て不揮発性メモリ上に書き込み、データを1回の書き込
み処理で更新する。 この方法によれば、データの書き込み処理が1回になる
ため不揮発性メモリ上のデータの更新時間は従来に比し
て半分になり、データ破壊の確率を低く抑えることがで
きる。 (b)不揮発性メモリの異なる領域に同じデータを格納
してデータをバックアップする。データの持つ意味に応
じて次のミラー機能、バックアップ機能の2通りのバッ
クアップ方法を使い分ける。例えば、ミラー機能は常に
同じデータを2つもつため長いデータに使用するとメモ
リ容量を多く必要とするので、比較的短いデータに適用
し、バックアップ機能は長いデータに適用する。 (bー1)ミラー機能(同じデータを常に二重化する) データの整合性が確認できなかった場合、バックアッ
プデータを利用して不整合の発生しているデータを修正
する。 データの整合性が確認できなかった場合、バックアッ
プデータを参照する。 上記またはが発生している場合、データの書き換
えに際しては「不整合の発生しているデータ領域→整合
性のとれているデータ領域」の順で書き換えを行い、ま
ず壊れているデータから書き換え、壊れていないデータ
はなるべく書き換えずに読み出せることを優先する。 (bー2)バックアップ機能(メモリ上の特定作業領域
を利用する) (イ)データ書き込み方法 不揮発性メモリ上のデータを書き換える前に不揮発性
メモリの作業領域(バックアップ領域)にデータ(古い
データ)をコピーする。 RAM上の新しいデータをRAMから不揮発性メモリ
(書き込みデータ領域)にコピーしてデータを書き換え
る。 不揮発性メモリの作業領域を初期化して古いデータを
消去する。 (ロ)データ復元方法 不揮発性メモリの作業領域が初期化されていない(古
いデータが残っている)場合、(イ)のデータ書き込み
が完了していないため、作業領域の古いデータを利用し
て復元する。 不揮発性メモリの作業領域が初期化されている場合は
何もしない。(c)上記(b)に示したミラー機能、バ
ックアップ機能は、それぞれの機能の有効/無効をメモ
リ上の設定によって使い分けられるようにする。具体的
には、メモリ上に有効/無効を示すフラグ領域を設け、
処理に先立ってこのフラグを参照して有効/無効を判断
する。これは、ミラー機能の場合にはメモリを多く必要
とし、バックアップ機能の場合は書き換え回数が多くな
るので、必要に応じてこの機能を使ったり、使わなかっ
たりできるようにするためである。
A data management method for that purpose will be described below. (A) When rewriting data in the nonvolatile memory,
The data in the non-volatile memory is temporarily copied to the volatile memory (RAM) and processed according to the following procedure. The data on the RAM is updated and a check code is calculated. Further, the calculated check code is stored in the RAM together with the data. The updated data on the RAM and the check code are collectively written into the nonvolatile memory, and the data is updated by a single write process. According to this method, since the data write processing is performed once, the update time of the data in the nonvolatile memory is halved as compared with the related art, and the probability of data destruction can be reduced. (B) The same data is stored in different areas of the nonvolatile memory to back up the data. The following two backup methods, a mirror function and a backup function, are used depending on the meaning of the data. For example, since the mirror function always has two identical data and is used for long data, a large memory capacity is required for long data. Therefore, the mirror function is applied to relatively short data, and the backup function is applied to long data. (B-1) Mirror Function (Always Duplicating the Same Data) If data consistency cannot be confirmed, the inconsistent data is corrected using backup data. If data consistency cannot be confirmed, the backup data is referred to. If the above or has occurred, when rewriting data, rewrite data in the order of “data area where inconsistency has occurred → data area with consistency”. Priority is given to reading unwritten data without rewriting as much as possible. (B-2) Backup function (using a specific work area on the memory) (a) Data writing method Before rewriting data on the nonvolatile memory, data (old data) is stored in the work area (backup area) of the nonvolatile memory. Copy New data in the RAM is copied from the RAM to the nonvolatile memory (write data area) to rewrite the data. Initialize the work area of the non-volatile memory to erase old data. (B) Data restoration method If the work area of the non-volatile memory is not initialized (old data remains), the data writing in (b) is not completed, so use the old data in the work area. Restore. If the work area of the nonvolatile memory has been initialized, nothing is performed. (C) The mirror function and the backup function shown in (b) can be used depending on whether the function is valid or invalid depending on the setting on the memory. Specifically, a flag area indicating valid / invalid is provided on the memory,
Prior to processing, validity / invalidity is determined with reference to this flag. This is because the mirror function requires a large amount of memory and the backup function requires a large number of rewrites, so that this function can be used or not used as necessary.

【0009】[0009]

【発明の実施の形態】以下、本発明の実施の形態につい
て説明する。図1は不揮発性メモリにおける基本的なE
F(Elementary File )のデータ構造を示す図、図2は
不揮発性メモリの領域構造を説明する図である。ICカ
ード内のデータは図1に示すようなEFとして不揮発性
メモリ上に格納される。図1に示すディレクトリ情報
は、データの記憶位置(アドレス)を示すポインタPや
ファイル識別子等の集まりを表し、この情報の正当性を
保つブロック・チェック・コード(BCC1)とで構成
される。データは、ICカードを利用したシステムがI
Cカード内に格納しておきたい場所に格納され、格納さ
れたデータはブロック・チェック・コード(BCC2)
で正当性を保っている。
Embodiments of the present invention will be described below. FIG. 1 shows a basic E in a nonvolatile memory.
FIG. 2 is a diagram illustrating a data structure of F (Elementary File), and FIG. 2 is a diagram illustrating an area structure of a nonvolatile memory. The data in the IC card is stored in the nonvolatile memory as an EF as shown in FIG. The directory information shown in FIG. 1 represents a collection of a pointer P indicating a data storage position (address), a file identifier, and the like, and is constituted by a block check code (BCC1) for maintaining the validity of this information. Data is stored in a system using an IC card.
The data is stored in a place where it is desired to be stored in the C card, and the stored data is a block check code (BCC2).
The legitimacy is maintained.

【0010】通常、ICカードは、BCC2に不整合が
生じた場合は、上位システム(図7のリーダ/ライタ)
側に「データに間違いがあるかもしれない。」という警
告とともにデータを返送し、BCC1に不整合が生じた
場合は、ポインタの値も保障できないため「データが壊
れている」を意味するエラーを返送する。
Normally, when an inconsistency occurs in the BCC2, the IC card uses a higher-level system (reader / writer in FIG. 7).
Sends back data with a warning that "data may be incorrect." If BCC1 is inconsistent, the value of the pointer cannot be guaranteed and an error that means "data is corrupted" is returned. I will send it back.

【0011】そこで、ICカードの持つメモリ領域を図
2に示すような構造とする。このとき、図1のディレク
トリ情報を図2のPrimary 領域とSecondary 領域の2箇
所に書き込み、ミラー機能を実現する。つまり、Primar
y 領域とSecondary 領域の2箇所に同じディレクトリ情
報を格納してバックアップできるようにしておく。ディ
レクトリ情報は比較的短いため、このように2箇所の領
域を使っても多くのメモリ容量を必要とすることはな
い。
Accordingly, the memory area of the IC card has a structure as shown in FIG. At this time, the directory information of FIG. 1 is written into two places of the Primary area and the Secondary area of FIG. 2 to realize the mirror function. That is, Primar
Store the same directory information in two places, the y area and the secondary area, so that they can be backed up. Since the directory information is relatively short, a large amount of memory capacity is not required even if such two areas are used.

【0012】さらに、図1のデータを図2の書き込みデ
ータ領域に格納し、データを書き換えるときは、それに
先立ってデータをバックアップ領域にコピーした後、R
AM上のデータで上書きすることにより、バックアップ
機能を実現する。
Further, when the data of FIG. 1 is stored in the write data area of FIG. 2 and the data is rewritten, the data is copied to a backup area prior to the rewriting, and
A backup function is realized by overwriting with data on the AM.

【0013】次に、図3によりミラー機能における処理
フローを説明する。この処理は、ディレクトリ情報にア
クセスした際に実行される。まず、Primary 領域のEF
を検索し(ステップS1)、EFがあるか否か判断する
(ステップS2)。そして、EFを発見すると、Primar
y にBCCエラーがあるか否か判断する(ステップS
3)。BCCエラーがなくディレクトリ情報に正当性が
ある場合には、それをRAM上にコピーする(ステップ
S4)。そして、ミラー機能を確認し(ステップS
5)、ミラー機能が有効の場合、Primary の情報からSe
condary のアドレスを算出し(ステップS6)、次いで
Secondary にBCCエラーがあるか否か判断する(ステ
ップS7)。Secondary にBCCエラーがある場合、R
AMからSecondary にデータをコピーしてデータを復元
する(ステップS8)。ステップS5においてミラー機
能が無効の場合、ステップS7においてSecondary にB
CCエラーが無い場合、リターンし以降RAMを参照す
ることになる。ステップS3において、Primary にBC
Cエラーが有る場合、Primary のBCCエラーフラグを
セットし(ステップS9)、ステップS2において、Pr
imary のEFが発見できなかった場合、Primary のBC
Cエラーフラグをクリアし(ステップS10)、ミラー
機能を確認する(ステップS11)。ミラー機能が有効
の場合、Secondary のEFを検索し(ステップS1
2)、EFがあるか否か判断する(ステップS13)。
Secondary にBCCエラーが無い場合、Secondary のデ
ィレクトリ情報をRAMにコピーして(ステップS1
5)、Secondary の情報からPrimary のアドレスを算出
し、RAMからPrimary にデータをコピーしてデータを
復元する(ステップS17)。ステップS11において
ミラー機能が無効の場合、ステップS13においてEF
が発見できなかった場合、ステップS14においてSeco
ndary にBCCエラーが有る場合、Primary にBCCエ
ラーが有るか否か判断し(ステップS18)、BCCエ
ラーが無い場合(ステップS10でフラグクリア)はE
Fが存在しないことになり、エラーがある場合はディレ
クトリ情報が破壊されたことになる。
Next, a processing flow in the mirror function will be described with reference to FIG. This process is executed when accessing the directory information. First, the EF of the Primary area
(Step S1), and it is determined whether there is an EF (step S2). And when I discover EF,
It is determined whether or not y has a BCC error (step S
3). If there is no BCC error and the directory information is valid, it is copied onto the RAM (step S4). Then, the mirror function is confirmed (step S
5) If the mirror function is enabled, the Se
Calculate the address of condary (step S6), and then
It is determined whether there is a BCC error in Secondary (step S7). If there is a BCC error in Secondary, R
The data is copied from the AM to the Secondary to restore the data (step S8). If the mirror function is invalid in step S5, B is sent to Secondary in step S7.
If there is no CC error, the process returns and the RAM is referred to thereafter. In step S3, the BC is
If there is a C error, the primary BCC error flag is set (step S9), and in step S2, Pr is set.
If the imary EF could not be found, the Primary BC
The C error flag is cleared (step S10), and the mirror function is confirmed (step S11). If the mirror function is enabled, the secondary EF is searched (step S1).
2) It is determined whether there is an EF (step S13).
If there is no BCC error in Secondary, copy the directory information of Secondary to RAM (step S1).
5) The Primary address is calculated from the Secondary information, and the data is copied from the RAM to the Primary to restore the data (step S17). If the mirror function is invalid in step S11, EF is executed in step S13.
If no is found, in step S14 Seco
If there is a BCC error in the ndary, it is determined whether or not the Primary has a BCC error (step S18). If there is no BCC error (the flag is cleared in step S10), E is set.
F does not exist, and if there is an error, the directory information has been destroyed.

【0014】図4はミラー機能の処理フローを示す図で
ある。この処理は、RAM上に更新された新しいデータ
があり、これをメモリに書き込む際に行われる。まず、
ミラー機能を確認し(ステップS21)、有効の場合は
Primary のLRC(Longitudinal redundancy check )
エラーがあるか否か判断する(ステップS22)。エラ
ーがなくPrimary のデータが正しい場合は、RAM上の
データをSecondary 領域に書き込んで更新する(ステッ
プS23)。そして、Secondary 領域への書き込みエラ
ーが有るか否か判断し(ステップS24)、書き込みエ
ラーがない場合、Secondary に正しいデータが格納され
たので、Primary 領域も同じRAM上のデータで更新す
る(ステップS25)。また、ステップS21でミラー
機能が無効の場合も、RAM上のデータでPrimary 領域
を更新する。さらに、Primary 領域への書き込みエラー
が有るか否か判断し(ステップS26)、無ければ正常
終了する(ステップS27)。ステップS22におい
て、Primary にLRCエラーがある場合、Primary のデ
ータが壊れているのでRAM上のデータでPrimary 領域
を更新し(ステップS28)、Primary 領域への書き込
みエラーが有るか否か判断する(ステップS29)。書
き込みエラーがなければ、Primary に正しいデータが格
納されたので、Secondary 領域も同じRAM上のデータ
で更新する(ステップS30)。そしてSecondary 領域
への書き込みエラーがあるか否か判断し(ステップS3
1)、無ければ正常終了する。また、ステップS24、
ステップS26、ステップS29、ステップS31のい
ずれかで書き込みエラーがあった場合は異常終了となる
(ステップS32)。
FIG. 4 is a diagram showing a processing flow of the mirror function. This process is performed when there is updated new data in the RAM and this is to be written to the memory. First,
Check the mirror function (step S21), and if it is valid,
Primary LRC (Longitudinal redundancy check)
It is determined whether there is an error (step S22). If there is no error and the Primary data is correct, the data in the RAM is written to the Secondary area and updated (step S23). Then, it is determined whether or not there is a write error in the secondary area (step S24). If there is no write error, since the correct data has been stored in the secondary, the primary area is also updated with the data in the same RAM (step S25). ). Also, even when the mirror function is invalid in step S21, the Primary area is updated with the data on the RAM. Further, it is determined whether or not there is a write error in the Primary area (step S26), and if not, the process ends normally (step S27). If there is an LRC error in the Primary in step S22, the data in the Primary is corrupted, so the Primary area is updated with the data in the RAM (step S28), and it is determined whether there is an error in writing to the Primary area (step S22). S29). If there is no write error, since the correct data is stored in the Primary, the Secondary area is also updated with the data on the same RAM (step S30). Then, it is determined whether or not there is a write error in the secondary area (step S3).
1) If not, end normally. Step S24,
If there is a write error in any of steps S26, S29, and S31, the process ends abnormally (step S32).

【0015】図5はバックアップ機能におけるデータ書
き込み方法の処理フローを示す図である。この処理は、
バックアップするデータの不揮発性メモリ上のアドレス
と長さは引数として与えられる。まず、バックアップ機
能を確認し(ステップS41)、有効である場合、保存
するデータの先頭アドレスと長さをRAMにセットする
(ステップS42)。次いで保存するデータをRAMへ
コピーし(ステップS43)、RAMへコピーしたデー
タのLRCを求める(ステップS44)。次いで、バッ
クアップデータをRAMから不揮発性メモリのバックア
ップ領域へ書き込み(ステップS45)、書き込みエラ
ーがあるか否か判断する(ステップS46)。書き込み
エラーが無い場合、また、ステップS41でバックアッ
プ機能が無効の場合、書き込みデータ領域のデータをR
AM上のデータで更新する(ステップS47)。このと
き書き込みエラーがあるか否か判断し(ステップS4
8)、無ければバックアップ機能を確認し(ステップS
49)、バックアップ機能が有効であればバックアップ
領域を初期化し(ステップS50)、また、ステップS
49でバックアップ機能が無効であれば、正常終了とな
る(ステップS51)。ステップS46、ステップS4
8で書き込みエラーがあった場合、異常終了となる(ス
テップS52)。
FIG. 5 is a diagram showing a processing flow of a data writing method in the backup function. This process
The address and length of the data to be backed up in the non-volatile memory are given as arguments. First, the backup function is checked (step S41). If the backup function is valid, the start address and length of the data to be stored are set in the RAM (step S42). Next, the data to be stored is copied to the RAM (step S43), and the LRC of the data copied to the RAM is obtained (step S44). Next, the backup data is written from the RAM to the backup area of the nonvolatile memory (Step S45), and it is determined whether or not there is a write error (Step S46). If there is no write error, or if the backup function is disabled in step S41, the data in the write data area is
Update with the data on the AM (step S47). At this time, it is determined whether or not there is a write error (step S4).
8) If not, check the backup function (Step S)
49), if the backup function is valid, the backup area is initialized (step S50);
If the backup function is invalid at 49, the process ends normally (step S51). Step S46, Step S4
If there is a write error in step 8, the process ends abnormally (step S52).

【0016】図6はバックアップ機能におけるデータ復
元方法の処理フローを説明する図である。まず、バック
アップ機能を確認し(ステップS61)、有効の場合、
バックアップ領域が初期化状態か否か判断する(ステッ
プS62)。初期化状態でない場合、不揮発性メモリの
データ書き換えが完了していないので、バックアップデ
ータで復帰する必要がある。そこで、バックアップ領域
に残っているデータにLRCエラーがあるか否か判断す
る(ステップS63)。LRCエラーがない場合、この
バックアップデータは正当であり、これをRAMにセッ
トし(ステップS64)、バックアップデータのLRC
を算出する(ステップS65)。次いで、RAM上のバ
ックアップデータで不揮発性メモリのデータを書き換え
る(ステップS66)。このとき書き込みエラーがある
か否か判断し(ステップS67)、書き込みエラーが無
ければ、不揮発性メモリのデータ領域のデータが復帰し
たので、バックアップ領域を初期化する。ステップS6
1でバックアップ機能が無効のとき、ステップS62で
バックアップ領域が初期化状態のとき、ステップS63
でバックアップ領域にLRCエラーがあるとき、ステッ
プS67で書き込みエラーがあるとき、いずれも処理は
終了する。
FIG. 6 is a diagram for explaining the processing flow of the data restoration method in the backup function. First, the backup function is checked (step S61).
It is determined whether the backup area is in the initialized state (step S62). If it is not in the initialization state, the data rewriting of the non-volatile memory has not been completed, so it is necessary to restore with the backup data. Therefore, it is determined whether or not there is an LRC error in the data remaining in the backup area (step S63). If there is no LRC error, the backup data is valid and is set in the RAM (step S64), and the LRC of the backup data is set.
Is calculated (step S65). Next, the data in the nonvolatile memory is rewritten with the backup data in the RAM (step S66). At this time, it is determined whether or not there is a write error (step S67). If there is no write error, the data in the data area of the nonvolatile memory has been restored, so the backup area is initialized. Step S6
1 when the backup function is disabled, and when the backup area is in the initialized state in step S62, step S63
When there is an LRC error in the backup area, and when there is a write error in step S67, the process ends.

【0017】[0017]

【発明の効果】以上のように本発明によれば、不揮発性
メモリ上のデータを書き換える際には、RAM上に不揮
発性メモリ上のデータを一旦コピーし、RAM上のデー
タを更新し、チェックコードを算出した後、まとめて不
揮発性メモリ上に書き込むようにしたので、データを1
回の書き込み処理で更新することができ、不揮発性メモ
リ上のデータの更新時間は従来に比して半分になり、デ
ータ破壊の確率を低く抑えることができる。また、同じ
データを常に二重化するミラー機能、メモリ上の特定作
業領域を利用するバックアップ機能を備え、これらの機
能を適宜使いわけることにより、壊れる前のデータを復
元することができる。
As described above, according to the present invention, when rewriting data in a non-volatile memory, the data in the non-volatile memory is temporarily copied to the RAM, and the data in the RAM is updated and checked. After calculating the code, the data was written to the non-volatile memory all at once.
The data can be updated in one writing process, and the update time of the data in the non-volatile memory is halved as compared with the related art, so that the probability of data destruction can be reduced. In addition, a mirror function for always duplicating the same data and a backup function for using a specific work area on a memory are provided. By properly using these functions, data before corruption can be restored.

【図面の簡単な説明】[Brief description of the drawings]

【図1】 不揮発性メモリにおけるEFのデータ構造を
説明する図である。
FIG. 1 is a diagram illustrating a data structure of an EF in a nonvolatile memory.

【図2】 不揮発性メモリの領域を説明する図である。FIG. 2 is a diagram illustrating an area of a nonvolatile memory.

【図3】 ミラー機能の処理フローを説明する図であ
る。
FIG. 3 is a diagram illustrating a processing flow of a mirror function.

【図4】 ミラー機能の処理フローを説明する図であ
る。
FIG. 4 is a diagram illustrating a processing flow of a mirror function.

【図5】 バックアップ機能のデータ書き込み方法を説
明する図である。
FIG. 5 is a diagram illustrating a data writing method of a backup function.

【図6】 バックアップ機能のデータ復元方法を説明す
る図である。
FIG. 6 is a diagram illustrating a data restoration method of a backup function.

【図7】 リーダ/ライタとICカードの通信を説明す
る図である。
FIG. 7 is a diagram illustrating communication between a reader / writer and an IC card.

【図8】 ICカードの構成を説明する図である。FIG. 8 is a diagram illustrating a configuration of an IC card.

【符号の説明】[Explanation of symbols]

1…リーダ/ライタ、2…ICカード、11…CPU、
12…RAM、13…ROM、14…不揮発性メモリ、
P…ポインタ。
1 ... reader / writer, 2 ... IC card, 11 ... CPU,
12 RAM, 13 ROM, 14 nonvolatile memory,
P ... pointer.

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 不揮発性メモリに格納されたデータを書
き換える際、不揮発性メモリ上のデータを揮発性メモリ
(RAM)上にコピーして更新した後チェックコードを
算出し、RAM上の更新したデータとチェックコードを
まとめて不揮発性メモリ上に書き込むことによりデータ
書き換えを行うことを特徴とする不揮発性メモリのデー
タ管理方法。
When rewriting data stored in a non-volatile memory, the data in the non-volatile memory is copied to a volatile memory (RAM), updated, a check code is calculated, and the updated data in the RAM is calculated. And rewriting data by writing the check code and the check code together on the non-volatile memory.
【請求項2】 不揮発性メモリの異なる領域に同じデー
タを格納し、一方の領域のデータに不整合が発生したと
き、他方の領域のデータをRAM上にコピーした後、該
RAM上のデータを不整合が発生した領域にコピーする
ことにより不整合の発生したデータを修正することを特
徴とする不揮発性メモリのデータ管理方法。
2. The same data is stored in different areas of a non-volatile memory, and when data in one area becomes inconsistent, data in the other area is copied onto a RAM, and then the data on the RAM is copied. A data management method for a non-volatile memory, wherein data in which inconsistency has occurred is corrected by copying the data in an area in which inconsistency has occurred.
【請求項3】 前記データはディレクトリ情報であるこ
とを特徴とする請求項2記載の不揮発性メモリのデータ
管理方法。
3. The data management method according to claim 2, wherein the data is directory information.
【請求項4】 不揮発性メモリにバックアップ領域を設
け、不揮発性メモリのデータを書き換える際、書き換え
前のデータをバックアップ領域にコピーし、RAM上の
新しいデータで不揮発性メモリのデータを更新し、更新
が正常に行われたことを条件にバックアップ領域を初期
化することを特徴とする不揮発性メモリのデータ管理方
法。
4. A backup area is provided in a nonvolatile memory, and when rewriting data in the nonvolatile memory, data before rewriting is copied to the backup area, and the data in the nonvolatile memory is updated with new data in the RAM. A data management method for a non-volatile memory, wherein a backup area is initialized on the condition that the operation is normally performed.
【請求項5】 前記バックアップ領域が初期化されてい
ないとき、バックアップ領域のデータにより不揮発性メ
モリのデータを復元することを特徴とする請求項4記載
の不揮発性メモリのデータ管理方法。
5. The data management method for a nonvolatile memory according to claim 4, wherein when the backup area is not initialized, the data in the nonvolatile memory is restored using the data in the backup area.
【請求項6】 前記データは比較的長いデータからなる
ことを特徴とする請求項4または5記載の不揮発性メモ
リのデータ管理方法。
6. The data management method for a nonvolatile memory according to claim 4, wherein said data comprises relatively long data.
【請求項7】 不揮発性メモリに処理を実行するか否か
のフラグ領域を設け、該フラグがセットされていること
を条件に処理を実行することを特徴とする請求項2乃至
6いずれか記載の不揮発性メモリのデータ管理方法。
7. The nonvolatile memory according to claim 2, wherein a flag area for determining whether or not to execute the processing is provided, and the processing is executed on condition that the flag is set. Non-volatile memory data management method.
JP2000135833A 2000-05-09 2000-05-09 Nonvolatile memory data management method Expired - Lifetime JP4596602B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000135833A JP4596602B2 (en) 2000-05-09 2000-05-09 Nonvolatile memory data management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000135833A JP4596602B2 (en) 2000-05-09 2000-05-09 Nonvolatile memory data management method

Publications (2)

Publication Number Publication Date
JP2001318836A true JP2001318836A (en) 2001-11-16
JP4596602B2 JP4596602B2 (en) 2010-12-08

Family

ID=18643863

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000135833A Expired - Lifetime JP4596602B2 (en) 2000-05-09 2000-05-09 Nonvolatile memory data management method

Country Status (1)

Country Link
JP (1) JP4596602B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100565807B1 (en) * 2003-06-18 2006-03-29 삼성전자주식회사 Method for initializing electronical device
US7117335B2 (en) * 2003-10-01 2006-10-03 Bosch Rexroth Ag Method of and apparatus for controlling of regulating industrial processes
JP2012198704A (en) * 2011-03-18 2012-10-18 Fujitsu Ltd Storage apparatus, control apparatus, and storage apparatus control method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04145596A (en) * 1990-10-08 1992-05-19 Fuji Photo Film Co Ltd Memory card and data management system therefor
JPH07122087A (en) * 1993-10-25 1995-05-12 Hitachi Ltd Eeprom error check system
JPH0830515A (en) * 1994-07-20 1996-02-02 Toshiba Corp Data processor using flash eeprom
JPH08190510A (en) * 1995-01-12 1996-07-23 Hitachi Ltd Information processor capable of mounting semiconductor memory including defective part

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04145596A (en) * 1990-10-08 1992-05-19 Fuji Photo Film Co Ltd Memory card and data management system therefor
JPH07122087A (en) * 1993-10-25 1995-05-12 Hitachi Ltd Eeprom error check system
JPH0830515A (en) * 1994-07-20 1996-02-02 Toshiba Corp Data processor using flash eeprom
JPH08190510A (en) * 1995-01-12 1996-07-23 Hitachi Ltd Information processor capable of mounting semiconductor memory including defective part

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100565807B1 (en) * 2003-06-18 2006-03-29 삼성전자주식회사 Method for initializing electronical device
US7117335B2 (en) * 2003-10-01 2006-10-03 Bosch Rexroth Ag Method of and apparatus for controlling of regulating industrial processes
JP2012198704A (en) * 2011-03-18 2012-10-18 Fujitsu Ltd Storage apparatus, control apparatus, and storage apparatus control method
US9146803B2 (en) 2011-03-18 2015-09-29 Fujitsu Limited Storage apparatus, control apparatus, and storage apparatus control method

Also Published As

Publication number Publication date
JP4596602B2 (en) 2010-12-08

Similar Documents

Publication Publication Date Title
JP4037605B2 (en) Nonvolatile memory unit controller, memory system having the controller, and nonvolatile memory unit control method
RU2146399C1 (en) Method for data storage in non-volatile memory unit, method for using integral circuit device, and integral circuit device
US6845434B2 (en) Method for updating parametric data for use in data management system
JP2914360B2 (en) External storage device and data processing method
US7694094B2 (en) Transaction method for managing the storing of persistent data in a transaction stack
US5869823A (en) Method and system for improving the integrity of data on a smartcard
KR970062904A (en) Database recovery method using double-sided nonvolatile memory and method thereof
JP2846739B2 (en) Method for safely updating EEPROM memory
US6430662B1 (en) Method and device for changing memory contents in a control unit, especially of a motor vehicle
KR100746198B1 (en) Apparatus and method for storing data, and readable recording medium thereof
US6483746B2 (en) Electronic apparatus
KR20000048112A (en) Flash memory unit and control method of flash memory
JP3003619B2 (en) Apparatus internal setting information backup apparatus and method, and storage medium storing apparatus internal setting information backup control program
JP2009048557A (en) Data update device, data update method, and data update program
JP2005222202A (en) Data protection method for nonvolatile storage device
JP4596602B2 (en) Nonvolatile memory data management method
JP3376331B2 (en) Storage method using flash memory and storage medium storing storage control program
JP3082344B2 (en) Disk file control device and update method
US7849279B2 (en) Method for the secure updating data areas in non volatile memory, device to perform such a method
JPH06180674A (en) Data storage device
JP4031693B2 (en) Nonvolatile memory and data storage device having the same
KR100628176B1 (en) Method for upgrading program stored in information terminal
KR100575927B1 (en) Method for booting the nand flash memory using multi boot loader in mobile station
JP2004265275A (en) Ic card and ic card program
JP2012027806A (en) Memory managing device and memory managing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070131

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091120

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100119

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100709

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100830

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: 20100917

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100921

R150 Certificate of patent or registration of utility model

Ref document number: 4596602

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131001

Year of fee payment: 3

EXPY Cancellation because of completion of term