JP3951371B2 - Watchdog timer and microcomputer - Google Patents
Watchdog timer and microcomputer Download PDFInfo
- Publication number
- JP3951371B2 JP3951371B2 JP20462597A JP20462597A JP3951371B2 JP 3951371 B2 JP3951371 B2 JP 3951371B2 JP 20462597 A JP20462597 A JP 20462597A JP 20462597 A JP20462597 A JP 20462597A JP 3951371 B2 JP3951371 B2 JP 3951371B2
- Authority
- JP
- Japan
- Prior art keywords
- cpu
- output
- watchdog timer
- circuit
- signal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、CPUが暴走したときに当該CPUをリセットしたり或いは割込みをかけるためのウォッチドッグタイマ及び斯様なウォッチドッグタイマを備えたマイクロコンピュータに関する。
【0002】
【従来の技術】
従来より、ウォッチドッグタイマとして、特開平3−194628号公報のものが提案されている。このものは、エミュレーション時に、特別に設けられた外部端子の信号レベルをハイレベルとすることによりウオッチドッグタイマを停止するように構成されており、その外部端子に切替えのための信号を与えるだけで済むので、デバッグ等も容易になる。
【0003】
【発明が解決しようとする課題】
しかしながら、上記構成のものでは、ウォッチドッグタイマを停止させるための信号を当該ウォッチドッグタイマの外部端子に与えなければならず、その接続が極めて面倒であった。
【0004】
本発明は上記事情に鑑みてなされたもので、その目的は、プログラム開発のデバッグ作業の際に、面倒な接続を行うことなく簡単に機能検査を行うことができるウォッチドッグタイマ及び斯様なウォッチドッグタイマを備えたマイクロコンピュータを提供することにある。
【0005】
【課題を解決するための手段】
請求項1の発明によれば、CPUが正常に動作しているときは、CPUは、ウォッチドッグタイマに所定周期毎にアクセスするので、カウント手段は、カウント動作を繰返して実行する。この場合、ウォッチドッグタイマのカウント値が限度値となることはない。
【0006】
そして、CPUが暴走したときは、CPUはウォッチドッグタイマにアクセスしなくなるので、カウント手段のカウント値が限度値となる。これにより、カウント手段は異常信号をCPUへ出力するので、CPUはリセットされたり或いは割込みをかけられることにより暴走状態が停止する。
【0007】
さて、エミュレーション時においてウォッチドッグタイマの動作を検査するためにカウント手段のカウント動作を一時停止するときは、CPUによるエミュレーションプログラムの実行により停止指令発生手段に対して第1のデータの書込みを行う。
【0008】
すると、停止指令発生手段は、カウント手段へ停止指令を出力するので、カウント手段はカウント動作を停止する。この状態でウォッチドッグタイマの動作状態を検査する。
【0009】
また、カウント手段のカウント動作を再開するときは、停止指令発生手段に対してCPUにより第2のデータの書込みを行う。すると、停止指令発生手段は、カウント手段に対する停止指令の出力を停止する。これにより、カウント手段がカウント動作を再開するようになる。
【0014】
この場合、停止指令出力手段による停止指令の出力状態を確認するときは、エミュレーションプログラム実行中のCPUは制御回路にアクセスする。
すると、制御回路は、出力状態出力手段に指令を与え、それに応じて出力状態出力手段は、停止指令発生手段による停止指令の出力状態を出力するので、その出力によりCPUは停止指令の出力状態を確認することができる。
【0015】
また、カウント手段のカウント値を確認したいときは、エミュレーションプログラム実行中のCPUは制御回路にアクセスする。
すると、制御回路は、カウント値出力手段に指令を与え、それに応じてカウント値出力手段は、カウント手段のカウント値を出力するので、その出力によりCPUはカウント手段のカウント値を確認することができる。
従って、CPUによるエミュレーションプログラムの実行により任意のタイミングでウォッチドッグタイマを停止したり、再動作させたりすることができるので、ウォッチドッグタイマに配線を接続することなくプログラム開発のデバッグ作業ができる。
【0016】
【発明の実施の形態】
以下、本発明の一実施例を図面を参照して説明する。
図1はワンチップマイクロコンピュータの概略構成を示すと共に、ワンチップマイクロコンピュータが有するウォッチドッグタイマの電気的構成を示している。この図1において、ワンチップマイクロコンピュータ1は、CPU2、プログラムが記憶されたROM3、ワーキングデータ記憶用のRAM4及び周辺回路5に加えてウォッチドッグタイマ6を備えて構成されている。
【0017】
CPU2とROM3、RAM4、周辺回路5及びウォッチドッグタイマ6とはアドレスバス7及びデータバス8などのシステムバスを通じて接続されており、CPU1とそれらの間でシステムバスを通じてデータの授受が行われるようになっている。
【0018】
ウォッチドッグタイマ6は、カウントイネーブル発生回路9(停止指令出力手段に相当し、以下、CE発生回路と称する)、ダウンカウンタ10(カウント手段に相当)及び制御回路11を主体として構成されている。
【0019】
CE発生回路9において、ラッチ回路12のデータ入力端子Dにはデータバス8のDB0(データバスのビット0)が接続されており、クロック端子CがハイレベルとなったタイミングでデータバスDB0のビットパターンがラッチ回路12に記憶されて出力端子Qから出力される。
【0020】
ラッチ回路12のリセット端子Rには電源投入時にシステムリセット信号が入力されるようになっており、システムスタート時においてはラッチ回路12の出力端子Qの出力レベルはローレベルとなっている。
【0021】
ラッチ回路12のクロック端子Cにはアンド回路13の出力端子が接続されている。このアンド回路13の入力端子にはアドレスバスデコーダ14(以下、Aバスデコーダと称する)、データバスキーパターンデコーダ15(以下、Dバスキーパターンデコーダと称する)が接続されていると共に、CPU2からのライト信号IWRE、CPU駆動用のクロック信号CK1が入力するように接続されている。
【0022】
Aバスデコーダ14はアドレスバス7のビットパターンが所定パターンとなったことを検出するためのもので、例えばCE発生回路9に予め設定されたアドレスが[041C]hだとすると、アドレスデータが[041C]hとなった状態でハイレベル信号を出力する。
Dバスキーパターンデコーダ15はデータバス8のビットパターンが所定パターンとなったことを検出するためのものである。
【0023】
図2はDバスキーパターンデコーダ15の具体的回路を示している。この図2において、データバスDB5(ビット5)〜DB1(ビット1)が所定のキーパターンとなったときにアンド回路13からの出力がハイレベルとなるように構成されている。つまり、データバスDB1,DB3,DB5はアンド回路16の入力端子に直接接続され、データバスDB2,DB4はインバータ17を介してアンド回路16の入力端子に接続されている。
【0024】
従って、このような接続関係にあっては、DB5〜DB1のビットパターンが[10101]bとなったときのみアンド回路16のアンド条件が成立してハイレベル信号を出力し、これ以外のビットパターンではアンド回路16からハイレベル信号を出力することはない。
【0025】
以上の構成により、CE発生回路9は、アドレスバス7のビットパターンが[041C]hで且つデータバス8のDB5〜DB0のビットパターンが[101011]bとなった状態で(第1のアクセス条件、第1のデータの書込み動作に相当)、CPU2からライト信号IWREが入力し且つクロック信号CK1が入力したタイミングでハイレベルのカウントイネーブル信号(以下、CE信号と称する)と称する。
【0026】
また、CE発生回路9は、アドレスバス7のビットパターンが[041C]hで且つデータバス8のDB5〜DB0のビットパターンが[101010]bとなった状態で(第2のアクセス条件、第2のデータの書込み動作に相当)、CPU2からライト信号IWREが入力し且つクロック信号CK1が入力したタイミングでCE信号の出力を停止する。
【0027】
CE発生回路9からのCE信号はバッファ回路18に与えられる。このバッファ回路18の出力端子は所定のデータバスと接続されており、データバス8を通じてCPU2がバッファ回路18の出力レベルを読取れるようになっている。
【0028】
ダウンカウンタ10において、選択器19は制御回路11により決定された側のデータを入力してラッチ部20によりラッチすることによりダウンカウンタ10の値を更新するようになっている。つまり、選択器19は、選択端子Sがローレベルの状態においては入力端子IN0からの入力データを選択して出力すると共に、選択端子Sがハイレベルの状態においては入力端子IN1の入力データを選択して出力するようになっている。この場合、選択器19の入力端子IN1はデータバス8と接続されており、選択端子SがハイレベルとなったタイミングでCPU2からのカウント初期値をデータバス8を通じてダウンカウンタ10に取込むようになっている。
【0029】
ラッチ部20は、CPU駆動用のクロックCK1の入力タイミングで選択器19からの出力データをラッチして記憶すると共にその記憶データを出力する。この場合、ラッチ部20は記憶したデータが0となったときはCPU2へボロー信号(異常信号に相当)を出力するようになっている。
【0030】
デクリメント部21は、ラッチ部20からの出力データを入力し、その入力データから1を減算した値を出力する。
ラッチ部22は、C端子にハイレベルが入力したタイミングでデクリメント部21からの出力データを記憶すると共にその記憶データを出力する。このラッチ部22の出力端子は選択器19の入力端子IN0と接続されている。
【0031】
以上の構成により、ダウンカウンタ10は、所定タイミングでCPU2によりカウント初期値が設定されると共に、所定周期毎にカウント値が1ずつ減数される。
【0032】
バッファ回路23は、ダウンカウンタ10のカウント値をCPU2がリードするための回路であり、制御回路11からWDTリード信号を入力したタイミングでダウンカウンタ10からのカウント値をデータバス8を通じてCPU2へ出力する。
【0033】
一方、アンド回路24は、ダウンカウンタ10がデクリメント動作を実行するためのパルス信号を発生すると共に、CE発生回路9から出力されるCE信号に応じてダウンカウンタ10に対するパルス信号の出力を禁止する機能を有する。つまり、アンド回路24の入力端子はCE発生回路9からのCE信号をインバータ25を介して入力するように接続されていると共に、CPU駆動用のクロック信号CK2及び制御回路11からのタイマクロック信号を入力するように接続されている。
【0034】
従って、アンド回路24は、CE発生回路9からハイレベルのCE信号の非出力状態でクロック信号CK2が入力し且つ制御回路11からタイマクロック信号が入力したタイミングでアンド条件が成立してハイレベル信号をダウンカウンタ10へ出力する。
【0035】
制御回路11は、ウォッチドッグタイマ6全体の動作を制御するためのものである。つまり、制御回路11は、CPU2により所定のアドレスにアクセスされた状態でリード信号が与えられたタイミングでカウント値ライト信号をダウンカウンタ10へ出力する。
また、制御回路11は、例えば1μs毎にタイマクロック信号をアンド回路24へ出力する機能を有する。
【0036】
また、制御回路11は、自己に設定された所定のアドレスがアクセスされた状態でCPU2からリード信号が与えられたタイミングでCEリード信号を出力する。この場合、CEリード信号はバッファ回路18の制御端子に与えられるもので、その制御端子のレベルがハイレベルとなった状態でCE発生回路9からのCE信号の出力状態がバッファ回路18からデータバス8を通じてCPU2へ出力される。
【0037】
また、制御回路11は、自己に設定された所定のアドレス(CEリード信号出力用のアドレスとは異なる)がアクセスされた状態でCPU2からリード信号が与えられたタイミングでWDTリード信号を出力する。この場合、WDTリード信号はバッファ回路23の制御端子に与えられるもので、その制御端子のレベルがハイレベルとなった状態でダウンカウンタ10のカウント値がバッファ回路23からデータバス8を通じてCPU2へ出力される。
【0038】
さらに、制御回路11は、CPU2によりウォッチドッグタイマ10に対するカウント初期値ライトタイミングとダウンカウンタ10に対するタイマクロック信号の出力タイミングとが重なった場合のタイミング調整するためのシーケンサ機能を有する。
【0039】
以上のように構成されたウォッチドッグタイマ6はCPU2の暴走を検出するためのものであり、CPU2が正常に動作している状態では、ウォッチドッグタイマ値が0となる前に当該ウォッチドッグタイマ値がCPU2により更新されるようになっている。
【0040】
具体的には、更新値(カウント初期値)を例えば[C000]hとした場合、CPU2が暴走したときは、ウォッチドッグタイマ値が[0000]hになる前に更新されないことなるので、ウォッチドッグタイマ値が0になり、ウォッチドッグタイマ6のダウンカウンタ10からボロー信号が発生してCPU2に対して暴走を知らせるために割込みをかけたり、強制的にリセットするようになる。
【0041】
尚、上述のようにウォッチドッグタイマ5に設定された各アドレスはメモリ空間に配列されるものであるが、ROM3或いはRAM3のアドレスとは一致しないように設定されている。
【0042】
次に上記構成の作用について説明する。
ワンチップマイクロコンピュータ1を用いてプログラム開発する場合、デバッグのためのエミュレーションプログラムにより動作を検査する必要がある。この場合、エミュレーションプログラムの実行方法には、ROM3内に予め格納したのを使用したり、外部とのパソコン等とシリアル通信などを介してRAM上にエミュレーションプログラムを転送して実行させたり、ICEを用いたりする方法がある。
【0043】
さて、CPU2は、エミュレーションプログラムの実行にしたがって、まず、ウォッチドッグタイマ6に対して[C000]hを書込む。すると、制御回路11の制御により、ダウンカウンタ10のラッチ部20には[C000]hが書込まれる。
ここで、制御回路11は、タイマクロック信号を1μs毎に出力するので、ダウンカウンタ10は1μs毎に[C000]hから1ずつ減算する。
【0044】
一方、CPU2は、ウォッチドッグタイマ6に対して所定周期毎に[C000]hを再書込みするので、ウォッチドッグタイマ6には所定周期毎にカウント初期値が書込まれる。この結果、ウォッチドッグタイマ6のカウント値が0となることはないので、ウォッチドッグタイマ6からボロー信号がCPU2に対して出力されてしまうことはなく、CPU2はエミュレーションプログラムの動作を継続する。
【0045】
さて、CPU2は、エミュレーションプログラムの実行にしたがってウォッチドッグタイマ6の機能を検査するために当該ウォッチドッグタイマ6を停止するときは、アドレス[041C]hに[002B]hを書込む動作を実行する(図3参照)。
【0046】
この結果、アドレスバス7のビットパターンが[041C]hとなると共に、データバス8においてDB5〜DB0が[10101]bとなるので、Aバスデコーダ14及びDバスキーパターンデコーダ15からハイレベル信号が出力される。
【0047】
そして、この状態でCPU2からライト信号IWREが出力され且つクロック信号CK1が出力されたタイミングで、アンド回路13からハイレベル信号が出力されるので、ラッチ回路12は、そのタイミングでデータバスにおけるDB0のビットパターン[1]を出力端子Qから出力する。
【0048】
以上の動作により、CE発生回路9からハイレベルのCE信号が出力されるので、アンド回路24の入力端子の1つのレベルがローレベルとなり、アンド回路24からローレベル信号が出力されるようになる。従って、ダウンカウンタ10のカウント動作が停止して当該ダウンカウンタ10のカウント値が変化しなくなる(図3及び図4参照)。
【0049】
上述のようにしてウォッチドッグタイマ6を停止させたCPU2は、エミュレーションプログラムの実行にしたがってウォッチドッグタイマ6の動作状態を読取る。
【0050】
即ち、CPU2は、CE発生回路9からの出力状態を読取るために制御回路11に設定されたCE発生回路9に対応したアドレスを出力する。
すると、制御回路11は、自己に設定されたアドレスのうちCE発生回路9に対応したアドレスが選択された状態で、CPU2からライト信号IWREを入力したときは、CEリード信号をCE発生回路9に接続されたバッファ回路18に出力する。
【0051】
これにより、バッファ回路18が有効となって、バッファ回路18からCE発生回路9からのCE信号の出力状態がデータバス8へ出力されるので、CPU2は、CE発生回路9のCE信号の出力状態を読取ることができる。
【0052】
続いて、CPU2は、ウオッチドッグタイマ6のカウント値を読取るために制御回路11に設定されたダウンカウンタ10に対応するアドレスを出力する。
すると、制御回路11は、自己に設定されたアドレスのうちダウンカウンタ10に対応したアドレスが選択された状態で、CPU2からライト信号IWREを入力したときは、WDTリード信号をダウンカウンタ10に接続されたバッファ回路23に出力する。
【0053】
これにより、バッファ回路23が有効となって、バッファ回路23からダウンカウンタ10のカウント値がデータバス8へ出力されるので、CPU2は、ダウンカウンタ10の現在のカウント値を読取ることができる。
【0054】
従って、CPU2が読取ったウォッチドッグタイマ6の動作状態に基づいて、エミュレーションプログラムに設定された所定のタイミングでもってマイクロコンピュータ1による動作状態を確認することができる。
【0055】
上述のようにしてウォッチドッグタイマ6の動作状態を読取ったCPU2は、ウォッチドッグタイマ6を再動作させる。つまり、アドレス[041C]hに対して[002A]hを書込む動作を実行する(図3参照)。
【0056】
これにより、CE発生回路9が選択されて、ラッチ回路12にはデータバス8のDB0のレベルである[0]が書込まれるので、CE発生回路9からのCE信号の出力が停止する。
この結果、ダウンカウンタ10が有効となり、カウント動作を再開するようになる(図3及び図4参照)。
【0057】
上記構成のものによれば、CPU2によるエミュレーションプログラムの実行によりウォッチドッグタイマ6のCE発生回路9に対してアクセスすることによりダウンカウンタ10をソフト的に停止させたり再動作させるように構成したので、ウォッチドッグタイマを停止させるための専用端子を有し、その専用端子に信号を与えることによりウォッチドッグタイマを停止させる従来構成のものと違って、面倒な接続を行うことなくウォッチドッグタイマ6を所定タイミングで簡単に停止させることができ、プログラム開発のデバッグが容易になる。さらに、プログラムの実行途中に割り込んでエミュレーションを実行させる場合にも、その間のみCE発生回路9の出力をローレベルとして、エミュレーション終了後、CE発生回路9の出力をハイレベルにすることで、通常動作に復帰できるため、非常に使い易いものとなる。
【0058】
また、ウォッチドッグタイマ6を停止させた状態で、CPU2によりウォッチドッグタイマ6のCE発生回路9の動作状態及びダウンカウンタ10のカウント値を読取るようにしたので、デバッグを一層容易に行うことができる。
【0059】
さらに、ウォッチドッグタイマ6を停止するためのアドレス及び当該ウォッチドッグタイマ6の動作状態を読取るためのアドレスをメモリ空間に配列しながら、ROM3及びRAM4のアドレスと一致しないようにしたので、CPU2が実際のプログラムを実行した際に、ウォッチドッグタイマ6が不用意にアクセスされることがなく、ウォッチドッグタイマ6のカウント動作に支障を生じることはない。
【0060】
本発明は、上記実施例にのみ限定されるものではなく、次のように変形または拡張できる。
ダウンカウンタ10の代わりに、アップカウンタを設け、アップカウンタのカウンタ値が限度値なったときにキャリー信号をCPU2に対する異常信号として出力するようにしてもよい。
【0061】
Dバスキーパターンデコーダとしては、[10101]bというビットパターンに限定されるものではないと共に、5ビットのキーパターンに限定されるものではない。さらに、CE発生回路9用のAバスデコーダ14とは別にDパスキーパターンデコーダ15専用のアドレスを設定し、Dパスキーパターンデコーダ15が有効になった状態でのみCE発生回路9の動作を有効化することにより、誤動作を一層防止することができる。
【0062】
また、ウォッチドッグタイマ6のアドレスをメモリ空間に配列したが、I/Oアドレス空間に配列するようにしてもよい。この場合、ウォッチドッグタイマ6にアクセスするには、CPU2によるI/O命令の実行による。
【0063】
また、ウォッチドッグタイマ6を停止させた状態でその動作状態を読取る手段としては、ウォッチドッグタイマ6をCPU2から切離し、データバス8を通じてウォッチドッグタイマ6にアクセスするようにしてもよい。
【図面の簡単な説明】
【図1】本発明の一実施例におけるワンチップマイクロコンピュータの全体構成を示す概略図
【図2】Dパスキーパターンデコーダの具体的構成を示す図
【図3】ウォッチドッグタイマの動作を示す各種信号の波形図
【図4】ウォッチドッグタイマのタイマカウント値の変化を示す図
【符号の説明】
1はワンチップマイクロコンピュータ、2はCPU、6はウォッチドッグタイマ、9はカウントイネーブル発生回路(停止指令出力手段)、10はダウンカウンタ(カウント手段)、18はバッファ回路(出力状態出力手段)、23はバッファ回路(カウント値出力手段)である。[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a watchdog timer for resetting or interrupting a CPU when the CPU runs away and a microcomputer having such a watchdog timer.
[0002]
[Prior art]
Conventionally, a watchdog timer disclosed in Japanese Patent Laid-Open No. 3-194628 has been proposed. This is configured to stop the watchdog timer by setting the signal level of a specially provided external terminal to a high level during emulation, and only gives a signal for switching to the external terminal. This will make debugging easier.
[0003]
[Problems to be solved by the invention]
However, in the above configuration, a signal for stopping the watchdog timer must be given to the external terminal of the watchdog timer, and the connection is extremely troublesome.
[0004]
The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a watchdog timer and such a watch that can easily perform a function test without troublesome connection during debugging of program development. The object is to provide a microcomputer equipped with a dog timer.
[0005]
[Means for Solving the Problems]
According to the first aspect of the present invention, when the CPU is operating normally, the CPU accesses the watch dog timer every predetermined period, so that the counting means repeatedly executes the counting operation. In this case, the count value of the watchdog timer never becomes the limit value.
[0006]
When the CPU runs away, the CPU does not access the watchdog timer, so the count value of the counting means becomes the limit value. As a result, the counting means outputs an abnormal signal to the CPU, so that the runaway state stops when the CPU is reset or interrupted.
[0007]
When the counting operation of the counting means is temporarily stopped to check the operation of the watchdog timer during emulation, the first data is written to the stop command generating means by executing the emulation program by the CPU.
[0008]
Then, since the stop command generating means outputs a stop command to the counting means, the counting means stops the counting operation. In this state, the operating state of the watchdog timer is checked.
[0009]
When restarting the counting operation of the counting means, the CPU writes the second data to the stop command generating means. Then, the stop command generating means stops outputting the stop command to the counting means. As a result, the counting means resumes the counting operation.
[0014]
In this case , when checking the output state of the stop command by the stop command output means , the CPU executing the emulation program accesses the control circuit .
Then, the control circuit gives a command to the output status output means, and the output status output means outputs the output status of the stop command by the stop command generating means accordingly, so that the CPU changes the output status of the stop command by the output. Can be confirmed.
[0015]
Also, when you want to check the count value of the count means, CPU running emulation program to access the control circuit.
Then, the control circuit gives a command to the count value output means, and the count value output means outputs the count value of the count means accordingly, so that the CPU can check the count value of the count means by the output. .
Therefore, since the watchdog timer can be stopped or restarted at any timing by executing the emulation program by the CPU, debugging of program development can be performed without connecting wiring to the watchdog timer.
[0016]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 shows a schematic configuration of a one-chip microcomputer and an electrical configuration of a watchdog timer included in the one-chip microcomputer. In FIG. 1, a one-
[0017]
The CPU 2, the
[0018]
The watchdog timer 6 is mainly composed of a count enable generating circuit 9 (corresponding to a stop command output means, hereinafter referred to as a CE generating circuit), a down counter 10 (corresponding to a counting means), and a control circuit 11.
[0019]
In the CE generation circuit 9, the data input terminal D of the
[0020]
A system reset signal is input to the reset terminal R of the
[0021]
The output terminal of the
[0022]
The
The D bus key pattern decoder 15 is for detecting that the bit pattern of the data bus 8 has become a predetermined pattern.
[0023]
FIG. 2 shows a specific circuit of the D bus key pattern decoder 15. In FIG. 2, the output from the
[0024]
Therefore, in such a connection relationship, the AND condition of the AND
[0025]
With the above configuration, the CE generation circuit 9 is in a state where the bit pattern of the address bus 7 is [041C] h and the bit patterns of DB5 to DB0 of the data bus 8 are [101011] b (first access condition This corresponds to a first data write operation), and is referred to as a high-level count enable signal (hereinafter referred to as a CE signal) at the timing when the write signal IWRE is input from the CPU 2 and the clock signal CK1 is input.
[0026]
The CE generation circuit 9 is in a state where the bit pattern of the address bus 7 is [041C] h and the bit pattern of DB5 to DB0 of the data bus 8 is [101010] b (second access condition, second The output of the CE signal is stopped when the write signal IWRE is input from the CPU 2 and the clock signal CK1 is input.
[0027]
The CE signal from the CE generation circuit 9 is given to the buffer circuit 18. The output terminal of the buffer circuit 18 is connected to a predetermined data bus, and the CPU 2 can read the output level of the buffer circuit 18 through the data bus 8.
[0028]
In the
[0029]
The
[0030]
The
The
[0031]
With the above configuration, the count value of the
[0032]
The
[0033]
On the other hand, the AND circuit 24 generates a pulse signal for the
[0034]
Therefore, the AND circuit 24 is configured so that the AND condition is satisfied at the timing when the clock signal CK2 is input in the non-output state of the high-level CE signal from the CE generation circuit 9 and the timer clock signal is input from the control circuit 11, and the high-level signal Is output to the
[0035]
The control circuit 11 is for controlling the operation of the entire watchdog timer 6. That is, the control circuit 11 outputs a count value write signal to the down counter 10 at a timing when a read signal is given in a state where a predetermined address is accessed by the CPU 2.
The control circuit 11 has a function of outputting a timer clock signal to the AND circuit 24, for example, every 1 μs.
[0036]
Further, the control circuit 11 outputs a CE read signal at a timing when a read signal is given from the CPU 2 in a state where a predetermined address set to itself is accessed. In this case, the CE read signal is applied to the control terminal of the buffer circuit 18, and the output state of the CE signal from the CE generation circuit 9 is changed from the buffer circuit 18 to the data bus when the level of the control terminal is high. 8 to the CPU 2.
[0037]
Further, the control circuit 11 outputs a WDT read signal at the timing when the read signal is given from the CPU 2 in a state where a predetermined address set to itself (different from the CE read signal output address) is accessed. In this case, the WDT read signal is given to the control terminal of the
[0038]
Furthermore, the control circuit 11 has a sequencer function for adjusting the timing when the count initial value write timing for the
[0039]
The watchdog timer 6 configured as described above is for detecting the runaway of the CPU 2, and when the CPU 2 is operating normally, the watchdog timer value before the watchdog timer value becomes zero. Is updated by the CPU 2.
[0040]
Specifically, if the update value (count initial value) is set to [C000] h, for example, when the CPU 2 runs away, the watchdog timer value is not updated before it becomes [0000] h. The timer value becomes 0, and a borrow signal is generated from the down counter 10 of the watchdog timer 6 so that an interrupt is issued to notify the CPU 2 of a runaway, or the reset is forcibly reset.
[0041]
As described above, the addresses set in the watchdog timer 5 are arranged in the memory space, but are set so as not to coincide with the addresses in the
[0042]
Next, the operation of the above configuration will be described.
When developing a program using the one-
[0043]
The CPU 2 first writes [C000] h to the watchdog timer 6 in accordance with the execution of the emulation program. Then, under the control of the control circuit 11, [C000] h is written in the
Here, since the control circuit 11 outputs the timer clock signal every 1 μs, the
[0044]
On the other hand, since the CPU 2 rewrites [C000] h to the watchdog timer 6 every predetermined period, the count initial value is written to the watchdog timer 6 every predetermined period. As a result, since the count value of the watchdog timer 6 does not become 0, the borrow signal is not output from the watchdog timer 6 to the CPU 2, and the CPU 2 continues the operation of the emulation program.
[0045]
When the CPU 2 stops the watchdog timer 6 in order to check the function of the watchdog timer 6 according to the execution of the emulation program, the CPU 2 executes an operation of writing [002B] h to the address [041C] h. (See FIG. 3).
[0046]
As a result, the bit pattern of the address bus 7 becomes [041C] h and DB5 to DB0 become [10101] b in the data bus 8, so that a high level signal is output from the
[0047]
In this state, a high level signal is output from the AND
[0048]
As a result of the above operation, the CE generation circuit 9 outputs a high-level CE signal, so that one level of the input terminal of the AND circuit 24 becomes a low level, and the AND circuit 24 outputs a low-level signal. . Accordingly, the count operation of the
[0049]
The CPU 2 that has stopped the watchdog timer 6 as described above reads the operation state of the watchdog timer 6 in accordance with the execution of the emulation program.
[0050]
That is, the CPU 2 outputs an address corresponding to the CE generation circuit 9 set in the control circuit 11 in order to read the output state from the CE generation circuit 9.
Then, the control circuit 11 receives the CE read signal from the CPU 2 when the address corresponding to the CE generation circuit 9 among the addresses set to itself is selected and the CPU 2 receives the write signal IWRE. It outputs to the connected buffer circuit 18.
[0051]
As a result, the buffer circuit 18 is enabled, and the output state of the CE signal from the CE generation circuit 9 is output from the buffer circuit 18 to the data bus 8. Therefore, the CPU 2 outputs the output state of the CE signal from the CE generation circuit 9. Can be read.
[0052]
Subsequently, the CPU 2 outputs an address corresponding to the
Then, the control circuit 11 connects the WDT read signal to the
[0053]
As a result, the
[0054]
Therefore, based on the operation state of the watchdog timer 6 read by the CPU 2, the operation state by the
[0055]
The CPU 2 that has read the operation state of the watchdog timer 6 as described above causes the watchdog timer 6 to operate again. That is, the operation of writing [002A] h to the address [041C] h is executed (see FIG. 3).
[0056]
As a result, the CE generation circuit 9 is selected and [0], which is the level of DB0 of the data bus 8, is written into the
As a result, the
[0057]
According to the configuration described above, the CPU 2 is configured to stop or restart the
[0058]
Since the CPU 2 reads the operation state of the CE generation circuit 9 of the watchdog timer 6 and the count value of the
[0059]
Furthermore, since the address for stopping the watchdog timer 6 and the address for reading the operation state of the watchdog timer 6 are arranged in the memory space so as not to coincide with the addresses of the
[0060]
The present invention is not limited to the above embodiment, and can be modified or expanded as follows.
Instead of the
[0061]
The D bus key pattern decoder is not limited to a bit pattern of [10101] b, and is not limited to a 5-bit key pattern. Further, an address dedicated to the D passkey pattern decoder 15 is set separately from the
[0062]
Further, although the addresses of the watchdog timer 6 are arranged in the memory space, they may be arranged in the I / O address space. In this case, access to the watchdog timer 6 is by execution of an I / O instruction by the CPU 2.
[0063]
Further, as a means for reading the operation state with the watchdog timer 6 stopped, the watchdog timer 6 may be disconnected from the CPU 2 and accessed through the data bus 8.
[Brief description of the drawings]
FIG. 1 is a schematic diagram showing the overall configuration of a one-chip microcomputer in an embodiment of the present invention. FIG. 2 is a diagram showing a specific configuration of a D passkey pattern decoder. FIG. 3 is a diagram showing various signals indicating the operation of a watchdog timer. [Figure 4] Figure showing the change in the timer count value of the watchdog timer [Explanation of symbols]
1 is a one-chip microcomputer, 2 is a CPU, 6 is a watchdog timer, 9 is a count enable generation circuit (stop command output means), 10 is a down counter (count means), 18 is a buffer circuit (output state output means),
Claims (2)
エミュレーションプログラム実行中の前記CPU(2)により自己のアドレスに対して特定の第1のデータの書込み動作が行われたときに停止指令を出力すると共に当該第1のデータと異なる特定の第2のデータの書込み動作が行われたときに停止指令の出力を停止する停止指令出力手段(9)と、
外部からの指令に応じて前記停止指令出力手段(9)による停止指令の出力状態を前記CPU(2)へ出力する出力状態出力手段(18)と、
外部からの指令に応じて前記カウント手段(10)のカウント値を前記CPU(2)へ出力するカウント値出力手段(23)と、
エミュレーションプログラム実行中の前記CPU(2)からのアクセスに応じて前記出力状態出力手段(18)及び前記カウント値出力手段(23)に対して指令を与える制御回路(11)とを備えたことを特徴とするウォッチドッグタイマ。Provided from the initial value or any set value every time it is accessed by the CPU (2) during normal operation so as to perform the count operation, when the counting of up to the limit value by runaway of the CPU (2) has been completed Is a counting means (10) for outputting an abnormal signal to the CPU (2) and stopping the counting operation in a state of receiving a stop command;
When the CPU (2) executing the emulation program performs a write operation of specific first data to its own address, a stop command is output and a specific second different from the first data is output. Stop command output means (9) for stopping the output of the stop command when the data writing operation is performed ;
Output state output means (18) for outputting the output state of the stop command by the stop command output means (9) to the CPU (2) in response to a command from the outside;
Count value output means (23) for outputting the count value of the count means (10) to the CPU (2) in response to an external command;
A control circuit (11) for giving a command to the output state output means (18) and the count value output means (23) in response to an access from the CPU (2) during execution of the emulation program ; Features a watchdog timer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP20462597A JP3951371B2 (en) | 1997-07-30 | 1997-07-30 | Watchdog timer and microcomputer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP20462597A JP3951371B2 (en) | 1997-07-30 | 1997-07-30 | Watchdog timer and microcomputer |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH1153224A JPH1153224A (en) | 1999-02-26 |
JP3951371B2 true JP3951371B2 (en) | 2007-08-01 |
Family
ID=16493579
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP20462597A Expired - Fee Related JP3951371B2 (en) | 1997-07-30 | 1997-07-30 | Watchdog timer and microcomputer |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3951371B2 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7454169B2 (en) * | 2002-05-08 | 2008-11-18 | Mediatek Inc. | Method and apparatus for use in securing an electronic device such as a cell phone |
CN100419693C (en) * | 2005-09-16 | 2008-09-17 | 鸿富锦精密工业(深圳)有限公司 | Computer system state monitoring circuit |
-
1997
- 1997-07-30 JP JP20462597A patent/JP3951371B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH1153224A (en) | 1999-02-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2597153B2 (en) | Write protector | |
JPS63301339A (en) | Computer device | |
JPH0193837A (en) | Microprocessor for debug | |
EP0348240B1 (en) | Microprocessor equipped with parity control unit on same chip | |
JPH1078889A (en) | Microcomputer | |
JP3951371B2 (en) | Watchdog timer and microcomputer | |
CN112306782A (en) | Debugging test-oriented operating system kernel booting and hardware loading architecture and method | |
JP3172214B2 (en) | Status mode setting method | |
JPH08235073A (en) | Microcomputer | |
JPH0337897A (en) | Microcomputer | |
JP2004021421A (en) | Control method for memory device, its program, and recording medium | |
JPH11212945A (en) | Microcomputer and it memory | |
JP3006487B2 (en) | Emulation device | |
JPH0411895B2 (en) | ||
JP3433824B2 (en) | Failure detection device for pulse input / output circuit | |
JP2000029508A (en) | Programmable controller | |
JP2928216B1 (en) | Semiconductor integrated circuit | |
JPH0630056B2 (en) | Signal processor | |
JPS6053330B2 (en) | Program writing method | |
JPH0612292A (en) | Microcomputer | |
JPS62248043A (en) | Memory switching circuit for fetching microcomputer instruction | |
JPS5853773B2 (en) | Emergency control method | |
JP2004185356A (en) | Debug system | |
JPH04112341A (en) | Microcomputer lsi | |
JP2003256402A (en) | Microcomputer |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20060217 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060221 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060418 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20061003 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20061122 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20070109 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070208 |
|
A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20070316 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20070403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070416 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |