JP4006871B2 - Serial communication device - Google Patents
Serial communication device Download PDFInfo
- Publication number
- JP4006871B2 JP4006871B2 JP04822199A JP4822199A JP4006871B2 JP 4006871 B2 JP4006871 B2 JP 4006871B2 JP 04822199 A JP04822199 A JP 04822199A JP 4822199 A JP4822199 A JP 4822199A JP 4006871 B2 JP4006871 B2 JP 4006871B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- register
- processing
- communication
- microcomputer
- 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 - Lifetime
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
Description
【0001】
【発明の属する技術分野】
本発明は、例えば車両用エンジンの電子制御装置(エンジンECU)におけるシリアル通信技術に係り、複数のマイクロコンピュータ(マイコン)間でシリアル通信を行うシリアル通信装置に関する。
【0002】
【従来の技術】
この種の従来技術として、特開平9−282265号公報の装置が知られており、同公報の装置はマスタ/スレーブの関係を有する2つのマイコン間で双方向にデータ(メッセージ)をシリアル通信するものとして構成されている。例えば、マスタ側マイコンは点火時期制御や燃料噴射制御等、主要なエンジン制御を司り、スレーブ側マイコンはエンジン制御に必要な各種センサによるセンシングデータのA/D変換、負荷演算やその他補助的な制御を行う。ここで、同公報の装置にあってはシリアル通信クロックに同期してメッセージが送信され、マイコン間で授受されるメッセージには、例えばA/D変換やRAM読み出しのデータの他に、それら各処理の要求コマンドが含まれる。
【0003】
実際のデータ通信に際しては、クロックの最初の立ち下がりに同期して処理完了信号(同公報図6のEOCT信号)がひとまず論理ハイレベルに立ち上げられると共に、各マイコンのシフトレジスタに各々セットされているメッセージが交換される。そして、1セット分のメッセージ交換が終了すると、クロックが一旦停止され、それに伴い処理完了信号(EOCT)が論理ローレベルに立ち下げられる。その後、スレーブ側マイコンは、マスタ側マイコンから受信したメッセージ内の要求コマンドに従いA/D変換、RAMデータ読み出し等、所定の処理を実行し、その処理が終了した時点で処理完了信号(EOCT)を再び論理ハイレベルに立ち上げる。マスタ側マイコンは、処理完了信号が論理ハイレベルに立ち上げられたことによりデータ送信の準備ができた旨を判断し、クロックを再起動させて次のメッセージをスレーブ側マイコンへ送信する。
【0004】
【発明が解決しようとする課題】
ところで、上記特開平9−282265号公報の装置では、スレーブ側マイコンが要求コマンドに応じた所定の処理を実行している間(同公報の図6で言えば、EOCT=Lの間)、クロックが停止して通信が中断される。特に、マスタ側マイコンからの要求がA/D変換である場合など、スレーブ側マイコンでの処理時間を要する場合には通信停止の時間が長くなる。従って、通信している時間に比べて通信が停止している時間が大きくなり、通信速度を向上させることが困難となる。またかかる装置では、スレーブ応答用通信線(EOCT線)が不可欠となり、構成の簡素化を図る上で不都合であった。
【0005】
上記装置に対し、スレーブ応答用通信線(EOCT線)を用いず、一定時間の経過後に次のメッセージ(コマンド及びデータ)を送信する方法も考えられる。すなわち、スレーブ側マイコンでは、クロックに同期してメッセージを受信した後、要求コマンドに従って所定の処理(A/D変換やRAM書き込みの処理)を行い、更にその後、当該スレーブ側マイコンの処理が確実に終了する一定時間(例えば40μs)毎に次のメッセージを受信する。ここで、スレーブ側マイコンの処理が終了しようと終了しまいと、マスタ側マイコンは一定時間40μs毎に次のメッセージを送信する。なお、スレーブ側マイコンでの処理が正しく終了したかどうかは、送信されてきたメッセージ内の識別ビットから判断される。
【0006】
しかしこの場合、スレーブ応答用通信線(EOCT線)は不要となるものの、スレーブ側マイコンでの処理が確実に終了する一定時間(40μs)を待ってから次のメッセージを送信する必要があるため、特開平9−282265号公報の装置よりも更に通信時間が長くなるという問題があった。
【0007】
また既存の通信方法として、特開平9−282265号公報とは異なり、全てのメッセージの送信が終了するまでクロックを停止させないものもあるが、マスタ側マイコンからの要求コマンドがRAMデータの読み出しや書き込みの他、A/D変換等、処理時間を要するものを含む場合、スレーブ側マイコンでの処理時間を要し、実質上、適用が不可能となる。
【0008】
因みに、他の従来技術として特許第2719734号公報のシリアル通信装置では、マスタ側及びスレーブ側の間にクロック、マスタデータ及びスレーブデータ用の各通信線と、同期初期化要求及びスレーブ応答用の各制御線とを設けている。そして、マスタ側装置は、マスタデータの送信開始時又はスレーブデータ受信開始時に同期初期化要求を送信し、他方、スレーブ側装置は、マスタデータの受信後とスレーブデータ送信前にスレーブ応答を送信する。ところが、かかる装置においても、コマンドの実施に際して通信が中断される、スレーブ応答用通信線を要する、といった問題があった。
【0009】
本発明は、上記問題に着目してなされたものであって、第1の目的は、コマンドに対応する処理に時間を要する場合にも通信速度を向上させることができるシリアル通信装置を提供することである。また第2の目的は、構成の簡素化を図ることができるシリアル通信装置を提供することである。
【0010】
【課題を解決するための手段】
本発明のシリアル通信装置では、一定周期で連続送信されるシリアル通信クロックに同期して、相手側のマイクロコンピュータからの処理コマンドを受信すると共に該処理コマンドに対応した処理結果を送信することを前提とする。
【0016】
請求項1に記載の発明では、相手側のマイクロコンピュータとの間で通信データを送受信するための第1のレジスタと、所定クロック数分のデータをそれぞれ格納可能な一対のレジスタからなり、前記第1のレジスタの通信データを一時的に格納するための第2のレジスタと、第1のレジスタにて所定クロック数分のデータを受信すると、当該データを一方の第2のレジスタに読み出し、該読み出した処理コマンドの実施後、処理結果を他方の第2のレジスタにセットし、所定クロック数が経過した時点で、前記処理結果を第1のレジスタに書き込むと共に、次の受信データを第2のレジスタに読み出す通信制御手段と、を備える。
【0017】
本発明によれば、第2のレジスタでは、所定クロック数分の受信データを読み出すと、該データ中における処理コマンドに従って処理が行われると共に、その処理結果がセットされる。そして、所定クロック数が経過した時点で、前記処理結果が第1のレジスタに書き込まれると共に、次の受信データが第2のレジスタに読み出される。その後、前記処理結果が第1のレジスタから相手側のマイクロコンピュータへ送信され、このデータ送信と引き替えに、所定クロック数分の新たなデータが第1のレジスタで受信される。
【0018】
こうして通信専用の第1のレジスタと処理専用の第2のレジスタとを使い通信を行うことで、受信直後の処理コマンドを一時的に退避させ、その退避先で所定の処理を行わせることができる。従って、処理コマンドに対応する処理が例えばA/D変換であり、その処理に時間を要する場合であってもコマンド毎に通信が中断されることはなく、通信速度を向上させることができる。また更に、所定クロック数分の通信毎に通信準備が完了したかどうかをチェックする必要がないため、スレーブ応答用通信線(例えば特開平9−282265号公報のEOCT線)が削除でき、構成の簡素化を図ることができる。
【0020】
特に、第1のレジスタでの所定クロック数分のデータ受信が完了したタイミングでは、
・第1のレジスタの受信データを第2のレジスタに読み出す。
・第2のレジスタの処理結果を第1のレジスタに書き込む。
といった各処理を行うが、上記の如く一対の第2のレジスタを用いることで、それら各処理を効率良く行うことができる。
【0021】
請求項2に記載の発明では、請求項1に記載の発明において、前記第1のレジスタは、所定クロック数分のデータを受信するための受信部と、同じく所定クロック数分のデータを送信するための送信部とを持つ。
【0022】
上記構成によれば、第1のレジスタが受信部と送信部とを各々持つことで、第1のレジスタでのデータ受信後には、受信部の受信データが第2のレジスタに読み出され、それと同時に、第2のレジスタの処理結果が送信部に書き込まれる。つまり、これらデータ読み出し/書き込みの処理を同時に行うことができ、その処理時間が短縮される。従って、シリアル通信の更なる高速化が可能となる。
【0023】
請求項3に記載の発明では、請求項1又は請求項2に記載の発明において、所定周期で通信同期のための通信同期初期化信号を受信する。本構成によれば、ノイズ等に起因してクロックのずれが発生しても、通信同期初期化信号を定期的に受信することでその不都合な状態が解消される。すなわち、通信の同期化が改めてなされ、適正なるシリアル通信が継続できる。
【0024】
請求項4に記載の発明では、請求項1〜3の何れかに記載の発明において、連続A/D変換要求のコマンドを受信した時、通信とは独立して該連続A/D変換を行ってその結果を順次メモリに記憶し、その間に相手側の他のコマンドを実行し、連続A/D変換の終了後、A/D結果取り込みのコマンドを受信すると、前記A/D変換の結果を送信する。
【0025】
本構成によれば、連続A/D変換の要求に伴い該A/D変換に長い時間を要する場合にも、それにより通信が中断されることはなく、そのA/D変換時間を利用して相手側の他のコマンドが実施される。連続A/D変換の結果はメモリに一旦記憶された後、取り込みコマンドに従い相手側に送信される。従って、通信の効率化並びに迅速化が実現できる。
【0026】
請求項5に記載の発明では、請求項1〜4の何れかに記載の発明において、受信したコマンドが定義されていない不当コマンドであれば、それ以降の通信を強制停止させるべく停止信号を出力する。この場合、クロックずれ等に起因して不正な通信が行われ誤った処理が実施される、といった不具合が未然に防止できる。
【0027】
【発明の実施の形態】
(第1の実施の形態)
以下、この発明のシリアル通信装置を具体化した一実施の形態を図面に従って説明する。
【0028】
第1の実施の形態では、各種のエンジン制御を司る車両用電子制御ユニット(エンジンECU)にあってマスタ/スレーブの関係にある2つのマイコンを備える。そして、同ECUでは、両マイコン間を接続する各種通信線を介してシリアル通信が行われる。先ずは図1を参照して、同実施の形態の装置が適用されるエンジンECUについてその全体の構成を説明する。
【0029】
本通信システムにおいて、第1のマイコン10は、図示しないエンジンの燃料噴射量制御や点火時期制御を行うマイコンであり、本シリアル通信の主導権を握るマスタ側マイコンとしての役割を担う。また、第2のマイコン20は、エンジンに取り付けられた各種センサ(図示略)からそれらセンシングデータを取り込むと共に、例えばノック制御や負荷制御等の補助的な制御を主に実行するマイコンであり、スレーブ側マイコンとしての役割を担う。第2のマイコン20には、空気流量や水温等、各種センシングデータのA/D変換を行うA/D変換器が内蔵されており、当該第2のマイコン20は第1のマイコン10からの要求に従いA/D変換を実施する。
【0030】
なお因みに、例えば第2のマイコン20によるノック制御の実施に際しては、車種毎に設定される仕様別データが第1のマイコン10から第2のマイコン20に送信され、この送信された仕様別データに基づきノック制御が実施される。つまり、本実施の形態のエンジンECUでは、車種毎の仕様変更に関係なく第2のマイコン20が共通化されるようになっている。
【0031】
第1のマイコン10は、制御量としての燃料噴射量や点火時期等を演算するCPU11、プログラムメモリとして用いられるROM12、データメモリとして用いられるRAM13、点火信号や燃料噴射信号などを出力する出力バッファ14をはじめ、クロック発生回路15、通信制御部16及びシリアル通信ブロック17を備える。これらCPU11、ROM12、RAM13、出力バッファ14及び通信制御部16は、共通のバスB1を介して接続されている。
【0032】
クロック発生回路15は、所定の周波数でシリアル通信用のシフトクロックSCLKを発生する発振子151と、通信制御部16によりオン/オフされるスイッチ152とを備える。通信制御部16は、CPU11によって起動されることによりシリアル通信ブロック17を操作し、ROM12やRAM13に格納されているデータを第2のマイコン20に転送したり、同第2のマイコン20から必要なデータを取り込む部分である。
【0033】
シリアル通信ブロック17は、スイッチSW1,SW2により切替可能な一対のシフトレジスタ17a,17bを備える。スイッチSW1,SW2は通信制御部16により切替操作され、16クロック分のカウント毎に図のc側又はd側に切り替えられる。シフトレジスタ17a,17bは、一方がシリアル通信中、他方では前回受信したメッセージが解析されるものであるが、その詳細は後述する。
【0034】
一方、第2のマイコン20は、ノック制御や負荷制御にかかる制御量を演算するCPU21、プログラムメモリとして用いられるROM22、データメモリとして用いられるRAM23をはじめ、A/D変換器24、マルチプレクサ25、入力バッファ26、出力バッファ27、通信制御部28及びシリアル通信ブロック29を備える。これらCPU21、ROM22、RAM23、A/D変換器24、入力バッファ26、出力バッファ27及び通信制御部28は、共通のバスB2を介して接続されている。
【0035】
ここで、空気流量や水温など、各種アナログ信号はアナログマルチプレクサ25に一旦取り込まれ、上記CPU21或いは通信制御部28によってA/D変換チャネルとして指定されたチャネルに対応する信号だけが該マルチプレクサ25により選択されて、A/D変換器24によりアナログ/デジタル変換される。また、入力バッファ26は、A/C(エアコン)スイッチの状態やニュートラルスイッチの状態等を示す入力を一時格納し、出力バッファ27は、O2 センサヒータに対するオン/オフ指令やウォーニングランプに対するオン/オフ指令等の出力を一時格納する。すなわち、各バッファ26,27は、PBポート(入出力ポート)の状態を一時的に格納する。
【0036】
通信制御部28は、第1のマイコン10側の通信制御部16から受信される要求コマンドに基づき、A/D変換器24を起動してA/D変換処理やその処理結果の返信、並びにRAM23へのデータ書き込みやRAM23からのデータ読み出しにかかるメモリアクセス等を行う部分である。すなわち、通信制御部28は、シフトクロックに基づくいわゆるハンドシェイクでのシリアルデータ交換に際し、その受信されたメッセージ中の要求コマンドを解析してA/D変換器24やRAM23に対するアクセスを実行する。
【0037】
シリアル通信ブロック29は、前記シリアル通信ブロック17と同様の構成を持つ。すなわち、スイッチSW3,SW4により切替可能な一対のシフトレジスタ29a,29bを備える。スイッチSW3,SW4は通信制御部28により切替操作され、16クロック分のカウント毎に図のa側又はb側に切り替えられる。シフトレジスタ29a,29bは、一方がシリアル通信中、他方では前回受信したメッセージが解析されるものであるが、その詳細は後述する。
【0038】
第1,第2のマイコン10,20間は、シフトクロックSCLKを送信するためのクロック線や、その他、通信同期初期化信号IORESB,マスタ信号SRXD,スレーブ信号STXD用の各種通信線を介して接続されている。ここで、通信制御部16,28にはクロック発生回路15からシフトクロックSCLKが送信され、通信制御部16から通信制御部28に向けては通信同期初期化信号IORESBが送信される。通信途中においてはシフトクロックSCLKは停止されることなく、一定周期で連続的に送信される。通信同期初期化信号IORESBは、所定周期(例えば4ms毎)に送信される。
【0039】
シリアル通信ブロック17,29の各シフトレジスタは、図示の態様でループ状に接続されており、シフトクロックSCLKに基づいて互いのデータが交換されるようになる。このとき、シリアル通信ブロック17からシリアル通信ブロック29に向けてはマスタ信号SRXDが送信され、逆のシリアル通信ブロック29からシリアル通信ブロック17に向けてはそのマスタ信号SRXDに応答するスレーブ信号STXDが送信される。
【0040】
すなわちこれらシフトレジスタでは、シフトクロックSCLKの1クロック毎に例えば、
・シフトレジスタ17aのMSBがシフトレジスタ29aのLSBに転送される。
・シフトレジスタ29aのMSBがシフトレジスタ17aのLSBに転送される。
といったシフト動作が同時に実行され、ここでの例の場合、シフトクロックSCLKが16クロック出力されることで、それら各シフトレジスタ17a,29aにセットされている16ビット分の信号(メッセージ)が全て交換されるようになる。
【0041】
通信制御部16において、シリアル通信ブロック17のシフトレジスタ17a,17bにセットする16ビットのマスタ信号SRXDには、授受の対象となる通常1バイト(8ビット)からなるデータの他に、
(A)A/D変換要求コマンド
(B)RAM23へのデータ書き込み要求コマンド
(C)RAM23からのデータ読み出し要求コマンド
等のコマンドが含まれる。
【0042】
以下に、同システムにおいて実行されるデータ通信の具体例について、上記各コマンドによる要求内容との対応のもとに順次列記する。また併せて、図2を参照し、上記(A)〜(C)の各要求に際して第1のマイコン10(マスタ側マイコン)のシフトレジスタ17a,17bにセットされるシリアルデータのデータ構造、並びに第2のマイコン20(スレーブ側マイコン)のシフトレジスタ29a,29bにセットされるシリアルデータのデータ構造を説明する。
【0043】
(A)A/D変換要求
第1のマイコン10自身は、先の図1に示されるようにA/D変換器を持たない。このため、前述した燃料噴射量制御や点火時期制御に際して、例えば冷却水温等についてのセンシングデータを取り込む必要が生じた場合には、第2のマイコン20に対してA/D変換要求を発し、前記A/D変換器24を通じてA/D変換処理された結果を転送してもらうこととなる。
【0044】
こうしたA/D変換要求に際し、第1のマイコン10から第2のマイコン20へは図2(a)に示されるように、
・A/D変換コマンド、
・A/D変換の指定チャネル、
・ダミーデータ、
といったデータ構造にて16ビットからなるマスタ信号SRXDが送信される。
【0045】
一方、上記信号SRXDを受信した第2のマイコン20からは図2(b)に示されるように、
・指定されたA/D変換チャネル、
・当該A/D変換が正常終了したか否かを示す識別ビットF、
・A/D変換結果、
といったデータ構造にて、これも16ビットからなるスレーブ信号STXDが返信される。
【0046】
(B)RAM23へのデータ書き込み要求
第1のマイコン10から第2のマイコン20のRAM23に対して書き込み要求されるデータとしては、例えば、
・ノック判定補正値のマップデータ、
・フェイル判定レベルのマップデータ、
・ゲート区間のマップデータ、
等からなるノック制御用のデータがあり、同制御データは第1のマイコン10のROM12に予め登録されている。
【0047】
同データ書き込み要求に際し、第1のマイコン10から第2のマイコン20へは図2(c)に示されるように、
・RAM書き込みコマンド、
・RAM23内の書き込みアドレス、
・各マップデータ等の書き込みデータ、
といったデータ構造にて16ビットからなるマスタ信号SRXDが送信される。
【0048】
一方、上記信号SRXDを受信した第2のマイコン20からは図2(d)に示されるように、
・RAM書き込みコマンド、
・RAM23内の書き込みアドレス、
・当該データ書き込みが正常終了したか否かを示す識別ビットF、
・ダミーデータ
といったデータ構造にて、これも16ビットからなるスレーブ信号STXDが返信される。
【0049】
(C)RAM23からのデータ読み出し要求
第1のマイコン10が第2のマイコン20のRAM23から読み出し要求するデータとしては、同第2のマイコン20による例えば負荷状態等についての演算値がある。
【0050】
同データ読み出し要求に際し、第1のマイコン10から第2のマイコン20へは図2(e)に示されるように、
・RAM読み出しコマンド、
・RAM23内の読み出しアドレス、
・ダミーデータ、
といったデータ構造にて16ビットからなるマスタ信号SRXDが送信される。
【0051】
一方、上記信号SRXDを受信した第2のマイコン20からは図2(f)に示されるように、
・RAM読み出しコマンド、
・RAM23内の読み出しアドレス、
・当該データ読み出しが正常終了したか否かを示す識別ビットF、
・RAM23からの指定された読み出しデータ、
といったデータ構造にて、これも16ビットからなるスレーブ信号STXDが返信される。
【0052】
上記(A),(B),(C)以外の要求を第2のマイコン20が受信した場合、不当コマンドと処理され、第2のマイコン20からは図2(g)に示されるように、
・要求コマンド、
・要求アドレス、
・不当コマンドとして処理されたことを示す識別ビットF、
・ダミーデータ、
といったデータ構造にて、これも16ビットからなるスレーブ信号STXDが返信される(但しこのとき、識別ビットF=0である)。
【0053】
図3は、第1のマイコン10の通信用RAMについてその構造を模式的に示す図である。図3(a)に示されるように、送信用データを格納するRAMは、各16ビットのm〜m+kまでの複数の領域(ブロック)を有する。また、図3(b)に示されるように、受信用データを格納するRAMは、各16ビットのn〜n+kまでの複数の領域(ブロック)を有する。
【0054】
ところで、本実施の形態における装置では、既述の通りシフトクロックSCLKが通信途中に停止されることなく、一定周期で連続的に送信される。そして、A/D変換など、コマンドに対応する処理に時間を要する場合にも、次のコマンド受信中に前回のコマンドに従って処理を行い、更にその次のコマンド受信時に全二重方式にて通信を行うことで、シフトクロックSCLKを止めることなく通信を行うこととしている。
【0055】
上記装置の実現として、シリアル通信ブロック17,29内の各々2つのシフトレジスタのうち、一方を「送信用レジスタ」、他方を「処理用レジスタ」として用い、それら送信用及び処理用のレジスタを所定クロック毎に交互に切り替えることとする。この場合、送信用レジスタ側にて16ビット分の信号(メッセージ)を全て交換した後、通信を止めることなくそれに引き続いて前記要求コマンドに応じたA/D変換等の処理を実施すべく、受信し終わった16クロック分の信号を処理用レジスタ側に退避させる。
【0056】
すなわち、送信用レジスタとしての一方のシフトレジスタでシリアル通信が行われる際、それと同時に、処理用レジスタとしての他方のシフトレジスタでは前回受信したコマンドが解析され、そのコマンドに従った所定の処理が行われる。そして、その処理結果が当該処理用レジスタにセットされ、送信用レジスタでの16クロック分のシリアル通信が終了するのを待った後、それまでの処理用レジスタが送信用に切り替えられて該送信用レジスタから前記セットされた処理結果が送信される。また、16クロック分のデータを受信したレジスタがその受信後に処理用レジスタに切り替えられることで、受信し終えたコマンド等のデータが非通信状態のレジスタに一旦退避される。従って、コマンド毎にデータ通信が途切れることはない。
【0057】
上述したデータ構造を持つ各信号が第1,第2のマイコン10,20間で授受される際、図4に示されるように、例えば周波数1MHzで連続送信されるシフトクロックSCLKに同期して、同クロックSCLKの16クロック分を1セットとしてデータ部分及びコマンド部分からなる信号が送信される。このとき、第1のマイコン10から第2のマイコン20へは、16μs間に16ビットのマスタ信号SRXDが送信される。
【0058】
図5は、第2のマイコン20側の動作を主として、各マイコン10,20で上記データ構造を持つ各信号が授受されるデータ転送態様を示したタイムチャートであり、この図5を併せ参照して、シリアル通信の概要を説明する。なお、図5では、通信初期においてA/D変換データがシリアル通信され、その後、RAMデータやPBポートデータがシリアル通信されるようになっている。
【0059】
通信開始当初において、第1のマイコン10は、通信同期初期化信号IORESBを一時的に論理ローレベルとし(時刻t1)、それに伴いシリアル通信ブロック等のレジスタが初期化される。このとき、シリアル通信ブロック29内のシフトレジスタ29a,29bには初期値(例えば00・・・0)が代入される。また、シフトレジスタ29a,29bのMSB,LSB側のスイッチSW3,SW4は何れもa側に接続されており、この初期状態ではシフトレジスタ29aが送信用レジスタとなり、シフトレジスタ29bが処理用レジスタとなる。
【0060】
時刻t2以降、1MHzのシフトクロックSCLKが発信され、第1のマイコン10は、コマンド及びデータからなるマスタ信号SRXD(図の「AD要求1」)をシフトクロックSCLKに同期させて送信する。すなわち、このA/D変換要求に際し、前記図2(a)に示したデータ構造のマスタ信号SRXDが第2のマイコン20に送信される。このとき、同クロックSCLKの16クロック出力に基づき、第1のマイコン10からの送信データとシフトレジスタ29a内のデータとが交換される。その結果、シフトレジスタ29aにおいては、A/D変換要求コマンドをはじめ、A/D変換の指定チャネルが受信される。
【0061】
16クロック分のデータ送受信が完了すると(時刻t3)、スイッチSW3,SW4がb側に切り替えられ、それまでとは逆に、シフトレジスタ29aが処理用レジスタとなり、シフトレジスタ29bが送信用レジスタとなる。
【0062】
時刻t3以降、第1のマイコン10は、シフトクロックSCLKを停止させることなく、前記同様、図2(a)に示したデータ構造のマスタ信号SRXD(図の「AD要求2」)を同クロックSCLKに同期させて送信する。その結果、シフトレジスタ29bにおいては、A/D変換要求コマンドをはじめ、A/D変換の指定チャネルが受信される。
【0063】
時刻t3〜t4の「AD要求2」の受信と同時に、第2のマイコン20は、前記シフトレジスタ29aに受信した処理コマンドを解析してその処理コマンドに応じた所定の処理(ここではA/D変換処理)を行う。すなわち、A/D変換器24を起動してその指定されたチャネルのA/D変換を行わせ、その結果を取り込むなど、同要求に応ずるべく所定の処理を実行した後、前記図2(b)に示したデータ構造のスレーブ信号STXDを処理用レジスタ(シフトレジスタ29a)にセットする。そして、送信用レジスタ(シフトレジスタ29b)の通信終了を待つ。なおスレーブ信号STXDには、コマンドが正しかったか、処理が正しく終了したか等の判定結果を示す識別ビットFも併せてセットされる。
【0064】
16クロック分のデータ送受信が完了すると(時刻t4)、スイッチSW3,SW4が再びa側に切り替えられ、シフトレジスタ29aが送信用レジスタに戻り、シフトレジスタ29bが処理用レジスタに戻る。
【0065】
時刻t4〜t5でもやはり、第1のマイコン10は、シフトクロックSCLKを停止させることなく、前記同様、図2(a)に示したデータ構造のマスタ信号SRXD(図の「AD要求3」)を同クロックSCLKに同期させて送信する。このとき、第2のマイコン20は、A/D変換要求コマンドをはじめ、A/D変換の指定チャネル等をシフトレジスタ29aで受信すると共に、それと引き替えに、当該レジスタ29aに既にセットされているスレーブ信号STXDを第1のマイコン10に送信する。このとき、前記「AD要求1」に応答したA/D変換結果をはじめ、A/D変換チャネル、識別ビットFが第1のマイコン10に送信される。
【0066】
第1のマイコン10では、その時の送信用レジスタであるシフトレジスタ17aでスレーブ信号STXDを受信した後(時刻t5後)、前記図1のスイッチSW1,SW2の操作によりシフトレジスタ17aを処理用レジスタに切り替え、当該処理用レジスタ内のデータ(上記A/D変換結果)を自身の通信用RAMに格納する。
【0067】
以後は、通信の終了に伴い第1のマイコン10からのシフトクロックSCLKが停止するまで、上記に準じた処理が繰り返し実行される。
要するに、例えば「AD要求1」に基づくデータ通信に着目すると、最初の16クロック(時刻t2〜t3)で第1のマイコン10からの要求コマンドが読み取られ、次の16クロック(時刻t3〜t4)でそのコマンドに応じた処理が行われ、更にその次の16クロック(時刻t4〜t5)で前記コマンドに対応した処理結果が第1のマイコン10に返信されることとなる。
【0068】
因みに図6において、例えば時刻t11〜t12,t12〜t13では、RAM書き込み要求コマンドを含む、前記図2(c)に示したデータ構造のマスタ信号SRXDが、スイッチSW3,SW4の状態に応じてシフトレジスタ29a,29bに交互に送信される。そして、時刻t12〜t13では、その直前の時刻t11〜t12で受信したSRXD信号中のRAM書き込み要求コマンドに応答してRAM書き込み処理が実行されると共に、前記図2(d)に示したデータ構造のスレーブ信号STXDがその時の処理用レジスタにセットされる。また、その次の時刻t13〜t14では、第1のマイコン10からの新たな送信データと引き替えに、RAM書き込みの処理結果を含むスレーブ信号STXDが第1のマイコン10に送信される。
【0069】
一連の通信処理を終えると最後に、第1のマイコン10から2つのダミーデータが送信されてくる。従って、第2のマイコン20は、そのダミーデータと引き替えに、シフトレジスタ29a,29bの最後の処理データを第1のマイコン10へ送信する。
【0070】
通信同期初期化信号IORESBは、各マイコン10,20の通信の同期化を定期的に行う目的で、例えば4ms毎に論理ローレベルに操作される。これにより、基準タイミングがその都度調整され、ノイズ等に起因するクロック信号のずれが解消される。
【0071】
次に、第1,第2のマイコン10,20を通じて実行される通信処理の詳細な内容を図6〜図9のフローチャートを参照しながら説明する(但し、実際にはこれと同等の処理がハードウェアによる論理演算によって実現される)。
【0072】
図6は、各通信制御部16,28を通じて実行されるクロックエッジ割込み処理を示すフローチャートである。図6の処理では、シフトクロックSCLKの状態に基づいて相手側のマイコンからの受信メッセージの有無を常時監視しており、受信メッセージの到来があると、これに含まれるコマンドを解析し、該解析したコマンドの内容に従い上述した各要求に応じた処理を実行する。
【0073】
詳細には、先ずステップ101において、今回の割込みがシフトクロックSCLKの立ち下がりエッジであるか否かを判別し、YESであればステップ102に進み、送信用レジスタのMSBデータを送信用端子より送信する。その後、本処理を一旦終了する。
【0074】
ステップ101がNOであればステップ103に進み、今回の割込みがシフトクロックSCLKの立ち上がりエッジであるか否かを判別する。そして、ステップ103がYESであればステップ104に進み、送信用レジスタを上位ビット側(図1の左側)へシフトさせる。その後、ステップ105では、相手側のマイコンから受信したデータを送信用レジスタのLSBにセットし、続くステップ106では、その時のクロックカウンタを「1」デクリメントする。
【0075】
ステップ107では、クロックカウンタが「0」であるか否かを判別し、NOであればそのまま本処理を終了する。つまり、カウンタ≠0の場合、上述した通り、
・送信用レジスタのMSBデータを送信する(ステップ102)、
・受信データを送信用レジスタのLSBへセットする(ステップ105)、
等の処理を繰り返し行う。
【0076】
16クロック分のデータ送受信が終了してステップ107がYESになるとステップ108に進み、クロックカウンタに「16」をセットする。その後、ステップ109では、第1,第2のマイコン10,20について個々のデータ処理を起動させる。ここで、第1のマイコン10については、後述する図7に示すデータ処理を起動させ、第2のマイコン20については、後述する図8に示すデータ処理を起動させる。そして、データ処理の実施後、当該処理を一旦終了する。
【0077】
第1のマイコン10にて実行される図7のデータ処理において、先ずステップ201では、シリアル通信ブロック17内のスイッチSW1,SW2を操作して送信用レジスタと処理用レジスタとを入れ替える。ここで、例えばシフトレジスタ17aでの通信終了時には、当該レジスタ17aが処理用レジスタに切り替えられると共に、シフトレジスタ17bが送信用レジスタに切り替えられることとなる。
【0078】
その後、ステップ202では、処理用レジスタの内容を通信用RAMのnブロックに保管し、続くステップ203では、通信用RAMのmブロックの内容を処理用レジスタに書き込む。また、ステップ204では、通信用RAMのブロックをn+1,m+1とし、本処理を終了する。
【0079】
次に、第2のマイコン20にて実行されるデータ処理手順を、図8のフローチャートに従い説明する。
ステップ301では、シリアル通信ブロック29内のスイッチSW3,SW4を操作して送信用レジスタと処理用レジスタとを入れ替える。ここで、例えばシフトレジスタ29aでの通信終了時には、当該レジスタ29aが処理用レジスタに切り替えられると共に、シフトレジスタ29bが送信用レジスタに切り替えられることとなる。
【0080】
その後、ステップ302では、処理用レジスタ中のコマンドを解析し、続くステップ303では、コマンドの内容を判定する。ここでは、
(A)A/D変換要求コマンド
(B)RAM23へのデータ書き込み要求コマンド
(C)RAM23からのデータ読み出し要求コマンド
の何れであるかを判定する。そして、各コマンドにそれぞれ対応した処理を実行する。
【0081】
すなわちいま、上記解析したコマンドが「A/D変換要求」であった場合、ステップ304に進み、処理用レジスタ中のデータに指定されているA/D変換チャネル(ch)を選択し、A/D変換器24を起動する。続くステップ305では、A/D変換チャネル(ch)とA/D変換結果と識別ビットFとを処理用レジスタにセットし、当該処理を一旦終了する。
【0082】
また、上記解析したコマンドが「RAM23へのデータ書き込み要求」であった場合、ステップ306に進み、処理用レジスタ中のデータに含まれる書き込みアドレスと書き込みデータとに従いRAM23への書き込みを行う。続くステップ307では、書き込みアドレスと識別ビットFとを処理用レジスタにセットし、当該処理を一旦終了する。
【0083】
更に、上記解析したコマンドが「RAM23からのデータ読み出し要求」であった場合、ステップ308に進み、処理用レジスタ中のデータに含まれる読み出しアドレスに従いRAM23からのデータ読み出しを行う。続くステップ309では、読み出しアドレスと読み出しデータと識別ビットFとを処理用レジスタにセットし、当該処理を一旦終了する。
【0084】
図9は、第1マイコン10での一定周期毎(例えば4ms毎)の割込み処理を示すフローチャートである。同処理によれば、各マイコンの通信の同期化が行われる。先ずステップ401では、通信同期初期化信号IORESBを論理ローレベルとし、続くステップ402ではそのままの状態で所定時間(例えば10μs)待つ。その後、ステップ403では、通信同期初期化信号IORESBを論理ハイレベルに戻す。更に、ステップ404では、シフトクロックSCLKを起動させ、当該処理を一旦終了する。
【0085】
以上詳述した本実施の形態によれば、以下に示す効果が得られる。
(a)シフトクロックSCLKに同期して処理コマンドの受信と、該処理コマンドに対応した処理結果の送信とを行うシリアル通信に際し、クロックが途切れたり、それに伴い通信が中断されたりすることがないので通信速度が向上する。つまり、処理コマンドに対応する処理が例えばA/D変換であり、その処理に時間を要する場合であってもコマンド毎に通信が中断されることはなく、通信速度を向上させることができる。この場合、同一の通信時間で比較すると、従来の通信方法よりも大量のデータ転送が可能となる。
【0086】
(b)通信/非通信の状態で交互に切り替えられる一対のシフトレジスタを用いたので、受信直後の処理コマンドを一時的に退避させ、その退避先で所定の処理を行わせることができる。従って、処理コマンドに対応する処理が例えばA/D変換であり、その処理に時間を要する場合であってもコマンド毎に通信が中断されることはなく、通信速度を向上させることができる。
【0087】
(c)また上記構成では、16クロック分の通信毎に通信準備が完了したかどうかをチェックする必要がないため、スレーブ応答用通信線(例えば特開平9−282265号公報のEOCT線)が削除でき、構成の簡素化を図ることができる。
【0088】
(d)所定周期で通信同期初期化信号IORESBを受信するので、ノイズ等に起因してクロックのずれが発生してもその不都合な状態が解消される。すなわち、通信の同期化が改めてなされ、適正なるシリアル通信が継続できる。
【0089】
次に、本発明における第2〜第5の実施の形態を説明する。但し、以下の各実施の形態の構成において、上述した第1の実施の形態と同等であるものについては図面に同一の記号を付すと共にその説明を簡略化する。そして、以下には第1の実施の形態との相違点を中心に説明する。
【0090】
(第2の実施の形態)
本第2の実施の形態は、要求コマンドに応じたスレーブ側マイコンでの処理時間が所定クロック数分の所要時間よりも長くなる場合にも、通信を中断させることなく継続して実施するためのシリアル通信装置に関する。すなわち、
・連続A/D変換要求により複数のA/D変換が連続して行われる場合、
・A/D変換時間(20μs)>16クロックの時間(16μs)の場合、
・複数の装置にてA/D変換器を共有するため、A/D変換処理が待たされる場合、
等においても、シリアル通信を好適に行うためのシリアル通信装置を提案する。
【0091】
ここでは、連続A/D変換要求が到来する場合を例にとり、その要求時において、通信とは独立させて連続A/D変換を行わせる。つまり、第1,第2のマイコン10,20間の通信には、A/D変換データ以外に、RAMデータ(ノック制御の適合値など)の通信がある。そこで、そのRAMデータの通信時間を有効に利用して、当該通信とは独立したバックグランドで連続A/D変換を行わせることとする。
【0092】
上記連続A/D変換が実施される場合、第1のマイコン10から送信されるマスタ信号SRXDには、
・連続A/D変換要求コマンド、
・連続A/D変換結果の取り出し要求コマンド、
等のコマンドが含まれる。
【0093】
より詳細には、第1のマイコン10から第2のマイコン20に向けて連続A/D変換要求が出力される際、第1のマイコン10からは図10(a)に示されるように、
・連続A/D変換要求コマンド、
・A/D変換開始の指定チャネル、
・A/D変換の指定チャネル数、
・ダミーデータ、
といったデータ構造にて16ビットからなるマスタ信号SRXDが送信される。
【0094】
また、連続A/D変換の処理終了後におけるA/D変換結果の取り込み要求に際し、同じく第1のマイコン10からは図10(b)に示されるように、
・連続A/D変換結果の取り出し要求コマンド、
・連続A/D変換結果の取り出しチャネル、
・ダミーデータ、
といったデータ構造にて16ビットからなるマスタ信号SRXDが送信される。
【0095】
一方、上記マスタ信号SRXDを受信した第2のマイコン20からは図10(c)に示されるように、
・連続A/D変換結果の取り出しチャネル、
・連続A/D変換が正常終了したか否かを示す識別ビットF、
・連続A/D変換結果、
といったデータ構造にて、これも16ビットからなるスレーブ信号STXDが返信される。
【0096】
図11は、第2のマイコン20側の動作を主として、各マイコン10,20で上記データ構造を持つ各信号が授受されるデータ転送態様を示したタイムチャートである。以下、前記図5との相違点を中心に説明する。
【0097】
通信同期初期化信号IORESBのリセット後、時刻t21〜t22では、第1のマイコン10は、連続A/D変換要求コマンドを含む、前記図10(a)に示したデータ構造のマスタ信号SRXDをシフトクロックSCLKに同期させて第2のマイコン20に送信する。例えば「ch1〜ch4までA/D変換を実行」というコマンドを送信する。
【0098】
このとき、第1のマイコン10からの送信データとシフトレジスタ29a(送信用レジスタ)内のデータとが交換され、シフトレジスタ29aには、連続A/D変換要求コマンドをはじめ、A/D変換開始の指定チャネル、A/D変換の指定チャネル数が受信される。
【0099】
16クロック分のデータ送受信が完了すると(時刻t22)、スイッチSW3,SW4がa側からb側に切り替えられ、それまでとは逆に、シフトレジスタ29aが処理用レジスタとなり、シフトレジスタ29bが送信用レジスタとなる。
【0100】
その後、時刻t22〜t23,t23〜t24では、RAM書き込み要求コマンドを含む、前記図2(c)に示したデータ構造のマスタ信号SRXDが、スイッチSW3,SW4の状態に応じてシフトレジスタ29a,29bに交互に送信される。そして、時刻t23〜t24では、その直前の時刻t22〜t23で受信したSRXD信号中のRAM書き込み要求コマンドに応答してRAM書き込み処理が実行されると共に、前記図2(d)に示したデータ構造のスレーブ信号STXDがその時の処理用レジスタにセットされる。また、その次の時刻t24〜t25では、第1のマイコン10からの新たな送信データと引き替えに、RAM書き込みの処理結果を含むスレーブ信号STXDが第1のマイコン10に送信される。
【0101】
また時刻t22以降、第2のマイコン20は、通信とは独立したバックグランドにて、前記時刻t21〜t22にて受信したマスタ信号SRXD中のA/D変換開始の指定チャネルやA/D変換の指定チャネル数に従い、「AD1,AD2,AD3・・・」といった連続A/D変換処理を行う。そして、該A/D変換した結果を順次RAM23に格納していく。
【0102】
RAM書き込み要求等に応じた一連の通信が終了すると、第1のマイコン10は、次に連続A/D変換結果の取り込みを行う。すなわち、時刻t26〜t27では、第1のマイコン10は、連続A/D変換結果の取り出し要求コマンドを含む、前記図10(b)に示したデータ構造のマスタ信号SRXD(図の「AD結果取出し要求1」)をシフトクロックSCLKに同期させて第2のマイコン20に送信する。このとき、第1のマイコン10からの送信データとシフトレジスタ29a(送信用レジスタ)内のデータとが交換され、シフトレジスタ29aには、連続A/D変換結果の取り出し要求コマンドをはじめ、連続A/D変換結果の取り出しチャネルが受信される。
【0103】
その後、時刻t27では送信用と処理用のレジスタが切り替えられる。また、時刻t27〜t28では、前記時刻t26〜t27と同様、第1のマイコン10は、連続A/D変換結果の取り出し要求コマンドを含む、前記図10(b)に示したデータ構造のマスタ信号SRXD(図の「AD結果取出し要求2」)をシフトクロックSCLKに同期させて第2のマイコン20に送信する。このとき、第1のマイコン10からの送信データとシフトレジスタ29b(送信用レジスタ)内のデータとが交換され、シフトレジスタ29bには、連続A/D変換結果の取り出し要求コマンドをはじめ、連続A/D変換結果の取り出しチャネルが受信される。
【0104】
時刻t27〜t28の「AD結果取出し要求2」の受信と同時に、第2のマイコン20は、その直前の時刻t26〜t27で受信した処理コマンドに従いA/D変換結果の取り出し処理を行う。すなわち、前記RAM23に格納した連続A/D変換結果を読み出し、それを前記図10(c)に示したデータ構造のスレーブ信号STXDとして、処理用レジスタ(シフトレジスタ29a)にセットする。そして、送信用レジスタ(シフトレジスタ29b)の通信終了を待つ。
【0105】
時刻t28では、再び送信用と処理用のレジスタが切り替えられる。また、時刻t28〜t29では、第2のマイコン20は、送信用レジスタ(シフトレジスタ29a)にセットされているスレーブ信号STXDを第1のマイコン10に送信する。すなわち、連続A/D変換結果等が第1のマイコン10に送信される。第1のマイコン10では、スレーブ信号STXDを受信した後、上記連続A/D変換結果を自身の通信用RAMに格納する。
【0106】
次に、第2のマイコン20にて実行されるデータ処理手順を、図12のフローチャートに従い説明する。この処理は、例えば前記図8の処理に置き替えて実行される。
【0107】
ステップ501では、シリアル通信ブロック29内の送信用レジスタと処理用レジスタとを入れ替える(前記図8のステップ301に同じ)。その後、ステップ502では、処理用レジスタ中のコマンドを解析し、続くステップ503では、コマンドの内容を判定する。ここでは、
・A/D変換要求コマンド、
・RAMへのデータ書き込み要求コマンド、
・RAMからのデータ読み出し要求コマンド、
といった、前記図8で判定した各コマンドに加えその他に、
・連続A/D変換要求コマンド、
・連続A/D変換結果の取り出し要求コマンド、
の何れであるかを判定する。そして、各要求にそれぞれ対応した処理を実行する。
【0108】
すなわちいま、上記解析したコマンドが「連続A/D変換要求」であった場合、ステップ504に進み、処理用レジスタ中のデータに指定されているA/D変換開始の指定チャネル(ch)と指定チャネル数とをセットし、順次A/D変換器24を起動する。続くステップ505では、同じくA/D変換開始の指定チャネル(ch)と指定チャネル数と識別ビットFとを処理用レジスタにセットし、当該処理を一旦終了する。
【0109】
また、上記解析したコマンドが「連続A/D変換結果の取り出し要求」であった場合、ステップ506に進み、処理用レジスタ中のデータに含まれる連続A/D変換結果の取り出しチャネルに対応させつつ、A/D変換結果をRAM23から読み出す。その後、ステップ507では、連続A/D変換結果の取り出しチャネルと連続A/D変換結果と識別ビットFとを処理用レジスタにセットし、当該処理を一旦終了する。
【0110】
以上第2の実施の形態によれば、連続A/D変換の要求に伴い該A/D変換に長い時間を要する場合にも、それにより通信が中断されることはなく、そのA/D変換時間を利用して第1のマイコン10からの他のコマンドが実施される。従って、通信の効率化並びに迅速化が実現できる。
【0111】
(第3の実施の形態)
複数のマイコン間のシリアル通信では、ノイズ等によりシフトクロックSCLKが1個でもずれると、不当コマンドか、全く異なった処理を行うコマンドとなってしまう。そこで本実施の形態では、定義されていない不当コマンドを一度でも受信したら、それ以降の通信を強制的に停止させ、誤った処理の実行を未然に防止する。
【0112】
図13は、本実施の形態におけるエンジンECUの構成を示すブロック図である。前記図1の構成との相違として図13では、第2のマイコン20から第1のマイコン10に対してチェック信号CHKを送信する。このチェック信号CHKは、第2のマイコン20が不当コマンド等を受信した際、それ以降の通信を強制停止させるものである。
【0113】
図14は、第2のマイコン20側の動作を主として、各マイコン10,20でのデータ転送態様を示したタイムチャートである。以下、前記図5との相違点を中心に説明する。
【0114】
時刻t31では、通信同期初期化信号IORESBのリセットに伴い、チェック信号CHKも一旦リセットされる。信号IORESB,CHKのリセット動作により、これら各信号の通信線が断線しているかどうかが第1のマイコン10にて確認される。
【0115】
時刻t32〜t33,t33〜t34,t34〜t35の各期間では、前記図5の時刻t2〜t3,t3〜t4,t4〜t5の各期間と同様に、第1のマイコン10は、1MHzで連続発信されるシフトクロックSCLKに同期させて、A/D変換要求コマンドを含む、マスタ信号SRXD(図の「AD要求1,2,3」)を順次送信する。また、16クロック毎に送信用レジスタと処理用レジスタとを切り替え、第2のマイコン20では、その時々の送信用レジスタにてA/D変換要求コマンドを受け取ると共に、当該レジスタが処理用レジスタに切り替わった際、要求コマンドに応じた処理結果(A/D変換結果等)をその処理用レジスタにセットする。そして、処理用レジスタが送信用レジスタに戻ると、第2のマイコン20は、前記処理結果を第1のマイコン10へ送信する。
【0116】
その後、時刻t41において、ノイズ等によりシフトクロックSCLKが数個分だけずれると、第2のマイコン20では、受信したコマンドが不当コマンドとして認識される(時刻t42)。同時刻t42において、第2のマイコン20はチェック信号CHKを論理ローレベルに立ち下げる。第1のマイコン10では、チェック信号CHKの立ち下がりエッジを受け、シリアル通信を強制的に停止させると共に、通信同期初期化信号IORESBを論理ローレベルに立ち下げる。
【0117】
その後、時刻t43では、通信同期初期化信号IORESBを論理ローレベルから論理ハイレベルに立ち上げる。これにより、チェック信号CHKも同時に論理ハイレベルに復帰する。
【0118】
次に、第2のマイコン20にて実行されるデータ処理の一部を、図15のフローチャートに従い説明する。この処理は、例えば前記図8のステップ302の直後(又は前記図12のステップ502の直後)に実行される。
【0119】
ステップ601では、受信したコマンドが不当コマンドであるか否かを判別し、NOであれば、そのまま図示しない後続の処理(図8のステップ303、又は図12のステップ503)に進む。また、不当コマンドであればステップ602に進み、チェック信号CHKを論理ローレベルとし、続くステップ603で異常発生の旨を表す識別ビットを処理用レジスタにセットする。
【0120】
また、第1のマイコン10では、前記チェック信号CHKの立ち下げに伴い、図16の割込み処理を起動させる。すなわち、図16において先ずステップ701では、その時のチェック信号CHKが論理ローレベルであるか否かを判別する。仮にCHK=Hの場合、チェック信号CHKの立ち下げ時であると誤検出されたのであるから、ステップ702に進んで異常割込み発生の旨を判定し、所定のフェイルセーフ処理を実行する。
【0121】
また、CHK=Lであればステップ703に進み、強制的に通信を終了させる。続くステップ704では、通信同期初期化信号IORESBを論理ローレベルに立ち下げ、当該処理を終了する。
【0122】
一方、第1のマイコン10は、一定周期毎(例えば4ms毎)に図17に示す処理を起動させる。この処理は、例えば前記図9の処理に置き替えて実行される。図17において、ステップ801では、通信同期初期化信号IORESBを論理ローレベルとし、続くステップ802では、第2のマイコン20から送信されてくる前記チェック信号CHKが論理ローレベルか否かを判別する。通常はIORESB=Lに伴いCHK=Lとなる筈であるため、ステップ802がNO(CHK=H)であればステップ803に進み、チェック線断線(H固定)とみなして当該異常に対するフェイルセーフ処理を実行する。
【0123】
また、ステップ802がYES(CHK=L)であればステップ804に進み、通信同期初期化信号IORESBを論理ハイレベルに戻し、続くステップ805では、前記チェック信号CHKが論理ハイレベルか否かを判別する。通常はIORESB=Hに伴いCHK=Hとなる筈であるため、ステップ805がNO(CHK=L)であればステップ806に進み、チェック線断線(L固定)とみなして当該異常に対するフェイルセーフ処理を実行する。
【0124】
また、ステップ805がYES(CHK=L)であればステップ807に進み、シフトクロックSCLKを起動させ、本処理を一旦終了する。こうした図15の処理によれば、定期的にクロックが再起動される。
【0125】
以上本実施の形態によれば、クロックずれ等が原因で通信が不正状態に陥り誤った処理が実施される、といった不具合が未然に防止できる。また、仮に前記図14のタイムチャートで示した通り一時的にクロックずれが発生し、それに伴いチェック信号CHKが論理ローレベルに立ち下げられても、すなわち通信が強制停止されても、定期的な同期初期化の処理(図17の処理)により通信の正常復帰が可能となる。
【0126】
(第4の実施の形態)
上記各実施の形態では、各マイコンのシリアル通信ブロック内に一対のシフトレジスタを設け、それらの通信/非通信の状態(送信用レジスタ及び処理用レジスタとなる状態)を所定クロック数毎に切り替えていたが、本実施の形態では同シリアル通信ブロックの構成を変更する。
【0127】
図18に示されるように、例えば第2のマイコン20側のシリアル通信ブロック31は、「第1のレジスタ」としての1つのシフトレジスタ31aと、「第2のレジスタ」としての2つの処理用レジスタ31b,31cとを備える。これら各レジスタは何れも16ビットで構成される。ここで、通信制御部28は、シフトレジスタ31aで受信した16クロック分のデータを一方の処理用レジスタ31bに読み出し、更にその後、要求コマンドに対応した処理結果を他方の処理用レジスタ31cにセットし、16クロック経過のタイミングで同処理結果をシフトレジスタ31aに書き込むものである。
【0128】
詳細には、以下に示す一連の通信処理が行われる。なお、通信の基本動作は前記図5と同じであるため、ここでは図5を併せ参照しながら動作を説明する(但し、図5中のSW3,SW4の動作は無関係である)。
(1)シフトクロックSCLKに同期して、16クロック分のデータがシフトレジスタ31aにて受信される(時刻t2〜t3)。
(2)16クロック分のデータ受信が完了すると、
・シフトレジスタ31aのデータが処理用レジスタ31bに瞬時に読み出され、・処理用レジスタ31cのデータがシフトレジスタ31aに瞬時に書き込まれる(時刻t3)。
(3)処理用レジスタ31bに入っているコマンドに対応する処理(指定チャネルのA/D変換、RAM書き込み、RAM読み出し等)が行われ、処理結果が処理用レジスタ31cにセットされる(時刻t3〜t4)。
(4)前記(3)と同時に、次の16クロック分の送信データがシフトレジスタ31aにて受信される(時刻t3〜t4)。
(5)更に16クロックが経過すると、前記(2)と同じく、
・シフトレジスタ31aのデータが処理用レジスタ31bに瞬時に読み出され、・処理用レジスタ31cのデータがシフトレジスタ31aに瞬時に書き込まれる(時刻t4)。
(6)前記(3)と同じく、処理用レジスタ31bに入っているコマンドに対応する処理が行われ、処理結果が処理用レジスタ31cにセットされる(時刻t4〜t5)。
(7)前記(6)と同時に、次の16クロック分の送信データがシフトレジスタ31aにて受信され、それと引き替えに、前記処理結果が第1のマイコン10に送信される。以降、上記(5)〜(7)の動作が、シフトクロックSCLKが停止するまで繰り返し実行される。
【0129】
以上第4の実施の形態によれば、シフトレジスタ31aと処理用レジスタ31b,31cとを使い通信を行うことで、受信直後の処理コマンドを一時的に退避させ、その退避先で所定の処理を行わせることができる。従って、上記第1の実施の形態と同様に、処理コマンドに対応する処理に時間を要する場合であってもコマンド毎に通信が中断されることはなく、通信速度を向上させることができる。また更に、16クロック分の通信毎に通信準備が完了したかどうかをチェックする必要がないため、スレーブ応答用通信線(例えば特開平9−282265号公報のEOCT線)が削除でき、構成の簡素化を図ることができる。特に本実施の形態では、上記の如く一対の処理用レジスタ31b,31cを用いるので、データ読み出し/書き込みの処理を効率良く行うことができる。
【0130】
(第5の実施の形態)
第5の実施の形態では、上記第4の実施の形態の一部を変更してシリアル通信装置を具体化する。上記第4の実施の形態では既述の通り、クロック数が16クロックに達すると、
・シフトレジスタ31aのデータを処理用レジスタ31bに瞬時に読み出す。
・処理用レジスタ31cのデータをシフトレジスタ31aに瞬時に書き込む。
といった2つの処理を順次実施したが、それら「シフトレジスタ⇔処理用レジスタ間」の処理は、シフトクロックSCLKの立ち上がりから次の立ち下がりまでの極短時間(SCLK=1MHzの場合、0.5μs以内)にて実施しなくてはならず、かなりの高速処理が強いられる。そこで本実施の形態では、「シフトレジスタ⇔処理用レジスタ間」のデータ処理を早期に行うことのできる通信装置について説明する。
【0131】
図19は、本実施の形態におけるシリアル通信ブロックの構成を示す図である。第2のマイコン20のシリアル通信ブロック41は、「第1のレジスタ」としての32ビットのシフトレジスタ41aと、「第2のレジスタ」としての16ビットの処理用レジスタ41b,41cとを備える。また、シフトレジスタ41aは、上位側16ビットの送信部αと下位側16ビットの受信部βとからなる。下位側の受信部βでは、第1のマイコン10から送信されてくるマスタ信号SRXDが取り込まれ、同信号が16クロック毎に処理用レジスタ41bに読み出される。また、上位側の送信部αでは、処理用レジスタ41cから処理後のデータが書き込まれ、該データがスレーブ信号STXDとして第1のマイコン10に送信される。
【0132】
詳細には、以下に示す一連の通信処理が行われる。なお、通信の基本動作は前記図5と同じであるため、ここでは図5を併せ参照しながら動作を説明する(但し、図5中のSW3,SW4の動作は無関係である)。
(1)シフトクロックSCLKに同期して、16クロック分のデータがシフトレジスタ41aの受信部βにて受信される(時刻t2〜t3)。このとき、送信データはシフトレジスタ41aのLSBに入り、シフトレジスタ41aのMSBのデータが第1のマイコン10に送信される。
(2)クロック数が16クロックに達し、レジスタ41aのデータの半分が入れ替わると、
・受信部βのデータが処理用レジスタ41bに瞬時に読み出され、
・それと同時に、処理用レジスタ41cのデータが送信部αに瞬時に書き込まれる(時刻t3)。
(3)処理用レジスタ41bに入っているコマンドに対応する処理(指定チャネルのA/D変換、RAM書き込み、RAM読み出し等)が行われ、処理結果が処理用レジスタ41cにセットされる(時刻t3〜t4)。
(4)前記(3)と同時に、次の16クロック分の送信データが受信部βにて受信される(時刻t3〜t4)。
(5)更に16クロックが経過すると、前記(2)と同じく、
・受信部βのデータが処理用レジスタ41bに瞬時に読み出され、
・それと同時に、処理用レジスタ41cのデータが送信部αに瞬時に書き込まれる(時刻t4)。
(6)前記(3)と同じく、処理用レジスタ41bに入っているコマンドに対応する処理が行われ、処理結果が処理用レジスタ41cにセットされる(時刻t4〜t5)。
(7)前記(6)と同時に、次の16クロック分の送信データが受信部βにて受信され、それと引き替えに、前記処理結果が第1のマイコン10に送信される。以降、上記(5)〜(7)の動作が、シフトクロックSCLKが停止するまで繰り返し実行される。
【0133】
なお、前記(1)で受信部βに入ってきた16ビットデータ(処理要求)は、(2)で処理用レジスタ41bに瞬時に読み出されるが、その際、受信部βのデータは消えないため、(4)の処理にて送信部α側にシフトする。その後、(5)の処理にて処理用レジスタ41cのデータが送信部αに書き込まれ、スレーブ信号STXDとして出力される。
【0134】
以上第5の実施の形態によれば、シフトレジスタ41が送信部αと受信部βとを各々持つことで、受信部βから処理用レジスタ41bへのデータ読み出しと、処理用レジスタ41cから送信部αへのデータ書き込みとを同時に行うことができ、その処理時間が短縮される。従って、シリアル通信の更なる高速化が可能となる。
【0135】
なお本発明は、上記以外に次の形態にて具体化できる。
上記第4,第5の実施の形態においても既述の通り、
・第2のマイコン20は、所定周期で通信同期初期化信号IORESBを受信する。
・第2のマイコン20は、受信データ中の不当コマンドを認識すると、チェック信号CHKをH→Lとし、通信を強制停止させる。
といった各処理を併せて行うようにしてもよい。
【0136】
シリアル通信ブロック内に設けたシフトレジスタは、リングバッファ構成であってもよい。このリングバッファは16個の記憶領域を持ち、16クロック毎に全領域のデータを取り替える構成となる。
【0137】
上記各実施の形態では、車両用エンジンECUを例にとり、本発明のシリアル通信装置を具体化したが、勿論それに限定されることなく、他の通信システムに適用してもよい。すなわち、一定周期で連続送信されるシリアル通信クロックに同期して、相手側のマイコンからの処理コマンドを受信すると共に該処理コマンドに対応した処理結果を送信するシリアル通信システムであれば、他の如何なるシステムにも本発明が適用できる。
【図面の簡単な説明】
【図1】発明の実施の形態におけるエンジンECUの概要を示す構成図。
【図2】各種要求時のシリアルデータ構造例を示す略図。
【図3】RAM構造を示す模式図。
【図4】データ転送の基本動作を示すタイムチャート。
【図5】処理要求時のデータ転送態様を示すタイムチャート。
【図6】クロックエッジ割込み処理を示すフローチャート。
【図7】第1のマイコンによるデータ処理を示すフローチャート。
【図8】第2のマイコンによるデータ処理を示すフローチャート。
【図9】第1のマイコンによる一定周期毎の割込み処理を示すフローチャート。
【図10】連続A/D変換要求時のシリアルデータ構造例を示す略図。
【図11】第2の実施の形態においてデータ転送態様を示すタイムチャート。
【図12】第2の実施の形態において第2のマイコンによるデータ処理を示すフローチャート。
【図13】第3の実施の形態において各マイコンの構成図。
【図14】第3の実施の形態においてデータ転送態様を示すタイムチャート。
【図15】第3の実施の形態において第2のマイコンによるデータ処理の一部を示すフローチャート。
【図16】第3の実施の形態においてチェック信号立ち下げ時の割込み処理を示すフローチャート。
【図17】第3の実施の形態において一定周期毎の割込み処理を示すフローチャート。
【図18】第4の実施の形態においてシリアル通信ブロックの構成を示す図。
【図19】第5の実施の形態においてシリアル通信ブロックの構成を示す図。
【符号の説明】
10…第1のマイコン、11…CPU、15…クロック発生回路、16…通信制御手段としての通信制御部、17…シリアル通信ブロック、17a,17b…シフトレジスタ、20…第2のマイコン、21…CPU、28…通信制御手段としての通信制御部、29…シリアル通信ブロック、29a,29b…シフトレジスタ、31,41…シリアル通信ブロック、31a,41a…第1のレジスタとしてのシフトレジスタ、31b,31c,41b,41c…第2のレジスタとしての処理用レジスタ、α…送信部、β…受信部、SW1〜SW4…切替手段としてのスイッチ。[0001]
BACKGROUND OF THE INVENTION
The present invention relates to serial communication technology in, for example, an electronic control unit (engine ECU) for a vehicle engine, and performs serial communication between a plurality of microcomputers. Ushi The present invention relates to a real communication device.
[0002]
[Prior art]
As this type of prior art, an apparatus disclosed in Japanese Patent Application Laid-Open No. 9-282265 is known, and the apparatus disclosed in this publication serially communicates data (messages) bidirectionally between two microcomputers having a master / slave relationship. It is structured as a thing. For example, the master side microcomputer controls the main engine control such as ignition timing control and fuel injection control, and the slave side microcomputer controls the A / D conversion of sensing data by various sensors necessary for engine control, load calculation, and other auxiliary control. I do. Here, in the apparatus of the same publication, a message is transmitted in synchronization with the serial communication clock, and the message exchanged between the microcomputers includes, for example, A / D conversion and RAM read data as well as each of these processes. Request commands are included.
[0003]
In actual data communication, a processing completion signal (EOCT signal in FIG. 6) is first raised to a logic high level in synchronization with the first fall of the clock, and set in the shift register of each microcomputer. Messages are exchanged. When the message exchange for one set is completed, the clock is temporarily stopped, and accordingly, the processing completion signal (EOCT) is lowered to the logic low level. After that, the slave side microcomputer executes predetermined processing such as A / D conversion and RAM data reading according to the request command in the message received from the master side microcomputer, and when the processing is completed, a processing completion signal (EOCT) is sent. Launch again to logic high level. The master-side microcomputer determines that the data transmission is ready when the processing completion signal is raised to a logic high level, restarts the clock, and transmits the next message to the slave-side microcomputer.
[0004]
[Problems to be solved by the invention]
By the way, in the apparatus disclosed in Japanese Patent Laid-Open No. 9-282265, while the slave microcomputer executes a predetermined process corresponding to the request command (in FIG. 6 of the same publication, while EOCT = L), the clock Stops and communication is interrupted. In particular, when the processing time in the slave side microcomputer is required, such as when the request from the master side microcomputer is A / D conversion, the communication stop time becomes long. Therefore, the time during which communication is stopped is longer than the time during communication, and it is difficult to improve the communication speed. Further, in such a device, a slave response communication line (EOCT line) is indispensable, which is inconvenient for simplifying the configuration.
[0005]
A method of transmitting the next message (command and data) to the above apparatus without using a slave response communication line (EOCT line) after a certain period of time has been considered. In other words, after receiving a message in synchronization with the clock, the slave side microcomputer performs predetermined processing (A / D conversion and RAM write processing) according to the request command, and then the slave side microcomputer is surely processed. The next message is received every predetermined time (for example, 40 μs). Here, when the processing of the slave microcomputer ends, the master microcomputer transmits the next message every 40 μs for a certain time. Whether or not the processing in the slave microcomputer has been correctly completed is determined from the identification bit in the transmitted message.
[0006]
However, in this case, although the slave response communication line (EOCT line) is not necessary, it is necessary to wait for a certain time (40 μs) that the processing in the slave side microcomputer is reliably completed before transmitting the next message. There has been a problem that the communication time is longer than that of the apparatus disclosed in Japanese Patent Laid-Open No. 9-282265.
[0007]
Also, as an existing communication method, unlike Japanese Patent Laid-Open No. 9-282265, there is a method in which the clock is not stopped until transmission of all messages is completed, but a request command from the master side microcomputer reads and writes RAM data. In addition, in the case of including those that require processing time, such as A / D conversion, the processing time in the slave microcomputer is required, and the application is practically impossible.
[0008]
Incidentally, as another prior art, in the serial communication device of Japanese Patent No. 2719734, each communication line for clock, master data and slave data, and each for synchronization initialization request and slave response are provided between the master side and the slave side. And a control line. The master side device transmits a synchronization initialization request at the start of master data transmission or slave data reception, while the slave side device transmits a slave response after receiving master data and before transmitting slave data. . However, even in such a device, there is a problem that communication is interrupted when a command is executed and a slave response communication line is required.
[0009]
The present invention has been made paying attention to the above problems, and the first object is to improve the communication speed even when processing corresponding to a command takes time. Ru It is to provide a real communication device. A second object is to provide a serial communication device capable of simplifying the configuration.
[0010]
[Means for Solving the Problems]
The present invention The The real communication apparatus is premised on receiving a processing command from a microcomputer on the other side and transmitting a processing result corresponding to the processing command in synchronization with a serial communication clock continuously transmitted at a constant period.
[0016]
[0017]
According to the present invention, when the reception data corresponding to the predetermined number of clocks is read in the second register, the processing is performed according to the processing command in the data and the processing result is set. When the predetermined number of clocks has elapsed, the processing result is written into the first register and the next received data is read out into the second register. Thereafter, the processing result is transmitted from the first register to the counterpart microcomputer, and in exchange for this data transmission, new data for a predetermined number of clocks is received by the first register.
[0018]
In this way, by performing communication using the first register dedicated to communication and the second register dedicated to processing, the processing command immediately after reception can be temporarily saved, and a predetermined process can be performed at the saving destination. . Therefore, even if the processing corresponding to the processing command is, for example, A / D conversion, and the processing requires time, communication is not interrupted for each command, and the communication speed can be improved. Furthermore, since it is not necessary to check whether or not the communication preparation is completed every communication for a predetermined number of clocks, the slave response communication line (for example, the EOCT line of Japanese Patent Laid-Open No. 9-282265) can be deleted. Simplification can be achieved.
[0020]
In particular At the timing when data reception for a predetermined number of clocks in the first register is completed,
Read the received data of the first register to the second register.
Write the processing result of the second register to the first register.
Each process can be performed efficiently by using the pair of second registers as described above.
[0021]
[0022]
According to the above configuration, since the first register has the receiving unit and the transmitting unit, after the data is received by the first register, the received data of the receiving unit is read to the second register, and At the same time, the processing result of the second register is written to the transmitter. That is, these data reading / writing processes can be performed simultaneously, and the processing time is shortened. Therefore, the serial communication can be further speeded up.
[0023]
[0024]
Claim 4 In the invention described in
[0025]
According to this configuration, even when a long time is required for the A / D conversion in response to a request for continuous A / D conversion, communication is not interrupted by this, and the A / D conversion time is used. Other commands on the other side are executed. The result of the continuous A / D conversion is temporarily stored in the memory, and then transmitted to the other party according to the capture command. Accordingly, communication efficiency and speed can be improved.
[0026]
Claim 5 In the invention described in
[0027]
DETAILED DESCRIPTION OF THE INVENTION
(First embodiment)
Hereinafter, this invention The An embodiment embodying a real communication device will be described with reference to the drawings.
[0028]
In the first embodiment, two microcomputers in a master / slave relationship are provided in a vehicle electronic control unit (engine ECU) that manages various engine controls. In the ECU, serial communication is performed via various communication lines connecting the two microcomputers. First, an overall configuration of an engine ECU to which the apparatus of the embodiment is applied will be described with reference to FIG.
[0029]
In the present communication system, the
[0030]
Incidentally, for example, when the knock control is performed by the
[0031]
The
[0032]
The
[0033]
The
[0034]
On the other hand, the
[0035]
Here, various analog signals such as air flow rate and water temperature are once taken into the analog multiplexer 25, and only the signal corresponding to the channel designated as the A / D conversion channel by the
[0036]
The
[0037]
The
[0038]
The first and
[0039]
The shift registers of the serial communication blocks 17 and 29 are connected in a loop shape in the illustrated manner, and data is exchanged based on the shift clock SCLK. At this time, the master signal SRXD is transmitted from the
[0040]
That is, in these shift registers, for example, every shift clock SCLK, for example,
The MSB of the shift register 17a is transferred to the LSB of the
The MSB of the
In this example, when the shift clock SCLK is output by 16 clocks, all the 16-bit signals (messages) set in the
[0041]
In the
(A) A / D conversion request command
(B) Data write request command to the
(C) Data read request command from
Etc. commands are included.
[0042]
Hereinafter, specific examples of data communication executed in the system will be listed in order based on the correspondence with the request contents by the above commands. In addition, referring to FIG. 2, the data structure of serial data set in the shift registers 17a and 17b of the first microcomputer 10 (master side microcomputer) upon each request of the above (A) to (C), and the first A data structure of serial data set in the
[0043]
(A) A / D conversion request
The
[0044]
Upon such an A / D conversion request, as shown in FIG. 2A, the
A / D conversion command,
-A / D conversion designated channel,
・ Dummy data,
A master signal SRXD consisting of 16 bits is transmitted in such a data structure.
[0045]
On the other hand, from the
・ Specified A / D conversion channel,
An identification bit F indicating whether or not the A / D conversion has been normally completed;
・ A / D conversion result,
In this data structure, a slave signal STXD consisting of 16 bits is also returned.
[0046]
(B) Data write request to RAM 23
As data requested to be written from the
・ Map data of knock determination correction value,
・ Fail judgment level map data,
・ Map data for the gate section,
And the like, and the control data is registered in advance in the
[0047]
When the same data write request is made, the
RAM write command,
The write address in
・ Write data such as each map data
A master signal SRXD consisting of 16 bits is transmitted in such a data structure.
[0048]
On the other hand, from the
RAM write command,
The write address in
An identification bit F indicating whether or not the data writing has been completed normally;
・ Dummy data
In this data structure, a slave signal STXD consisting of 16 bits is also returned.
[0049]
(C) Data read request from
The data that the
[0050]
When the data read request is made, the
RAM read command,
A read address in the
・ Dummy data,
A master signal SRXD consisting of 16 bits is transmitted in such a data structure.
[0051]
On the other hand, from the
RAM read command,
A read address in the
An identification bit F indicating whether or not the data read is normally completed,
-Designated read data from the
In this data structure, a slave signal STXD consisting of 16 bits is also returned.
[0052]
When the
Request command,
Request address,
An identification bit F indicating that it has been processed as an illegal command,
・ Dummy data,
In this data structure, a slave signal STXD consisting of 16 bits is also returned (in this case, the identification bit F = 0).
[0053]
FIG. 3 is a diagram schematically showing the structure of the communication RAM of the
[0054]
By the way, in the apparatus according to the present embodiment, as described above, the shift clock SCLK is continuously transmitted at a constant period without being stopped during communication. Even when A / D conversion or other processing requires time, processing is performed according to the previous command during reception of the next command, and communication is performed in full-duplex mode when the next command is received. By doing so, communication is performed without stopping the shift clock SCLK.
[0055]
As an implementation of the above device, one of the two shift registers in each of the serial communication blocks 17 and 29 is used as a “transmission register” and the other is used as a “processing register”. It will be switched alternately every clock. In this case, after all the 16-bit signals (messages) are exchanged on the transmission register side, the reception is performed without interrupting the communication so that processing such as A / D conversion corresponding to the request command can be performed subsequently. The finished 16 clock signals are saved to the processing register side.
[0056]
That is, when serial communication is performed with one shift register as a transmission register, at the same time, the other received shift register as a processing register analyzes a previously received command and performs predetermined processing according to the command. Is called. The processing result is set in the processing register, and after waiting for 16 clocks of serial communication in the transmission register to end, the processing register up to that point is switched to transmission, and the transmission register The set processing result is transmitted from. Further, a register that has received data for 16 clocks is switched to a processing register after receiving the data, whereby data such as a command that has been received is temporarily saved in a non-communication register. Therefore, data communication is not interrupted for each command.
[0057]
When each signal having the above-described data structure is exchanged between the first and
[0058]
FIG. 5 is a time chart showing a data transfer mode in which each signal having the above data structure is transmitted / received by each
[0059]
At the beginning of communication, the
[0060]
After time t2, a 1 MHz shift clock SCLK is transmitted, and the
[0061]
When the data transmission / reception for 16 clocks is completed (time t3), the switches SW3 and SW4 are switched to the b side, and the
[0062]
After the time t3, the
[0063]
Simultaneously with reception of “
[0064]
When data transmission / reception for 16 clocks is completed (time t4), the switches SW3 and SW4 are switched to the a side again, the
[0065]
At time t4 to t5 as well, the
[0066]
In the
[0067]
Thereafter, the processing according to the above is repeatedly executed until the shift clock SCLK from the
In short, for example, focusing on data communication based on “
[0068]
In FIG. 6, for example, at times t11 to t12 and t12 to t13, the master signal SRXD having the data structure shown in FIG. 2C including the RAM write request command is shifted according to the states of the switches SW3 and SW4. The signals are alternately transmitted to the
[0069]
When a series of communication processes are completed, finally, two dummy data are transmitted from the
[0070]
The communication synchronization initialization signal IORESB is operated to a logic low level, for example, every 4 ms for the purpose of periodically synchronizing the communication between the
[0071]
Next, the detailed contents of the communication process executed through the first and
[0072]
FIG. 6 is a flowchart showing clock edge interrupt processing executed through the
[0073]
Specifically, first, in
[0074]
If
[0075]
In
Send the MSB data in the register for transmission (step 102);
Set the received data in the LSB of the transmission register (step 105),
Etc. are repeated.
[0076]
When data transmission / reception for 16 clocks is completed and step 107 becomes YES, the process proceeds to step 108, and "16" is set in the clock counter. Thereafter, in
[0077]
In the data processing of FIG. 7 executed by the
[0078]
Thereafter, in
[0079]
Next, a data processing procedure executed by the
In
[0080]
Thereafter, in
(A) A / D conversion request command
(B) Data write request command to the
(C) Data read request command from
It is determined which one is. Then, processing corresponding to each command is executed.
[0081]
That is, if the analyzed command is “A / D conversion request”, the process proceeds to step 304, where the A / D conversion channel (ch) designated in the data in the processing register is selected, and A / D The D converter 24 is activated. In the
[0082]
If the analyzed command is “data write request to RAM 23”, the process proceeds to step 306, and writing to the
[0083]
Further, when the analyzed command is “data read request from
[0084]
FIG. 9 is a flowchart showing interrupt processing in the
[0085]
According to the embodiment described in detail above, the following effects can be obtained.
(A) In serial communication for receiving a processing command in synchronization with the shift clock SCLK and transmitting a processing result corresponding to the processing command, the clock is not interrupted and communication is not interrupted accordingly. Communication speed is improved. That is, the process corresponding to the process command is, for example, A / D conversion, and even if the process takes time, communication is not interrupted for each command, and the communication speed can be improved. In this case, when compared with the same communication time, a larger amount of data can be transferred than in the conventional communication method.
[0086]
(B) Since a pair of shift registers that are alternately switched in a communication / non-communication state is used, a processing command immediately after reception can be temporarily saved, and a predetermined process can be performed at the saving destination. Therefore, even if the processing corresponding to the processing command is, for example, A / D conversion, and the processing requires time, communication is not interrupted for each command, and the communication speed can be improved.
[0087]
(C) In the above configuration, since it is not necessary to check whether communication preparation is completed every communication for 16 clocks, the slave response communication line (for example, the EOCT line in JP-A-9-282265) is deleted. It is possible to simplify the configuration.
[0088]
(D) Since the communication synchronization initialization signal IORESB is received at a predetermined cycle, even if a clock shift occurs due to noise or the like, the inconvenient state is eliminated. That is, communication is synchronized again, and proper serial communication can be continued.
[0089]
Next, second to fifth embodiments of the present invention will be described. However, in the configuration of each of the following embodiments, components that are equivalent to those of the first embodiment described above are given the same reference numerals in the drawings and the description thereof is simplified. In the following description, differences from the first embodiment will be mainly described.
[0090]
(Second Embodiment)
This second embodiment is for continuously executing communication without interruption even when the processing time in the slave microcomputer corresponding to the request command is longer than the required time for the predetermined number of clocks. The present invention relates to a serial communication device. That is,
-When multiple A / D conversions are performed continuously by a continuous A / D conversion request,
When A / D conversion time (20 μs)> 16 clock time (16 μs),
-When an A / D conversion process is awaited in order to share an A / D converter among a plurality of devices,
For example, a serial communication device for suitably performing serial communication is proposed.
[0091]
Here, a case where a continuous A / D conversion request arrives is taken as an example, and at the time of the request, continuous A / D conversion is performed independently of communication. In other words, communication between the first and
[0092]
When the continuous A / D conversion is performed, the master signal SRXD transmitted from the
・ Continuous A / D conversion request command,
・ Continuous A / D conversion result retrieval request command,
Etc. commands are included.
[0093]
More specifically, when a continuous A / D conversion request is output from the
・ Continuous A / D conversion request command,
-A / D conversion start specified channel,
-Number of specified channels for A / D conversion,
・ Dummy data,
A master signal SRXD consisting of 16 bits is transmitted in such a data structure.
[0094]
In addition, when the A / D conversion result fetch request after the end of the continuous A / D conversion process is performed, the
・ Continuous A / D conversion result retrieval request command,
-Channel for extracting continuous A / D conversion results,
・ Dummy data,
A master signal SRXD consisting of 16 bits is transmitted in such a data structure.
[0095]
On the other hand, from the
-Channel for extracting continuous A / D conversion results,
An identification bit F indicating whether or not the continuous A / D conversion is normally completed;
・ Continuous A / D conversion result,
In this data structure, a slave signal STXD consisting of 16 bits is also returned.
[0096]
FIG. 11 is a time chart showing a data transfer mode in which each signal having the above data structure is transmitted / received by each
[0097]
After the reset of the communication synchronization initialization signal IORESB, at time t21 to t22, the
[0098]
At this time, the transmission data from the
[0099]
When the data transmission / reception for 16 clocks is completed (time t22), the switches SW3 and SW4 are switched from the a side to the b side. Conversely, the
[0100]
Thereafter, at times t22 to t23 and t23 to t24, the master signal SRXD having the data structure shown in FIG. 2C, including the RAM write request command, is shifted in accordance with the states of the switches SW3 and SW4. Are sent alternately. From time t23 to t24, the RAM write processing is executed in response to the RAM write request command in the SRXD signal received at the previous time t22 to t23, and the data structure shown in FIG. Slave signal STXD is set in the processing register at that time. At the next time t24 to t25, a slave signal STXD including the processing result of RAM writing is transmitted to the
[0101]
Further, after time t22, the
[0102]
When a series of communications in response to a RAM write request or the like is completed, the
[0103]
Thereafter, at time t27, the transmission register and the processing register are switched. Also, at time t27 to t28, as in the case of time t26 to t27, the
[0104]
Simultaneously with the reception of “AD
[0105]
At time t28, the transmission and processing registers are switched again. In addition, from time t28 to t29, the
[0106]
Next, a data processing procedure executed by the
[0107]
In
A / D conversion request command,
-Data write request command to RAM,
-Data read request command from RAM,
In addition to the commands determined in FIG.
・ Continuous A / D conversion request command,
・ Continuous A / D conversion result retrieval request command,
It is determined which one is. Then, processing corresponding to each request is executed.
[0108]
That is, if the analyzed command is a “continuous A / D conversion request”, the process proceeds to step 504, where the designated channel (ch) for A / D conversion start designated in the data in the processing register is designated. The number of channels is set, and the A / D converter 24 is sequentially activated. In the
[0109]
If the analyzed command is “continuous A / D conversion result extraction request”, the process proceeds to step 506, while corresponding to the continuous A / D conversion result extraction channel included in the data in the processing register. The A / D conversion result is read from the
[0110]
As described above, according to the second embodiment, even when a long time is required for the A / D conversion in response to a request for continuous A / D conversion, the communication is not interrupted by the A / D conversion. Other commands from the
[0111]
(Third embodiment)
In serial communication between a plurality of microcomputers, if even one shift clock SCLK is shifted due to noise or the like, it becomes an illegal command or a command for performing completely different processing. Therefore, in this embodiment, when an undefined illegal command is received even once, the subsequent communication is forcibly stopped to prevent erroneous processing from being executed.
[0112]
FIG. 13 is a block diagram showing a configuration of the engine ECU in the present embodiment. As a difference from the configuration of FIG. 1, the check signal CHK is transmitted from the
[0113]
FIG. 14 is a time chart showing a data transfer mode in each of the
[0114]
At time t31, the check signal CHK is also reset once with the reset of the communication synchronization initialization signal IORESB. By resetting the signals IORESB and CHK, it is confirmed by the
[0115]
In each period from time t32 to t33, t33 to t34, t34 to t35, the
[0116]
Thereafter, when the shift clock SCLK is shifted by several clocks due to noise or the like at time t41, the
[0117]
Thereafter, at time t43, the communication synchronization initialization signal IORESB is raised from the logic low level to the logic high level. As a result, the check signal CHK also simultaneously returns to the logic high level.
[0118]
Next, part of the data processing executed by the
[0119]
In
[0120]
Further, the
[0121]
If CHK = L, the process proceeds to step 703 to forcibly terminate communication. In the
[0122]
On the other hand, the
[0123]
If YES in step 802 (CHK = L), the flow advances to step 804 to return the communication synchronization initialization signal IORESB to the logic high level. In the
[0124]
If
[0125]
As described above, according to the present embodiment, it is possible to prevent in advance a problem that communication is in an illegal state due to a clock shift or the like and erroneous processing is performed. Further, as shown in the time chart of FIG. 14, even if a clock deviation occurs temporarily and the check signal CHK falls to the logic low level accordingly, that is, even if the communication is forcibly stopped, the periodic Communication normal recovery can be performed by the synchronization initialization process (the process of FIG. 17).
[0126]
(Fourth embodiment)
In each of the above embodiments, a pair of shift registers are provided in the serial communication block of each microcomputer, and the communication / non-communication state (the state of being a transmission register and a processing register) is switched every predetermined number of clocks. However, in the present embodiment, the configuration of the serial communication block is changed.
[0127]
As shown in FIG. 18, for example, the serial communication block 31 on the
[0128]
Specifically, a series of communication processes shown below are performed. Since the basic operation of communication is the same as that in FIG. 5, the operation will be described here with reference to FIG. 5 (however, the operations of SW3 and SW4 in FIG. 5 are irrelevant).
(1) Data for 16 clocks is received by the
(2) When data reception for 16 clocks is completed,
Data in the
(3) Processing (A / D conversion of specified channel, RAM writing, RAM reading, etc.) corresponding to the command stored in the
(4) Simultaneously with (3), transmission data for the next 16 clocks is received by the
(5) When 16 clocks have passed, as in (2) above,
Data in the
(6) Similar to (3) above, processing corresponding to the command stored in the
(7) At the same time as (6), transmission data for the next 16 clocks is received by the
[0129]
As described above, according to the fourth embodiment, by performing communication using the
[0130]
(Fifth embodiment)
In the fifth embodiment, a part of the fourth embodiment is changed to embody a serial communication device. As described above, when the number of clocks reaches 16 clocks in the fourth embodiment,
Reads data in the
• Instantly write the data in the
These processes are sequentially performed. The process between the shift register and the processing register is performed in an extremely short time from the rising edge of the shift clock SCLK to the next falling edge (within 0.5 μs when SCLK = 1 MHz). ) Must be implemented, and a considerable high-speed processing is forced. Therefore, in the present embodiment, a communication device capable of performing data processing “between shift registers and processing registers” at an early stage will be described.
[0131]
FIG. 19 is a diagram showing the configuration of the serial communication block in the present embodiment. The
[0132]
Specifically, a series of communication processes shown below are performed. Since the basic operation of communication is the same as that in FIG. 5, the operation will be described here with reference to FIG. 5 (however, the operations of SW3 and SW4 in FIG. 5 are irrelevant).
(1) In synchronization with the shift clock SCLK, data for 16 clocks is received by the receiving unit β of the
(2) When the number of clocks reaches 16 clocks and half of the data in the
The data of the receiving unit β is instantaneously read into the
At the same time, the data in the
(3) Processing corresponding to the command stored in the
(4) Simultaneously with the above (3), transmission data for the next 16 clocks is received by the receiving unit β (time t3 to t4).
(5) When 16 clocks have passed, as in (2) above,
The data of the receiving unit β is instantaneously read into the
At the same time, the data in the
(6) As in (3) above, processing corresponding to the command stored in the
(7) At the same time as (6), transmission data for the next 16 clocks is received by the receiving unit β, and the processing result is transmitted to the
[0133]
Note that the 16-bit data (processing request) that has entered the receiving unit β in (1) is instantaneously read into the
[0134]
As described above, according to the fifth embodiment, the
[0135]
In addition to the above, the present invention can be embodied in the following forms.
As described above in the fourth and fifth embodiments,
The
When the
These processes may be performed together.
[0136]
The shift register provided in the serial communication block may have a ring buffer configuration. This ring buffer has 16 storage areas, and the data of all areas is replaced every 16 clocks.
[0137]
In each of the embodiments described above, the vehicle engine ECU is taken as an example, and the serial communication device of the present invention is embodied. However, the present invention is not limited thereto, and may be applied to other communication systems. That is, any other serial communication system that receives a processing command from a microcomputer on the other side and transmits a processing result corresponding to the processing command in synchronization with a serial communication clock continuously transmitted at a constant cycle. The present invention can also be applied to a system.
[Brief description of the drawings]
FIG. 1 is a configuration diagram showing an outline of an engine ECU in an embodiment of the invention.
FIG. 2 is a schematic diagram showing an example of a serial data structure at the time of various requests.
FIG. 3 is a schematic diagram showing a RAM structure.
FIG. 4 is a time chart showing the basic operation of data transfer.
FIG. 5 is a time chart showing a data transfer mode at the time of processing request.
FIG. 6 is a flowchart showing clock edge interrupt processing.
FIG. 7 is a flowchart showing data processing by the first microcomputer.
FIG. 8 is a flowchart showing data processing by a second microcomputer.
FIG. 9 is a flowchart showing interrupt processing at regular intervals by the first microcomputer.
FIG. 10 is a schematic diagram showing an example of a serial data structure when a continuous A / D conversion is requested.
FIG. 11 is a time chart showing a data transfer mode in the second embodiment.
FIG. 12 is a flowchart showing data processing by a second microcomputer in the second embodiment.
FIG. 13 is a configuration diagram of each microcomputer in the third embodiment.
FIG. 14 is a time chart showing a data transfer mode in the third embodiment.
FIG. 15 is a flowchart showing a part of data processing by the second microcomputer in the third embodiment;
FIG. 16 is a flowchart showing an interrupt process when a check signal falls in the third embodiment.
FIG. 17 is a flowchart showing interrupt processing at regular intervals in the third embodiment.
FIG. 18 is a diagram showing a configuration of a serial communication block in the fourth embodiment.
FIG. 19 is a diagram showing a configuration of a serial communication block in the fifth embodiment.
[Explanation of symbols]
DESCRIPTION OF
Claims (5)
相手側のマイクロコンピュータとの間で通信データを送受信するための第1のレジスタと、 A first register for transmitting / receiving communication data to / from a counterpart microcomputer;
所定クロック数分のデータをそれぞれ格納可能な一対のレジスタからなり、前記第1のレジスタの通信データを一時的に格納するための第2のレジスタと、 A pair of registers each capable of storing data for a predetermined number of clocks, a second register for temporarily storing communication data of the first register;
第1のレジスタにて所定クロック数分のデータを受信すると、当該データを一方の第2のレジスタに読み出し、該読み出した処理コマンドの実施後、処理結果を他方の第2のレジスタにセットし、所定クロック数が経過した時点で、前記処理結果を第1のレジスタに書き込むと共に、次の受信データを第2のレジスタに読み出す通信制御手段と、 When data for a predetermined number of clocks is received by the first register, the data is read to one second register, and after execution of the read processing command, the processing result is set to the other second register, Communication control means for writing the processing result to the first register and reading the next received data to the second register when a predetermined number of clocks have elapsed,
を備えることを特徴とするシリアル通信装置。A serial communication device comprising:
前記第1のレジスタは、所定クロック数分のデータを受信するための受信部と、同じく所定クロック数分のデータを送信するための送信部とを持つシリアル通信装置。 The first register is a serial communication device having a receiving unit for receiving data for a predetermined number of clocks and a transmitting unit for transmitting data for a predetermined number of clocks.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP04822199A JP4006871B2 (en) | 1999-02-25 | 1999-02-25 | Serial communication device |
US09/511,947 US6499067B1 (en) | 1999-02-25 | 2000-02-23 | Serial communication apparatus and serial communication system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP04822199A JP4006871B2 (en) | 1999-02-25 | 1999-02-25 | Serial communication device |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2000253094A JP2000253094A (en) | 2000-09-14 |
JP4006871B2 true JP4006871B2 (en) | 2007-11-14 |
Family
ID=12797374
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP04822199A Expired - Lifetime JP4006871B2 (en) | 1999-02-25 | 1999-02-25 | Serial communication device |
Country Status (2)
Country | Link |
---|---|
US (1) | US6499067B1 (en) |
JP (1) | JP4006871B2 (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002108835A (en) * | 2000-09-29 | 2002-04-12 | Mitsubishi Electric Corp | On-vehicle electronic controller |
JP4511063B2 (en) * | 2001-03-02 | 2010-07-28 | パナソニック株式会社 | Transmission device, reception device, data transfer system, reproduction or recording device, transmission method, reception method, and data transfer method |
US7765269B2 (en) * | 2003-11-05 | 2010-07-27 | Renesas Technology Corporation | Communications system, and information processing device and control device incorporating said communications system |
US8892791B2 (en) * | 2003-12-05 | 2014-11-18 | Keysight Technologies, Inc. | Communications system for implementation of synchronous, multichannel, galvanically isolated instrumentation devices |
JP4508072B2 (en) * | 2005-10-18 | 2010-07-21 | 株式会社デンソー | Serial communication circuit and A / D conversion system |
JP5363490B2 (en) * | 2007-10-02 | 2013-12-11 | オープンピーク インコーポレイテッド | System and method for interprocessor communication |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS5291471A (en) * | 1976-01-28 | 1977-08-01 | Toshiba Corp | Clock pulse generator |
JPS53118325A (en) | 1977-03-25 | 1978-10-16 | Fujitsu Ltd | Control system for input/output device |
JPS6124347A (en) * | 1984-07-12 | 1986-02-03 | Nissan Motor Co Ltd | Network system |
NL8801033A (en) * | 1988-04-21 | 1989-11-16 | At & T & Philips Telecomm | SWITCHING SYSTEM FOR CIRCUIT AND / OR PACKAGE SWITCHED COMMUNICATIONS. |
JP3326619B2 (en) * | 1992-01-08 | 2002-09-24 | ソニー株式会社 | PWM circuit |
JPH08503564A (en) * | 1992-11-09 | 1996-04-16 | マイクロソフト コーポレイション | Method and system for connecting objects in computer system |
US5822738A (en) * | 1995-11-22 | 1998-10-13 | F.M.E. Corporation | Method and apparatus for a modular postage accounting system |
JP3562126B2 (en) | 1996-04-09 | 2004-09-08 | 株式会社デンソー | DMA controller |
US6157999A (en) * | 1997-06-03 | 2000-12-05 | Motorola Inc. | Data processing system having a synchronizing link stack and method thereof |
-
1999
- 1999-02-25 JP JP04822199A patent/JP4006871B2/en not_active Expired - Lifetime
-
2000
- 2000-02-23 US US09/511,947 patent/US6499067B1/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
US6499067B1 (en) | 2002-12-24 |
JP2000253094A (en) | 2000-09-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4954986B2 (en) | GPS processing configuration | |
US10409749B2 (en) | Semiconductor device and system provided with a communication interface | |
JP4006871B2 (en) | Serial communication device | |
US7487331B2 (en) | Programming a digital processor with a single connection | |
JP2001216284A (en) | Electronic control unit | |
KR20110124273A (en) | Configurable status processing unit for sensor-actuator systems | |
JP3827565B2 (en) | Microcomputer logic development equipment | |
JPH0888668A (en) | Communication equipment | |
JP3267646B2 (en) | Data communication device | |
JP3628265B2 (en) | Multiprocessor system unit | |
JP2018155105A (en) | Engine control device and electronic control device | |
WO1996007254A1 (en) | Receiver | |
JP3318863B2 (en) | Synchronous data transmission method and synchronous data transmission device | |
JP2512119B2 (en) | Microprocessor | |
US20030196130A1 (en) | Prompt resynchronization for a serial interface | |
CN117033276B (en) | Bus communication method, system, electronic device and storage medium | |
US20220365757A1 (en) | Device and Method for Handling Programming Language Function | |
ATE36613T1 (en) | METHOD AND ARRANGEMENT FOR THE SUPERVISED TRANSMISSION OF CONTROL SIGNALS TO INTERFACES OF DIGITAL SYSTEMS. | |
KR100532608B1 (en) | a bus system having serial/parallel circuitry | |
JP2007036850A (en) | Character recognizing circuit | |
JPH07175736A (en) | Inter-cpu data transfer device | |
SU1037235A1 (en) | Channel-to-channel adapter | |
JPH09218846A (en) | Bus converter | |
JP3408046B2 (en) | Data communication system and data communication method | |
JP2004199658A (en) | Digital signal processor, system, method, and host device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050413 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070320 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070521 |
|
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: 20070807 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070820 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100907 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100907 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110907 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110907 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120907 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120907 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130907 Year of fee payment: 6 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
EXPY | Cancellation because of completion of term |