JPH09297830A - Ic card - Google Patents

Ic card

Info

Publication number
JPH09297830A
JPH09297830A JP8110913A JP11091396A JPH09297830A JP H09297830 A JPH09297830 A JP H09297830A JP 8110913 A JP8110913 A JP 8110913A JP 11091396 A JP11091396 A JP 11091396A JP H09297830 A JPH09297830 A JP H09297830A
Authority
JP
Japan
Prior art keywords
data
sector
connection information
data storage
diagnostic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8110913A
Other languages
Japanese (ja)
Inventor
Seiji Hirano
誠治 平野
Fumihiro Takayama
文博 高山
Kenichi Yamaoka
憲一 山岡
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.)
Toppan Inc
Original Assignee
Toppan 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 Toppan Printing Co Ltd filed Critical Toppan Printing Co Ltd
Priority to JP8110913A priority Critical patent/JPH09297830A/en
Publication of JPH09297830A publication Critical patent/JPH09297830A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To shorten the wait time at the time of resetting of the IC card, and reduce the influence of a defect that a nonvolatile data storage means has after data writing. SOLUTION: A CPU 1 which executes a program stored in a ROM 2 performs a diagnostic process for a ROM 2, a diagnostic process for an EEPROM 4, and a repairing process for the EEPROM 4 only when receiving a self-diagnostic process command. Further, the CPU 1 diagnoses the SUM of respective sectors constituting a data storage area of the EEPROM 4 and connection information on the order of the respective sectors through the diagnostic process for the EEPROM 4, and repairs the SUM and connection information through the subsequent repairing process. Further, the CPU 1 determines the mode of the repair in the repairing process for the EEPROM 4 according to the parameters of the command and performs the repairing process in the corresponding mode.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、EEPROMやF
RAM等の不揮発性データ記憶手段を複数のセクタに分
割しこれら複数のセクタにまたがってファイルを格納す
るICカードにおいて、メモリ不良によってICカード
が使用不能となるのを抑制するICカードに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an EEPROM or F
The present invention relates to an IC card that divides a non-volatile data storage unit such as a RAM into a plurality of sectors and stores files across the plurality of sectors and that prevents the IC card from becoming unusable due to memory failure.

【0002】[0002]

【従来の技術】従来より、メモリ不良の検出機能を有す
るICカードが開発されている。例えば、不揮発性デー
タ記憶手段の特定領域に格納されたファイル制御用の情
報(例えば、ディレクトリ情報)をリセット直後にチェ
ックし、このチェック結果がエラーであれば、外部機器
(上位システム)に対して当該情報にエラーが発生した
旨のデータを返送するICカードが存在する。また、I
Cカード活性化後にPROMに格納されたプログラムコ
ードに対してチェック用のSUMを付加し、リセット直
後にプログラムコードのチェックを行うようにしたカー
ドも存在する。
2. Description of the Related Art Conventionally, an IC card having a function of detecting a memory defect has been developed. For example, the file control information (for example, directory information) stored in the specific area of the non-volatile data storage unit is checked immediately after reset, and if the check result is an error, the external device (upper system) is checked. There is an IC card that returns data indicating that an error has occurred in the information. Also, I
There is also a card in which a SUM for checking is added to the program code stored in the PROM after the activation of the C card, and the program code is checked immediately after resetting.

【0003】また、不揮発性データ記憶手段の不良を検
出し、この不良を自動的に修復する機能を有するICカ
ードも存在する。この種のICカードでは、不揮発性デ
ータ記憶手段のあるセクタに不良が発生してもICカー
ド全体が使用不能とならないよう不良セクタを使用不可
としてロックし、この不良セクタをスキップしてデータ
を書き込むという処理が行われている。こうして書き込
まれたデータは、ロックされた使用不可セクタを自動的
にスキップして正しく連続するよう読み出される。
There is also an IC card having a function of detecting a defect in the nonvolatile data storage means and automatically repairing the defect. In this type of IC card, the defective sector is locked as unusable so that the entire IC card is not disabled even if a defect occurs in a certain sector of the nonvolatile data storage means, and the defective sector is skipped to write data. Is being processed. The data written in this way is automatically skipped over the locked unusable sectors and is read so as to be correctly contiguous.

【0004】[0004]

【発明が解決しようとする課題】ところで、近年、RA
M、PROM、EEPROM、FRAM等の半導体素子
の信頼性は極めて向上しており、以前のようにリセット
処理毎にチェックする必要はなくなってきている。しか
しながら、従来のICカードでは、上述したように、デ
ィレクトリ情報のチェック処理およびプログラムコード
のチェック処理を、いずれもリセット直後に自動的かつ
強制的に行っている。
By the way, in recent years, RA
The reliability of semiconductor devices such as M, PROM, EEPROM, and FRAM has been extremely improved, and it is no longer necessary to check each reset process as before. However, in the conventional IC card, both the directory information check process and the program code check process are automatically and forcibly performed immediately after reset as described above.

【0005】もちろん、リセット毎に必ず上記チェック
を行うようにしてもよいが、当該チェック処理の間、外
部機器はICカードからの返信(ATR:Answer To Re
turn)を待っていなければならない。発生する確率が極
めて低いメモリ不良の有無を確認するだけのために必ず
少なからぬ時間だけ処理が停滞してしまうのである。ま
た、データ書き込み時に不揮発性データ記憶手段の不良
セクタをロックする従来のICカードでは、データを書
き込んだ後にメモリ不良が発生した場合、この不良セク
タをロックしスキップすることができず、当該不良セク
タ以降のデータを正常に読み出すことができなくなる。
Of course, the above check may be carried out every reset, but during the check process, the external device sends a reply (ATR: Answer To Re) from the IC card.
turn). Processing is always delayed for a considerable amount of time just to confirm whether or not there is a memory defect with a very low probability of occurrence. Further, in the conventional IC card which locks the defective sector of the non-volatile data storage means at the time of writing data, when a memory defect occurs after writing the data, this defective sector cannot be locked and skipped, and the defective sector concerned. Subsequent data cannot be read normally.

【0006】本発明はこのような背景の下になされたも
ので、リセット時の待ち時間を短縮するとともに、デー
タ書き込み後に不揮発性データ記憶手段に生じた不良に
よる影響を低減することができるICカードを提供する
ことを目的としている。
The present invention has been made under such a background, and it is possible to reduce the waiting time at the time of resetting and to reduce the influence of a defect generated in the non-volatile data storage means after data writing. Is intended to provide.

【0007】[0007]

【課題を解決するための手段】上述した課題を解決する
ために、請求項1記載の発明は、プログラムを格納した
第1の不揮発性データ記憶手段と、データを記憶する第
2の不揮発性データ記憶手段と、外部機器との間でデー
タを送受する通信手段と、前記第1の不揮発性データ記
憶手段に格納されたプログラムに基づいて、前記通信手
段を介して受信した命令を実行するとともに、命令の実
行結果を前記通信手段を介して外部へ送信する処理手段
とを具備したICカードであって、前記処理手段は、前
記第1の不揮発性データ記憶手段に格納されたプログラ
ム中に記述された、前記第1の不揮発性データ記憶手段
に対する診断処理、前記第2の不揮発性データ記憶手段
に対する診断処理、および前記第2の不揮発性データ記
憶手段の修復処理のうち、前記通信手段を介して受信し
た命令に対応した処理を選択実行することを特徴として
いる。
In order to solve the above-mentioned problems, the invention according to claim 1 is the first non-volatile data storage means for storing a program, and the second non-volatile data for storing the data. A storage unit, a communication unit that transmits and receives data to and from an external device, and a command received via the communication unit based on a program stored in the first nonvolatile data storage unit, and An IC card comprising a processing means for transmitting an execution result of an instruction to the outside via the communication means, wherein the processing means is described in a program stored in the first non-volatile data storage means. Also, a diagnostic process for the first non-volatile data storage means, a diagnostic process for the second non-volatile data storage means, and a repair process for the second non-volatile data storage means. Among them, it is characterized in that selecting executing processing corresponding to commands received via the communication means.

【0008】また、請求項2記載の発明は、請求項1記
載のものにおいて、前記第2の不揮発性データ記憶手段
は複数のセクタから構成され、かつ複数のセクタに連続
してデータが記憶されてなる場合において、前記セクタ
は実データと該実データに対応した診断用データを含
み、前記処理手段は、前記第2の不揮発性データ記憶手
段の修復処理の選択実行により、実データと診断用デー
タとの対応関係が異常とされたセクタの診断用データを
再設定することを特徴としている。
According to a second aspect of the present invention, in the first aspect, the second non-volatile data storage means is composed of a plurality of sectors, and data is continuously stored in the plurality of sectors. In this case, the sector includes real data and diagnostic data corresponding to the real data, and the processing unit selects the restoration process of the second non-volatile data storage unit to execute real data and diagnostic data. It is characterized by resetting the diagnostic data of a sector whose correspondence with the data is abnormal.

【0009】さらに、請求項3記載の発明は、請求項2
記載のものにおいて、前記セクタは実データと、セクタ
の順序を表す繋ぎ情報と、実データおよび繋ぎ情報に対
応した診断用データとを含み、前記処理手段は、実デー
タおよび繋ぎ情報と診断用データとの対応関係が正常と
されたセクタの繋ぎ情報の整合性を診断するとともに、
この診断結果を前記通信手段を介して外部機器へ送信す
ることを特徴としている。
Further, the invention according to claim 3 is the invention according to claim 2.
In the described one, the sector includes actual data, connection information indicating the order of the sectors, and actual data and diagnostic data corresponding to the connection information, and the processing means includes the actual data, the connection information, and the diagnostic data. While diagnosing the consistency of the connection information of the sector whose correspondence with is normal,
The diagnostic result is transmitted to an external device via the communication means.

【0010】また、請求項4記載の発明は、請求項2記
載のものにおいて、前記セクタは実データと、セクタの
順序を表す繋ぎ情報と、実データおよび繋ぎ情報に対応
した診断用データとを含み、前記処理手段は、実データ
および繋ぎ情報と診断用データとの対応関係が正常とさ
れたセクタの繋ぎ情報の整合性を診断するとともに、こ
の診断結果において整合性がとれていないとされたセク
タの繋ぎ情報を修復し、該セクタの診断用データを再設
定することを特徴としている。
Further, in the invention according to claim 4, in the invention according to claim 2, the sector includes real data, connection information indicating an order of the sectors, and real data and diagnostic data corresponding to the connection information. In addition, the processing means diagnoses the consistency of the connection information of the sector for which the correspondence between the actual data and the connection information and the diagnostic data is normal, and the result of this diagnosis is not consistent. It is characterized in that the connection information of the sector is restored and the diagnostic data of the sector is reset.

【0011】[0011]

【発明の実施の形態】以下、図面を参照して、本発明の
一実施形態について説明する。図1は本発明の一実施形
態によるICカードの構成を示す図である。この図にお
いて1はCPU(中央処理装置)であり、CPU1に実
行されるプログラムを格納したROM(Read Only Memo
ry)2、コマンドデータの一時格納領域やCPU1の作
業領域等として使用されるRAM(Random Access Memo
ry、揮発性メモリ)3、EEPROM(Electrically Er
asable Programmable ROM)4と所定幅のバスを介して接
続されている。このCPU1は、図示せぬICカード端
子部(通信手段)から供給されるVcc(電源電圧)、
RST信号(リセット信号)、CLK信号(クロック信
号)に基づいて、ROM2に格納されたプログラムを読
み出し実行し、RAM3およびEEPROM4に対して
データの書き込み及び読み出しを行うとともに、I/O
インタフェースを介して外部機器との間でデータ(図中
I/Oで表される)を送受する。
An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a diagram showing a configuration of an IC card according to an embodiment of the present invention. In the figure, reference numeral 1 denotes a CPU (Central Processing Unit), which is a ROM (Read Only Memo) storing a program executed by the CPU 1.
ry) 2, a RAM (Random Access Memo) used as a temporary storage area for command data, a work area for the CPU 1, etc.
ry, volatile memory) 3, EEPROM (Electrically Er
asable Programmable ROM) 4 via a bus of a predetermined width. The CPU 1 has a Vcc (power supply voltage) supplied from an IC card terminal section (communication means) (not shown),
A program stored in the ROM 2 is read out and executed based on the RST signal (reset signal) and the CLK signal (clock signal) to write and read data to and from the RAM 3 and the EEPROM 4, and I / O.
Data (represented by I / O in the figure) is transmitted / received to / from an external device via the interface.

