JP2000276354A - Communication device control circuit - Google Patents

Communication device control circuit

Info

Publication number
JP2000276354A
JP2000276354A JP11080589A JP8058999A JP2000276354A JP 2000276354 A JP2000276354 A JP 2000276354A JP 11080589 A JP11080589 A JP 11080589A JP 8058999 A JP8058999 A JP 8058999A JP 2000276354 A JP2000276354 A JP 2000276354A
Authority
JP
Japan
Prior art keywords
cpu
program
reset
abnormal state
system error
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
JP11080589A
Other languages
Japanese (ja)
Inventor
Setomi Uchikawa
せとみ 内川
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP11080589A priority Critical patent/JP2000276354A/en
Publication of JP2000276354A publication Critical patent/JP2000276354A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To investigate a cause and to restore a main program when a CPU is turned to an abnormal state at the time of downloading a main program SOLUTION: The abnormal state of a central processing unit(CPU) 1 is monitored by a system error detector 4 and an abnormal state detector 5 on the basis of an output from a watchdog circuit 2. When an abnormal state is detected at the time of downloading a main program from a host writing in a rewritable memories 9, 10 storing the main program and a spare program is inhibited. When the abnormal state of the CPU 1 is continue for fixed time, the state is regarded as a system error whose restoratic is impossible, and at the time of judging that illegal writing in the memories 9, 10 was executed before write inhibition control, the operation history of the abnormal operation is stored and redownloading or self-checking operation is executed by the spare program stored in a spare memory area in accordance with a state whether the operation history exists or not at the occurrence of a system error.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、通信装置制御回路
に関し、特に、通信制御用のプログラムを書き込み可能
なメモリに記憶させた通信装置制御回路に関する。
The present invention relates to a communication device control circuit, and more particularly to a communication device control circuit in which a communication control program is stored in a writable memory.

【0002】[0002]

【従来の技術】近年の通信端末装置では、主プログラム
用メモリとしてフラッシュメモリ等の書き込み可能なメ
モリを用いることにより、生産ロットの切り替わり時又
は通信端末装置の市場出荷後の機能追加又は修正等のバ
ージョンアップ時において、通信回線を介してホスト側
から新たな主プログラムのダウンロードを行うことを可
能とする方式が採用されている。この方式によれば装置
を解体して内部のROM交換を行う必要がなく容易に主
プログラムのバージョンアップを行うことが可能であ
る。
2. Description of the Related Art In a recent communication terminal device, a writable memory such as a flash memory is used as a main program memory so that functions such as addition or modification at the time of production lot switching or after shipping the communication terminal device to the market can be improved. At the time of version upgrade, a method is adopted which enables a new main program to be downloaded from the host via a communication line. According to this method, it is not necessary to disassemble the device and replace the internal ROM, and it is possible to easily upgrade the main program.

【0003】この方式のように主プログラムの書き換え
が可能な通信端末装置の回路構成においては、ダウンロ
ード時に中央処理装置(CPU)が暴走した場合(以
下、「システムエラー」ともいう。)は、メインメモリ
の主プログラム領域へ不当データを上書きすることにな
るので、ダウンライロード不能等の障害を生じることを
回避するようにした技術が特開平10−133958号
公報に記載されている。
In a circuit configuration of a communication terminal device in which a main program can be rewritten as in this method, if a central processing unit (CPU) goes out of control at the time of downloading (hereinafter, also referred to as a "system error"), the main processing is performed. Japanese Patent Application Laid-Open No. H10-133958 describes a technique for avoiding the occurrence of a failure such as inability to download data, since illegal data is overwritten on the main program area of the memory.

【0004】図5は、前記公報記載の通信装置制御回路
の構成を示す図である。この通信装置制御回路は、CP
U41と、障害時にCPU41をリセットするためのウ
ォッチドッグ回路42と、CPU41を動作させる主プ
ログラムを記憶するプログラム領域を有するメインメモ
リとしてのフラッシュメモリ47及びRAM(1)48
と、同様のプログラム領域を有する予備メモリとしての
ROM49及びRAM(2)50と、前記メインメモリ
と予備メモリの何れかを切り替えて使用するためのアド
レスデコード46と、ホスト46とCPU41とを接続
するI/Oポート45と、CPU41の暴走状態か否か
を検出するシステムエラー検出回路43とから構成され
る。
FIG. 5 is a diagram showing a configuration of a communication device control circuit described in the above publication. This communication device control circuit has a CP
U41, a watchdog circuit 42 for resetting the CPU 41 when a failure occurs, a flash memory 47 as a main memory having a program area for storing a main program for operating the CPU 41, and a RAM (1) 48
And a ROM 49 and a RAM (2) 50 as spare memories having similar program areas, an address decode 46 for switching and using any of the main memory and the spare memory, and a host 46 and a CPU 41. It comprises an I / O port 45 and a system error detection circuit 43 for detecting whether or not the CPU 41 is in a runaway state.

【0005】ここで、システムエラー検出回路43は、
CPU41の状態によりアドレスデコード44を制御
し、CPU41の通常時には前記メインメモリを使用
し、異常時には予備メモりを使用するようにCPU41
からのアドレスデータの出力先メモリを切り替える制御
を行う。
Here, the system error detection circuit 43
The address decode 44 is controlled according to the state of the CPU 41, and the main memory is used when the CPU 41 is normal, and the spare memory is used when the CPU 41 is abnormal.
Control for switching the output destination memory of the address data from.

【0006】図5に示す通信装置制御回路では、CPU
41は、通常時は前記メインメモリを使用し、ホストか
らの主プログラムのダウンロードの動作時には、メイン
メモリ47、48のプログラム領域に新しい主プログラ
ムをダウンロードしてバージョンアップすることを可能
としている。また、ダウンロード動作中にシステムエラ
ーが検出された場合には、CPU41がアクセスするメ
モリ領域を強制的に予備プログラム格納用ROM49及
びRAM(2)50の予備メモリ領域に切り替え、当該
予備メモリ領域に格納されているダウンロード機能プロ
グラム及び予備動作時の所要の機能プログラム等を使用
して所要のCPU動作を継続することを可能としてい
る。
In the communication device control circuit shown in FIG.
The main memory 41 normally uses the main memory, and when the main program is downloaded from the host, a new main program can be downloaded to the program area of the main memories 47 and 48 to upgrade the main program. If a system error is detected during the download operation, the memory area accessed by the CPU 41 is forcibly switched to the spare program storage ROM 49 and the spare memory area of the RAM (2) 50 and stored in the spare memory area. The required CPU operation can be continued using the downloaded download function program and the required function program in the preliminary operation.

【0007】このような構成により、ウォッチドッグ回
路からのウオッチドックリセットでも復帰不可能なCP
Uの暴走状態になった場合でも、予備プログラムに切り
替え再度主プログラムのダウンライロードを行い、メモ
リ素子を交換することなく障害状態から復帰することを
可能としている。
[0007] With such a configuration, the CP which cannot be restored even by the watchdog reset from the watchdog circuit can be used.
Even in the case of the runaway state of U, it is possible to switch to the spare program, download the main program again, and return from the failure state without replacing the memory element.

【0008】又、予備動作時の所要なチェックアプリケ
ーションプログラムを予備メモリ内ROM49等へ格納
しておくことにより、システムエラー発生原因の究明や
ハードウェアに損傷がないか等のハードウェアチェック
等を行うことも可能としている。
Further, by storing a necessary check application program in the preliminary operation in the ROM 49 or the like in the preliminary memory, it is possible to determine the cause of a system error and check the hardware for damage to the hardware. It is also possible.

【0009】[0009]

【発明が解決しようとする課題】前述の通信装置制御回
路では、新しい主プログラムをダウンロードする動作に
おいて、CPUがウオッチドック回路により回復可能な
異常状態となった場合でもプログラム格納用フラッシュ
メモリの書き込み動作は継続することから、システムエ
ラーとならなくてもフラッシュメモリへの不当な上書き
が行なわれるという問題があった。
In the above-described communication device control circuit, in the operation of downloading a new main program, even when the CPU is brought into an abnormal state recoverable by the watchdog circuit, the write operation of the program storage flash memory is performed. However, there is a problem that the flash memory is unduly overwritten even if a system error does not occur.

