JP4465905B2 - Electronic control unit - Google Patents

Electronic control unit Download PDF

Info

Publication number
JP4465905B2
JP4465905B2 JP2001116925A JP2001116925A JP4465905B2 JP 4465905 B2 JP4465905 B2 JP 4465905B2 JP 2001116925 A JP2001116925 A JP 2001116925A JP 2001116925 A JP2001116925 A JP 2001116925A JP 4465905 B2 JP4465905 B2 JP 4465905B2
Authority
JP
Japan
Prior art keywords
reception
interval
communication
routine
interrupt routine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2001116925A
Other languages
Japanese (ja)
Other versions
JP2002314632A (en
Inventor
良文 尾関
高広 市川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2001116925A priority Critical patent/JP4465905B2/en
Publication of JP2002314632A publication Critical patent/JP2002314632A/en
Application granted granted Critical
Publication of JP4465905B2 publication Critical patent/JP4465905B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)
  • Debugging And Monitoring (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、通信相手の装置と通信線を介して接続されることにより、通信システムを形成する電子制御装置に関し、特に、その通信相手の装置から一定時間毎にデータが送信されて来る電子制御装置に関するものである。
【0002】
【従来の技術】
従来より、例えば車両においては、通信線を介して互いに接続された複数の電子制御装置が通信を行って制御データを共有する通信システムが構成される。そして、一般に、こうした車載用電子制御装置間の通信システムにおいては、常時予め決められた時間間隔(通信間隔)で且つ同じボーレートでシリアルデータ通信が行われる。
【0003】
ところで、このような通信システムにおいては、送信側の電子制御装置に異常が発生して、その装置からの通信データの送信間隔が、予め決められた通信間隔よりも長くなったり、短くなったりすることがある。
このため、受信側の電子制御装置には、以下のようなフェイルセーフ機能が備えられる。即ち、受信側の電子制御装置では、通信データを受信した間隔(受信間隔)が予め決められた正常範囲から外れたか否かを判定し、正常範囲から外れたならば通信異常が発生したとして、受信処理(即ち、通信線から受信したデータを、制御対象の制御のためにアクセスするRAM等の記憶手段へ転送する処理)を中断する。そして、その後、受信間隔が正常に戻ったと判定したら、正常復帰したとして、受信処理を再開する。尚、通信システムを構成する各電子制御装置が、データの送受信(即ち、双方向の通信)を行うものであるならば、こうしたフェイルセーフ機能は、各電子制御装置に備えられる。つまり、上記の「受信側の電子制御装置」とは、データを受信している電子制御装置を意味している。
【0004】
そして、従来の電子制御装置では、上記のフェイルセーフ機能を、マイクロコンピュータにて1フレーム分の通信データを受信する毎に起動される受信割込ルーチンで実現するようにしていた。
具体的に説明すると、まず、一般に、この種の電子制御装置を構成するマイクロコンピュータ(以下、単にマイコンという)には、他の装置とシリアルデータ通信を行うためのハードウエアであるシリアル通信インターフェース(以下、SCIと記す)が備えられている。
【0005】
そして、そのSCIは、例えば特開平8−293881号公報にも開示されているように、スタートビットからストップビットまでの複数ビット(例えば10ビット)を1フレームとした通信データを受信するための手段として、受信用シフトレジスタと、受信バッファとを備えている。そして更に、SCIは、通信線上のスタートビットを検出したら、以降のデータビットを、予め決められたボーレートで上記受信用シフトレジスタに1ビットずつシフトしていき、その後、通信線上のストップビットを検出したら、そのストップビットまでの1フレーム分の通信データを受信用シフトレジスタから受信バッファに移して、受信割込要求を発生し、ソフトウエアで上記受信バッファからデータ(即ち、受信した1フレーム分の通信データ)を読み出せるようにする。
【0006】
このため、マイコンでは、上記受信割込要求に応じて起動される受信割込ルーチンにて、上記SCIの受信バッファからRAM等へ通信データを転送する受信処理を行うのであるが、その受信処理の前に、当該受信割込ルーチンが前回起動されてから今回起動されるまでの時間間隔を、SCIによる通信データの受信間隔として測定する処理と、その処理で測定された受信間隔が正常であるか否かを判定する判定処理とを行い、その判定処理で受信間隔が正常ではないと判定すると、以後、その判定処理で受信間隔が正常になったと判定されるまでの間、当該受信割込ルーチンで上記受信処理が行われるのを禁止する。
【0007】
そして、このような受信割込ルーチンの構成により、上記のフェイルセーフ機能が実現される。
【0008】
【発明が解決しようとする課題】
ところが、上記のように受信割込ルーチンだけでフェイルセーフ機能の全てを実現するように構成すると、受信間隔が正常でないと異常判定してから受信間隔が正常に戻ったか否かを判定する正常復帰の判定も、受信割込ルーチンで行うこととなるため、特に通信間隔が短くなる異常が発生した場合には、受信割込ルーチンが正常時よりも頻繁に起動されることとなり、その結果、受信割込ルーチンよりも優先順位が低い時間割込ルーチンやベースルーチン等で行われる処理が、所定期間内に終わらなくなって、制御性が低下してしまうという問題が生じる。
【0009】
尚、上記特開平8−293881号公報には、マスタ装置としての外部診断装置と、スレーブ装置としての各車載用電子制御装置とが、通常のボーレートでメッセージの送受信を行う前に、外部診断装置が通常のボーレートよりも大幅に遅いボーレートで初期化アドレスを送信することにより、初期化が行われる通信システムにおいて、通常の速いボーレートで通信している時に、外部診断装置が誤って遅いボーレートの初期化アドレスを送信してしまうと、各電子制御装置で受信割込が多発して他の処理が先に進まなくなる、という不具合を解決するために、以下のような技術が開示されている。
【0010】
即ち、各電子制御装置は、受信した1フレーム分の通信データにおけるストップビットが正規な値ではないときに発生するフレーミングエラーに起因した受信割込が多発したと判定すると、外部診断装置が遅いボーレートの初期化アドレスを送信していると判断して、受信割込ルーチンが起動されるのを禁止し、その後は、一定時間毎の時間割込ルーチンにて、通信線のレベルをサンプリングすることにより上記初期化アドレスの各ビットを受信すると共に、その初期化アドレスの全ビットを受信したならば、受信割込ルーチンの起動を許可するようにしている。
【0011】
しかし、上記公報に記載の技術は、通信間隔が異常になったことと、通信間隔が異常になってから正常に復帰したこととを検出しようとするものではなく、上記問題を解決することはできない。
また、上記技術のうち「受信割込ルーチンが起動されるのを禁止する」という考え方を利用して、受信割込ルーチンにて、SCIによる通信データの受信間隔が正常ではないと判定すると、当該受信割込ルーチンが起動されるのを禁止し、その後は、時間割込ルーチンやベースルーチン等の他のルーチンによって、受信間隔が正常に戻ったか否かを判定すると共に、そのルーチンで、受信間隔が正常に戻ったと判定したならば受信割込ルーチンの起動を許可する、といった構成を採ることが考えられる。
【0012】
ところが、このように構成しようとしても、実際には、受信割込ルーチン以外の時間割込ルーチンやベースルーチン等では、受信間隔が正常に戻ったか否かを簡単な処理内容で正確に判定することはできず、上記問題を解決できない。
これは、受信割込ルーチン以外のルーチンでは、受信間隔を正確に検出することができない上に、通信異常のモードとしては、受信間隔が正常値よりも長くなる異常と、受信間隔が正常値よりも短くなる異常との2通りがあり、その両方の各異常モードから正常に復帰したことを夫々正確に判定することは難しいからである。
【0013】
また例えば、正常な受信間隔よりも起動周期が短い時間割込ルーチンにより、SCIが通信データを受信したか否かを判定すると共に、受信したと前回判定してから今回判定するまでの当該ルーチンの起動回数から、SCIによる受信間隔を求めるように構成することも考えられるが、十分な判定精度を得るためには、その時間割込ルーチンの起動周期を正常な受信間隔よりも大幅に小さく(例えば10分の1以下)設定しなければならなず、その時間割込ルーチンの分だけ、処理負荷が増大してしまう。よって、その時間割込ルーチンよりも優先順位が低い他の時間割込ルーチンやベースルーチン等で行われる処理が所定期間内に終わらなくなって、制御性が低下してしまう。
【0014】
本発明は、こうした問題に鑑みなされたものであり、通信相手の装置から一定時間毎に送信されるはずの通信データを受信する電子制御装置において、その通信データの受信間隔が異常になったことと、その異常が解消されて受信間隔が正常に戻ったこととを、処理負荷を増大させることなく正確に判定することができるようにすることを目的としている。
【0015】
【課題を解決するための手段及び発明の効果】
上記目的を達成するためになされた請求項1記載の本発明の電子制御装置は、通信相手の装置と通信線を介して接続される。
そして、この電子制御装置では、通信手段が、前記通信相手の装置から一定時間毎に送信される1フレーム分の通信データを受信して受信バッファに格納する毎に、受信割込要求を発生する。そして更に、この電子制御装置では、上記受信割込要求に応じて起動される受信割込ルーチンにて、通信手段の受信バッファから所定の記憶手段へ通信データ(即ち受信データ)を転送する受信処理を行う。また、この電子制御装置では、上記記憶手段内のデータを用いて制御対象を制御する。
【0016】
このため、本電子制御装置では、従来の電子制御装置と同様に、前述のSCIに相当する通信手段が1フレーム分の通信データを受信して受信バッファに格納する毎に、受信割込ルーチンが起動され、その受信割込ルーチン内の受信処理により、通信手段の受信バッファから所定の記憶手段へ受信データが転送される。そして、その記憶手段に転送された受信データは、制御対象の制御に適宜用いられることとなる。
【0017】
ここで特に、本発明の電子制御装置では、受信割込ルーチンにて、以下の異常モード検出対応処理が行われる。
この異常モード検出対応処理では、当該受信割込ルーチンが前回起動されてから今回起動されるまでの時間間隔に基づいて、通信手段による通信データの受信間隔が正常な範囲よりも長い異常(以下、第1種異常という)が発生したか否かと、受信間隔が正常な範囲よりも短い異常(以下、第2種異常という)が発生したか否かとを判定すると共に、第1種異常が発生していると判定した場合には、当該受信割込ルーチンにて上記受信処理が行われるのを禁止し、また、第2種異常が発生していると判定した場合には、当該受信割込ルーチンにて上記受信処理が行われるのを禁止すると共に、以後、当該受信割込ルーチンが起動されるのを禁止する。
【0018】
そして更に、本発明の電子制御装置では、上記異常モード検出対応処理により受信割込ルーチンの起動が禁止されている場合には、予め定められた所定時間毎に起動される定期ルーチンにて、通信手段による通信データの受信間隔が正常に戻ったか否かを判定すると共に、受信間隔が正常に戻ったと判定したならば、受信割込ルーチンが起動されるのを許可する。
【0019】
このような本発明の電子制御装置においては、通信相手の装置に異常が生じて、その装置からの通信データの送信間隔が正常な範囲よりも長くなると、通信手段による通信データの受信間隔、延いては、受信割込ルーチンの起動間隔が正常な範囲よりも長くなり、その結果、受信割込ルーチン内の異常モード検出対応処理により、第1種異常が発生したと判定されて、受信処理が中断されることとなる。
【0020】
そして、その後、通信相手の装置からの通信データの送信間隔が正常に戻ると、通信手段による通信データの受信間隔及び受信割込ルーチンの起動間隔が正常な範囲に戻るため、受信割込ルーチンの異常モード検出対応処理により、第1種異常と第2種異常との何れも発生していない(即ち正常である)と判定されて、受信処理の禁止が解除される(即ち受信処理が再開される)こととなる。
【0021】
このため、通信相手の装置からの通信データの送信間隔が正常な範囲よりも長くなって、受信割込ルーチンで第1種異常の発生を検知した場合(即ち、受信間隔が正常な範囲よりも長いと異常判定した場合)には、前述した従来の電子制御装置と同様に、受信間隔が正常に戻ったか否かを判定する正常復帰の判定も、受信割込ルーチンで行われることとなる。
【0022】
一方、本発明の電子制御装置において、通信相手の装置からの通信データの送信間隔が正常な範囲よりも短くなると、通信手段による通信データの受信間隔、延いては、受信割込ルーチンの起動間隔が正常な範囲よりも短くなり、その結果、受信割込ルーチン内の異常モード検出対応処理により、第2種異常が発生したと判定されて、受信処理が中断されると共に、当該受信割込ルーチンの起動が禁止されることとなる。すると、その後は、所定時間毎に起動される定期ルーチンにて、通信手段による通信データの受信間隔が正常に戻ったか否かが判定される。
【0023】
そして、その後、通信相手の装置からの通信データの送信間隔が正常に戻り、上記定期ルーチンにて、受信間隔が正常に戻ったと判定されると、受信割込ルーチンの起動が許可されることとなる。
このため、通信相手の装置からの通信データの送信間隔が正常な範囲よりも短くなって、受信割込ルーチンで第2種異常の発生を検知した場合(即ち、受信間隔が正常な範囲よりも短いと異常判定した場合)には、以後、所定時間毎の定期ルーチンで受信間隔が正常に戻ったと判定されるまでの間、受信割込ルーチンの起動が禁止される。よって、受信割込ルーチンが正常時よりも頻繁に起動されることが防止される。
【0024】
つまり、本発明の電子制御装置では、受信割込ルーチンにて、第1種異常(通信相手からの送信間隔が長くなって、受信間隔が正常な範囲よりも長くなる異常)が発生したと判定した場合には、引き続き、受信割込ルーチンにて、受信間隔が正常に戻ったか否かを判定するが、受信割込ルーチンにて、第2種異常(通信相手からの送信間隔が短くなって、受信間隔が正常な範囲よりも短くなる異常)が発生したと判定した場合には、その受信割込ルーチンの起動を禁止し、以後は、所定時間毎の定期ルーチンにて、受信間隔が正常に戻ったか否かを判定するようにしている。換言すれば、受信間隔が正常時よりも短い第2種異常が発生したと判定した場合にだけ、受信割込ルーチンの起動を禁止して、受信間隔が正常に戻ったか否かを、所定時間毎の定期ルーチンにて判定するようにしている。
【0025】
このため、本発明の電子制御装置によれば、通信データの受信間隔が異常になったことと、その異常が解消されて受信間隔が正常に戻ったこととを、処理負荷を増大させることなく正確に判定することができる。
即ち、まず前述したように、受信割込ルーチンにて第1種異常の発生を検知した場合には、従来の電子制御装置と同様に、受信間隔が正常に戻ったか否かを判定する正常復帰の判定も、受信割込ルーチンで行われることとなるが、この場合、通信データの受信間隔は正常時よりも長くなっているため、受信割込ルーチンが正常時よりも頻繁に起動されることはなく、処理負荷は特に増大しない。
【0026】
そして、受信割込ルーチンによれば、そのルーチンの起動間隔が受信間隔に等しいため、実際の受信間隔を正確に検出することができ、受信間隔が正常に戻ったことを正確に判定することができる。尚、もちろん、受信割込ルーチンによれば、受信間隔が正常な範囲から外れて第1種異常と第2種異常との何れが発生しているのかも、正確に判定することができる。また、受信割込ルーチンの起動間隔(=受信間隔)は、当該ルーチンが前回起動された時刻と今回起動された時刻との差から求めることができ、その各時刻は、フリーランタイマ(フリーランカウンタ)等の一般的な内部時計によって容易に計測することができる。
【0027】
一方、受信割込ルーチンにて第2種異常の発生を検知した場合には、受信割込ルーチンの起動が禁止される。よって、受信割込ルーチンが正常時よりも頻繁に起動されることが防止される。
そして更に、この場合には、受信間隔が正常な範囲よりも短くなっているということが前提条件にあることから、起動周期が比較的長く、その起動周期が正常な受信間隔と同等な定期ルーチンによっても、受信間隔が正常に戻ったか否かを正確且つ容易に判定することができる。
【0028】
具体例を挙げると、請求項2に記載のように、まず、定期ルーチンの起動周期(上記所定時間)を、前記正常な範囲内の値(つまり、正常な受信間隔の下限値から上限値までの間の所定値)に設定しておく。そして、その定期ルーチンでは、当該定期ルーチンが前回起動されてから今回起動されるまでの間に通信手段が通信データを1回だけ受信したか否かを判定して、通信データを1回だけ受信していれば、受信間隔が正常に戻った(つまり、受信間隔が正常な範囲に戻った)と判定すれば良い。
【0029】
尚、一般に、マイコンのSCIは、1フレーム分の通信データを前回受信してから今回受信するまでの間に、CPUから何等かのアクセスを受けなかった場合には、2重受信であるオーバーランエラーの発生を示すオーバーランエラーフラグを立てる(セットする)ようになっている。このため、そのようなSCIを通信手段として用いれば、定期ルーチンが前回起動されてから今回起動されるまでの間に通信手段が通信データを1回だけ受信したか否かは、その定期ルーチンにて、上記オーバーランエラーフラグの状態を監視することにより、簡単に判定することができる。
【0030】
以上のように、本発明の電子制御装置によれば、受信間隔が正常な範囲よりも長い異常時と短い異常時とで、受信間隔の正常復帰判定の処理方法を変えており、特に、受信間隔が正常な範囲よりも長い異常時には、引き続き受信割込ルーチンで正常復帰判定を行い、受信間隔が正常な範囲よりも短い異常時には、受信割込ルーチンの起動を禁止して、定期ルーチンで受信間隔の正常復帰判定を行うようにしているため、受信間隔が異常になったことと、受信間隔が正常に戻ったこととを、処理負荷を増大させることなく正確に判定できるようになる。
【0031】
ところで、定期ルーチンにて、受信間隔が正常に戻ったと判定したならば、受信割込ルーチンの起動を許可するだけでなく、請求項3に記載の如く、その時点で通信手段の受信バッファに格納されている通信データを前記記憶手段に転送するようにすれば、受信間隔が正常に戻った後の信頼性の高い受信データを、極力早期に記憶手段へ転送することができ、制御性を向上させることができる。
【0032】
つまり、定期ルーチンで受信間隔が正常に戻ったと判定された後に、通信手段により次の通信データが受信されて、それに伴い起動される受信割込ルーチンで受信処理が行われれば、記憶手段に正常な受信データが転送されることとなるが、それよりも1回前に受信された正常な受信データを記憶手段に転送することができ、その分、最新の受信データを用いた制御をいち早く開始することができるからである。
【0033】
【発明の実施の形態】
以下、本発明が適用された実施形態の車両内通信システム(詳しくは、車両に搭載された電子制御装置間の通信システム)について、図面を用いて説明する。まず図1(A)に示すように、本実施形態の車両内通信システムは、車両に搭載された2つの電子制御装置(以下、ECUという)1a,1bと、これらECU1a,1bを接続する通信線3とから構成されており、例えば、ECU1aは、エンジンを制御するECU(エンジンECU)であり、ECU1bは、トランスミッションを制御するECU(トランスミッションECU)である。
【0034】
そして、ECU1a,1bは、通信線3を介してシリアルデータ通信を行うことにより、エンジン回転数データや車速データといった各種の制御データを互いに共用し、その制御データを用いて各自の制御対象を制御する。尚、以下の説明において、各ECU1a,1bを特に区別しない場合には、ECUの符号として“1”を用いる。
【0035】
また、本実施形態の車両内通信システムにおいて、各ECU1が通信線3を介してやり取りする通信データは、図1(B)に示すように、ローレベルのスタートビットSと、実質的な情報データである8ビットD0〜D7と、ハイレベルのストップビットPと、からなる10ビットを1フレームとしている。
【0036】
次に、図2(A)に示す如く、各ECU1は、他のECU1との通信と制御対象の制御とを司るマイコン5と、マイコン5から出力される通信データを通信線3へと送出すると共に、通信線3上に伝送される通信データをマイコン5へと入力させる通信ドライバ回路7とを備えている。
【0037】
そして、マイコン5は、一般的な構成のものであり、CPU9と、CPU9で実行されるプログラムやそのプログラムの実行時に参照される固定データが格納されたROM11と、CPU9による演算結果等が一時記憶される記憶手段としてのRAM13と、他のECU1(詳しくは、他のECU1のマイコン5)とシリアルデータ通信を行うための通信手段としてのSCI(シリアル通信インターフェース)15と、それらを互いに接続するバス17とを備えている。
【0038】
また、SCI15は、図2(B)に示すように、通信ドライバ回路7から入力される通信データ(即ち受信データ)を内部に取り込むための入力バッファ19と、当該マイコン5が送信しようとしている通信データ(即ち送信データ)を通信ドライバ回路7へ出力するための出力バッファ21と、入力バッファ19によって取り込まれた通信データを1ビットずつ格納する受信用シフトレジスタ23と、その受信用シフトレジスタ23に格納された1フレーム分の通信データが移されると共に、バス17を介してアクセス可能な受信バッファ25と、バス17を介して送信対象のデータが書き込まれる送信バッファ27と、送信バッファ27に格納されたデータが移されると共に、そのデータを1ビットずつシフトして出力する送信用シフトレジスタ29と、入力バッファ19及び出力バッファ21と上記両シフトレジスタ23,29との間に介在して設けられた入出力回路31と、上記各部を制御する制御回路33とを備えている。そして、制御回路33はバス17と接続されている。
【0039】
このようなSCI15においては、入力バッファ19から入力されてきた通信データが入出力回路31に取り込まれる。そして、入出力回路31によりスタートビットSが検出されると、制御回路33が、その入出力回路31から受信用シフトレジスタ23へ、以降のデータビットD0〜D7を、予め決められたボーレートで1ビットずつシフトして出力させ、これにより、スタートビットSから始まる通信データの各ビットを受信用シフトレジスタ23にシフトして格納させていく。そして更に、その後、入出力回路31によりストップビットPが検出されると、制御回路33は、そのストップビットPまでの1フレーム分の通信データを受信用シフトレジスタ23から受信バッファ25に転送させると共に、CPU9に対して受信割込要求を発生し、更に、当該SCI15が1フレーム分の通信データを受信したこと(つまり、受信バッファ25に受信データが格納されていること)を示す受信履歴フラグをセットする(“1”にする)。尚、上記受信履歴フラグは、バス17を介して読み出し可能であると共に、その受信履歴フラグのクリア(“0”にすること)は、ソフトウエアによって行われる。
【0040】
また、制御回路33は、入出力回路31によって検出されたストップビットP(即ち、入出力回路31がスタートビットSを検出してから9ビット目に当たるビット)が正規な値(本実施形態では、ハイレベルに相当する論理1)であるか否かを判定し、ストップビットPが正規な値でなければ、フレーミングエラーの発生を示すフレーミングエラーフラグをセットする。また更に、制御回路33は、1フレーム分の通信データの受信を完了して、その通信データを受信用シフトレジスタ23から受信バッファ25に転送させる時に、受信履歴フラグがセットされたままであったならば、2重受信であるオーバーランエラーの発生を示すオーバーランエラーフラグをセットする。尚、上記フレーミングエラーフラグ及びオーバーランエラーフラグも、バス17を介して読み出し可能であると共に、その各フラグのクリアは、ソフトウエアによって行われる。
【0041】
一方、SCI15において、データの送信時には、ソフトウエアによってRAM13から送信バッファ27に1バイト(=8ビット)の送信対象データD0〜D7が書き込まれる。すると、その送信バッファ27内のデータD0〜D7は、先頭と末尾とに夫々スタートビットSとストップビットPとが付けられた合計10ビットの1フレームの形で送信用シフトレジスタ29に転送される。
【0042】
そして、その送信用シフトレジスタ29に転送された1フレーム分のデータは、制御回路33の制御により、送信用シフトレジスタ29から入出力回路31及び出力バッファ21を介して、スタートビットSを先頭に1ビットずつ通信ドライバ回路7へ出力される。これにより、通信線3への1フレーム分のデータ送信が行われる。
【0043】
以上のように構成された本実施形態の車両内通信システムにおいては、ECU1a,1bのうちの何れかが送信者となり他が受信者となる。そして、送信側のECU1は、1フレーム分の通信データを、予め決められた一定時間毎に(以下、この時間間隔を通信間隔ともいう)且つ同じボーレートで送信する。
【0044】
具体例を挙げると、エンジンECU1aが、エンジン回転数データや車速データなどを情報データD0〜D7として含んだ通信データを、一定時間毎に送信する。そして、トランスミッションECU1bでは、エンジンECU1aからの通信データを受信し、その受信データ(詳しくは、受信した通信データ中の情報データD0〜D7)を、RAM13に転送して制御対象の制御に用いる。例えば、トランスミッションECU1bは、エンジンECU1aからのエンジン回転数データや車速データに応じて、変速制御やセンサの異常検出等を行う。
【0045】
このため、本実施形態の車両内通信システムにおいて、受信側となるECU1は、通信データの受信間隔が予め決められた通信間隔の正常範囲から外れたか否かを判定して、正常範囲から外れたならば、その後、受信間隔が正常に戻ったと判定するまでの間、通信線3から受信したデータをRAM13に転送する受信処理を中断する、といったフェイルセーフ動作を行う。つまり、受信間隔が正常範囲から外れたということは、送信側のECU1に何等かの異常が生じたと考えられるためであり、そのような場合に受信したデータをRAM13に転送してしまうと、信頼性の無いデータを用いて制御対象を制御することとなるからである。
【0046】
そこで次に、上記フェイルセーフ動作を実現するために、ECU1のマイコン5で実行される処理について、図3及び図4のフローチャートを用いて説明する。尚、本実施形態の車両内通信システムでは、どのECU1a,1bも受信側になり得る。そして、以下に説明する処理は、受信側になったECU1のマイコン5で実行されるものである。
【0047】
まず図3は、マイコン5において、前述のSCI15により受信割込要求が発生された時に起動される受信割込ルーチンを表すフローチャートである。
図3に示すように、この受信割込ルーチンの実行が開始されると、まずステップ(以下、「S」と記す)110にて、前述のフレーミングエラーフラグとオーバーランエラーフラグとが何れか一方でもセットされているか否かを判定し、その両フラグの何れか一方でもセットされていれば、受信エラーが発生したとして、S120に進み、そのセットされているフラグをクリアする。
【0048】
そして、S130に進んで、SCI15の受信バッファ25をクリアすると共に、前述の受信履歴フラグをクリアし、当該ルーチンを終了する。
一方、上記S110にて、フレーミングエラーフラグとオーバーランエラーフラグとが両方共にセットされていないと判定した場合には、SCI15にて通信データが正常に受信された(即ち、受信エラーが無い)と判断できるため、S140に移行する。
【0049】
S140では、現在の時刻(現在時刻)から、当該S140の処理を前回実行した時刻(前回時刻)を引くことにより、SCI15による通信データの受信間隔を求める。そして、続くS150にて、今回のS140で用いた現在時刻を、次回のS140で用いる前回時刻として記憶する。尚、現在時刻は、マイコン5に内蔵された周知のフリーランタイマの値によって検出される。
【0050】
つまり、S140及びS150では、当該受信割込ルーチンが前回起動されてから今回起動されるまでの時間間隔(当該受信割込ルーチンの起動間隔)を、通信データの受信間隔として求めている。
そして次に、S160にて、S140で求めた受信間隔が、予め決められた通信間隔の正常範囲の上限値よりも長いか、その正常範囲内か、その正常範囲の下限値よりも短いかを判定する。尚、本実施形態においては、通信間隔のセンター値が5msであり、その通信間隔の正常範囲は4〜6ms(=5ms±20%)であるものとする。
【0051】
そして、受信間隔が正常範囲内であると判定した場合には、S170に進んで、カウンタCntLの値とカウンタCntSの値とを、夫々“0“にクリアし、続くS180にて、第1種異常検出フラグFLと第2種異常検出フラグFSとを、夫々“0”にクリアする。尚、第1種異常検出フラグFLは、受信間隔が正常範囲よりも長い異常(第1種異常)が発生したことを示すフラグであり、第2種異常検出フラグFSは、受信間隔が正常範囲よりも短い異常(第2種異常)が発生したことを示すフラグである。
【0052】
そして更に、続くS190にて、受信バッファ25に格納されている受信データ(詳しくは情報データD0〜D7)をRAM13に転送する受信処理を行い、その後、前述したS130に移行して、受信バッファ25と受信履歴フラグとをクリアした後、当該ルーチンを終了する。
【0053】
これに対し、上記S160にて、受信間隔が正常範囲の上限値よりも長いと判定した場合には、S200に移行する。
S200では、カウンタCntLの値を1インクリメント(+1)し、続くS210にて、そのカウンタCntLの値が所定の判定値NL(本実施形態では3)以上であるか否かを判定する。そして、カウンタCntLの値が判定値NL以上でなければ、そのままS130に移行するが、カウンタCntLの値が判定値NL以上であれば、S220に進んで、第1種異常検出フラグFLをセットし(“1”にし)、その後、S130に移行する。
【0054】
また、上記S160にて、受信間隔が正常範囲の下限値よりも短いと判定した場合には、S230に移行する。
S230では、カウンタCntSの値を1インクリメント(+1)し、続くS240にて、そのカウンタCntSの値が所定の判定値NS(本実施形態では3)以上であるか否かを判定する。そして、カウンタCntSの値が判定値NS以上でなければ、そのままS130に移行するが、カウンタCntSの値が判定値NS以上であれば、S250に進む。
【0055】
そして、S250では、第2種異常検出フラグFSをセットし(“1”にし)、続くS260では、以後の当該受信割込ルーチンの起動が禁止されるように割込ベクタを変更する。つまり、受信割込要求が発生した時に、当該受信割込ルーチンに代えて、何も処理を行わずにリターンするだけのダミールーチンが起動されるようにする。尚、マイコン5の機能として、受信割込要求を内部レジスタの設定によって無効にすることができるのであれば、その内部レジスタの設定により、当該受信割込ルーチンが起動されるのを禁止しても良い。
【0056】
そして、上記S260の処理を行った後、S130に移行する。すると、以後は、SCI15によって受信割込要求が発生されても、当該受信割込ルーチンは起動されなくなる。
尚、本実施形態では、この受信割込ルーチンにおけるS160〜S180及びS200〜S260の処理が、異常モード検出対応処理に相当している。
【0057】
次に、図4は、マイコン5において、所定時間毎に起動される定期ルーチンとしての時間割込ルーチンを表すフローチャートである。尚、本実施形態において、この時間割込ルーチンの起動間隔は、通信間隔の正常範囲(4〜6ms)の下限値と同じ4msに設定されている。よって、以下、この時間割込ルーチンを4ms時間割込ルーチンという。
【0058】
図4に示すように、この4ms時間割込ルーチンの実行が開始されると、まずS310にて、当該ルーチンに割り当てられた処理のうち、通信には直接関係のない他の制御処理(以下、4ms毎の他の制御処理という)を行う。
そして、続くS320にて、第2種異常検出フラグFSがセットされているか否かを判定し、第2種異常検出フラグFSがセットされていなけば、そのままS390に移行して、4ms毎の他の制御処理の残り部分を行い、その後、当該ルーチンを終了する。
【0059】
一方、上記S320にて、第2種異常検出フラグFSがセットされていると判定した場合には、受信割込ルーチンの起動が禁止されている状態であることから、その受信割込ルーチンの代わりに受信間隔が正常に戻ったか否かを判定するため、以下のS330〜S380の処理を行う。
【0060】
即ち、まずS330にて、受信履歴フラグがセットされているか否かを判定し、受信履歴フラグがセットされていなければ、SCI15により通信データが受信されていないことから、そのままS390に移行する。
また、上記S330で受信履歴フラグがセットされていると判定した場合には、当該4ms時間割込ルーチンが前回起動されてから今回起動されるまでの間に、SCI15が通信データを少なくとも1回以上受信していることから、S340に進んで、フレーミングエラーフラグとオーバーランエラーフラグとが何れか一方でもセットされているか否かを判定する。
【0061】
そして、フレーミングエラーフラグとオーバーランエラーフラグとが何れか一方でもセットされていたならば、S345に進んで、そのセットされているフラグをクリアし、その後、S380に移行する。そして、このS380にて、受信バッファ25をクリアすると共に、受信履歴フラグをクリアし、その後、S390に進む。
【0062】
これに対し、上記S340にて、フレーミングエラーフラグとオーバーランエラーフラグとが両方共にセットされていないと判定した場合には、S350に進んで、カウンタCntSの値と第2種異常検出フラグFSとを夫々“0”にクリアする。
【0063】
そして、続くS360にて、受信割込ルーチンのS190と全く同様に、受信バッファ25に格納されている受信データをRAM13に転送する受信処理を行う。
そして更に、続くS370にて、図3の受信割込ルーチンが以後起動されるように、割込ベクタを変更する。つまり、割込ベクタを、図3のS260で変更する前の状態に戻して、受信割込ルーチンが起動されるのを許可するのである。尚、受信割込ルーチンの起動が内部レジスタの設定によって無効にされているのであれば、その内部レジスタの値を、受信割込ルーチンが起動されるように設定し直せば良い。
【0064】
そして、上記S370の処理を行った後、S380に進んで、受信バッファ25をクリアすると共に、受信履歴フラグをクリアし、その後、S390で4ms毎の他の制御処理の残り部分を行った後、当該ルーチンを終了する。
この4ms時間割込ルーチンでは、S330とS340の処理により、当該ルーチンが前回起動されてから今回起動されるまでの4msの間に、SCI15が通信データを1回だけ受信したか否かを判定するようにしている。
【0065】
つまり、まず、この4ms時間割込ルーチンでは、S330で受信履歴フラグがセットされていると肯定判定すると、必ずS380にて、その受信履歴フラグをクリアする。このため、もし、当該4ms時間割込ルーチンが前回起動されてから今回起動されるまでの間に、SCI15が通信データを2回以上受信していたならば、受信履歴フラグだけでなく、オーバーランエラーフラグもセットされることとなり、また、当該4ms時間割込ルーチンが前回起動されてから今回起動されるまでの間に、SCI15が通信データを1回だけ受信していたならば、受信履歴フラグだけがセットされることとなる。
【0066】
そして、上記S340にて、フレーミングエラーフラグとオーバーランエラーフラグとが両方共にセットされていないと否定判定した場合(S340:NO)には、受信履歴フラグがセットされており且つオーバーランエラーフラグはセットされていない状態である。
【0067】
よって、その場合には、当該ルーチンが前回起動されてから今回起動されるまでの4msの間に、SCI15が通信データを1回だけ受信したと判定することができる。
そして、この4ms時間割込ルーチンでは、上記S340での否定判定により、当該4ms時間割込ルーチンが前回起動されてから今回起動されるまでの間にSCI15が通信データを1回だけ受信したことを確認したならば、正常範囲(4〜6ms)よりも短くなっていた受信間隔が正常範囲内に戻ったと判断している。
【0068】
そして更に、S340で否定判定した場合には、SCI15で受信された受信データにフレーミングエラーも無いため、S360にて、SCI15の受信バッファ25から、その正常な受信データをRAM13へ転送し、更にS370にて、それまで禁止されていた受信割込ルーチンの起動を許可するようにしている。
【0069】
以上のような本実施形態のECU1では、送信側のECUに異常が生じて、そのECUからの送信間隔が正常範囲より長くなると、図5に示すように、マイコン5のSCI15が1フレーム分の通信データを受信するタイミング(受信タイミング)の間隔である受信間隔及び受信割込ルーチンの起動間隔が、正常範囲(4〜6ms)よりも長くなる。尚、図5では、時刻t1〜時刻t2までの間、受信間隔が正常範囲より長くなっている。
【0070】
すると、受信割込ルーチンでは、S160の判定処理により、受信間隔が正常範囲の上限値よりも長い第1種異常が発生したと判定されるようになり、S190での受信処理が行われなくなる。
そして更に、受信割込ルーチンにて、S160の判定処理により、第1種異常が発生したと判定されるようになると、図5における時刻t1〜時刻t2の期間内に示す如く、SCI15により通信データが受信されて受信割込ルーチンが起動される毎に、カウンタCntLの値が1ずつ増加される(S200)。そして、カウンタCntLの値が判定値NL(=3)以上になると(S210:YES)、第1種異常が発生したという異常判定が確定されて、第1種異常検出フラグFLがセットされる(S220)。尚、この第1種異常検出フラグFLは、図示しない他の処理によって参照され、例えば、そのフラグFLがセットされている継続時間から、通信線3の断線などが検出される。
【0071】
その後、送信側のECUからの通信データの送信間隔が正常範囲に戻って、図5の時刻t2以降に示す如く、SCI15による通信データの受信間隔及び受信割込ルーチンの起動間隔が正常範囲に戻ると、受信割込ルーチンでは、S160の判定処理により、受信間隔が正常範囲内であると判定(即ち、正常に戻ったと判定)されるようになり、S190での受信処理が再び行われるようになる。尚、この時、カウンタCntLの値と第1種異常検出フラグFLは、S170とS180の処理によってクリアされる。
【0072】
一方、本実施形態のECU1において、送信側のECUに異常が生じて、そのECUからの送信間隔が正常範囲より短くなると、図6に示すように、SCI15による通信データの受信間隔及び受信割込ルーチンの起動間隔が、正常範囲(4〜6ms)よりも短くなる。尚、図6では、時刻t3〜時刻t5までの間、受信間隔が正常範囲より短くなっている。
【0073】
すると、受信割込ルーチンでは、S160の判定処理により、受信間隔が正常範囲の下限値よりも短い第2種異常が発生したと判定されるようになり、S190での受信処理が行われなくなる。
そして更に、受信割込ルーチンにて、S160の判定処理により、第2種異常が発生したと判定されるようになると、図6における時刻t3〜時刻t4の期間内に示す如く、SCI15により通信データが受信されて受信割込ルーチンが起動される毎に、カウンタCntSの値が1ずつ増加される(S230)。そして、図6の時刻t4に示す如く、カウンタCntSの値が判定値NS(=3)に達すると(S240:YES)、第2種異常が発生したという異常判定が確定されて、第2種異常検出フラグFSがセットされると共に(S250)、それ以後の受信割込ルーチンの起動が禁止される(S260)。
【0074】
このようにして第2種異常検出フラグFSがセットされると、その後は、4ms時間割込ルーチンにて、S330〜S380の処理(以下、通信処理という)が実行され、この通信処理により、SCI15による通信データの受信間隔が正常に戻ったか否かが判定される。
【0075】
そして、その後、送信側のECUからの通信データの送信間隔が正常範囲に戻って、図6の時刻t5以降に示す如く、SCI15による通信データの受信間隔が正常範囲に戻り、SCI15が、4ms時間割込ルーチンの起動間隔内に通信データを1回だけ受信するようになると、図6の時刻t6に示す如く、4ms時間割込ルーチンにおける上記通信処理にて、受信間隔が正常に戻ったと判定され(S340:NO)、カウンタCntSの値と第2種異常検出フラグFSとがクリアされると共に(S350)、その時点で受信バッファ25に格納されている最新且つ正常な受信データがRAM13に転送され(S360)、更に、受信割込ルーチンの起動が許可される(S370)。
【0076】
よって、以後は、SCI15にて通信データが受信される毎に、再び受信割込ルーチンが起動されるようになり、その受信割込ルーチンにて、S190の受信処理が行われることとなる。また、第2種異常検出フラグFSがクリアされると、4ms時間割込ルーチンでは、上記S330〜S380の通信処理が再び実行されなくなる。
【0077】
以上詳述したように、本実施形態のECU1では、受信間隔が正常範囲よりも長い異常時と短い異常時とで、受信間隔の正常復帰判定の処理方法を変えており、特に、受信間隔が正常範囲よりも長い第1種異常の検出時には、引き続き受信割込ルーチンで正常復帰判定を行い、受信間隔が正常範囲よりも短い第2種異常の検出時には、受信割込ルーチンの起動を禁止して、起動周期が正常な受信間隔と同等な4ms時間割込ルーチンにより、受信間隔の正常復帰判定を行うようにしている。
【0078】
よって、通信データの受信間隔が異常になったことと、その異常が解消されて受信間隔が正常に戻ったこととを、マイコン5での処理負荷を増大させることなく正確に判定することができる。
即ち、受信割込ルーチンにて第1種異常の発生を検知した場合(受信間隔が正常範囲よりも長いと異常判定した場合)には、通信データの受信間隔が正常時よりも長くなっているため、そのまま受信割込ルーチンで正常復帰判定を行っても、その受信割込ルーチンが正常時よりも頻繁に起動されることはなく、処理負荷は特に増大しない。そして、受信割込ルーチンによれば、そのルーチンの起動間隔が受信間隔に等しいため、受信間隔を正確に検出することができ、受信間隔が正常に戻ったことを正確に判定することができる。もちろん、受信割込ルーチンによれば、受信間隔が正常範囲から外れて第1種異常と第2種異常との何れが発生しているのかも、正確に判定することができる。
【0079】
また、受信割込ルーチンにて第2種異常の発生を検知した場合(受信間隔が正常範囲よりも短いと異常判定した場合)には、受信割込ルーチンの起動が禁止されるため、受信割込ルーチンが正常時よりも頻繁に起動されることが防止される。そして特に、この場合には、受信間隔が正常な範囲よりも短くなっているということが分かっているため、起動周期が正常な受信間隔と同等な4ms時間割込ルーチンによって、受信間隔が正常に戻ったか否かを正確に判定することができる。つまり、4ms時間割込ルーチンにて、受信履歴フラグとオーバーランエラーフラグとを監視し、当該ルーチンが前回起動されてから今回起動されるまでの間にSCI15が通信データを1回だけ受信したか否かを確認するだけで、受信間隔が正常に戻ったか否かを正確に判定することができる。このため、受信間隔が正常範囲より短くなり、受信割込ルーチンにて第2種異常の発生を検知した場合にも、マイコン5での処理負荷が増大することはない。
【0080】
一方更に、本実施形態のECU1では、4ms時間割込ルーチンにて、受信間隔が正常に戻ったと判定したならば(S340:NO)、受信割込ルーチンの起動を許可するだけでなく、その時点でSCI15の受信バッファ25に格納されている通信データをRAM13に転送するようにしている(S360)。
【0081】
このため、受信間隔が正常に戻った後の信頼性の高い受信データを、極力早期にRAM13へ転送することができ、制御性を向上させることができる。
つまり、4ms時間割込ルーチンで受信間隔が正常に戻ったと判定された後に、SCI15により次の通信データが受信されて、それに伴い起動される受信割込ルーチンでS190の受信処理が行われれば、RAM13に正常な受信データが転送されることとなるが、それよりも1回前に受信された正常な受信データをRAM13に転送することができ、その分、最新の受信データを用いた制御をいち早く開始できるからである。
【0082】
以上、本発明の一実施形態について説明したが、本発明は、種々の形態を採り得ることは言うまでもない。
例えば、 上記実施形態では、定期ルーチンとしての時間割込ルーチンの起動間隔を、受信間隔(通信間隔)の正常範囲の下限値に設定したが、そのルーチンの起動間隔は、受信間隔の正常範囲内の値であれば良い。但し、上記実施形態の如く正常範囲の下限値に設定すれば、受信間隔が正常範囲よりも短くなってから正常範囲内に復帰したことを、いち早く検知し易くなるという点で有利である。
【0083】
また、上記実施形態のECU1は、車両内通信システムを構成するものであったが、本発明は、車両用以外のECUに対しても全く同様に適用することができる。
【図面の簡単な説明】
【図1】 実施形態の車両内通信システムを説明する説明図であり、(A)はそのシステムの構成を表し、(B)は通信データのフォーマットを表している。
【図2】 実施形態の電子制御装置(ECU)の構成を説明する説明図である。
【図3】 電子制御装置のマイコンで実行される受信割込ルーチンを表すフローチャートである。
【図4】 電子制御装置のマイコンで実行される4ms時間割込ルーチンを表すフローチャートである。
【図5】 受信間隔が正常範囲よりも長くなった場合の作用を説明するタイムチャートである。
【図6】 受信間隔が正常範囲よりも短くなった場合の作用を説明するタイムチャートである。
【符号の説明】
1,1a,1b…ECU(電子制御装置)、3…通信線、5…マイコン(マイクロコンピュータ)、7…通信ドライバ回路、9…CPU、11…ROM、13…RAM、15…SCI(シリアル通信インターフェース)、17…バス、19…入力バッファ、21…出力バッファ、23…受信用シフトレジスタ、25…受信バッファ、27…送信バッファ、29…送信用シフトレジスタ、31…入出力回路、33…制御回路
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an electronic control device that forms a communication system by being connected to a communication partner device via a communication line, and in particular, electronic control in which data is transmitted from the communication partner device at regular intervals. It relates to the device.
[0002]
[Prior art]
Conventionally, for example, in a vehicle, a communication system is configured in which a plurality of electronic control devices connected to each other via communication lines communicate to share control data. In general, in such a communication system between in-vehicle electronic control devices, serial data communication is always performed at a predetermined time interval (communication interval) and at the same baud rate.
[0003]
By the way, in such a communication system, an abnormality occurs in the electronic control device on the transmission side, and the transmission interval of communication data from the device becomes longer or shorter than a predetermined communication interval. Sometimes.
For this reason, the electronic control device on the receiving side is provided with the following fail-safe function. That is, the electronic control device on the receiving side determines whether or not the interval (reception interval) at which communication data is received is out of the normal range determined in advance. Reception processing (that is, processing for transferring data received from the communication line to a storage unit such as a RAM that is accessed for control of the control target) is interrupted. Then, after that, if it is determined that the reception interval has returned to normal, it is determined that the reception interval has returned to normal, and the reception process is resumed. If each electronic control device constituting the communication system performs data transmission / reception (that is, bidirectional communication), such a fail-safe function is provided in each electronic control device. That is, the above “reception-side electronic control device” means an electronic control device that is receiving data.
[0004]
In the conventional electronic control apparatus, the above fail-safe function is realized by a reception interrupt routine that is activated every time one frame of communication data is received by the microcomputer.
Specifically, first, in general, a microcomputer (hereinafter simply referred to as a microcomputer) that constitutes this type of electronic control device has a serial communication interface (hardware for performing serial data communication with other devices). (Hereinafter referred to as SCI).
[0005]
The SCI is a means for receiving communication data in which a plurality of bits (for example, 10 bits) from a start bit to a stop bit are one frame, as disclosed in, for example, Japanese Patent Laid-Open No. Hei 8-293881. Are provided with a shift register for reception and a reception buffer. Furthermore, when the SCI detects a start bit on the communication line, it shifts subsequent data bits bit by bit to the reception shift register at a predetermined baud rate, and then detects a stop bit on the communication line. Then, the communication data for one frame up to the stop bit is moved from the reception shift register to the reception buffer, a reception interrupt request is generated, and the data (that is, one frame received) is received from the reception buffer by software. Communication data).
[0006]
For this reason, the microcomputer performs a reception process for transferring communication data from the SCI reception buffer to the RAM or the like in the reception interrupt routine activated in response to the reception interrupt request. Before, the process of measuring the time interval from the previous activation of the reception interrupt routine to the current activation as the communication data reception interval by SCI, and whether the reception interval measured in the process is normal When the determination process determines that the reception interval is not normal, the reception interrupt routine is performed until the determination process determines that the reception interval is normal. The above reception process is prohibited.
[0007]
The above fail-safe function is realized by such a configuration of the reception interrupt routine.
[0008]
[Problems to be solved by the invention]
However, if all the fail-safe functions are realized only by the reception interrupt routine as described above, it is determined that the reception interval has returned to normal after the abnormality is determined that the reception interval is not normal. The reception interrupt routine is also performed by the reception interrupt routine. Therefore, especially when an abnormality occurs that shortens the communication interval, the reception interrupt routine is started more frequently than normal. There is a problem that the processing performed by the time interrupt routine, the base routine, etc., which has a lower priority than the interrupt routine, does not end within a predetermined period and the controllability is reduced.
[0009]
In the above Japanese Patent Laid-Open No. 8-293881, the external diagnostic device before the external diagnostic device as the master device and each on-vehicle electronic control device as the slave device send and receive messages at the normal baud rate. By transmitting the initialization address at a baud rate that is much slower than the normal baud rate, the external diagnostic device may accidentally start at a low baud rate when communicating at a normal high baud rate in a communication system that performs initialization. The following technique is disclosed in order to solve the problem that, when a computerized address is transmitted, reception interrupts frequently occur in each electronic control device, and other processing does not proceed first.
[0010]
That is, when each electronic control unit determines that a number of reception interrupts due to a framing error that occurs when the stop bit in the received communication data for one frame is not a normal value, the external diagnostic device detects a slow baud rate. It is determined that the initialization address is transmitted, and the reception interrupt routine is prohibited from being started, and thereafter the communication line level is sampled in the time interruption routine at regular intervals. In addition to receiving each bit of the initialization address, the activation of the reception interrupt routine is permitted when all bits of the initialization address are received.
[0011]
However, the technique described in the above publication does not attempt to detect that the communication interval has become abnormal and that the communication interval has returned to normal since the communication interval has become abnormal. Can not.
In addition, when the reception interrupt routine determines that the reception interval of communication data by SCI is not normal using the concept of “prohibiting activation of the reception interrupt routine” among the above-described techniques, The reception interrupt routine is prohibited from being started, and after that, it is determined whether or not the reception interval has returned to normal by other routines such as a time interruption routine and a base routine. It is conceivable to adopt a configuration in which the activation of the reception interrupt routine is permitted if it is determined that the operation has returned to normal.
[0012]
However, even when trying to configure in this way, in fact, in time interrupt routines and base routines other than the reception interrupt routine, it is not possible to accurately determine whether or not the reception interval has returned to normal with simple processing contents. Cannot solve the above problem.
This is because the routine other than the reception interrupt routine cannot accurately detect the reception interval, and the communication abnormality mode includes an abnormality in which the reception interval is longer than the normal value, and the reception interval is greater than the normal value. This is because it is difficult to accurately determine that the abnormality has returned to normal from both abnormal modes.
[0013]
Also, for example, it is determined whether or not the SCI has received communication data by a time interruption routine whose activation cycle is shorter than the normal reception interval, and activation of the routine from the previous determination that it was received until the current determination Although it is conceivable that the SCI reception interval is obtained from the number of times, in order to obtain sufficient determination accuracy, the activation period of the time interrupt routine is significantly smaller than the normal reception interval (for example, 10 minutes). 1) or less), and the processing load increases by the time interrupt routine. Therefore, the processing performed in another time interruption routine or base routine having a lower priority than that time interruption routine does not end within the predetermined period, and the controllability deteriorates.
[0014]
The present invention has been made in view of these problems, and in the electronic control device that receives communication data that should be transmitted at regular intervals from the communication partner device, the communication data reception interval has become abnormal. It is an object of the present invention to accurately determine that the abnormality has been resolved and the reception interval has returned to normal without increasing the processing load.
[0015]
[Means for Solving the Problems and Effects of the Invention]
In order to achieve the above object, the electronic control device according to the first aspect of the present invention is connected to a communication partner device via a communication line.
In this electronic control device, the communication means generates a reception interrupt request every time it receives communication data for one frame transmitted from the communication partner device every predetermined time and stores it in the reception buffer. . Further, in this electronic control device, in the reception interrupt routine activated in response to the reception interrupt request, a reception process for transferring communication data (that is, reception data) from the reception buffer of the communication means to a predetermined storage means I do. In the electronic control device, the control target is controlled using the data in the storage means.
[0016]
For this reason, in this electronic control device, as in the case of the conventional electronic control device, every time communication means corresponding to the above-mentioned SCI receives communication data for one frame and stores it in the reception buffer, the reception interrupt routine is executed. The reception data is transferred from the reception buffer of the communication means to the predetermined storage means by the reception processing in the reception interrupt routine. The received data transferred to the storage means is appropriately used for control of the control target.
[0017]
Here, in particular, in the electronic control device of the present invention, the following abnormal mode detection handling process is performed in the reception interrupt routine.
In this abnormal mode detection handling process, an abnormality in which the communication data reception interval by the communication means is longer than the normal range based on the time interval from when the reception interrupt routine is activated last time to this time activation (hereinafter, It is determined whether or not a first type abnormality has occurred and whether or not an abnormality in which the reception interval is shorter than the normal range (hereinafter referred to as a second type abnormality) has occurred. If it is determined that the reception interrupt routine is performed, the reception interrupt routine is prohibited, and if it is determined that the second type abnormality has occurred, the reception interrupt routine is performed. And prohibiting the reception interrupt routine from being started thereafter.
[0018]
Further, in the electronic control device of the present invention, when the activation of the reception interrupt routine is prohibited by the abnormal mode detection handling process, the communication is performed in a regular routine that is activated every predetermined time. It is determined whether or not the reception interval of communication data by the means has returned to normal, and if it is determined that the reception interval has returned to normal, the reception interrupt routine is permitted to be started.
[0019]
In such an electronic control device of the present invention, if an abnormality occurs in the communication partner device and the communication data transmission interval from the device becomes longer than the normal range, the communication data reception interval by the communication means is increased. In this case, the activation interval of the reception interrupt routine becomes longer than the normal range. As a result, it is determined by the abnormal mode detection corresponding process in the reception interrupt routine that the first type abnormality has occurred, and the reception process is performed. Will be interrupted.
[0020]
After that, when the communication data transmission interval from the communication partner device returns to normal, the communication data reception interval by the communication means and the start interval of the reception interrupt routine return to the normal range. By the abnormal mode detection handling process, it is determined that neither the first type abnormality nor the second type abnormality has occurred (that is, normal), and the prohibition of the reception process is released (that is, the reception process is resumed). The Rukoto.
[0021]
For this reason, when the transmission interval of communication data from the communication partner device becomes longer than the normal range and the occurrence of the first type abnormality is detected in the reception interrupt routine (that is, the reception interval is less than the normal range). When the abnormality is determined to be long), a normal return determination for determining whether the reception interval has returned to normal is also performed in the reception interrupt routine, as in the above-described conventional electronic control device.
[0022]
On the other hand, in the electronic control device of the present invention, when the communication data transmission interval from the communication partner device becomes shorter than the normal range, the communication data reception interval by the communication means, and hence the reception interrupt routine activation interval. Becomes shorter than the normal range, and as a result, the abnormal mode detection corresponding process in the reception interrupt routine determines that the second type abnormality has occurred, the reception process is interrupted, and the reception interrupt routine Activation is prohibited. Then, after that, it is determined whether or not the communication data reception interval by the communication means has returned to normal in a periodic routine that is activated at predetermined time intervals.
[0023]
After that, when the communication data transmission interval from the communication partner device returns to normal, and it is determined in the regular routine that the reception interval has returned to normal, activation of the reception interrupt routine is permitted. Become.
For this reason, when the transmission interval of communication data from the communication partner device is shorter than the normal range and the occurrence of the second type abnormality is detected in the reception interrupt routine (that is, the reception interval is less than the normal range). Thereafter, when it is determined that the abnormality is short, the activation of the reception interrupt routine is prohibited until it is determined that the reception interval has returned to normal in a regular routine every predetermined time. Therefore, it is possible to prevent the reception interrupt routine from being started more frequently than normal.
[0024]
That is, in the electronic control device of the present invention, it is determined that a first type abnormality (abnormality in which the transmission interval from the communication partner becomes longer and the reception interval becomes longer than the normal range) has occurred in the reception interrupt routine. In this case, it is determined whether or not the reception interval has returned to normal in the reception interrupt routine. However, in the reception interrupt routine, the second type abnormality (the transmission interval from the communication partner is shortened). If it is determined that the reception interval is shorter than the normal range), the activation of the reception interrupt routine is prohibited, and thereafter the reception interval is normal in a regular routine every predetermined time. It is determined whether or not it has returned to In other words, the activation of the reception interrupt routine is prohibited only when it is determined that the type 2 abnormality that is shorter than the reception interval has occurred, and whether or not the reception interval has returned to normal is determined for a predetermined time. Judgment is made in each regular routine.
[0025]
For this reason, according to the electronic control device of the present invention, the communication data reception interval becomes abnormal and the abnormality is resolved and the reception interval returns to normal without increasing the processing load. It can be determined accurately.
That is, as described above, when the occurrence of the first type abnormality is detected in the reception interrupt routine, the normal return is determined to determine whether the reception interval has returned to normal as in the case of the conventional electronic control device. However, in this case, since the communication data reception interval is longer than normal, the reception interrupt routine is started more frequently than normal. There is no particular increase in processing load.
[0026]
According to the reception interrupt routine, since the activation interval of the routine is equal to the reception interval, the actual reception interval can be detected accurately, and it can be accurately determined that the reception interval has returned to normal. it can. Of course, according to the reception interrupt routine, it is possible to accurately determine whether the reception interval is out of the normal range and the first type abnormality or the second type abnormality occurs. The activation interval (= reception interval) of the reception interrupt routine can be obtained from the difference between the time when the routine was activated last time and the time when the routine was activated this time. It can be easily measured by a general internal clock such as a counter).
[0027]
On the other hand, when the occurrence of the second type abnormality is detected in the reception interrupt routine, the activation of the reception interrupt routine is prohibited. Therefore, it is possible to prevent the reception interrupt routine from being started more frequently than normal.
Furthermore, in this case, since the precondition is that the reception interval is shorter than the normal range, a regular routine whose activation cycle is relatively long and whose activation cycle is equal to the normal reception interval This makes it possible to accurately and easily determine whether the reception interval has returned to normal.
[0028]
As a specific example, as described in claim 2, first, the start cycle of the regular routine (the predetermined time) is set to a value within the normal range (that is, from a lower limit value to an upper limit value of a normal reception interval). To a predetermined value). In the regular routine, the communication means determines whether or not the communication data has been received only once during the period from the previous activation to the current activation, and the communication data is received only once. If so, it may be determined that the reception interval has returned to normal (that is, the reception interval has returned to a normal range).
[0029]
In general, the SCI of the microcomputer is an overrun which is a double reception if no access is received from the CPU between the previous reception of communication data for one frame and the reception of this time. An overrun error flag indicating the occurrence of an error is set (set). For this reason, if such SCI is used as a communication means, whether or not the communication means has received communication data only once during the period from when the regular routine was last activated until this time is activated. Thus, it can be easily determined by monitoring the state of the overrun error flag.
[0030]
As described above, according to the electronic control device of the present invention, the reception interval normal return determination processing method is changed between an abnormality time longer than a normal range and a short abnormality time. If the interval is longer than the normal range, the reception interrupt routine continues to determine whether the interval is normal. If the reception interval is shorter than the normal range, the reception interrupt routine is prohibited and received by the regular routine. Since the interval normal return determination is performed, it is possible to accurately determine that the reception interval has become abnormal and that the reception interval has returned to normal without increasing the processing load.
[0031]
By the way, if it is determined in the regular routine that the reception interval has returned to normal, not only the activation of the reception interrupt routine is permitted, but also stored in the reception buffer of the communication means at that time as described in claim 3. If the communication data being transferred is transferred to the storage means, highly reliable received data after the reception interval has returned to normal can be transferred to the storage means as soon as possible, improving controllability. Can be made.
[0032]
That is, if it is determined in the regular routine that the reception interval has returned to normal, the next communication data is received by the communication means, and if reception processing is performed in the reception interrupt routine that is activated in association with the next communication data, the storage means is normal. Normal received data can be transferred to the storage means, and control using the latest received data can be started as soon as possible. Because it can be done.
[0033]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, an in-vehicle communication system (specifically, a communication system between electronic control devices mounted on a vehicle) of an embodiment to which the present invention is applied will be described with reference to the drawings. First, as shown in FIG. 1 (A), an in-vehicle communication system according to this embodiment includes two electronic control devices (hereinafter referred to as ECUs) 1a and 1b mounted on a vehicle, and communication connecting these ECUs 1a and 1b. For example, the ECU 1a is an ECU (engine ECU) that controls the engine, and the ECU 1b is an ECU (transmission ECU) that controls the transmission.
[0034]
The ECUs 1a and 1b perform serial data communication via the communication line 3, thereby sharing various control data such as engine speed data and vehicle speed data, and control their control objects using the control data. To do. In the following description, when the ECUs 1a and 1b are not particularly distinguished, “1” is used as the symbol of the ECU.
[0035]
In the in-vehicle communication system of the present embodiment, the communication data exchanged by each ECU 1 via the communication line 3 includes a low-level start bit S and substantial information data as shown in FIG. 10 bits consisting of 8 bits D0 to D7 and high-level stop bits P are defined as one frame.
[0036]
Next, as shown in FIG. 2A, each ECU 1 sends out to the communication line 3 the microcomputer 5 that controls communication with other ECUs 1 and control of the control target, and communication data output from the microcomputer 5. In addition, a communication driver circuit 7 for inputting communication data transmitted on the communication line 3 to the microcomputer 5 is provided.
[0037]
The microcomputer 5 has a general configuration. The CPU 9, the ROM 11 in which the program executed by the CPU 9 and fixed data referred to when the program is executed, the calculation result by the CPU 9, and the like are temporarily stored. RAM 13 as storage means, SCI (serial communication interface) 15 as communication means for performing serial data communication with other ECU 1 (specifically, microcomputer 5 of other ECU 1), and a bus connecting them to each other 17.
[0038]
Further, as shown in FIG. 2B, the SCI 15 includes an input buffer 19 for taking in communication data (that is, received data) input from the communication driver circuit 7 and a communication to be transmitted by the microcomputer 5. An output buffer 21 for outputting data (that is, transmission data) to the communication driver circuit 7, a reception shift register 23 for storing communication data fetched by the input buffer 19 bit by bit, and the reception shift register 23 The stored communication data for one frame is moved, and is stored in the reception buffer 25 accessible via the bus 17, the transmission buffer 27 in which data to be transmitted is written via the bus 17, and the transmission buffer 27. Shift for transmission that shifts the data and outputs the data one bit at a time A register 29, an output circuit 31 provided interposed between the input buffer 19 and output buffer 21 and the both shift registers 23 and 29, and a control circuit 33 for controlling the respective units. The control circuit 33 is connected to the bus 17.
[0039]
In such SCI 15, communication data input from the input buffer 19 is taken into the input / output circuit 31. When the input / output circuit 31 detects the start bit S, the control circuit 33 transfers the subsequent data bits D0 to D7 from the input / output circuit 31 to the reception shift register 23 at a predetermined baud rate. Each bit of the communication data starting from the start bit S is shifted and stored in the reception shift register 23. After that, when the stop bit P is detected by the input / output circuit 31, the control circuit 33 transfers the communication data for one frame up to the stop bit P from the reception shift register 23 to the reception buffer 25. , A reception interrupt request to the CPU 9 is generated, and a reception history flag indicating that the SCI 15 has received one frame of communication data (that is, reception data is stored in the reception buffer 25). Set (set to “1”). The reception history flag can be read out via the bus 17, and the reception history flag is cleared (set to "0") by software.
[0040]
Further, the control circuit 33 has a normal value (in this embodiment, the stop bit P detected by the input / output circuit 31 (that is, the bit corresponding to the ninth bit after the input / output circuit 31 detects the start bit S). It is determined whether or not the logic 1) corresponds to a high level. If the stop bit P is not a normal value, a framing error flag indicating the occurrence of a framing error is set. Furthermore, when the control circuit 33 completes the reception of the communication data for one frame and transfers the communication data from the reception shift register 23 to the reception buffer 25, the reception history flag remains set. For example, an overrun error flag indicating the occurrence of an overrun error that is a double reception is set. The framing error flag and the overrun error flag can also be read out via the bus 17, and each flag is cleared by software.
[0041]
On the other hand, in the SCI 15, when data is transmitted, 1-byte (= 8 bits) transmission target data D0 to D7 is written from the RAM 13 to the transmission buffer 27 by software. Then, the data D0 to D7 in the transmission buffer 27 are transferred to the transmission shift register 29 in the form of one frame having a total of 10 bits with the start bit S and the stop bit P added to the head and tail, respectively. .
[0042]
Then, the data for one frame transferred to the transmission shift register 29 starts with the start bit S from the transmission shift register 29 via the input / output circuit 31 and the output buffer 21 under the control of the control circuit 33. It is output to the communication driver circuit 7 bit by bit. Thereby, data transmission for one frame to the communication line 3 is performed.
[0043]
In the in-vehicle communication system of the present embodiment configured as described above, one of the ECUs 1a and 1b is a sender and the other is a receiver. Then, the ECU 1 on the transmission side transmits communication data for one frame at predetermined time intervals (hereinafter, this time interval is also referred to as a communication interval) and at the same baud rate.
[0044]
If a specific example is given, engine ECU1a will transmit the communication data containing engine speed data, vehicle speed data, etc. as information data D0-D7 for every fixed time. The transmission ECU 1b receives communication data from the engine ECU 1a, and transfers the received data (specifically, information data D0 to D7 in the received communication data) to the RAM 13 for use in control of the control target. For example, the transmission ECU 1b performs shift control, sensor abnormality detection, and the like in accordance with engine speed data and vehicle speed data from the engine ECU 1a.
[0045]
For this reason, in the in-vehicle communication system of the present embodiment, the ECU 1 on the receiving side determines whether or not the communication data reception interval is out of the normal range of the predetermined communication interval, and is out of the normal range. Then, after that, a fail-safe operation is performed such that the reception process for transferring the data received from the communication line 3 to the RAM 13 is interrupted until it is determined that the reception interval has returned to normal. In other words, the fact that the reception interval deviates from the normal range is because it is considered that some abnormality has occurred in the ECU 1 on the transmission side, and if the received data is transferred to the RAM 13 in such a case, This is because the object to be controlled is controlled using non-characteristic data.
[0046]
Then, next, the process performed by the microcomputer 5 of ECU1 in order to implement | achieve the said fail safe operation | movement is demonstrated using the flowchart of FIG.3 and FIG.4. In the in-vehicle communication system of the present embodiment, any ECU 1a, 1b can be the receiving side. And the process demonstrated below is performed by the microcomputer 5 of ECU1 used as the receiving side.
[0047]
First, FIG. 3 is a flowchart showing a reception interrupt routine that is started when a reception interrupt request is generated by the aforementioned SCI 15 in the microcomputer 5.
As shown in FIG. 3, when the execution of this reception interrupt routine is started, first, in step (hereinafter referred to as “S”) 110, either the framing error flag or the overrun error flag is selected. However, it is determined whether or not it is set. If either one of the two flags is set, it is determined that a reception error has occurred, the process proceeds to S120, and the set flag is cleared.
[0048]
In S130, the reception buffer 25 of the SCI 15 is cleared, the above-described reception history flag is cleared, and the routine ends.
On the other hand, if it is determined in S110 that both the framing error flag and the overrun error flag are not set, the communication data is normally received by the SCI 15 (that is, there is no reception error). Since it can be determined, the process proceeds to S140.
[0049]
In S140, the reception interval of the communication data by SCI15 is calculated | required by subtracting the time (previous time) which performed the process of the said S140 last time from the present time (present time). In subsequent S150, the current time used in the current S140 is stored as the previous time used in the next S140. The current time is detected by the value of a known free-run timer built in the microcomputer 5.
[0050]
That is, in S140 and S150, the time interval from the time when the reception interrupt routine is activated last time to the current activation (activation interval of the reception interrupt routine) is obtained as the communication data reception interval.
Next, in S160, it is determined whether the reception interval obtained in S140 is longer than the upper limit value of the normal range of the predetermined communication interval, within the normal range, or shorter than the lower limit value of the normal range. judge. In this embodiment, the center value of the communication interval is 5 ms, and the normal range of the communication interval is 4 to 6 ms (= 5 ms ± 20%).
[0051]
If it is determined that the reception interval is within the normal range, the process proceeds to S170, where the value of the counter CntL and the value of the counter CntS are each cleared to “0”, and in the subsequent S180, the first type The abnormality detection flag FL and the second type abnormality detection flag FS are each cleared to “0”. Note that the first type abnormality detection flag FL is a flag indicating that an abnormality in which the reception interval is longer than the normal range (first type abnormality) has occurred, and the second type abnormality detection flag FS is the reception interval within the normal range. Is a flag indicating that a shorter abnormality (second-type abnormality) has occurred.
[0052]
Further, in the subsequent S190, a reception process for transferring the reception data (specifically, information data D0 to D7) stored in the reception buffer 25 to the RAM 13 is performed, and thereafter, the process proceeds to S130 described above, and the reception buffer 25 And the reception history flag are cleared, the routine is terminated.
[0053]
On the other hand, if it is determined in S160 that the reception interval is longer than the upper limit value of the normal range, the process proceeds to S200.
In S200, the value of the counter CntL is incremented by 1 (+1), and in subsequent S210, it is determined whether or not the value of the counter CntL is equal to or greater than a predetermined determination value NL (3 in the present embodiment). If the value of the counter CntL is not equal to or greater than the determination value NL, the process proceeds to S130. If the value of the counter CntL is equal to or greater than the determination value NL, the process proceeds to S220, and the first type abnormality detection flag FL is set. ("1" is set), and then the process proceeds to S130.
[0054]
If it is determined in S160 that the reception interval is shorter than the lower limit value of the normal range, the process proceeds to S230.
In S230, the value of the counter CntS is incremented by 1 (+1), and in subsequent S240, it is determined whether or not the value of the counter CntS is equal to or greater than a predetermined determination value NS (3 in the present embodiment). If the value of the counter CntS is not equal to or greater than the determination value NS, the process proceeds to S130 as it is. If the value of the counter CntS is equal to or greater than the determination value NS, the process proceeds to S250.
[0055]
In S250, the second type abnormality detection flag FS is set (set to “1”), and in subsequent S260, the interrupt vector is changed so that the subsequent activation of the reception interrupt routine is prohibited. That is, when a reception interrupt request is generated, a dummy routine that returns only without performing any processing is activated instead of the reception interrupt routine. If the reception interrupt request can be invalidated by setting the internal register as a function of the microcomputer 5, even if the reception interrupt routine is prohibited from being started by setting the internal register. good.
[0056]
And after performing the process of said S260, it transfers to S130. Thereafter, even if a reception interrupt request is generated by the SCI 15, the reception interrupt routine is not activated.
In the present embodiment, the processes of S160 to S180 and S200 to S260 in the reception interrupt routine correspond to the abnormal mode detection handling process.
[0057]
Next, FIG. 4 is a flowchart showing a time interruption routine as a regular routine activated every predetermined time in the microcomputer 5. In this embodiment, the activation interval of this time interruption routine is set to 4 ms which is the same as the lower limit value of the normal range (4 to 6 ms) of the communication interval. Therefore, hereinafter, this time interruption routine is referred to as a 4 ms time interruption routine.
[0058]
As shown in FIG. 4, when the execution of the 4 ms time interrupt routine is started, first, in S310, among the processes assigned to the routine, other control processes (hereinafter referred to as 4 ms) that are not directly related to communication. Each other control process).
Then, in subsequent S320, it is determined whether or not the second type abnormality detection flag FS is set. If the second type abnormality detection flag FS is not set, the process proceeds to S390 as it is, and every other 4 ms. The rest of the control process is performed, and then the routine is terminated.
[0059]
On the other hand, if it is determined in S320 that the second type abnormality detection flag FS is set, since the activation of the reception interrupt routine is prohibited, the reception interrupt routine is replaced. In order to determine whether the reception interval has returned to normal, the following processes of S330 to S380 are performed.
[0060]
That is, first, in S330, it is determined whether or not the reception history flag is set. If the reception history flag is not set, the communication data is not received by the SCI 15, and the process proceeds to S390 as it is.
If it is determined in S330 that the reception history flag is set, the SCI 15 receives the communication data at least once during the period from when the 4 ms time interrupt routine was last activated until this time it is activated. Therefore, the process proceeds to S340, and it is determined whether or not either the framing error flag or the overrun error flag is set.
[0061]
If either one of the framing error flag and the overrun error flag is set, the process proceeds to S345 to clear the set flag, and then the process proceeds to S380. In S380, the reception buffer 25 is cleared and the reception history flag is cleared. Thereafter, the process proceeds to S390.
[0062]
On the other hand, if it is determined in S340 that both the framing error flag and the overrun error flag are not set, the process proceeds to S350 and the value of the counter CntS and the second type abnormality detection flag FS are set. Is cleared to “0”.
[0063]
Then, in the following S360, a reception process for transferring the reception data stored in the reception buffer 25 to the RAM 13 is performed in exactly the same manner as in S190 of the reception interrupt routine.
Further, in the subsequent S370, the interrupt vector is changed so that the reception interrupt routine of FIG. That is, the interrupt vector is returned to the state before being changed in S260 of FIG. 3, and the reception interrupt routine is permitted to be started. If the activation of the reception interrupt routine is disabled by the setting of the internal register, the value of the internal register may be reset so that the reception interrupt routine is activated.
[0064]
After performing the process of S370, the process proceeds to S380 to clear the reception buffer 25 and clear the reception history flag, and then perform the remaining part of the other control processes every 4 ms in S390. The routine ends.
In this 4 ms time interrupt routine, the processing of S330 and S340 determines whether or not the SCI 15 has received communication data only once during the 4 ms from when the routine was last activated until this time it is activated. I have to.
[0065]
That is, first, in this 4 ms time interruption routine, if a positive determination is made that the reception history flag is set in S330, the reception history flag is always cleared in S380. For this reason, if the SCI 15 has received communication data more than once during the period from when the 4 ms time interrupt routine was started last time to this time, not only the reception history flag but also an overrun error The flag will also be set, and if the SCI 15 has received communication data only once after the 4ms time interrupt routine was last activated until this time, only the reception history flag will be displayed. Will be set.
[0066]
If it is determined in S340 that both the framing error flag and the overrun error flag are not set (S340: NO), the reception history flag is set and the overrun error flag is It is not set.
[0067]
Therefore, in that case, it can be determined that the SCI 15 has received the communication data only once during 4 ms from when the routine is last activated until this time it is activated.
In this 4 ms time interrupt routine, the negative determination in S340 confirms that the SCI 15 has received communication data only once after the 4 ms time interrupt routine was last activated until this time it is activated. If so, it is determined that the reception interval that has been shorter than the normal range (4 to 6 ms) has returned to the normal range.
[0068]
If a negative determination is made in S340, since there is no framing error in the received data received by the SCI 15, the normal received data is transferred from the receiving buffer 25 of the SCI 15 to the RAM 13 in S360, and further S370. Thus, the activation of the reception interrupt routine that has been prohibited until then is permitted.
[0069]
In the ECU 1 of the present embodiment as described above, when an abnormality occurs in the transmission-side ECU and the transmission interval from the ECU becomes longer than the normal range, the SCI 15 of the microcomputer 5 is equivalent to one frame as shown in FIG. The reception interval which is the timing of receiving communication data (reception timing) and the activation interval of the reception interrupt routine are longer than the normal range (4 to 6 ms). In FIG. 5, the reception interval is longer than the normal range from time t1 to time t2.
[0070]
Then, in the reception interrupt routine, it is determined by the determination processing in S160 that the first type abnormality having a reception interval longer than the upper limit value of the normal range has occurred, and the reception processing in S190 is not performed.
Further, when it is determined in the reception interrupt routine that the first type abnormality has occurred by the determination processing in S160, the communication data is transmitted by the SCI 15 as shown in the period from time t1 to time t2 in FIG. Is received and the reception interrupt routine is started, the value of the counter CntL is incremented by 1 (S200). When the value of the counter CntL becomes equal to or greater than the determination value NL (= 3) (S210: YES), the abnormality determination that the first type abnormality has occurred is confirmed, and the first type abnormality detection flag FL is set ( S220). The first type abnormality detection flag FL is referred to by other processing (not shown). For example, the disconnection of the communication line 3 is detected from the duration for which the flag FL is set.
[0071]
Thereafter, the transmission interval of communication data from the ECU on the transmission side returns to the normal range, and the reception interval of communication data by the SCI 15 and the activation interval of the reception interrupt routine return to the normal range as shown after time t2 in FIG. In the reception interrupt routine, the determination process in S160 determines that the reception interval is within the normal range (that is, determines that the reception interval has returned to normal), and the reception process in S190 is performed again. Become. At this time, the value of the counter CntL and the first type abnormality detection flag FL are cleared by the processing of S170 and S180.
[0072]
On the other hand, in the ECU 1 according to the present embodiment, when an abnormality occurs in the ECU on the transmission side and the transmission interval from the ECU becomes shorter than the normal range, as shown in FIG. The routine startup interval is shorter than the normal range (4 to 6 ms). In FIG. 6, the reception interval is shorter than the normal range from time t3 to time t5.
[0073]
Then, in the reception interrupt routine, it is determined by the determination processing in S160 that a second type abnormality having a reception interval shorter than the lower limit value of the normal range has occurred, and the reception processing in S190 is not performed.
Further, when it is determined in the reception interrupt routine that the second type abnormality has occurred by the determination processing in S160, the communication data is transmitted by the SCI 15 as shown in the period from time t3 to time t4 in FIG. Is received and the reception interrupt routine is started, the value of the counter CntS is incremented by 1 (S230). Then, as shown at time t4 in FIG. 6, when the value of the counter CntS reaches the determination value NS (= 3) (S240: YES), the abnormality determination that the second type abnormality has occurred is confirmed, and the second type The abnormality detection flag FS is set (S250), and the subsequent activation of the reception interrupt routine is prohibited (S260).
[0074]
When the second type abnormality detection flag FS is set in this way, thereafter, the processing of S330 to S380 (hereinafter referred to as communication processing) is executed in the 4 ms time interruption routine. It is determined whether or not the communication data reception interval has returned to normal.
[0075]
After that, the transmission interval of communication data from the ECU on the transmission side returns to the normal range, and as shown after time t5 in FIG. 6, the reception interval of communication data by the SCI 15 returns to the normal range. When communication data is received only once within the activation interval of the interrupt routine, it is determined that the reception interval has returned to normal in the communication processing in the 4 ms time interrupt routine as shown at time t6 in FIG. 6 (S340). : NO), the value of the counter CntS and the second type abnormality detection flag FS are cleared (S350), and the latest and normal reception data stored in the reception buffer 25 at that time is transferred to the RAM 13 (S360). In addition, activation of the reception interrupt routine is permitted (S370).
[0076]
Therefore, thereafter, every time communication data is received by the SCI 15, the reception interrupt routine is started again, and the reception processing of S190 is performed in the reception interrupt routine. Further, when the second type abnormality detection flag FS is cleared, the communication processing of S330 to S380 is not executed again in the 4 ms time interruption routine.
[0077]
As described in detail above, in the ECU 1 of the present embodiment, the processing method for determining whether the reception interval is normal is changed between an abnormality time longer than the normal range and a short abnormality time. When a type 1 abnormality that is longer than the normal range is detected, normal reception is determined by the reception interrupt routine. When a type 2 abnormality whose reception interval is shorter than the normal range is detected, the activation of the reception interrupt routine is prohibited. Thus, the reception interval is returned to normal by a 4 ms time interrupt routine equivalent to a normal reception interval.
[0078]
Therefore, it is possible to accurately determine that the reception interval of communication data has become abnormal and that the abnormality has been resolved and the reception interval has returned to normal without increasing the processing load on the microcomputer 5. .
That is, when the occurrence of the first type abnormality is detected in the reception interrupt routine (when it is determined that the reception interval is longer than the normal range), the communication data reception interval is longer than normal. Therefore, even if the normal return determination is performed in the reception interrupt routine as it is, the reception interrupt routine is not started more frequently than normal, and the processing load is not particularly increased. According to the reception interrupt routine, since the activation interval of the routine is equal to the reception interval, the reception interval can be accurately detected, and it can be accurately determined that the reception interval has returned to normal. Of course, according to the reception interrupt routine, it is possible to accurately determine whether the reception interval is out of the normal range and the first type abnormality or the second type abnormality occurs.
[0079]
In addition, when the occurrence of the second type abnormality is detected in the reception interrupt routine (when it is determined that the reception interval is shorter than the normal range), the activation of the reception interrupt routine is prohibited. Is prevented from starting more frequently than normal. In particular, in this case, since it is known that the reception interval is shorter than the normal range, the reception interval is returned to normal by a 4 ms time interrupt routine equivalent to the normal reception interval. It can be accurately determined whether or not. That is, in the 4 ms time interrupt routine, the reception history flag and the overrun error flag are monitored, and whether or not the SCI 15 has received communication data only once since the routine was last activated until this time it is activated. It is possible to accurately determine whether or not the reception interval has returned to normal only by confirming whether or not. For this reason, even when the reception interval becomes shorter than the normal range and the occurrence of the second type abnormality is detected in the reception interrupt routine, the processing load on the microcomputer 5 does not increase.
[0080]
On the other hand, in the ECU 1 of this embodiment, if it is determined in the 4 ms time interrupt routine that the reception interval has returned to normal (S340: NO), not only the activation of the reception interrupt routine is permitted, but also at that time. The communication data stored in the reception buffer 25 of the SCI 15 is transferred to the RAM 13 (S360).
[0081]
For this reason, highly reliable received data after the reception interval returns to normal can be transferred to the RAM 13 as soon as possible, and controllability can be improved.
That is, if it is determined in the 4 ms time interrupt routine that the reception interval has returned to normal, the next communication data is received by the SCI 15, and if the reception processing of S 190 is performed in the reception interrupt routine that is started accordingly, the RAM 13 The normal received data is transferred to the RAM 13, but the normal received data received one time before that can be transferred to the RAM 13, and the control using the latest received data is promptly performed accordingly. Because you can start.
[0082]
As mentioned above, although one Embodiment of this invention was described, it cannot be overemphasized that this invention can take a various form.
For example, in the above embodiment, the activation interval of the time interruption routine as the regular routine is set to the lower limit value of the normal range of the reception interval (communication interval), but the activation interval of the routine is within the normal range of the reception interval. Any value is acceptable. However, setting the lower limit value of the normal range as in the above embodiment is advantageous in that it is easy to quickly detect that the reception interval has returned to the normal range after being shorter than the normal range.
[0083]
Moreover, although ECU1 of the said embodiment comprised the communication system in a vehicle, this invention is completely applicable similarly also to ECUs other than vehicles.
[Brief description of the drawings]
FIG. 1 is an explanatory diagram for explaining an in-vehicle communication system according to an embodiment, where (A) shows the configuration of the system and (B) shows the format of communication data.
FIG. 2 is an explanatory diagram illustrating a configuration of an electronic control unit (ECU) according to the embodiment.
FIG. 3 is a flowchart showing a reception interrupt routine executed by the microcomputer of the electronic control unit.
FIG. 4 is a flowchart showing a 4 ms time interrupt routine executed by the microcomputer of the electronic control unit.
FIG. 5 is a time chart for explaining the operation when the reception interval is longer than the normal range.
FIG. 6 is a time chart for explaining the operation when the reception interval is shorter than the normal range.
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 1, 1a, 1b ... ECU (electronic control unit), 3 ... Communication line, 5 ... Microcomputer (microcomputer), 7 ... Communication driver circuit, 9 ... CPU, 11 ... ROM, 13 ... RAM, 15 ... SCI (serial communication) Interface), 17 ... bus, 19 ... input buffer, 21 ... output buffer, 23 ... reception shift register, 25 ... reception buffer, 27 ... transmission buffer, 29 ... transmission shift register, 31 ... input / output circuit, 33 ... control circuit