【0012】ROM2(第1の不揮発性データ記憶手
段)としては、マスクROM、PROM(Programmable
ROM)、EPROMが用いられ、予め所望のプログラム
が格納される。また、第2の不揮発性データ記憶手段と
してEEPROM4を用いる構成を示したが、これに限
らず、例えば、SRAM(Static RAM)にバッテリを組
み合わせて不揮発性データ記憶手段を構成し、これを不
揮発性データ記憶手段として用いてもよいし、FRAM
(Flash RAM)を用いてもよい。なお、ROM2,RA
M3,EEPROM4のデータ記憶領域を以後、それぞ
れROM領域、RAM領域、EEPROM領域と称す。
The ROM 2 (first non-volatile data storage means) is a mask ROM or PROM (Programmable
ROM) and EPROM are used to store a desired program in advance. Further, although the configuration in which the EEPROM 4 is used as the second non-volatile data storage means is shown, the present invention is not limited to this, and the non-volatile data storage means is configured by combining an SRAM (Static RAM) with a battery, for example. It may be used as a data storage means or FRAM.
(Flash RAM) may be used. ROM2, RA
The data storage areas of the M3 and the EEPROM 4 are hereinafter referred to as a ROM area, a RAM area and an EEPROM area, respectively.

【0013】上記構成のICカードは、通常、ICカー
ドリーダライタに挿入された状態でこのICカードリー
ダライタに接続されたコンピュータにアクセスされるも
のである。本明細書中では、上記ICカードリーダライ
タとコンピュータを含めて外部機器と呼ぶ。
The IC card having the above structure is normally accessed by a computer connected to the IC card reader / writer while being inserted into the IC card reader / writer. In the present specification, the IC card reader / writer and the computer are referred to as an external device.

【0014】次に、上記構成のICカードが行う処理に
ついて説明する。ただし、以降の説明において、処理の
主体が省略されている場合には、CPU1が主体である
ものとする。ICカードは、Vcc、CLK信号が供給
された状態でRST信号を受信することによって活性化
し、ATR情報を送出する(ISO 7816)。そし
て、この活性化後、外部機器から送信されたデータブロ
ック(コマンド等)に対して図2に示されるような処理
を行う。
Next, the processing performed by the IC card having the above configuration will be described. However, in the following description, if the main body of processing is omitted, the CPU 1 is the main body. The IC card is activated by receiving the RST signal in the state where the Vcc and CLK signals are supplied, and sends the ATR information (ISO 7816). After the activation, the data block (command or the like) transmitted from the external device is processed as shown in FIG.

【0015】図2は上記ICカードにおけるアクセス処
理のフローチャートであり、この図に示されるように、
ステップSA1では、外部機器から送信されたデータブ
ロックを受信するまで待機処理が行われる。データブロ
ックを受信すると、当該データブロックが正しい書式で
あるか否かが判断され(ステップSA2,SA3)、正
しい書式であると判断された場合には、当該データブロ
ックに含まれるコマンドを処理し(ステップSA4)、
その処理結果からなるレスポンスを外部機器へ返送する
(ステップSA5)。逆に、ステップSA2,SA3に
おいて正しい書式ではないと判断された場合には、エラ
ー処理を行い(ステップSA6)、正しい書式ではない
旨のレスポンスを外部機器へ返送する(ステップSA
5)。なお、ICカードと外部機器との間の通信制御は
上述したブロック単位でもよいし、キャラクタ単位でも
よい。要するに、ステップSA2の段階でブロック単位
になっていれば良いのである。
FIG. 2 is a flow chart of access processing in the IC card, and as shown in this figure,
In step SA1, standby processing is performed until the data block transmitted from the external device is received. When the data block is received, it is determined whether or not the data block is in the correct format (steps SA2 and SA3), and when it is determined that the format is correct, the command included in the data block is processed ( Step SA4),
A response including the processing result is returned to the external device (step SA5). On the contrary, if it is determined in steps SA2 and SA3 that the format is not correct, error processing is performed (step SA6) and a response indicating that the format is not correct is returned to the external device (step SA).
5). The communication control between the IC card and the external device may be performed in the above-described block unit or in character units. In short, it suffices if it is in block units at the stage of step SA2.

【0016】図3は自己診断処理コマンドの処理を示す
フローチャートであり、この図に示される処理は、図2
において、受信したデータブロックが自己診断処理コマ
ンドを含んでいる場合のステップSA4の処理に相当す
る。自己診断処理コマンドの処理では、まず、ROM2
に格納されたプログラムコードのチェックを行うか否か
が判断される(ステップSB1)。この判断は、コマン
ドに付加されたスイッチ(パラメータ)に基づいてなさ
れる。ここで、図9を参照し、自己診断処理コマンドの
書式について説明する。
FIG. 3 is a flow chart showing the processing of the self-diagnosis processing command, and the processing shown in this figure is as shown in FIG.
In, the process corresponds to the process of step SA4 when the received data block includes the self-diagnosis process command. In the processing of the self-diagnosis processing command, first, the ROM 2
It is determined whether to check the program code stored in (step SB1). This judgment is made based on the switch (parameter) added to the command. Here, the format of the self-diagnosis processing command will be described with reference to FIG.

【0017】図9は本実施形態で使用される自己診断処
理コマンドの書式の一例を示す図であり、この例の自己
診断処理コマンドは、予約語“CHECK”とこれに続
く省略可能なパラメータP1,P2とからなる。パラメ
ータP1は値00、01、02をとり得るものであり、
それぞれ、ROM2のチェック処理、EEPROM4の
繋ぎ情報のチェック処理、EEPROM4の修復処理
(後述する)を意味している。また、パラメータP2は
修復処理の態様を表しており、値00、01をとり得る
ものであり、それぞれ、後述する強制修復処理、通常の
修復処理を意味している。よって、例えば、“CHEC
K /00”というコマンドは、ROM2のチェック処
理のみを行うコマンドとして処理される。なお、各パラ
メータは省略可能であり、ここでは、パラメータP1が
省略された場合にはROM2のチェック処理、パラメー
タP2が省略された場合には通常の修復処理が選択され
たものとして処理するよう設定されている。
FIG. 9 is a diagram showing an example of the format of the self-diagnosis processing command used in this embodiment. The self-diagnosis processing command in this example is a reserved word "CHECK" followed by an optional parameter P1. , P2. The parameter P1 can take the values 00, 01, 02,
These respectively mean a check process of the ROM 2, a check process of connection information of the EEPROM 4, and a repair process of the EEPROM 4 (described later). The parameter P2 represents the mode of the repair process, and can take the values 00 and 01, which means the forced repair process and the normal repair process, which will be described later, respectively. So, for example, "CHEC
The command "K / 00" is processed as a command for performing only the checking process of the ROM2. Each parameter can be omitted. In this case, when the parameter P1 is omitted, the checking process of the ROM2 and the parameter P2 are performed. When is omitted, the normal repair process is set to be processed as selected.

【0018】ROM2のチェック処理においては、RO
M2に格納されたプログラムコードと診断用データとし
てプログラムコードに付記されたSUMチェック(合計
検査)用コード(以後、SUMと称す)を0番地から最
終番地まで加算し(図3のステップSB2)、その合計
が0であるか否かを判断する。なお、SUMは、ROM
2の0番地から最終番地までの合計が0となるよう予め
ROM2に書き込まれているので、ROM2にメモリ不
良がなければ、上記合計は必ず0になる。
In the checking process of ROM2, RO
The program code stored in M2 and a SUM check (total check) code (hereinafter referred to as SUM) added to the program code as diagnostic data are added from address 0 to the final address (step SB2 in FIG. 3), It is determined whether or not the total is zero. The SUM is a ROM
Since the data from 0 to the final address of 2 are written in the ROM 2 in advance so that the total is 0, the above total is always 0 unless the ROM 2 has a memory defect.

【0019】ROM2の0番地から最終番地までの合計
が0であった場合、すなわちROM2が正常であると判
断された場合、チェック処理が正常終了した旨のレスポ
ンスを生成する(ステップSB3,SB4)。逆に、上
記合計が0でなく、ROM2にメモリ不良が発生したと
判断された場合、チェック処理が異常終了した旨のレス
ポンス(エラーレスポンス)を生成する(ステップSB
3,SB5)。こうして生成されたレスポンスは図2の
ステップSA5において外部機器へ返送される。
When the total of the addresses 0 to the final address of the ROM 2 is 0, that is, when the ROM 2 is determined to be normal, a response indicating that the check process is normally completed is generated (steps SB3 and SB4). . On the other hand, if the above total is not 0 and it is determined that a memory failure has occurred in the ROM 2, a response (error response) indicating that the check processing has ended abnormally is generated (step SB).
3, SB5). The response thus generated is returned to the external device in step SA5 of FIG.

【0020】また、ステップSB1において、パラメー
タP1が00でなく、ROM2のチェック処理を行わな
いと判断した場合には、EEPROM4の各セクタに記
憶された繋ぎ情報のチェック処理を行う(ステップSB
6)。繋ぎ情報のチェック処理は図4に示される処理で
あるが、ここでは、まず、図8(a)および図8(b)
を参照してEEPROM4のデータ構造について説明
し、次に繋ぎ情報のチェック処理について説明する。
When it is determined in step SB1 that the parameter P1 is not 00 and the check processing of the ROM2 is not performed, the connection information stored in each sector of the EEPROM 4 is checked (step SB).
6). The connection information check processing is the processing shown in FIG. 4, but here, first, in FIG. 8A and FIG. 8B.
The data structure of the EEPROM 4 will be described with reference to FIG.

【0021】図8(a)および図8(b)は、それぞれ
EEPROM4のデータ構造を概念的に示す図である。
これらの図において、16進表現で00、01、…、F
Fと番号が付された行はEEPROM領域内のセクタに
対応しており、各セクタには実データ領域、前セクタ領
域、後セクタ領域、およびSUM領域が設けられてい
る。実データ領域にはファイル等のデータ実体、前セク
タ領域には当該セクタの直前に位置するセクタの番号
(以後、前セクタ番号と称す)、後セクタ領域には当該
セクタの直後に位置するセクタの番号(以後、後セクタ
番号と称す)が格納されており、先頭セクタの前セクタ
番号および最終セクタの後セクタ番号はともに00にな
っている。なお、先頭セクタの前セクタ番号をFFとし
てEEPROM領域をリング状に構成してもよい。ま
た、SUM領域には当該セクタのデータ実体、前セクタ
番号、および後セクタ番号との和が0になるSUMが格
納されている。
FIGS. 8A and 8B are diagrams conceptually showing the data structure of the EEPROM 4, respectively.
In these figures, hexadecimal notation 00, 01, ..., F
The rows numbered F correspond to the sectors in the EEPROM area, and each sector has an actual data area, a front sector area, a rear sector area, and a SUM area. The actual data area is the data entity such as a file, the front sector area is the sector number immediately before the sector (hereinafter referred to as the front sector number), and the rear sector area is the sector immediately after the sector. A number (hereinafter referred to as a rear sector number) is stored, and the front sector number of the first sector and the rear sector number of the last sector are both 00. The front sector number of the head sector may be FF, and the EEPROM area may be formed in a ring shape. Further, in the SUM area, a SUM whose sum of the data substance of the sector, the front sector number, and the rear sector number is 0 is stored.