【0010】また、前述の通信装置制御回路は、新しい
主プログラムをダウンロードする動作において、システ
ムエラーが発生した場合は、フラッシュメモリ47、R
AM(1)48には主プログラムが不当なデータとして
上書きされ、その状況から改めて主プログラムをダウン
ロードし直すように動作する。このため、システムエラ
ー発生原因の究明やハードウェアに損傷がないか等のハ
ードウェアチェック等を行ったり、再度主プログラムを
ダウンロードするために、予備的プログラムを格納する
予備メモリを別途設けるように構成されており、通信装
置制御回路の規模を大きくし、高価な装置となるという
問題があった。
The communication device control circuit described above, when a system error occurs in the operation of downloading a new main program, the flash memory 47, R
AM (1) 48 is overwritten with the main program as invalid data, and operates to download the main program again from the situation. For this reason, a spare memory for storing a spare program is provided separately in order to investigate the cause of system error occurrence, check the hardware for damage to the hardware, etc., and download the main program again. However, there has been a problem that the scale of the communication device control circuit is increased and the device becomes expensive.

【0011】更に、主プログラムのダウンロードにおい
て異常状態が発生しても、システムエラーが検出される
までは主プログラムの不当データのダウンロードは継続
したままで、ハードウェアの損傷等や主プログラムの破
壊の原因となる不等データの上書きを防ぐことはできな
いという問題があった。
Further, even if an abnormal condition occurs during the download of the main program, the download of the illegal data of the main program is continued until a system error is detected. There is a problem that overwriting of the unequal data that causes it cannot be prevented.

【0012】(発明の目的)本発明の目的は、CPUの
異常状態において主プログラム格納用の書き換え可能メ
モリへのプログラムの上書を防止することを可能とする
通信装置制御回路を提供することにある。
(Object of the Invention) It is an object of the present invention to provide a communication device control circuit which makes it possible to prevent a program from being overwritten in a rewritable memory for storing a main program in an abnormal state of a CPU. is there.

【0013】本発明の他の目的は、単一の主プログラム
格納用の書き換え可能メモリのみで主プログラムのダウ
ンロード及び異常状態の究明等を行うことを可能とする
通信装置制御回路を提供することにある。
Another object of the present invention is to provide a communication device control circuit which enables a main program to be downloaded and an abnormal state to be determined with only a single rewritable memory for storing a main program. is there.

【0014】[0014]

【課題を解決するための手段】本発明の通信装置制御回
路は、中央処理装置の動作の現用プログラム及び予備プ
ログラムを格納する主メモリ領域及び予備メモリ領域を
有する書き換え可能なメモリに、通信回線を介してプロ
グラムの書き込みを行う通信制御回路において、中央処
理装置の動作異常が継続すると一定継続時間毎に中央処
理装置をリセットするリセット信号を発生するウオッチ
ドック回路と、前記リセット信号に基づき中央処理装置
の動作異常の継続時間に対応する異常状態信号を出力す
る異常状態検出器と、前記異常状態信号に基づき前記中
央処理装置の前記プログラムの書き込みを禁止する制御
部とを有することを特徴とする。
SUMMARY OF THE INVENTION A communication device control circuit according to the present invention provides a communication line to a rewritable memory having a main memory area and a spare memory area for storing an active program and a spare program for operation of a central processing unit. A communication control circuit that writes a program via the watchdog circuit that generates a reset signal for resetting the central processing unit at regular intervals when the operation abnormality of the central processing unit continues; and a central processing unit based on the reset signal. An abnormal state detector that outputs an abnormal state signal corresponding to the duration of the operation abnormality described above, and a control unit that prohibits the central processing unit from writing the program based on the abnormal state signal.

【0015】また、前記ウオッチドック回路が出力する
前記リセット信号を計数するリセットカウンターと、前
記リセット信号の間隔が前記一定継続時間以上の時に前
記リセットカウンターをリセットするリセット回路とを
有し、前記異常状態検出器は、前記リセット信号により
開始し前記リセット回路の出力により終了する前記異常
状態信号を出力することを特徴とする。
A reset counter for counting the reset signal output by the watchdog circuit; and a reset circuit for resetting the reset counter when an interval between the reset signals is equal to or longer than the predetermined duration. The state detector outputs the abnormal state signal that starts with the reset signal and ends with the output of the reset circuit.

【0016】更に、前記リセットカウンターの計数値が
所定値に達したときにシステムエラー信号を出力するシ
ステムエラー検出器と、中央処理装置の前記プログラム
の書き込み開始後、書き込み終了前に前記制御部が書き
込みの禁止動作を行った場合に異常動作履歴として保持
する書き込み動作記憶部とを有し、前記システムエラー
信号の発生時に、書き込み動作記憶部が異常動作履歴を
保持している場合は、予備プログラムにより通信回線を
介して新たにプログラムの書き込みを行うこと、又は、
前記システムエラー信号の発生時に、書き込み動作記憶
部が異常動作履歴を保持していない場合は、予備プログ
ラムによりセルフチェック動作を行うことを特徴とす
る。
Further, a system error detector which outputs a system error signal when the count value of the reset counter reaches a predetermined value, and the control unit which starts writing of the program of the central processing unit and before the end of writing, A write operation storage unit for holding as an abnormal operation history when a write prohibition operation is performed, and when the system error signal is generated, the write operation storage unit holds the abnormal operation history. To write a new program via a communication line, or
If the writing operation storage unit does not hold the abnormal operation history when the system error signal is generated, a self-check operation is performed by a preliminary program.

【0017】(作用)ウォッチドッグ回路の出力により
中央処理装置(CPU)の異常状態を監視し、ダウンロ
ード時に異常状態が検出された場合、主プログラム及び
予備プログラムが記憶された書き換え可能なメモリへの
書き込みを禁止し、CPUの軽微な異常状態からの回復
時に書き込みの継続を可能とする。また、CPUが一定
時間の異常状態が続いた場合システムエラーとし、ま
た、書き込み禁止制御以前にメモリへの不当な書き込み
が行われたと判断された場合、その異常動作の動作履歴
を記憶し、システムエラー発生時に前記動作履歴が有る
か否かにより、予備メモリ領域のプログラムによりそれ
ぞれ再ダウンロード又はセルフチェック動作を行う。
(Operation) An abnormal state of the central processing unit (CPU) is monitored by an output of the watchdog circuit, and if an abnormal state is detected at the time of downloading, the abnormal state is transferred to a rewritable memory in which a main program and a spare program are stored. Writing is prohibited, and writing can be continued when the CPU recovers from a minor abnormal state. If the CPU keeps the abnormal state for a certain period of time, it is regarded as a system error. If it is determined that the illegal writing to the memory has been performed before the write prohibition control, the operation history of the abnormal operation is stored. Depending on whether or not the operation history exists when an error occurs, re-downloading or self-check operation is performed by the program in the spare memory area.

【0018】[0018]

【発明の実施の形態】(構成の説明)本発明の通信装置
制御回路の一実施の形態を、図1、図2及び図3により
説明する。図1は、本発明の一実施の形態の全体構成を
示すブロック図である。本実施の形態の回路構成は、中
央処理装置1(CPU1)と、CPU1が制御処理動作
を行うための主プログラムを記憶するフラッシュメモリ
9及びRAM10と、主プログラムのバージョンアップ
時にホストからプログラムデータを取り込むためのI/
Oポート11と、CPU1の異常時にリセット信号を出
力するウオッチドック回路2と、ウオッチドック回路2
の出力のウオッチドックリセット信号(ウオッチドック
リセットパルス)を計数するリセットカウンター部3
と、前記リセットカウンター部3の計数値に基づきシス
テムエラーを検出するシステムエラー検出器4と、CP
U1の異常状態を検出する異常状態検出器5と、異常状
態時に、フラッシュメモリ9への書き込みを禁止する制
御器7と、システムエラー時にCPU1のアクセス領域
をフラッシュメモリ9の予備メモリ領域に切り替える予
備領域アクセス制御部8とからなる。
DESCRIPTION OF THE PREFERRED EMBODIMENTS (Description of Configuration) One embodiment of a communication device control circuit according to the present invention will be described with reference to FIGS. 1, 2 and 3. FIG. FIG. 1 is a block diagram showing the overall configuration of an embodiment of the present invention. The circuit configuration of the present embodiment includes a central processing unit 1 (CPU 1), a flash memory 9 and a RAM 10 that store a main program for the CPU 1 to perform a control processing operation, and a program data from a host when the main program is upgraded. I / to take in
An O port 11, a watchdog circuit 2 for outputting a reset signal when the CPU 1 is abnormal, and a watchdog circuit 2
Counter 3 for counting the output of the watchdog reset signal (watchdog reset pulse)
A system error detector 4 for detecting a system error based on the count value of the reset counter unit 3,
An abnormal state detector 5 for detecting an abnormal state of U1, a controller 7 for inhibiting writing to the flash memory 9 in an abnormal state, and a spare for switching an access area of the CPU 1 to a spare memory area of the flash memory 9 in case of a system error. And an area access control unit 8.

【0019】本実施の形態の各部の機能の概要は以下の
とおりである。フラッシュメモリ9は、CPU1の所要
の制御に加えて、バージョンアップ時のダウンロード制
御及び異常時のCPU1と周辺装置のセルフチェック制
御を行う主プログラム及び予備プログラムをそれぞれ格
納する主プログラム領域及び予備プログラム領域を有し
ている。つまり、何れのプログラム領域にもダウンロー
ド用領域とセルフチェック用領域とを有している。
The outline of the function of each part of the present embodiment is as follows. The flash memory 9 includes a main program area and a spare program area for storing a main program and a spare program for performing download control at the time of version upgrade and self-check control of the CPU 1 and peripheral devices at the time of an abnormality, in addition to required control of the CPU 1. have. That is, each program area has a download area and a self-check area.

【0020】CPU1は、通常状態時にはフラッシュメ
モリ9のプログラム領域にアクセスして所要の処理動作
を行い、ホストからのダウンロード指示等を受けると、
主プログラムをダウンロードしてプログラム領域の元の
主プログラムを上書きし、新しい主プログラムに基づく
処理動作を行う。また、CPU1は、正常動作状態では
正常処理動作を示すウオッチドックパルスを一定間隔で
ウオッチドック回路2に出力し、異常動作時には前記ウ
オッチドックパルスの出力を停止する。従って、ウオッ
チドックパルスの間隔が大きくなるとCPU1がその間
のみ異常動作状態となったことを意味し、ウオッチドッ
クパルスが長期間出力されない場合は、CPU1が暴走
状態に陥ったと判断することができる。
In a normal state, the CPU 1 accesses a program area of the flash memory 9 to perform a required processing operation, and upon receiving a download instruction or the like from the host,
Download the main program, overwrite the original main program in the program area, and perform the processing operation based on the new main program. Further, the CPU 1 outputs a watchdog pulse indicating a normal processing operation to the watchdog circuit 2 at regular intervals in a normal operation state, and stops the output of the watchdog pulse in an abnormal operation. Therefore, if the interval between the watchdog pulses becomes large, it means that the CPU 1 is in the abnormal operation state only during that period. If the watchdog pulse is not output for a long period of time, it can be determined that the CPU 1 has fallen out of control.

【0021】ウオッチドック回路2は、CPU1からの
ウオッチドックパルスが前記一定間隔で入力している場
合にはCPU1をリセットするウオッチドックリセット
パルスを出力しないが、ウオッチドックパルスの間隔が
前記一定間隔以上となった場合には、CPU1のウオッ
チドックリセットパルスを出力し、ウオッチドックパル
スが長期間出力されない場合は、ウオッチドック回路2
の内部タイマーで決まる所定間隔(後述のM秒[s])
で周期的にウオッチドックリセットパルスを出力し連続
的にCPU1のウオッチドックリセットを行う。
The watchdog circuit 2 does not output a watchdog reset pulse for resetting the CPU 1 when the watchdog pulse from the CPU 1 is input at the above-mentioned fixed interval, but the interval of the watchdog pulse is longer than the above-mentioned certain interval. , A watchdog reset pulse of the CPU 1 is output. If the watchdog pulse is not output for a long time, the watchdog circuit 2 is output.
Predetermined interval determined by the internal timer (M seconds [s] described later)
, A watchdog reset pulse is periodically output, and the watchdog reset of the CPU 1 is continuously performed.

【0022】異常状態検出器5は、後に詳述するように
前記ウオッチドックリセットパルスが出力されると直ち
にこれを検出しCPU1の異常状態の継続期間に対応す
る期間継続する異常状態信号を制御器7に出力する。制
御器7は書込禁止制御部71を有し、前記異常状態検出
器5からの異常状態信号を入力すると、ダウンロード動
作中でもフラッシュメモリ9及びRAM10への書き込
みを禁止する。
As will be described in detail later, the abnormal state detector 5 detects the watchdog reset pulse immediately after it is output, and outputs an abnormal state signal that continues for a period corresponding to the duration of the abnormal state of the CPU 1 to the controller. 7 is output. The controller 7 has a write prohibition control unit 71, and when an abnormal state signal is input from the abnormal state detector 5, the controller 7 prohibits writing to the flash memory 9 and the RAM 10 even during the download operation.

【0023】リセットカウンター部3は、ウオッチドッ
ク回路2が出力するウオッチドックリセットパルスが前
記一定間隔で連続的に発生される場合にそのパルスを計
数し、システムエラー検出器4は、この一定間隔でリセ
ットカウンター部3の計数値が所定数Nになった場合を
検出して、CPU1がウオッチドックパルスを長期間出
力しないので暴走状態に陥ったと判断し、前記異常状態
信号の出力後に発生するシステムエラー信号を出力す
る。
The reset counter unit 3 counts the watchdog reset pulse output from the watchdog circuit 2 when the watchdog reset pulse is continuously generated at the constant interval, and the system error detector 4 counts the pulse at this constant interval. When the count value of the reset counter unit 3 reaches a predetermined number N, the CPU 1 determines that a runaway state has occurred since the CPU 1 does not output a watchdog pulse for a long time, and a system error that occurs after the output of the abnormal state signal. Output a signal.

【0024】予備領域アクセス制御器8は、前記制御器
7が書き込み禁止制御信号を出力すると、CPU1がダ
ウンロードした主プログラムの書き込みが終了した後か
前かを判断し、書き込み終了前であれば、CPU1が異
常状態として、これを動作履歴として記憶し、異常状態
の動作履歴が記憶された後に前記システムエラー信号が
入力されると、フラッシュメモリ9及びRAM10の予
備メモリ領域のプログラムを使用して、再度のダウンロ
ード動作等を行うように、CPU1からのアドレスバス
の切り替えを行う。
When the controller 7 outputs the write inhibit control signal, the spare area access controller 8 determines whether the write of the main program downloaded by the CPU 1 has been completed or before. The CPU 1 stores this as an abnormal state as an operation history, and when the system error signal is input after the operation history of the abnormal state is stored, using the programs in the spare memory area of the flash memory 9 and the RAM 10, The address bus is switched from the CPU 1 so that the download operation or the like is performed again.

【0025】次に、本実施の形態における制御器7及び
予備領域アクセス制御器8のより詳細な内部ブロック図
の構成と、その動作及び機能の概要を説明する。
Next, the configuration of a more detailed internal block diagram of the controller 7 and the spare area access controller 8 in the present embodiment, and the outline of the operation and functions thereof will be described.

【0026】図2は、制御器7の内部ブロックを示す図
であり、本図を使って制御器7の内部構成及び動作等の
概要を説明する。制御器7は、書き込み禁止制御部71
と、フラッシュメモリ制御部72と、RAM制御部73
とから構成される。
FIG. 2 is a diagram showing an internal block of the controller 7, and an outline of the internal configuration and operation of the controller 7 will be described with reference to FIG. The controller 7 includes a write-inhibition control unit 71
, A flash memory control unit 72 and a RAM control unit 73
It is composed of

【0027】フラッシュメモリ制御部72は、CPU1
が定常状態の時、CPU1から出力される制御信号とア
ドレスデコード6から出力されるフラッシュメモリアク
セス通知信号によってメインメモリへの書き込み及び読
み出しを制御する。RAM制御部73は、CPU1が定
常状態の時、同様にCPU1から出力される制御信号と
アドレスデコード6から出力されるRAMアクセス通知
信号によってRAM10への書き込み及び読み出しを制
御する。
The flash memory control unit 72 includes a CPU 1
Is in a steady state, writing and reading to and from the main memory are controlled by a control signal output from the CPU 1 and a flash memory access notification signal output from the address decoder 6. When the CPU 1 is in the steady state, the RAM control unit 73 controls writing and reading to and from the RAM 10 by a control signal similarly output from the CPU 1 and a RAM access notification signal output from the address decoder 6.

【0028】書き込み禁止制御部71は、異常状態検出
器5から異常状態信号が出力されると、CPU1が異常
状態に陥ったとしてフラッシュメモリへの書き込みを禁
止する制御を行う。
When an abnormal state signal is output from the abnormal state detector 5, the write prohibition control section 71 determines that the CPU 1 has fallen into an abnormal state and performs control to prohibit writing to the flash memory.

【0029】図3は、予備領域アクセス制御器8の内部
ブロック図であり、本図を使って呼び領域アクセス制御
器8内部の構成及び動作等の概要を説明する。予備領域
アクセス制御器8は、書き込み動作記憶部81と、予備
領域アドレス生成部82と、選択部83とから構成され
る。
FIG. 3 is an internal block diagram of the spare area access controller 8, and an outline of the internal configuration and operation of the call area access controller 8 will be described with reference to FIG. The spare area access controller 8 includes a write operation storage section 81, a spare area address generation section 82, and a selection section 83.

【0030】書き込み動作記憶部81は、制御器7から
出力されるフラッシュメモリ9への書き込みを制御する
フラッシュメモリ用書き込み制御信号と、書き込み禁止
制御信号と、書き込みの正常終了を通知する書き込み終
了通知とを入力とし、書き込み開始後であって、書き込
み終了通知が入力される前にCPU1が異常により書き
込み禁止制御信号が入力された場合に、書き込み動作が
異常終了したものと判断し書き込み動作の異常状態を動
作履歴を記憶する。
The write operation storage unit 81 includes a flash memory write control signal output from the controller 7 for controlling writing to the flash memory 9, a write inhibit control signal, and a write end notification for notifying normal end of writing. When the CPU 1 receives a write prohibition control signal due to an abnormality after the start of writing and before the write end notification is input, the CPU 1 determines that the write operation has ended abnormally, and determines that the write operation has failed. The state and the operation history are stored.

【0031】予備領域アドレス生成部82は、予備のダ
ウンロード用プログラムの格納領域(ダウンロード用予
備領域)のアドレス及び予備のセルフチェック用プログ
ラムの格納領域(セルフチェック用予備領域)のアドレ
スを生成して出力する。選択部83は、前記ダウンロー
ド用予備領域及びセルフチェック用予備領域の各アドレ
ス及びCPU1のアドレスバスからのアドレスを入力と
し、システムエラー検出器4及び書き込み動作記憶部8
1の出力の状態の組合せにより前記アドレスの何れかを
フラッシュメモリ9及びRAM10に出力するようにア
ドレスバスを切り替える。
The spare area address generation unit 82 generates an address of a storage area for a spare download program (spare area for download) and an address of a storage area for a spare self-check program (spare area for self-check). Output. The selection unit 83 receives the addresses of the download spare area and the self-check spare area and the address from the address bus of the CPU 1 as inputs, and inputs the system error detector 4 and the write operation storage unit 8.
The address bus is switched so as to output any one of the addresses to the flash memory 9 and the RAM 10 according to the combination of the output states of Nos. 1 and 2.

【0032】選択部83のアドレスバスの切り替え制御
は、システムエラー検出器4からのシステムエラー通知
があり、且つ書き込み動作記憶部81が書き込み動作が
異常終了の動作履歴を記憶している場合は、ダウンロー
ド用予備領域へアドレスバスを切り替え、また、システ
ムエラー通知があり、且つ書き込み動作記憶部81が書
き込み動作が異常終了の動作履歴を記憶していない場合
は、セルフチェック用予備領域へアドレスバスを切り替
える。
The switching control of the address bus of the selecting unit 83 is performed in the case where there is a system error notification from the system error detector 4 and the writing operation storage unit 81 stores the operation history of the abnormal end of the writing operation. If the address bus is switched to the download spare area, and if there is a system error notification and the write operation storage unit 81 does not store the operation history of the abnormal end of the write operation, the address bus is switched to the self-check spare area. Switch.

【0033】以上説明した各部の機能概要から分かるよ
うに、本実施の形態は機能的に3つのブロックに分けら
れる。第1のブロックは、主プログラムによって所要の
処理制御を行う処理機能ブロックであり、主に、CPU
1と、CPU1の処理動作用の主プログラムが記憶され
たメインメモリであるフラッシュメモリ9及びRAM1
0と、CPU1がメインメモリへアクセスする際のアク
セス領域を決定するアドレスデコーダ6とで構成され
る。
As can be seen from the functional outline of each unit described above, this embodiment is functionally divided into three blocks. The first block is a processing function block for performing required processing control by the main program.
1, a flash memory 9 as a main memory storing a main program for a processing operation of the CPU 1 and a RAM 1
0 and an address decoder 6 for determining an access area when the CPU 1 accesses the main memory.

【0034】第2のブロックは、CPU1の動作状態の
監視を行う監視機能ブロックであり、主に、CPU1か
ら出力されるウォッチドッグパルスを監視し、このパル
スがCPU1より出力されない場合にCPU1にウオッ
チドックリセットパルスを出力するウォッチドック回路
2と、前記ウオッチドックリセットパルスによってCP
U1が復帰する可能性があるか否かに拘わらず直ちに異
常を検出する異常状態検出器5と、前記ウオッチドック
リセットパルスをカウントするリセットカウンター部3
と、前記リセットカウンター部3が前記ウオッチドック
リセットパルスを計数し所定計数値Nとなった場合にC
PU1が復帰不可能な暴走状態として、システムエラー
信号を出力するシステムエラー検出器4で構成される。
The second block is a monitoring function block for monitoring the operation state of the CPU 1, and mainly monitors a watchdog pulse output from the CPU 1, and when the pulse is not output from the CPU 1, the CPU 1 monitors the watch dog pulse. A watchdog circuit 2 for outputting a dock reset pulse;
An abnormal state detector 5 for immediately detecting an abnormality irrespective of whether or not U1 is likely to return; and a reset counter unit 3 for counting the watchdog reset pulse.
The reset counter unit 3 counts the watchdog reset pulse, and when a predetermined count value N is reached,
The system is configured by a system error detector 4 that outputs a system error signal when the PU 1 is in a runaway state in which the PU 1 cannot recover.

【0035】第3のブロックは、書き換え可能メモリへ
の上書きを禁止し予備プログラムによる緊急処理を行う
予備機能ブロックであり、主に、前記異常状態検出器5
が異常状態を検出した時にフラッシュメモリ9への書き
込み禁止を行う制御器7と、前記フラッシュメモリ9へ
の書き込みが開始され、CPU1から正常終了を示す書
き込み終了通知が入力される以前に異常状態検出器5か
ら異常状態信号が入力される場合に、異常状態を書き込
み動作履歴として記憶し、更にシステムエラー信号が出
力された時に前記書き込み動作履歴に異常状態の情報が
記憶されているか否かによって、CPU1のアクセス領
域を予備プログラムが記憶されているダウンロード用又
はセルフチェック用予備領域へ強制的に切り替え、セル
フチェック及び再度のダウンロード動作を行うようにア
ドレスバスを制御する予備領域アクセス制御器8とから
構成される。
The third block is a spare function block for prohibiting overwriting on the rewritable memory and performing emergency processing by a spare program.
A controller 7 for prohibiting writing to the flash memory 9 when detecting an abnormal state, and detecting an abnormal state before the writing to the flash memory 9 is started and a write end notification indicating normal end is input from the CPU 1. When an abnormal state signal is input from the unit 5, the abnormal state is stored as a write operation history, and when a system error signal is output, whether or not information on the abnormal state is stored in the write operation history is determined. A spare area access controller 8 which forcibly switches the access area of the CPU 1 to a download or self-check spare area in which a spare program is stored, and controls an address bus so as to perform a self-check and re-download operation. Be composed.

【0036】(動作の説明)次に、本実施の形態におけ
る通常処理機能、監視機能及び異常時のセルフチェック
機能について、図1、図2及び図3を用いてより詳細に
説明する。本実施の形態では、ホストから通信回線11
2、装置外部端子111及びI/Oポート11を介し所
要の制御を行う主プログラムをフラッシュメモリ9へダ
ウンロードする機能を有する。CPU1はホストよりダ
ウンロード要求コマンドを受信すると、フラッシュメモ
リ9の主プログラム領域の一つのダウンロード実行用タ
スクが起動し、主プログラム格納領域へ新規に主プログ
ラムを上書きにより書き換える。この際、CPU1はダ
ウンロード処理動作で必要なメインメモリであるRAM
10内のダウンロード処理用領域へもアクセスする。
(Explanation of Operation) Next, the normal processing function, the monitoring function, and the self-check function at the time of abnormality in the present embodiment will be described in more detail with reference to FIGS. 1, 2 and 3. In this embodiment, the communication line 11
2. It has a function of downloading a main program for performing required control to the flash memory 9 via the device external terminal 111 and the I / O port 11. When the CPU 1 receives the download request command from the host, one of the download execution tasks in the main program area of the flash memory 9 is started, and the main program storage area is newly rewritten by overwriting the main program. At this time, the CPU 1 has a RAM which is a main memory necessary for the download processing operation.
The access to the download processing area in 10 is also performed.

【0037】CPU1が定常状態にあり、所要の制御処
理を行う場合、フラッシュメモリ9に格納されている所
要の機能のタスクが起動し、RAM10の処理用メモリ
領域を使用し処理動作を行う。この処理動作では、I/
Oポート11、フラッシュメモリ9、RAM10へのア
クセス制御は、CPU1のアドレスバス101のアドレ
ス信号及び制御線103の制御信号に基づいてどの記憶
領域へアクセスするか、又、CPU1にとってアクセス
するデータは入出力どちらなのかを判断するアドレスデ
コーダ6と制御器7に委ねられている。
When the CPU 1 is in a steady state and performs required control processing, a task of a required function stored in the flash memory 9 is activated, and performs a processing operation using the processing memory area of the RAM 10. In this processing operation, I /
The access control to the O port 11, the flash memory 9, and the RAM 10 is performed based on the address signal of the address bus 101 of the CPU 1 and the control signal of the control line 103. It is up to the address decoder 6 and the controller 7 to determine which is the output.

【0038】通常、CPU1はフラッシュメモリ9の主
プログラムメモリ領域が消去又は書き換えにより破壊さ
れない限り、プログラムによる所要の処理を実行する動
作を継続する。CPU1に軽微な異常状態が生じた場合
にはウォッチドッグパルスの出力が瞬断することにな
り、ウォッチドッグ回路2がウォッチドッグウオッチド
ックリセットパルスを出力することによりCPU1はウ
オッチドックリセットされ、異常状態から復帰して再び
ウォッチドッグパルスが出力されるようになる。一方、
CPU1が暴走するような異常状態ではウォッチドッグ
回路2によるリセット動作ではCPU1を正常状態に回
復させることはできないので、リセット動作が所定周期
で継続することになる。
Normally, the CPU 1 continues the operation of executing required processing by a program unless the main program memory area of the flash memory 9 is destroyed by erasing or rewriting. When a slight abnormal state occurs in the CPU 1, the output of the watchdog pulse is momentarily interrupted, and the watchdog circuit 2 outputs the watchdog watchdog reset pulse, so that the CPU1 is reset by the watchdog, and the abnormal state is detected. And the watchdog pulse is output again. on the other hand,
In an abnormal state in which the CPU 1 runs away, the reset operation by the watchdog circuit 2 cannot restore the CPU 1 to a normal state, so that the reset operation continues at a predetermined cycle.

【0039】次に、リセットカウンター部3、システム
エラー検出器4及び異常状態検出器5の詳細な動作を説
明する。リセットカウンター31は、ウォッチドッグ回
路2からのウォッチドッグリセットパルスを計数するカ
ウンターであり、リセットカウンター31には、CPU
1が正常時にはその計数値を常時リセットする機能を有
するM秒[s]カウンター32が設けられている。M
[s]カウンター32は、ウオッチドック回路2の出力
のウォッチドッグリセットパルスでリセットされ、内部
の高速クロック(図示せず)を常に計数しており、ウォ
ッチドッグリセットパルスが入力されなければM秒毎に
リセットパルスを出力し、リセットカウンター31の計
数値を「0」にリセットする。
Next, detailed operations of the reset counter 3, the system error detector 4, and the abnormal state detector 5 will be described. The reset counter 31 is a counter that counts a watchdog reset pulse from the watchdog circuit 2.
An M second [s] counter 32 having a function of constantly resetting its count value when 1 is normal is provided. M
The [s] counter 32 is reset by a watchdog reset pulse output from the watchdog circuit 2, constantly counts an internal high-speed clock (not shown), and every M seconds unless a watchdog reset pulse is input. To reset the count value of the reset counter 31 to “0”.

【0040】このため、例えば、CPU1が正常状態か
ら軽微な異常状態となり、ウォッチドッグ回路2が1つ
のウォッチドッグリセットパルスを発生すると、リセッ
トカウンター31はウォッチドッグリセットパルスを計
数し、計数値「1」となったとしても、M[s]カウン
ター32も前記ウォッチドッグリセットパルスによりリ
セットされ、その時点からM秒後にリセットパルスを発
生してリセットカウンター31を計数値「0」にリセッ
トする。また、CPU1が正常状態から暴走状態になっ
た場合には、ウォッチドッグ回路2はウォッチドッグリ
セットパルスをM秒間隔で連続的に発生するので、M
[s]カウンター32はM秒の直前で前記ウォッチドッ
グリセットパルスによりリセットされ、リセットカウン
ター31をリセットするリセットパルスを発生しなくな
る。
Therefore, for example, when the CPU 1 changes from a normal state to a slightly abnormal state and the watchdog circuit 2 generates one watchdog reset pulse, the reset counter 31 counts the watchdog reset pulse, and the count value “1” is set. , The M [s] counter 32 is also reset by the watchdog reset pulse, and a reset pulse is generated M seconds later to reset the reset counter 31 to the count value “0”. When the CPU 1 changes from a normal state to a runaway state, the watchdog circuit 2 generates a watchdog reset pulse continuously at intervals of M seconds.
[S] The counter 32 is reset by the watchdog reset pulse just before M seconds, and does not generate a reset pulse for resetting the reset counter 31.

【0041】このような状態ではリセットカウンター3
1はウォッチドッグリセットパルスの計数を継続し計数
値を増加させていく。そして、リセットカウンター31
が所定カウント値Nに達すると、システムエラー検出器
4はシステムエラー信号、例えば「1」を出力する。な
お、CPU1がその後正常状態に復帰すると、ウォッチ
ドッグ回路2はウォッチドッグリセットパルスを出力し
なくなるから、最後に出力されたウォッチドッグリセッ
トパルスのM秒後からM[s]カウンター32はM秒間
隔でリセットパルスを出力するようになり、リセットカ
ウンター31の計数値はリセットされ、システムエラー
信号は、例えば「0」となり復帰する。
In such a state, the reset counter 3
1 keeps counting the watchdog reset pulse and increases the count value. And the reset counter 31
Reaches a predetermined count value N, the system error detector 4 outputs a system error signal, for example, “1”. When the CPU 1 returns to the normal state thereafter, the watchdog circuit 2 does not output the watchdog reset pulse. Therefore, M seconds after the last output watchdog reset pulse, the M [s] counter 32 has an interval of M seconds. , A reset pulse is output, the count value of the reset counter 31 is reset, and the system error signal returns to, for example, “0”.

【0042】次に、異常状態検出器5は、ウオッチドッ
ク回路2及びM[s]カウンター32の各出力を入力と
し、ウオッチドック回路2のウォッチドッグリセットパ
ルスが入力すると、直ちに異常状態の信号レベル、例え
ば「1」を出力し、M[s]カウンター32の出力であ
るリセットパルスを入力すると前記信号レベルを、例え
ば「0」に復帰させ、CPU1の異常状態を瞬時に判断
する。
Next, the abnormal state detector 5 receives the outputs of the watchdog circuit 2 and the M [s] counter 32 as inputs, and when the watchdog reset pulse of the watchdog circuit 2 is input, the signal level of the abnormal state is immediately set. For example, when "1" is output and a reset pulse output from the M [s] counter 32 is input, the signal level is returned to, for example, "0", and an abnormal state of the CPU 1 is immediately determined.

【0043】次に、本発明の特徴とする主プログラムの
ダウンロードにおけるフラッシュメモリ9への書き込み
異常終了と、この場合のCPU1の異常状態の検出及び
システムエラー検出等の動作について説明する。CPU
1が正常な定常状態とすると、M[s]カウンター32
はリセットパルスを続して出力するから、予備領域アク
セス制御器8の書き込み動作記憶部81はリセットされ
ており、システムエラー検出器4もシステムエラー通知
信号を出力していないので、選択部83は、CPU1の
アドレスバスを選択して、主プログラム領域の主プログ
ラムを使用して所要の処理動作を行う。CPU1の前記
処理動作においては、図2に示すフラッシュメモリ制御
部72は、CPU1からの制御信号及びアドレスデコー
ド6からのフラッシュメモリアクセス通知によりフラッ
シュメモリ9の書き込み及び読み出し制御を行う書き込
み制御信号及び読み出し制御信号を出力する。また、R
AM制御部73は、RAM10への書き込み及び読み出
し制御を行う書き込み制御信号及び読み出し制御信号を
出力する。書き込み禁止制御部71は、フラッシュメモ
リ用書き込み制御信号をフラッシュメモリ9及び予備領
域アクセス制御器8に出力する。
Next, an explanation will be given of the abnormal termination of writing to the flash memory 9 during the download of the main program, and the operation of detecting an abnormal state of the CPU 1 and detecting a system error in this case. CPU
Assuming that 1 is a normal steady state, the M [s] counter 32
Outputs a reset pulse, the write operation storage unit 81 of the spare area access controller 8 has been reset, and the system error detector 4 has not output a system error notification signal. , The address bus of the CPU 1 is selected, and a required processing operation is performed using the main program in the main program area. In the processing operation of the CPU 1, the flash memory control unit 72 shown in FIG. 2 controls the writing and reading of the flash memory 9 based on the control signal from the CPU 1 and the flash memory access notification from the address decoder 6. Outputs control signal. Also, R
The AM control unit 73 outputs a write control signal and a read control signal for controlling writing and reading to and from the RAM 10. The write prohibition control section 71 outputs a write control signal for flash memory to the flash memory 9 and the spare area access controller 8.

【0044】ここで、CPU1がホスト46等から主プ
ログラムをダウンロードする指示を受けた場合、フラッ
シュメモリ9及びRAM10の主プログラム領域のダウ
ンロード用領域からダウンロードのプログラムを読み出
してI/Oポート45を介して入力される新しいプログ
ラムをフラッシュメモリ9及びRAM10に上書きして
いくダウンロード動作を開始する。このダウンロード動
作はCPU1からの指令により、図7に示すアドレスデ
コード6がフラッシュメモリアクセス通知を出力し、制
御器7のフラッシュメモリ制御部72が書き込み制御信
号を書き込み禁止制御部71に出力し、書き込み禁止制
御部71がフラッシュメモリ用書き込み制御信号をフラ
ッシュメモリ9及びRAM10に出力することにより行
われる。
Here, when the CPU 1 receives an instruction to download the main program from the host 46 or the like, the CPU 1 reads the download program from the download area of the main program area of the flash memory 9 and the RAM 10 and sends the read program via the I / O port 45. A download operation is started in which a new program inputted by overwriting the flash memory 9 and the RAM 10 is overwritten. In this download operation, in response to a command from the CPU 1, the address decoder 6 shown in FIG. 7 outputs a flash memory access notification, and the flash memory control unit 72 of the controller 7 outputs a write control signal to the write inhibit control unit 71, and This is performed by the prohibition control unit 71 outputting a flash memory write control signal to the flash memory 9 and the RAM 10.

【0045】ダウンロード動作が開始されると、図3に
示す書き込み動作記憶部81には、最初にフラッシュメ
モリメモリ用書き込み制御信号が入力され、CPU1が
正常に動作しフラッシュメモリ9への書き込みを完了し
た場合にはフラッシュメモリ制御部72から書き込み終
了通知信号が次に入力される。また、CPU1の動作に
異常が発生した場合には書き込み終了通知信号が入力さ
れずに、図2に示す書き込み禁止制御部71からの書き
込み禁止制御信号が入力される。なお、書き込み禁止制
御部71からの書き込み禁止制御信号は、CPU1の異
常状態を異常状態検出器5がウォッチドッグリセットパ
ルスにより検出したとき出力される。
When the download operation is started, a write control signal for flash memory is first input to the write operation storage unit 81 shown in FIG. 3, and the CPU 1 operates normally and completes writing to the flash memory 9. In this case, a write completion notification signal is input from the flash memory control unit 72 next. When an abnormality occurs in the operation of the CPU 1, a write-inhibition control signal from the write-inhibition control unit 71 shown in FIG. The write-inhibition control signal from the write-inhibition control section 71 is output when the abnormal state detector 5 detects an abnormal state of the CPU 1 by a watchdog reset pulse.

【0046】書き込み動作記憶部81は、フラッシュメ
モリの書き込み動作でのCPU1の異常状態の発生の有
無を、書き込み終了通知信号と書き込み禁止制御信号の
入力の違いを利用して動作履歴として保持する。つま
り、書き込み動作記憶部81は、CPU1がダウンロー
ド動作を正常に開始した後、ダウンロードを正常に終了
して制御信号を出力すると、フラッシュメモリ制御部7
2から出力される書き込み終了通知信号が出力されるの
で、書き込み動作が正常に終了したと判断して異常動作
の動作履歴を記憶しない。例えば、動作履歴「0」とな
る。また、CPU1がダウンロード動作を正常に開始し
た後、CPU1が異常状態になると、書き込み終了通知
信号が入力される前に、書き込み禁止制御信号が出力さ
れるので、書き込み異常終了と判断して書き込み異常状
態の動作履歴を記憶する。例えば、動作履歴「1」とな
る。
The write operation storage section 81 holds the presence or absence of occurrence of an abnormal state of the CPU 1 in the write operation of the flash memory as an operation history by utilizing the difference between the input of the write end notification signal and the input of the write inhibit control signal. That is, when the CPU 1 normally starts the download operation and then normally ends the download and outputs the control signal, the write operation storage unit 81
Since the write completion notification signal output from the second device is output, it is determined that the write operation has been normally completed, and the operation history of the abnormal operation is not stored. For example, the operation history is “0”. Further, if the CPU 1 enters an abnormal state after the CPU 1 normally starts the download operation, the write inhibit control signal is output before the write end notification signal is input. The operation history of the state is stored. For example, the operation history is “1”.

【0047】書き込み禁止制御部71が書き込み禁止制
御信号を出力するとき、同時にフラッシュメモリ制御部
72が出力する書き込み制御信号によるフラッシュメモ
リの書き込み制御を直ちに禁止するので、フラッシュメ
モリ9及びRAM10は、書き込み禁止制御部71から
の書き込み禁止制御により、CPU1からの書き込み指
示があっても書き込みが行われない為、主プログラム領
域は保護される。
When the write inhibit control unit 71 outputs the write inhibit control signal, the write control of the flash memory by the write control signal output from the flash memory control unit 72 is immediately inhibited, so that the flash memory 9 and the RAM 10 Under the write prohibition control from the prohibition control unit 71, even if there is a write instruction from the CPU 1, writing is not performed, so that the main program area is protected.

【0048】ここで、CPU1がウォッチドッグ回路2
によるウォッチドッグリセットによりCPU1が復帰し
た場合、異常状態検出器5の出力は、M[s]カウンタ
ー32のリセット出力によって直ちに異常状態から正常
状態の出力に切り替わる(CPU1が定常状態に復帰し
たと判断)ので、書き込み禁止制御部71は、フラッシ
ュメモリ9への書き込み禁止を解除する。同時に、書き
込み動作記憶部81は、M[s]カウンター32出力の
リセットによって(CPU1が定常状態に復帰したと判
断し)直ちに書き込み動作履歴の記憶を消去(「0」)
して、再び書き込み動作の異常状態の検出動作にもど
る。つまり、CPU1の復帰可能な短期間に発生する異
常状態は動作履歴として残らない。また、このようなC
PU1の軽微な異常では、CPU1は一般に書き込みを
一時的に停止しても、書き込み禁止制御直前までの書き
込み状態を保持し、正常状態に復帰した場合に書き込み
を再開することが可能である。CPU1の書き込みの再
開動作のために、CPU1が書き込み禁止制御状態を認
識できるように、異常状態検出器5又は書き込み禁止制
御部71からの書き込み禁止の情報を利用できるように
構成することができる。
Here, the CPU 1 is connected to the watchdog circuit 2
When the CPU 1 returns due to the watchdog reset, the output of the abnormal state detector 5 is immediately switched from the abnormal state to the output of the normal state by the reset output of the M [s] counter 32 (judging that the CPU 1 has returned to the steady state. Therefore, the write prohibition control section 71 releases the prohibition of writing to the flash memory 9. At the same time, the writing operation storage unit 81 immediately erases the storage of the writing operation history (“0”) by resetting the output of the M [s] counter 32 (determining that the CPU 1 has returned to the steady state).
Then, the operation returns to the operation of detecting the abnormal state of the write operation. That is, an abnormal state that occurs in a short period during which the CPU 1 can recover does not remain as an operation history. Also, such C
In the case of a slight abnormality of the PU1, the CPU 1 can generally maintain the write state immediately before the write prohibition control even if the write operation is temporarily stopped, and restart the write operation when the write operation returns to the normal state. In order to allow the CPU 1 to recognize the write-inhibited control state for the operation of restarting the writing by the CPU 1, it can be configured to use the write-inhibited information from the abnormal state detector 5 or the write-inhibited control unit 71.

【0049】また、CPU1の暴走等により、上述のC
PU1の異常状態が検出される前にフラッシュメモリ9
の主プログラムメモリ領域が消去されたり、書き換えに
より破壊された場合や、CPU1の周辺回路を構成する
ハードウェアの破損等により上述のウォッチドッグリセ
ットではCPU1の復帰が不可能となる場合が想定され
る。この状況では、ウォッチドッグパルスがCPU1よ
り出力されない状態が継続するから、ウォッチドッグ回
路2の出力信号であるウォッチドッグリセットパルスが
周期M[s]毎に出力される。システムエラー検出器4
は、リセットカウンター31のカウント値が所定カウン
ト値Nより大きくなるとシステムエラーと判断し(CP
U1がある一定時間L[s]の間暴走状態であればシス
テムエラーであると定義した時、時間Lと周期Mとの関
係は、L=M×(N−1)(N>0)で定義付けられ
る)、システムエラー通知を図3に示す予備領域アクセ
ス制御器8の選択部83へ通知する。選択部83は、以
下のようにシステムエラー検出器4及び書き込み動作記
憶部81の出力の状態の組み合わせにより、アドレスバ
スの切り替えを行う。
Also, due to the runaway of the CPU 1 or the like, the above C
Before the abnormal state of PU1 is detected, the flash memory 9
It is assumed that the main program memory area of the CPU 1 is erased or destroyed by rewriting, or that the CPU 1 cannot be restored by the above-mentioned watchdog reset due to damage of hardware constituting peripheral circuits of the CPU 1 or the like. . In this situation, since a state in which the watchdog pulse is not output from the CPU 1 continues, a watchdog reset pulse which is an output signal of the watchdog circuit 2 is output every cycle M [s]. System error detector 4
Determines that a system error has occurred when the count value of the reset counter 31 exceeds a predetermined count value N (CP
If U1 is defined as a system error if it is in a runaway state for a certain time L [s], the relationship between time L and cycle M is L = M × (N−1) (N> 0). ) Is notified to the selecting unit 83 of the spare area access controller 8 shown in FIG. The selection unit 83 switches the address bus according to a combination of the output states of the system error detector 4 and the write operation storage unit 81 as described below.

【0050】選択部83は、システムエラー検出器4か
らのシステムエラー通知を受けた場合、書き込み動作記
憶部81が書き込み動作履歴としてCPU動作異常を記
憶していれば、フラッシュメモリ9への不当なデータの
上書きが行われたと判断し、予備領域アドレス生成部8
2が出力するダウンロード用の予備プログラムが記憶さ
れているダウンロード予備領域のアドレスを選択する。
選択部83がダウウンロード用予備領域のアドレスを選
択する事で、CPU1は、強制的にダウンロード用予備
領域のプログラムにより動作する。つまり、フラッシュ
メモリ9のダウンロード用予備領域にはシステムエラー
時に必要なダウンロード機能プログラムが記憶されてい
るから、CPU1は、システムエラー検出後、直ちにウ
ォッチドッグリセット信号によりダウンロード用予備領
域の予備プログラムの処理動作を起動し、ダウンロード
動作に復帰する。この結果、本来のフラッシュメモリ9
のメインメモリへの主プログラムのダウンロードが、予
備プログラムによってRAM10内の予備メモリに行わ
れる。
Upon receiving the system error notification from the system error detector 4, if the write operation storage unit 81 stores the CPU operation abnormality as the write operation history, the selection unit 83 It is determined that the data has been overwritten, and the spare area address generation unit 8
2 selects an address of a download spare area in which a download spare program output is stored.
When the selection unit 83 selects the address of the download spare area, the CPU 1 forcibly operates according to the program of the download spare area. That is, since the download function program necessary for a system error is stored in the download spare area of the flash memory 9, the CPU 1 immediately processes the spare program of the download spare area by the watchdog reset signal after detecting the system error. Start the operation and return to the download operation. As a result, the original flash memory 9
The main program is downloaded to the spare memory in the RAM 10 by the spare program.

【0051】また、選択部83は、システムエラー検出
器4からのシステムエラー通知を受けた場合、書き込み
動作記憶部81が書き込み動作履歴に異常状態を記憶し
ていなければ、フラッシュメモリへ不当なデータの上書
きがなかったと判断し、予備領域アドレス生成部82が
出力するセルフチェック用予備領域のアドレスを選択す
る。セルフチェック用予備領域のアドレスを選択する事
で、CPU1は、強制的にセルフチェック予備領域への
アクセスに切り替えられる。フラッシュメモリ9のセル
フチェック用予備領域にはシステムエラー時に必要とな
るCPU1のセルフチェックの予備プログラム及び周辺
回路のハードウェアチェック機能の予備プログラムが記
憶されている。CPU1は、システムエラー検出後、直
ちにウォッチドッグリセット信号によCPU1のセルフ
チェック及び周辺回路のハードウェアチェック機能予備
プログラムでの処理動作が起動し、CPU動作が復帰す
る。そして、CPU1のセルフチェック機能及び周辺回
路のハードウェアチェック機能のプログラム処理が予備
プログラムによってRAM10内の予備メモリを使用し
て行われる。
When the selection unit 83 receives the system error notification from the system error detector 4, if the write operation storage unit 81 does not store an abnormal state in the write operation history, the illegal data is stored in the flash memory. It is determined that there has been no overwriting, and the address of the self-check spare area output by the spare area address generation unit 82 is selected. By selecting the address of the spare area for self-check, the CPU 1 is forcibly switched to access to the spare area for self-check. In the spare area for self-check of the flash memory 9, a spare program for self-check of the CPU 1 and a spare program for a hardware check function of peripheral circuits, which are necessary at the time of a system error, are stored. Immediately after the detection of the system error, the CPU 1 starts the self-check of the CPU 1 and the processing operation of the hardware check function spare program of the peripheral circuit by the watchdog reset signal, and the CPU operation returns. Then, the program processing of the self-check function of the CPU 1 and the hardware check function of the peripheral circuit is performed using the spare memory in the RAM 10 by the spare program.

【0052】図4は、本実施の形態の動作パターンの一
覧を示す図である。パターンAは正常動作での各部の動
作状態を示し、アドレスバスは主メモリ領域を選択し、
ダウンロード動作の有無に拘わらず正常に動作する場合
である。パターンBは、書き込み中に少なくとも1回の
ウォッチドッグリセットが行われ、これによりCPU1
が正常に復帰する動作の場合である。パターンCはシス
テムエラーが発生し、異常動作の履歴がなくセルフチェ
ック動作を行う場合である。更に、パターンDはシステ
ムエラーが発生し、異常動作の履歴があり再度ダウンロ
ードを行う場合である。パターンC、Dではアドレスバ
スは予備メモリ領域を選択する。
FIG. 4 is a diagram showing a list of operation patterns according to the present embodiment. Pattern A shows the operation state of each part in normal operation, the address bus selects the main memory area,
This is a case where normal operation is performed regardless of the presence or absence of the download operation. In the pattern B, at least one watchdog reset is performed during the writing, whereby the CPU 1
Is a case where the operation returns to normal. Pattern C is a case in which a system error has occurred and the self-check operation is performed without any abnormal operation history. Pattern D is a case where a system error has occurred and there is a history of abnormal operation and download is performed again. In patterns C and D, the address bus selects a spare memory area.

【0053】以上の実施の形態では通常の通信回線を使
用する例により説明したが、通信回線としては、衛星通
信回線、通信用ケーブルを使用するパーソナルコンピュ
ータ間の通信回線又は電話回線等を使用することができ
る。
In the above embodiment, an example using a normal communication line has been described. As the communication line, a satellite communication line, a communication line between personal computers using a communication cable, a telephone line, or the like is used. be able to.

【0054】[0054]

【発明の効果】本発明によれば、CPUの異常状態で
は、これを直ちに検出してプログラム格納用フラッシュ
メモリへの書き込みを禁止するように構成しているか
ら、フラッシュメモリへの不当な上書きを防止する事が
でき、CPUは異常状態から回復可能な場合にはウオッ
チドック回路により書き込み動作を再開でき上書き動作
を正常に終了することが可能である。また、これにより
CPU動作を効率よく運用することが可能となる。
According to the present invention, when the CPU is in an abnormal state, the abnormal state is immediately detected and writing to the flash memory for program storage is prohibited. When the recovery from the abnormal state is possible, the CPU can restart the write operation by the watchdog circuit and normally end the overwrite operation. In addition, this makes it possible to efficiently operate the CPU operation.

【0055】また、CPUが初期の異常状態から復帰不
可能な状態(システムエラー)に陥ってしまった場合、
これをCPUの継続的な異常状態により検出し、それ以
前にCPUがフラッシュメモリへ不当な書き込みを行っ
たと判断し、CPUがアクセスする領域を予備プログラ
ムが格納された予備メモリ領域へ強制的に切り替わる事
で予備プログラムを起動するように構成しているので、
直ちに主プログラムを修復したり、セルフチェックによ
るシステムエラーの原因を究明する事が可能である。
If the CPU falls into an unrecoverable state (system error) from an initial abnormal state,
This is detected by the continuous abnormal state of the CPU, and it is determined that the CPU has performed an illegal write to the flash memory before that, and the area accessed by the CPU is forcibly switched to the spare memory area storing the spare program. Because it is configured to start the backup program
It is possible to repair the main program immediately or to investigate the cause of system error by self-check.

【0056】更に、予備メモリ領域をアクセスする制御
機能を持たせた事により、予備メモリ用ROM、RAM
を新たに設置する必要がなくメモリ回路規模を最小限に
抑えることができる。
Further, by providing a control function for accessing the spare memory area, the spare memory ROM and RAM
Need not be newly installed, and the memory circuit scale can be minimized.

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

【図1】本発明の通信装置制御回路の一実施の形態を示
す図である。
FIG. 1 is a diagram showing one embodiment of a communication device control circuit of the present invention.

【図2】本実施の形態の制御器の構成を示す図である。FIG. 2 is a diagram illustrating a configuration of a controller according to the present embodiment.

【図3】本実施の形態の予備領域アクセス制御部の構成
を示す図である。
FIG. 3 is a diagram illustrating a configuration of a spare area access control unit according to the present embodiment.

【図4】本実施の形態の動作のパターンを示す図であ
る。
FIG. 4 is a diagram showing an operation pattern according to the present embodiment.

【図5】従来の通信装置制御回路を示す図である。FIG. 5 is a diagram showing a conventional communication device control circuit.

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

1、41 CPU 2、42 ウォッチドッグ回路 3 リセットカウンター部 4 システムエラー検出器 5 異常状態検出器 6、44 アドレスデコード 7 制御器 8 予備領域アクセス制御器 9、47 フラッシュメモリ 10、48、50 RAM 11、45 I/Oポート 31 リセットカウンター 32 M[s]カウンター 43 システムエラー検出回路 71 書込禁止制御部 72 フラッシュメモリ制御部 73 RAM制御部 81 書き込み動作記憶部 82 予備領域アドレス生成部 83 選択部 1, 41 CPU 2, 42 Watchdog circuit 3 Reset counter unit 4 System error detector 5 Abnormal state detector 6, 44 Address decode 7 Controller 8 Reserved area access controller 9, 47 Flash memory 10, 48, 50 RAM 11 , 45 I / O port 31 Reset counter 32 M [s] counter 43 System error detection circuit 71 Write inhibit control unit 72 Flash memory control unit 73 RAM control unit 81 Write operation storage unit 82 Reserved area address generation unit 83 Selection unit

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 中央処理装置の動作の現用プログラム及
び予備プログラムを格納する主メモリ領域及び予備メモ
リ領域を有する書き換え可能なメモリに、通信回線を介
してプログラムの書き込みを行う通信制御回路におい
て、 中央処理装置の動作異常が継続すると一定継続時間毎に
中央処理装置をリセットするリセット信号を発生するウ
オッチドック回路と、前記リセット信号に基づき中央処
理装置の動作異常の継続時間に対応する異常状態信号を
出力する異常状態検出器と、前記異常状態信号に基づき
前記中央処理装置の前記プログラムの書き込みを禁止す
る制御部とを有することを特徴とする通信装置制御回
路。
1. A communication control circuit for writing a program via a communication line to a rewritable memory having a main memory area and a spare memory area for storing a working program and a spare program for operation of a central processing unit, the communication control circuit comprising: A watchdog circuit that generates a reset signal that resets the central processing unit at regular intervals when the operation abnormality of the processing device continues, and an abnormal state signal corresponding to the duration of the operation abnormality of the central processing device based on the reset signal. A communication device control circuit, comprising: an abnormal state detector that outputs a signal; and a control unit that prohibits the central processing unit from writing the program based on the abnormal state signal.
【請求項2】 前記ウオッチドック回路が出力する前記
リセット信号を計数するリセットカウンターと、前記リ
セット信号の間隔が前記一定継続時間以上の時に前記リ
セットカウンターをリセットするリセット回路とを有
し、前記異常状態検出器は、前記リセット信号により開
始し前記リセット回路の出力により終了する前記異常状
態信号を出力することを特徴とする請求項1記載の通信
装置制御回路。
A reset counter for counting the reset signal output from the watchdog circuit; and a reset circuit for resetting the reset counter when an interval between the reset signals is equal to or longer than the predetermined duration. 2. The communication device control circuit according to claim 1, wherein the status detector outputs the abnormal status signal that starts with the reset signal and ends with the output of the reset circuit.
【請求項3】 前記リセットカウンターの計数値が所定
値に達したときにシステムエラー信号を出力するシステ
ムエラー検出器と、中央処理装置の前記プログラムの書
き込み開始後、書き込み終了前に前記制御部が書き込み
の禁止動作を行った場合に異常動作履歴として保持する
書き込み動作記憶部とを有し、前記システムエラー信号
の発生時に、書き込み動作記憶部が異常動作履歴を保持
している場合は、予備プログラムにより通信回線を介し
て新たにプログラムの書き込みを行うことを特徴とする
請求項2記載の通信装置制御回路。
3. A system error detector that outputs a system error signal when a count value of the reset counter reaches a predetermined value, and the control unit is configured to start writing of the program of the central processing unit and before the end of writing. A write operation storage unit for holding as an abnormal operation history when a write prohibition operation is performed, and when the system error signal is generated, the write operation storage unit holds the abnormal operation history. 3. The communication device control circuit according to claim 2, wherein a program is newly written via a communication line.
【請求項4】 前記システムエラー信号の発生時に、書
き込み動作記憶部が異常動作履歴を保持していない場合
は、予備プログラムによりセルフチェック動作を行うこ
とを特徴とする請求項3記載の通信装置制御回路。
4. The communication device control according to claim 3, wherein when the system error signal is generated, if the write operation storage unit does not hold an abnormal operation history, a self-check operation is performed by a spare program. circuit.
【請求項5】 書き換え可能なメモリには、フラッシュ
メモリを含むことを特徴とする請求項1、2、3又は4
記載の通信装置制御回路。
5. The rewritable memory includes a flash memory.
The communication device control circuit according to any one of the preceding claims.
JP11080589A 1999-03-24 1999-03-24 Communication device control circuit Pending JP2000276354A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11080589A JP2000276354A (en) 1999-03-24 1999-03-24 Communication device control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11080589A JP2000276354A (en) 1999-03-24 1999-03-24 Communication device control circuit

Publications (1)

Publication Number Publication Date
JP2000276354A true JP2000276354A (en) 2000-10-06

Family

ID=13722538

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11080589A Pending JP2000276354A (en) 1999-03-24 1999-03-24 Communication device control circuit

Country Status (1)

Country Link
JP (1) JP2000276354A (en)

Similar Documents

Publication Publication Date Title
CN110865822A (en) Starting framework and method of Bootloader flash program for whole vehicle controller
JP2006338445A (en) Abnormality information storage apparatus
JP2002062956A (en) Service interruption processing method and service interruption processing device
JPH08178976A (en) Power breakage detector
JP2000276354A (en) Communication device control circuit
JPH09120376A (en) Data processor
KR100697086B1 (en) Mobile communication terminal enable to backup and its operating method
JPH09198258A (en) Task stack overflow detecting circuit
JP2004054616A (en) Information processor with function to automatically restore firmware
JPH1011293A (en) Information processor
JP4535316B2 (en) Terminal fail-safe system, terminal fail-safe method, and terminal fail-safe program
JP2003150449A (en) Cellular phone device
JP2000059981A (en) Digital protective relay device
JP3094924B2 (en) Communication device control circuit
JP2013065261A (en) Memory management device
JP2000181510A (en) Backup data protecting method for programmable controller, and programmable controller
JP2000163274A (en) Electronic equipment and recording medium with rom data monitoring program recorded thereon
JP2000132462A (en) Self-repairing system for program
JP2003242044A (en) Microcomputer circuit
JPH1125007A (en) Method for storing/recovering backup data
JP4543505B2 (en) Microcomputer control method and abnormality monitoring device
JP2003140915A (en) Computer device, and download method of program
JP3087650B2 (en) Automatic power recovery method
JPH0695974A (en) Memory protecting system
JPH08220198A (en) Battery backup memory unit and backup function testing method