Claims (3)

通信相手の装置と通信線を介して接続されると共に、
前記通信相手の装置から一定時間毎に送信される1フレーム分の通信データを受信して受信バッファに格納する毎に、受信割込要求を発生する通信手段を備え、
前記受信割込要求に応じて起動される受信割込ルーチンにて、前記通信手段の受信バッファから所定の記憶手段へ前記通信データを転送する受信処理を行い、
更に、前記記憶手段内のデータを用いて制御対象を制御するように構成された電子制御装置において、
前記受信割込ルーチンでは、
当該受信割込ルーチンが前回起動されてから今回起動されるまでの時間間隔に基づいて、前記通信手段による前記通信データの受信間隔が正常な範囲よりも長い異常(以下、第1種異常という)が発生したか否かと、前記受信間隔が正常な範囲よりも短い異常(以下、第2種異常という)が発生したか否かとを判定すると共に、前記第1種異常が発生していると判定した場合には、当該受信割込ルーチンにて前記受信処理が行われるのを禁止し、前記第2種異常が発生していると判定した場合には、当該受信割込ルーチンにて前記受信処理が行われるのを禁止すると共に、以後当該受信割込ルーチンが起動されるのを禁止する異常モード検出対応処理が行われるようになっており、
更に、前記異常モード検出対応処理により前記受信割込ルーチンの起動が禁止されている場合には、予め定められた所定時間毎に起動される定期ルーチンにて、前記通信手段による前記通信データの受信間隔が正常に戻ったか否かを判定すると共に、前記受信間隔が正常に戻ったと判定したならば、前記受信割込ルーチンが起動されるのを許可すること、
を特徴とする電子制御装置。
Connected to the communication partner device via a communication line,
A communication means for generating a reception interrupt request each time receiving communication data for one frame transmitted from the communication partner device every predetermined time and storing it in a reception buffer;
In a reception interrupt routine activated in response to the reception interrupt request, a reception process is performed to transfer the communication data from a reception buffer of the communication unit to a predetermined storage unit,
Furthermore, in an electronic control device configured to control a controlled object using data in the storage means,
In the reception interrupt routine,
An abnormality in which the communication data reception interval by the communication means is longer than a normal range based on a time interval from when the reception interrupt routine is activated this time to this time (hereinafter referred to as a first type abnormality). And whether or not an abnormality shorter than the normal range (hereinafter referred to as a second type abnormality) has occurred, and it is determined that the first type abnormality has occurred. If it is determined that the reception process is not performed in the reception interrupt routine, and the second type abnormality is determined to have occurred, the reception process is performed in the reception interrupt routine. And the abnormal mode detection corresponding processing for prohibiting the reception interrupt routine from being started is performed.
Further, when the activation of the reception interrupt routine is prohibited by the abnormal mode detection handling process, the communication means receives the communication data in a periodic routine that is activated at predetermined intervals. Determining whether or not the interval has returned to normal, and permitting the reception interrupt routine to be activated if it is determined that the reception interval has returned to normal,
An electronic control device.
請求項1に記載の電子制御装置において、
前記定期ルーチンの起動周期は、前記正常な範囲内の値に設定されていると共に、
前記定期ルーチンでは、当該定期ルーチンが前回起動されてから今回起動されるまでの間に前記通信手段が前記通信データを1回だけ受信したか否かを判定して、前記通信データを1回だけ受信していれば、前記受信間隔が正常に戻ったと判定すること、
を特徴とする電子制御装置。
The electronic control device according to claim 1.
The start cycle of the regular routine is set to a value within the normal range,
In the regular routine, it is determined whether or not the communication means has received the communication data only once after the regular routine is activated last time until it is activated this time, and the communication data is received only once. Determining that the reception interval has returned to normal if received.
An electronic control device.
請求項1又は請求項2に記載の電子制御装置において、
前記定期ルーチンにて、前記受信間隔が正常に戻ったと判定したならば、前記受信割込ルーチンが起動されるのを許可すると共に、その時点で前記通信手段の受信バッファに格納されている通信データを前記記憶手段に転送すること、
を特徴とする電子制御装置。
The electronic control device according to claim 1 or 2,
If it is determined in the regular routine that the reception interval has returned to normal, the reception interrupt routine is permitted to be started and communication data stored in the reception buffer of the communication means at that time Transferring to the storage means,
An electronic control device.
JP2001116925A 2001-04-16 2001-04-16 Electronic control unit Expired - Fee Related JP4465905B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001116925A JP4465905B2 (en) 2001-04-16 2001-04-16 Electronic control unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001116925A JP4465905B2 (en) 2001-04-16 2001-04-16 Electronic control unit