【0022】次に、図4を参照して、EEPROM領域
内の繋ぎ情報のチェック処理について説明する。まず、
ステップSC1では、コマンドを解析し、修復処理を行
うべきか否か、すなわちパラメータP1が02であるか
否かを判断する。繋ぎ情報のチェック処理を行う場合に
はコマンドは“CHECK /01”となっているの
で、処理はステップSC2へ進む。ステップSC2で
は、前セクタ番号を表す変数FSCTに00、処置対象
のセクタ番号(以後、現セクタ番号と称す)を表す変数
SCTに01を代入する。そして、EEPROM領域に
おける読み出しポインタの現在位置を表す“カレント”
が01でない場合には、変数SCTにカレントを代入す
る(ステップSC3,SC4)。こうして、初期設定が
完了する。
Next, with reference to FIG. 4, a process for checking the connection information in the EEPROM area will be described. First,
In step SC1, the command is analyzed to determine whether or not the repair process should be performed, that is, whether or not the parameter P1 is 02. When the connection information check process is performed, the command is "CHECK / 01", and thus the process proceeds to step SC2. In step SC2, 00 is substituted into the variable FSCT representing the previous sector number, and 01 is substituted into the variable SCT representing the sector number of the treatment target (hereinafter referred to as the current sector number). Then, "current" indicating the current position of the read pointer in the EEPROM area
If is not 01, the current is substituted into the variable SCT (steps SC3 and SC4). Thus, the initial setting is completed.

【0023】次に、ステップSC5〜SC11の処理を
後述する条件が成立するまで繰り返し行う。まず、変数
SCTで表される現セクタ(ここでは01のセクタ)に
対して読み出し処理が行われる(ステップSC5)。こ
の読み出し処理は図5のフローチャートに示されるよう
に、現セクタ内の全データをRAM領域上に読み出し
(ステップSD1)、読み出したデータに対してSUM
チェック処理を行う(ステップSD2)処理である。
Next, the processing of steps SC5 to SC11 is repeated until the conditions described later are satisfied. First, the reading process is performed on the current sector represented by the variable SCT (01 sector here) (step SC5). As shown in the flowchart of FIG. 5, this read processing reads all the data in the current sector onto the RAM area (step SD1), and SUMs the read data.
This is a process of performing a check process (step SD2).

【0024】次に、ステップSC6では、ステップSD
2のSUMチェック処理においてSUMエラーが検出さ
れたか否かを判断し、SUMエラーが検出されなかった
場合、すなわち現セクタにおけるデータ実体、前セクタ
番号、後セクタ番号、およびSUMの対応関係が正常と
された場合には現セクタ内の繋ぎ情報、すなわちRAM
領域上の前セクタ番号および後セクタ番号に基づいて繋
ぎ情報確認処理を行う(ステップSC7)。この確認処
理は図6のフローチャートに示されるように、RAM領
域上の前セクタ番号と変数FSCTとが一致する場合に
は変数FSCTに変数SCTの値を代入し(ステップS
E1,SE2)、等しくない場合には繋ぎエラーを検出
した旨の情報をRAM領域の特定領域に書き込む(ステ
ップSE1,SE3)、という処理である。
Next, in step SC6, step SD
It is determined whether or not the SUM error is detected in the SUM check process of No. 2, and when the SUM error is not detected, that is, the correspondence between the data entity in the current sector, the previous sector number, the rear sector number, and the SUM is normal. Connection information in the current sector, that is, RAM
A connection information confirmation process is performed based on the front sector number and the rear sector number on the area (step SC7). In this confirmation processing, as shown in the flowchart of FIG. 6, when the previous sector number on the RAM area and the variable FSCT match, the value of the variable SCT is substituted into the variable FSCT (step S
E1, SE2), and if they are not equal, information indicating that a connection error has been detected is written in a specific area of the RAM area (steps SE1, SE3).

【0025】変数FSCTには前セクタ番号となるべき
値(ここでは00)が格納されているので、現セクタの
前セクタ番号が00でない場合には繋ぎエラーとなる。
なお、ステップSE2において変数FSCTに変数SC
Tの値を代入するのは、次のループに備えるためであ
り、例えば、変数FSCTの値が00から01へ変わ
る。
Since the variable FSCT stores a value (here, 00) which should be the previous sector number, if the previous sector number of the current sector is not 00, a connection error occurs.
In step SE2, the variable FSCT is set to the variable SC.
The value of T is substituted in order to prepare for the next loop. For example, the value of the variable FSCT changes from 00 to 01.

【0026】次に、ステップSC9では、変数NSCT
にRAM領域上の後セクタ番号を代入する。そして、ス
テップSC7での診断処理において繋ぎエラーを検出し
た場合には、変数SCTにRAM領域上の後セクタ番号
を代入し(ステップSC10)、変数NSCTの値が0
でない場合にはステップSC5の処理に戻る。ただし、
ここでは、FSCT=01、SCT=02になってい
る。上記ステップSC5〜SC11の処理は、ステップ
SC11にて変数NSCTの値が0になるまで繰り返さ
れ、0になった時点で繋ぎ情報チェック処理を終了す
る。
Next, at step SC9, the variable NSCT
The rear sector number on the RAM area is substituted into. Then, if a connection error is detected in the diagnostic processing in step SC7, the rear sector number in the RAM area is substituted into the variable SCT (step SC10), and the value of the variable NSCT is 0.
If not, the process returns to step SC5. However,
Here, FSCT = 01, SCT = 02. The processes of steps SC5 to SC11 are repeated until the value of the variable NSCT becomes 0 in step SC11, and when the value becomes 0, the connection information check process ends.

【0027】一方、上記ループにおいてSUMエラーが
検出された場合、すなわち現セクタにおけるデータ実
体、前セクタ番号、後セクタ番号、およびSUMの対応
関係が異常とされた場合には、その旨を示す情報をRA
M領域の特定領域に書き込み、繋ぎ情報チェック処理を
終了する(ステップSC12)。図8(a)、図8
(b)の例ではFSCT=02、SCT=03、NSC
T=03の状態で処理を終了する。また、上記ループに
おいて繋ぎエラーが検出された場合には、その旨を示す
情報をRAM領域の特定領域に書き込み繋ぎ情報チェッ
ク処理を終了する(ステップSC12)。SUMエラー
が発生せず、かつ繋ぎエラーが発生するケースとして
は、例えば、図8(a)および図8(b)の**部分お
よび実データ領域の不良部分が偶然にもSUMエラーを
生じない変化をしている場合などがあり、図8(a)の
例ではFSCT=02、SCT=03、NSCT=04
の状態で、図8(b)の例ではFSCT=03、SCT
=03、NSCT=**の状態で処理を終了する。そし
て、処理は図2のステップSA5に戻り、繋ぎ情報チェ
ック処理における診断結果(上記処理の各時点でRAM
領域の特定領域に書き込まれた情報)に基づいたレスポ
ンスが外部機器へ返送される。
On the other hand, when a SUM error is detected in the above loop, that is, when the correspondence between the data entity, the previous sector number, the subsequent sector number, and the SUM in the current sector is abnormal, information indicating that fact is given. RA
The data is written in the specific area of the M area, and the connection information check processing is ended (step SC12). 8 (a) and 8
In the example of (b), FSCT = 02, SCT = 03, NSC
The process ends in the state of T = 03. If a connection error is detected in the above loop, the information indicating that is written in a specific area of the RAM area, and the connection information check process ends (step SC12). As a case where the SUM error does not occur and the connection error occurs, for example, the ** part in FIG. 8A and FIG. 8B and the defective part of the actual data area do not accidentally generate the SUM error. There is a case where there is a change, and in the example of FIG. 8A, FSCT = 02, SCT = 03, NSCT = 04.
8B, in the example of FIG. 8B, FSCT = 03, SCT
= 03, NSCT = **, the process ends. Then, the process returns to step SA5 of FIG. 2, and the diagnosis result in the connection information check process (the RAM at each point of the above process)
A response based on the information written in the specific area of the area) is returned to the external device.

【0028】ところで、コマンドのパラメータP1が0
2である場合、図4のステップSC14の修復処理を行
う。この修復処理は、前述した繋ぎ情報チェック処理の
後に、再度コマンドを発行することにより行われるもの
であり、前回のチェック処理終了時の各変数値はRAM
領域上に維持されている。以下、図7のフローチャート
を参照して修復処理について説明する。
By the way, the parameter P1 of the command is 0
If it is 2, the repair process of step SC14 of FIG. 4 is performed. This repair processing is performed by issuing a command again after the above-mentioned connection information check processing, and each variable value at the end of the previous check processing is stored in the RAM.
Has been maintained on the area. Hereinafter, the restoration process will be described with reference to the flowchart of FIG.

【0029】まず、ステップSF1では、変数SCTN
に0を代入する。次に、前セクタ番号がSCT(現セク
タ番号)と一致するセクタを検索し、ヒットしたセクタ
の番号を変数SCTNに代入する(ステップSF2)。
ヒットしたセクタが1個であった場合には、SCTで表
されるセクタの後セクタ番号に変数SCTNの値を再設
定する(ステップSF3,SF4)。
First, in step SF1, the variable SCTN is changed.
To 0. Next, a sector whose previous sector number matches the SCT (current sector number) is searched, and the number of the hit sector is substituted into the variable SCTN (step SF2).
When the number of hit sectors is one, the value of the variable SCTN is reset to the sector number after the sector represented by SCT (steps SF3 and SF4).

【0030】次に、ステップSF5では、変数SCTF
に0を代入する。そして、後セクタ番号がSCT(現セ
クタ番号)と一致するセクタを検索し、ヒットしたセク
タの番号を変数SCTFに代入する(ステップSF
6)。ヒットしたセクタが1個であった場合には、SC
Tで表されるセクタの前セクタ番号に変数SCTFの値
を設定する(ステップSF7,SF8)。
Next, in step SF5, the variable SCTF is set.
To 0. Then, a sector whose rear sector number matches the SCT (current sector number) is searched, and the number of the hit sector is substituted into the variable SCTF (step SF
6). If only one sector is hit, SC
The value of the variable SCTF is set to the sector number before the sector represented by T (steps SF7 and SF8).

【0031】例えば、図8(a)、図8(b)の例で
は、SCT=03の状態で修復処理に入り、前セクタが
03なるセクタが検索され、その結果セクタ番号が04
のセクタのみが抽出される。セクタ番号04はSCTN
に代入され、セクタ番号が03のセクタの後セクタ番号
として設定される。そして、後セクタが03なるセクタ
が検索され、その結果セクタ番号が02のセクタのみが
抽出される。セクタ番号02はSCTFに代入され、セ
クタ番号が03のセクタの前セクタ番号として設定され
る。上述した過程を経て繋ぎ情報を修復した後に、変数
SCTで表される現セクタのSUMを再計算し(ステッ
プSF9)、現セクタのSUMとして再設定し(ステッ
プSF10)、最後にデータのベリファイ(照合)を行
う(ステップSF11)。
For example, in the example of FIGS. 8 (a) and 8 (b), the repair process is started in the state of SCT = 03, the sector with the previous sector 03 is searched, and as a result, the sector number is 04.
Only the sectors of are extracted. Sector number 04 is SCTN
, And the sector number is set as the subsequent sector number of the sector of 03. Then, the sector having the subsequent sector of 03 is searched, and as a result, only the sector having the sector number of 02 is extracted. The sector number 02 is substituted into the SCTF and set as the previous sector number of the sector whose sector number is 03. After the connection information is restored through the above process, the SUM of the current sector represented by the variable SCT is recalculated (step SF9), the SUM of the current sector is reset (step SF10), and finally the data verification ( (Verification) is performed (step SF11).

【0032】ところで、各検索処理においてヒットした
セクタが複数存在する場合には、強制修復処理が指定さ
れているか否かを判断し(ステップSF12,SF1
3)、強制修復が指定されていれば、最後にヒットした
セクタの番号、すなわちSCTNの現在値を用いて、ス
テップSF4、SF8以降の処理を行う。逆に強制修復
が指定されていなければ、いずれのセクタ番号に基づい
て修復すべきか判断できないため、修復に失敗した旨の
情報をRAM領域の特定領域に書き込むのみに止める
(ステップSF14)。そして、処理は図2のステップ
SA5に戻り、繋ぎ情報チェック処理の場合と同様に、
RAM領域の特定領域に書き込まれた情報に基づいたレ
スポンスが外部機器へ返送される。
By the way, when there are a plurality of hit sectors in each search process, it is judged whether or not the forced repair process is designated (steps SF12, SF1).
3) If forced repair is designated, the process of steps SF4 and SF8 and subsequent steps is performed using the sector number of the last hit sector, that is, the current value of SCTN. On the other hand, if the forced repair is not designated, it cannot be determined which sector number should be used for the repair, so that only the information indicating that the repair has failed is written to the specific area of the RAM area (step SF14). Then, the process returns to step SA5 in FIG. 2, and as in the case of the connection information check process,
A response based on the information written in the specific area of the RAM area is returned to the external device.

【0033】以上説明したように、本発明の一実施形態
によれば、ROM領域のチェック処理、EEPROM領
域のチェック処理、EEPROM領域の修復処理をコマ
ンド化し、任意の時点で実行できるようにしたため、リ
セット時に各種処理を実行していた従来のものに比較し
て、待ち時間を短縮することができる。また、データ書
き込み後にEEPROM領域に不良が発生しても、SU
Mを再設定することにより、その影響を後続のデータに
及ぼさずに済む。
As described above, according to the embodiment of the present invention, the ROM area check processing, the EEPROM area check processing, and the EEPROM area repair processing are commandized and can be executed at any time. The waiting time can be shortened as compared with the conventional one in which various processes are executed at the time of reset. Even if a defect occurs in the EEPROM area after writing the data, the SU
By resetting M, the effect does not affect subsequent data.

【0034】さらに、繋ぎ情報自体にエラーが発生して
も、前後の繋ぎ情報からこれを再生することができる。
また、強制修復と通常の修復とを選択できるようにした
ため、不用意な修復によるデータの破壊を確実に回避す
ることができるとともに、状況に応じた修復処理を行う
ことができる。
Further, even if an error occurs in the connection information itself, it can be reproduced from the connection information before and after.
Further, since the forced repair and the normal repair can be selected, it is possible to surely avoid the data destruction due to the careless repair, and it is possible to perform the repair processing according to the situation.

【0035】[0035]

【発明の効果】以上説明したように、本発明によれば、
第1の不揮発性データ記憶手段の診断処理、第2の不揮
発性データ記憶手段の診断処理、および第2の不揮発性
データ記憶手段の修復処理を外部機器からの命令で選択
実行できるため、リセット時に必ず実行する場合に比較
して、所用時間を短縮できる(請求項1)。
As described above, according to the present invention,
At the time of resetting, the first non-volatile data storage means diagnostic process, the second non-volatile data storage device diagnostic process, and the second non-volatile data storage device repair process can be selectively executed by an instruction from an external device. The required time can be shortened as compared with the case where it is always executed (Claim 1).

【0036】また、第2の不揮発性データ記憶手段にお
いては、セクタに診断用コードを含め、これを修復する
ようにしたため、後続するセクタに与える影響を抑制す
ることができる(請求項2)。さらに、繋ぎ情報を診断
することによって、第2の不揮発性データ記憶手段にお
けるメモリ不良を確実に検出することができる(請求項
3)。また、繋ぎ情報を修復することによって、後続す
るセクタに与える影響を抑制することができる(請求項
4)。
Further, in the second non-volatile data storage means, since the diagnostic code is included in the sector and is repaired, the influence on the succeeding sector can be suppressed (claim 2). Further, by diagnosing the connection information, it is possible to reliably detect the memory failure in the second nonvolatile data storage means (claim 3). Further, by repairing the connection information, it is possible to suppress the influence on the subsequent sector (claim 4).

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

【図1】 本発明の一実施形態によるICカードの構成
を示す図である。
FIG. 1 is a diagram showing a configuration of an IC card according to an embodiment of the present invention.

【図2】 同ICカードにおけるアクセス処理のフロー
チャートである。
FIG. 2 is a flowchart of an access process in the IC card.

【図3】 同ICカードに対する自己診断処理の一例を
示すフローチャートである。
FIG. 3 is a flowchart showing an example of a self-diagnosis process for the IC card.

【図4】 同ICカードのEEPROM4に対する繋ぎ
情報のチェック処理を示すフローチャートである。
FIG. 4 is a flowchart showing a process of checking connection information with respect to the EEPROM 4 of the IC card.

【図5】 同EEPROM4からのセクタ読み出し処理
を示すフローチャートである。
FIG. 5 is a flowchart showing a sector read process from the EEPROM 4;

【図6】 同EEPROM4からの繋ぎ情報読み出し処
理を示すフローチャートである。
FIG. 6 is a flowchart showing a process of reading connection information from the EEPROM 4.

【図7】 同EEPROM4に対する修復処理を示すフ
ローチャートである。
FIG. 7 is a flowchart showing a repair process for the same EEPROM 4.

【図8】 同EEPROM4のデータ構造を概念的に示
す図である。
FIG. 8 is a diagram conceptually showing the data structure of the EEPROM 4.

【図9】 同ICカードが受信する修復コマンドの書式
の一例を示す図である。
FIG. 9 is a diagram showing an example of a format of a repair command received by the IC card.

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

1…CPU、2…ROM、3…RAM、4…EEPRO
M。
1 ... CPU, 2 ... ROM, 3 ... RAM, 4 ... EEPRO
M.

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 プログラムを格納した第1の不揮発性デ
ータ記憶手段と、 データを記憶する第2の不揮発性データ記憶手段と、 外部機器との間でデータを送受する通信手段と、 前記第1の不揮発性データ記憶手段に格納されたプログ
ラムに基づいて、前記通信手段を介して受信した命令を
実行するとともに、命令の実行結果を前記通信手段を介
して外部へ送信する処理手段とを具備したICカードで
あって、 前記処理手段は、前記第1の不揮発性データ記憶手段に
格納されたプログラム中に記述された、前記第1の不揮
発性データ記憶手段に対する診断処理、前記第2の不揮
発性データ記憶手段に対する診断処理、および前記第2
の不揮発性データ記憶手段の修復処理のうち、前記通信
手段を介して受信した命令に対応した処理を選択実行す
ることを特徴としたICカード。
1. A first non-volatile data storage means for storing a program, a second non-volatile data storage means for storing data, a communication means for transmitting and receiving data to and from an external device, and the first non-volatile data storage means. And a processing means for executing the command received via the communication means based on the program stored in the non-volatile data storage means and transmitting the execution result of the command to the outside via the communication means. An IC card, wherein the processing unit is a diagnostic process for the first non-volatile data storage unit described in the program stored in the first non-volatile data storage unit, the second non-volatile storage unit. Diagnostic processing for data storage means, and the second
Among the restoration processing of the non-volatile data storage means, a processing corresponding to an instruction received via the communication means is selectively executed.
【請求項2】 前記第2の不揮発性データ記憶手段は複
数のセクタから構成され、かつ複数のセクタに連続して
データが記憶されてなる場合において、 前記セクタは実データと該実データに対応した診断用デ
ータを含み、 前記処理手段は、前記第2の不揮発性データ記憶手段の
修復処理の選択実行により、実データと診断用データと
の対応関係が異常とされたセクタの診断用データを再設
定することを特徴とする請求項1記載のICカード。
2. In the case where the second non-volatile data storage means is composed of a plurality of sectors, and the data is continuously stored in the plurality of sectors, the sector corresponds to the real data and the real data. The diagnostic data of the sector in which the correspondence between the actual data and the diagnostic data is abnormal due to the selective execution of the restoration process of the second non-volatile data storage means. The IC card according to claim 1, wherein the IC card is reset.
【請求項3】 前記セクタは実データと、セクタの順序
を表す繋ぎ情報と、実データおよび繋ぎ情報に対応した
診断用データとを含み、 前記処理手段は、実データおよび繋ぎ情報と診断用デー
タとの対応関係が正常とされたセクタの繋ぎ情報の整合
性を診断するとともに、この診断結果を前記通信手段を
介して外部機器へ送信することを特徴とする請求項2記
載のICカード。
3. The sector includes real data, connection information indicating the order of the sectors, and real data and diagnostic data corresponding to the connection information, and the processing unit includes the real data, the connection information, and the diagnostic data. 3. The IC card according to claim 2, further comprising: diagnosing the consistency of the connection information of the sector whose correspondence relationship is normal, and transmitting the diagnosis result to an external device via the communication means.
【請求項4】 前記セクタは実データと、セクタの順序
を表す繋ぎ情報と、実データおよび繋ぎ情報に対応した
診断用データとを含み、 前記処理手段は、実データおよび繋ぎ情報と診断用デー
タとの対応関係が正常とされたセクタの繋ぎ情報の整合
性を診断するとともに、この診断結果において整合性が
とれていないとされたセクタの繋ぎ情報を修復し、該セ
クタの診断用データを再設定することを特徴とする請求
項2記載のICカード。
4. The sector includes real data, connection information indicating the order of the sectors, and real data and diagnostic data corresponding to the connection information, and the processing unit includes the real data, the connection information, and the diagnostic data. And the consistency of the connection information of the sector for which the relationship with is normal is diagnosed, the connection information of the sector for which the consistency is not found in this diagnosis result is restored, and the diagnostic data of the sector is re-established. The IC card according to claim 2, wherein the IC card is set.
JP8110913A 1996-05-01 1996-05-01 Ic card Pending JPH09297830A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8110913A JPH09297830A (en) 1996-05-01 1996-05-01 Ic card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8110913A JPH09297830A (en) 1996-05-01 1996-05-01 Ic card

Publications (1)

Publication Number Publication Date
JPH09297830A true JPH09297830A (en) 1997-11-18

Family

ID=14547818

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8110913A Pending JPH09297830A (en) 1996-05-01 1996-05-01 Ic card

Country Status (1)

Country Link
JP (1) JPH09297830A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007045258A (en) * 2005-08-08 2007-02-22 Ichikoh Ind Ltd Headlight device for vehicle

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007045258A (en) * 2005-08-08 2007-02-22 Ichikoh Ind Ltd Headlight device for vehicle

Similar Documents

Publication Publication Date Title
JP2922211B2 (en) Fault tolerant smart card
JP2990181B1 (en) Flash memory, microcomputer having flash memory, and method of storing program in flash memory
US20020039312A1 (en) Nonvolatile memory and method of writing data thereto
KR20030043691A (en) Detecting partially erased units in flash devices
US6546517B1 (en) Semiconductor memory
PL173398B1 (en) Method of writing data in non-volatile memory
JPH05233464A (en) Method for rewriting data in eeprom and eeprom card
CN116880782B (en) Embedded memory and testing method thereof
JPS62173696A (en) Information memorizing/reading system
JPH1091289A (en) Memory initialization device and method
US6535442B2 (en) Semiconductor memory capable of debugging an incorrect write to or an incorrect erase from the same
JPH09297830A (en) Ic card
JPH03147086A (en) Ic card
CN111696614B (en) Control test circuit and control test method for non-volatile memory redundant storage
US20050068842A1 (en) Electronic device, nonvolatile memory and method of overwriting data in nonvolatile memory
JP2005050442A (en) Redundant memory circuit
US20060236185A1 (en) Multiple function results using single pattern and method
JP3314719B2 (en) Flash EEPROM and its test method
JPS5812200A (en) Memory inspecting method
JPH0784894A (en) Method for writing nonvolatile memory
JPH07122087A (en) Eeprom error check system
JPH06131895A (en) Semiconductor memory chip
CN113094107B (en) Data protection method, device, equipment and computer storage medium
JP3019346B2 (en) Data processing device
JPH1125006A (en) Memory tester