Publications (2)

Publication Number Publication Date
JP2002314632A JP2002314632A (en) 2002-10-25
JP4465905B2 true JP4465905B2 (en) 2010-05-26

Family

ID=18967578

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001116925A Expired - Fee Related JP4465905B2 (en) 2001-04-16 2001-04-16 Electronic control unit

Country Status (1)

Country Link
JP (1) JP4465905B2 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4595637B2 (en) * 2005-04-11 2010-12-08 株式会社デンソー Vehicle control device and program used for vehicle control device
JP4827535B2 (en) 2006-01-20 2011-11-30 日立オートモティブシステムズ株式会社 Electronic control unit for automobile
JP4977740B2 (en) * 2009-08-03 2012-07-18 日立オートモティブシステムズ株式会社 Internal combustion engine control device
JP5573118B2 (en) * 2009-11-18 2014-08-20 日本電気株式会社 Failure diagnosis system for disk array device, failure diagnosis method, failure diagnosis program, and disk device
JP6062230B2 (en) * 2012-11-30 2017-01-18 株式会社三共 GAME SYSTEM AND GAME CONTROL DEVICE
JP2015077170A (en) * 2013-10-15 2015-04-23 株式会社三共 System for game
JP6384332B2 (en) * 2015-01-08 2018-09-05 株式会社デンソー Electronic control unit
JP6551111B2 (en) * 2015-09-28 2019-07-31 日本電気株式会社 Information processing apparatus, down determination method, cluster system, and program
JP2017047292A (en) * 2016-12-12 2017-03-09 株式会社三共 System for game, and game controller
JP2018149455A (en) * 2018-07-10 2018-09-27 株式会社三共 System for games
JP7268516B2 (en) * 2019-07-17 2023-05-08 株式会社デンソー electronic controller
JP2021133829A (en) 2020-02-27 2021-09-13 本田技研工業株式会社 Vehicle control device

Also Published As

Publication number Publication date
JP2002314632A (en) 2002-10-25

Similar Documents

Publication Publication Date Title
JP4465905B2 (en) Electronic control unit
JP5702829B2 (en) Relay device
JP3952830B2 (en) Communications system
JP5050653B2 (en) Electronic control device
JP6369341B2 (en) In-vehicle communication system
US11394726B2 (en) Method and apparatus for transmitting a message sequence over a data bus and method and apparatus for detecting an attack on a message sequence thus transmitted
JP5286659B2 (en) In-vehicle device relay system, in-vehicle device relay method, and relay device
JP2012204935A (en) Communication system and communication apparatus
EP1712424B1 (en) Vehicle control apparatus
JP6176199B2 (en) Transmission line abnormality detection device
CN113545012B (en) Communication device, communication system, and message arbitration method
JP2006253922A (en) Gateway apparatus and data transfer method for the gateway apparatus
JP6455220B2 (en) Communications system
US20090177890A1 (en) Method and Device for Forming a Signature
US5636343A (en) Microcomputer with built-in serial input-output circuit and collision detection circuit responsive to common input-output line being occupied
JP5892890B2 (en) Communication control device
JPH09226482A (en) Communication controller for vehicle
JP2007142694A (en) Lin communication apparatus and lin communication control method
JP6597325B2 (en) Electronic control unit
JP3487048B2 (en) Communications system
JPH11177590A (en) Multiplex communication system
JP5892889B2 (en) Communication control device
JP5409681B2 (en) Communications system
JP7056205B2 (en) Microcomputer, electronic control device
JP3827121B2 (en) Communication control device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070611

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20091218

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

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100215

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

Free format text: PAYMENT UNTIL: 20130305

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140305

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees