JP2019087878A - CAN communication control device and CAN communication control method - Google Patents
CAN communication control device and CAN communication control method Download PDFInfo
- Publication number
- JP2019087878A JP2019087878A JP2017214731A JP2017214731A JP2019087878A JP 2019087878 A JP2019087878 A JP 2019087878A JP 2017214731 A JP2017214731 A JP 2017214731A JP 2017214731 A JP2017214731 A JP 2017214731A JP 2019087878 A JP2019087878 A JP 2019087878A
- Authority
- JP
- Japan
- Prior art keywords
- message
- cpu
- communication control
- mailbox
- stored
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Small-Scale Networks (AREA)
Abstract
Description
本発明は、CAN通信制御装置及びCAN通信制御方法に係り、特に、ハードウェア資源の効率的活用を図りつつCANデータの授受を行うCAN通信制御装置及びCAN通信制御方法に適用して好適なものである。 The present invention relates to a CAN communication control device and a CAN communication control method, and in particular, to a CAN communication control device and a CAN communication control method for exchanging CAN data while efficiently utilizing hardware resources. It is.
車載に搭載された電子装置相互の種々データの授受には、CAN(Controller Area Network)が用いられていることは良く知られている通りである(例えば、特許文献1等参照)。
CANを介した電子装置間のデータの授受は、通常、CANメッセージと称される所定の信号形式に基づいて行われる。このCANメッセージは、そのメッセージの内容、種類等に応じて識別のためID(識別符号)が付与されて送信側の電子装置から送出される。
そして、受信側の他の電子装置においては、そのIDを識別することで、必要なCANメッセージのみが選択、取り込み等されるようになっている。
It is well known that CAN (Controller Area Network) is used to exchange various data between electronic devices mounted on a vehicle (see, for example, Patent Document 1).
The exchange of data between electronic devices via CAN is usually performed based on a predetermined signal format called a CAN message. This CAN message is sent from an electronic device on the transmission side, to which an ID (identification code) is added for identification in accordance with the content, type and the like of the message.
Then, in the other electronic device on the receiving side, only the necessary CAN message is selected, captured, etc. by identifying the ID.
通常、CANメッセージを受信する電子装置においては、CANコントローラと称されるCAN通信の制御を行う部位に、CANメッセージを一時的に格納するメールボックスと称される記憶領域が確保される。 Usually, in an electronic device that receives a CAN message, a storage area called a mailbox that temporarily stores the CAN message is secured in a part called CAN controller that controls CAN communication.
ところで、CANに接続された複数の電子装置において受信されるCANメッセージ数、換言すれば、受信対象となるIDの数は、それぞれの装置が有する機能等によって様々である。
一方、小型化、低価格、構成の簡素化等が恒常的に求められる電子装置にあって、必ずしも受信対象のCANメッセージ数に対応した記憶領域を有するメールボックスが確保できるとは限らず、寧ろ、受信対象のCANメッセージ数に対してメールボックス数が不足することもある。
By the way, the number of CAN messages received by a plurality of electronic devices connected to CAN, in other words, the number of IDs to be received, varies depending on the function of each device.
On the other hand, in electronic devices that are constantly required to be smaller in size, lower in price, and simplified in configuration, it is not always possible to secure a mailbox having a storage area corresponding to the number of CAN messages to be received. The number of mailboxes may be insufficient for the number of CAN messages to be received.
CANコントローラのメールボックスには、上述のように所定のIDのCANメッセージが到達する毎に、CANメッセージがメールボックスに格納されるが、そのCANメッセージのCPUへの取り込みは、通常、定常タスク処理において実行されるものとなっている。
すなわち、一定時間間隔で、定常タスク処理が開始されると、CPUは、その時点にCANコントローラのメールボックスに格納されているCANメッセージをCPUに取り込む処理を実行する。
As described above, each time a CAN message of a predetermined ID arrives in the mailbox of the CAN controller, the CAN message is stored in the mailbox, but the CAN message is usually captured by the CPU as regular task processing Is to be implemented in
That is, when steady-state task processing is started at regular time intervals, the CPU executes processing to load the CAN message stored in the mailbox of the CAN controller at that time into the CPU.
このようにCANコントローラのメールボックスからCPUに取り込まれるCANメッセージは、定常タスク処理の実行時点においてCANコントローラのメールボックスに格納されている最新のCANメッセージのみであるため、それ以前のCANメッセージはロストデータとして処理されていた。 Thus, since the CAN messages taken into the CPU from the mailbox of the CAN controller are only the latest CAN messages stored in the mailbox of the CAN controller at the time of execution of the routine task processing, the previous CAN messages are lost. It was processed as data.
本発明は、上記実状に鑑みてなされたもので、ハードウェアの追加を要することなく、ロストデータを可能な限り低減して効率の良いCANデータの受信ができるCAN通信制御装置及びCAN通信制御方法を提供するものである。 The present invention has been made in view of the above situation, and a CAN communication control device and a CAN communication control method capable of receiving CAN data efficiently by reducing lost data as much as possible without requiring addition of hardware. To provide
上記本発明の目的を達成するため、本発明に係るCAN通信制御装置は、
外部から到達したCANメッセージをメールボックス(230)へ一時的に格納するCANコントローラ(210)と、
前記メールボックス(230)に格納されたCANメッセージを格納するCPU側メールボックス(120)を有して、定常タスク処理により前記メールボックス(230)に格納されたCANメッセージを前記CPU側メールボックス(120)に格納するCPU(110)を有するCAN通信制御装置(201)であって、
前記CPU(110)には、複数のメッセージ格納域(130−1〜130−10)を有するテンポラリバッファメモリ(130)が設けられ、
前記CPU(110)は、
所定割込条件の下、実行中の処理に対して割り込みを行い、
前記複数のメッセージ格納域(130−1〜130−10)の中から受信フラグが上書き許可に設定されているメッセージ格納域(130−1〜130−10)を検出し、
当該検出されたメッセージ格納域(130−1〜130−10)に、前記メールボックス(230)に格納されたCANメッセージの中から所定の選択条件で選択されたCANメッセージを格納すると共に、当該CANメッセージを所要の箇所へ転送するまで前記受信フラグを上書き禁止状態に設定することを特徴とする。
In order to achieve the above object of the present invention, a CAN communication control device according to the present invention
CAN controller (210) which temporarily stores CAN messages arrived from the outside in mailbox (230),
The CPU-side mailbox (120) for storing the CAN message stored in the mailbox (230), the CAN message stored in the mailbox (230) by the routine task processing 120) a CAN communication control device (201) having a CPU (110) stored in
The CPU (110) is provided with a temporary buffer memory (130) having a plurality of message storage areas (130-1 to 130-10),
The CPU (110) is
Interrupt the process being executed under the specified interrupt condition,
Among the plurality of message storage areas (130-1 to 130-10), a message storage area (130-1 to 130-10) in which the reception flag is set to overwrite permission is detected,
In the detected message storage area (130-1 to 130-10), a CAN message selected according to a predetermined selection condition from the CAN messages stored in the mail box (230) is stored, The reception flag is set to the overwrite inhibition state until the message is transferred to a desired place.
本発明によれば、外部から受信対象のCANメッセージが到達した時点で、CPUへの取り込みを行い、CANメッセージが格納された箇所を、そのCANメッセージが所要の箇所へ転送されるまでの間、上書き禁止とすることで、定常タスク処理開始直前に到達した最新のCANメッセージのみしか取り込むことができなかった従来と異なり、定常タスク処理では取り込むことのできなかった時間的に古いCANメッセージを取り込むことができるので、ロストデータを確実に軽減することができる。
また、割込により実行されるのは、CANメッセージの取り込みと、所定の格納域への格納のみであり、格納されたCANメッセージの処理は、別途、通常のタスク処理の対象となるため、割込によって通常の処理に支障を来すことが殆どなく、一般的な割込処理と異なり、CPUの演算負担が小さく済み、効率の良いCAN通信制御が実現できるという効果を奏するものである。
According to the present invention, when the CAN message to be received from the outside arrives, the CPU is loaded, and the place where the CAN message is stored is until the CAN message is transferred to the required place, Unlike in the past, where only the latest CAN message that arrived immediately before the start of steady-state task processing could be captured by setting overwrite protection, the old-time CAN message can not be captured in steady-state task processing. Lost data can be reliably reduced.
Also, what is executed by the interrupt is only the capture of CAN message and the storage in a predetermined storage area, and processing of the stored CAN message is separately targeted for normal task processing, so There is almost no hindrance to normal processing due to loading, and unlike general interrupt processing, the computational load on the CPU can be reduced, and efficient CAN communication control can be realized.
以下、本実施の形態について、図1乃至図4を参照して説明する。
なお、以下に説明する部材及び配置は本発明を限定するものではなく、本発明の趣旨の範囲内で種々改変することができるものである。
最初に、本発明の実施の形態におけるCAN通信制御装置の一構成例について、図1を参照しつつ説明する。
Hereinafter, the present embodiment will be described with reference to FIGS. 1 to 4.
The members and arrangements described below do not limit the present invention, and various modifications can be made within the scope of the present invention.
First, one configuration example of the CAN communication control device in the embodiment of the present invention will be described with reference to FIG.
本発明の実施の形態におけるCAN通信制御装置201は、車両に搭載された電子制御ユニット101を用いて構成されている。
電子制御ユニット101は、例えば、トルクコントロール用電子制御ユニットなどであるが、特定の電子制御ユニットに限定されるものではない。
The CAN
The
CAN通信制御装置201は、電子制御ユニット101を構成するCPU110と、電子制御ユニット101内に設けられたCANコントローラ210とに大別されて構成されている。
The CAN
CANコントローラ210は、CANドライバ(図1においては「CAN DRV」と表記)220とメールボックス230とに大別されて構成されている。
かかるCANコントローラ210は、従来と基本的に同一の構成を有しているものである。
The
The
CANドライバ220は、CANバス1に接続されて、CANバス1を介して授受されるCANデータに対する緩衝増幅回路としての機能を有している。
メールボックス230は、複数のデータ格納域(図1においては、「MLB−1」、「MLB−2」・・・「MLB−n」と表記)230−1〜230−nを有するRAM等に代表される半導体記憶素子である。
The
The
CPU110は、それ自体、従来から良く知られているもので、電子制御ユニット101が、例えば、トルクコントロール用電子制御ユニットである場合には、エンジントルク制御処理等を実行する機能を有するものである。本発明の実施の形態においては、このCPU110がCAN通信制御処理にも用いられる構成となっている。
The
本発明の実施の形態においては、CPU110内の適宜な記憶領域に、CAN通信制御処理に用いられるCPU側メールボックス120と、テンポラリバッファメモリ(一時記憶メモリ)130とが確保されたものとなっている。
CPU側メールボックス120は、CANコントローラ210のメールボックス230のデータ格納域230−1〜230−nに格納されたCANメッセージを一時的に記憶するためのRAM等に代表される記憶素子である。
In the embodiment of the present invention, the
The CPU-
このCPU側メールボックス120は、CANコントローラ210のメールボックス230のデータ格納域230−1〜230−nと同数のメッセージ格納域120−1〜120−nを有するものである。
また、このCPU側メールボックス120は、本発明特有のものではなく、CAN通信の為、従来からCPU110内に設けられているものである。
The
The CPU-
テンポラリバッファメモリ130は、CPU側メールボックス120と同様、RAM等の半導体記憶素子である。このテンポラリバッファメモリ130は、後述する本発明の実施の形態におけるCAN通信制御処理の実行のために必要とされるものである。
Similar to the CPU-
また、テンポラリバッファメモリ130は、複数のメッセージ格納域を有するもので、図1の構成例においては、10個のメッセージ格納域130−1〜130−10を有する場合の例が示されている。
テンポラリバッファメモリ130のメッセージ格納域130−1〜130−10の数、すなわち、換言すれば、格納可能なCANメッセージ数は任意で良く、CPU側メールボックス120のメッセージ格納域120−1〜120−nの数等とは無関係に別個に定められる。
Further, the
The number of message storage areas 130-1 to 130-10 of
テンポラリバッファメモリ130のメッセージ格納域120−1〜120−nの数は、既存のRAM等の記憶素子における未使用(空き)の記憶領域を確保できる程度で十分である。
したがって、CPU側メールボックス120とテンポラリバッファメモリ130は、別個の記憶素子である必要は無く、例えば、同一のRAM内に、それぞれ必要な記憶領域を確保したものとするのが好適である。このように、既存のRAM等の記憶素子の空き領域を使用することで、テンポラリバッファメモリ130のために新たな記憶素子を別途追加することなく、ソフトウェアの変更のみで本発明に係るCAN通信制御装置を実現することが可能である。
The number of message storage areas 120-1 to 120-n of the
Therefore, the CPU-
テンポラリバッファメモリ130の各メッセージ格納域130−1〜130−10に対しては、CANメッセージが格納されているか否かを判別するための受信フラグが設定されるようになっている。
本発明の実施の形態において受信フラグは、CANメッセージが格納されている場合に”1”に設定され、CANメッセージが格納されていない場合、換言すれば、新たにCANメッセージが格納可能な場合に”0”に設定されるものとなっている。
A reception flag for determining whether or not a CAN message is stored is set in each of the message storage areas 130-1 to 130-10 of the
In the embodiment of the present invention, the reception flag is set to “1” when the CAN message is stored, and when the CAN message is not stored, in other words, when the CAN message can be newly stored. It is set to "0".
次に、本発明の実施の形態におけるCAN通信制御処理の手順について、図2、及び、図4を参照しつつ説明する。
最初に、本発明の実施の形態におけるCAN通信制御処理について概括的に説明する。
本発明の実施の形態におけるCAN通信制御処理は、CANコントローラ210のメールボックス230に取り込まれた(格納)されたCANメッセージを、効率良くCPU110に取り込むための処理手順である。かかるCAN通信制御処理は、従来と異なり、割り込み処理によってCANデータを適切なタイミングでCPU110に取り込むようにしたものである。
Next, the procedure of the CAN communication control process in the embodiment of the present invention will be described with reference to FIG. 2 and FIG.
First, CAN communication control processing in the embodiment of the present invention will be generally described.
The CAN communication control process in the embodiment of the present invention is a process procedure for efficiently fetching the CAN message captured (stored) in the
ここで、本発明のCAN通信制御処理の実行タイミングについて、従来の定常タスク処理との関係を含めて図4を参照しつつ説明する。
図4において、T1、T2は、定常タスク処理が開始されるタイミングで、その時間間隔は、例えば10msec等に設定される。この時間間隔は、あくまでも一例であり、勿論、これに限定される必要はないものである。
定常タスク処理は、所定の制御処理を一定時間間隔で繰り返し実行する処理をいう。
Here, the execution timing of the CAN communication control processing of the present invention will be described with reference to FIG. 4 including the relationship with the conventional steady task processing.
In FIG. 4, T1 and T2 are timings at which steady-state task processing is started, and their time intervals are set to, for example, 10 msec. This time interval is just an example and, of course, need not be limited to this.
The steady-state task processing is processing for repeatedly executing predetermined control processing at predetermined time intervals.
定常タスク処理が開始されると、予め定められ複数のタスクが所定の順に従って実行される。
図4においては、3つのタスクTask1〜Task3が実行される場合の例が示されている。
この例の場合、最初の第1のタスクTask1において、CANメッセージの送信処理、及び、受信処理が、それぞれ実行されるものとなっている。
従来、CANデータの送信処理、及び、受信処理は、このように、定常タスク処理においてのみ実行されるものであった。
When steady-state task processing is started, a plurality of predetermined tasks are executed in a predetermined order.
FIG. 4 shows an example in which three tasks Task1 to Task3 are executed.
In the case of this example, transmission processing and reception processing of the CAN message are respectively executed in the first first task Task1.
Conventionally, CAN data transmission processing and reception processing are thus performed only in steady-state task processing.
図4において、”Interrupt”と表記された箇所は、いわゆる割り込み処理が発生した時点であり、本発明の実施の形態におけるCAN通信制御処理は、この割り込み処理によって実行が開始されて、CANメッセージのCPU110への取り込みを行うものである。
In FIG. 4, the part described as “Interrupt” is a point when so-called interrupt processing occurs, and the CAN communication control processing in the embodiment of the present invention is started by this interrupt processing, and the CAN message is generated. It takes in to
次に、本発明の実施の形態におけるCAN通信制御処理の手順について、図2を参照しつつ説明する。
まず、図2に示されたCAN通信制御処は、次述する前提条件の下で実行されるものとする。
図2に示されたCAN通信制御処理は、電子制御ユニット101宛のCANメッセージが外部から到達したことがCPU110により検出された場合に、CPU110により割り込み要求が生成されることで実行されるものとなっている。
Next, the procedure of CAN communication control processing in the embodiment of the present invention will be described with reference to FIG.
First, it is assumed that the CAN communication control process shown in FIG. 2 is executed under the precondition described below.
The CAN communication control process shown in FIG. 2 is executed when the
外部から到達したCANメッセージは、図2に示された割り込り処理によるCAN通信制御処理の実行によってCPU110内部へ取り込まれる場合を除けば、通常は、先に述べた定常タスク処理の実行により、CANコントローラ210のメールボックス230からCPU側メールボックス120に転送されるようになっている。
Normally, the CAN message arrived from the outside is carried out by executing the above-described steady-state task processing, except that the CAN message is taken into the
ここで、外部から到達したCANメッセージのCANコントローラ210のメールボックス230への格納処理について説明する。
電子制御ユニット101に到達したCANメッセージは、最初にメールボックス230に格納されるが、このメールボックス230へのCANメッセージの格納は、アクセプタンスフィルタに基づいて行われるようになっている。
Here, storage processing of the CAN message arrived from the outside in the
The CAN message that has reached the
アクセプタンスフィルタは、受信するCANメッセージ数に対して、メールボックス230のデータ格納域230−1〜230−nの数が十分でない場合にあっても、CANメッセージの受信を可能とするため実行される一種のフィルタ処理である。
すなわち、アクセプタンスフィルタの実行に際しては、各データ格納域230−1〜230−n毎に、予め格納対象とされるCANメッセージのIDが設定される。
The acceptance filter is executed to enable reception of CAN messages even when the number of data storage areas 230-1 to 230-n of
That is, when executing the acceptance filter, IDs of CAN messages to be stored in advance are set for each of the data storage areas 230-1 to 230-n.
外部からCANメッセージが到達すると、CANコントローラ210は、到達したCANメッセージのIDが、メールボックス230のデータ格納域230−1〜230−nのいずれかに設定されたものと一致するか否かを判定する。
到達したCANメッセージのIDが、アクセプタンスフィルタとして設定されたIDに該当する場合、そのIDに対応するデータ格納域にCANデータが格納される。
When the CAN message arrives from the outside, the
If the ID of the arrived CAN message corresponds to the ID set as the acceptance filter, the CAN data is stored in the data storage area corresponding to the ID.
各データ格納域230−1〜230−n毎に予め設定されるID数は、単一IDまたは複数とされる。この場合、IDの値の設定は、離散的に複数の値を設定しても良いし、また、所定の範囲の値を設定しても良く、特定の設定形式に限定されるものではない。 The number of IDs set in advance for each data storage area 230-1 to 230-n is a single ID or a plurality of IDs. In this case, a plurality of values may be set discretely in the setting of the ID, or values in a predetermined range may be set, and the present invention is not limited to a specific setting format.
メールボックス230の一つのデータ格納域230−1〜230−nに、複数のIDが設定されている場合、通常、該当するIDのCANメッセージが到達する順に、直前に格納されたCANメッセージに上書きされるようになっている。
When multiple IDs are set in one data storage area 230-1 to 230-n of the
一方、メールボックス230のCANメッセージのCPU110への取り込みは、従来、定常タスク処理の実行タイミングでのみ行われるようになっていた。
したがって、定常タスク処理によりCPU110へ取り込まれるCANメッセージは、定常タスク処理の実行タイミングの直前に格納された最新のものが対象となる。そのため、それ以前のタイミングにメールボックス230格納されたCANメッセージはCPU110への取り込みの対象とならずロストデータとされていた。
On the other hand, conventionally, capturing of the CAN message of the
Therefore, the CAN message captured into the
図2を参照しつつ、以下に説明する本発明の実施の形態におけるCAN通信制御処理は、従来の定常タスク処理に取って代わるものではなく、定常タスク処理も従来同様に実行されることを前提としている。
したがって、CANコントローラ210のメールボックス230に格納されたCANメッセージは、従来通り、定常タスク処理の実行時にCPU110のCPU側メールボックス120に転送、格納されるものとする。
CAN communication control processing in the embodiment of the present invention described below with reference to FIG. 2 does not replace conventional steady-state task processing, and it is premised that steady-state task processing is also executed conventionally. And
Therefore, it is assumed that the CAN message stored in the
次に、図2を参照しつつ説明するCAN通信制御処理の実行開始の前提条件の一つとなるCPU110による割り込み処理について説明する。
CANコントローラ210は、外部からCANメッセージが到達するとCPU110へ対してCANメッセージの到達を通知する。CPU110は、CANコントローラ210からのCANメッセージ到達の通知を受信すると、到達したCANメッセージが、先に説明したアクセプタンスフィルタにより設定されたいずれかのIDに該当するものであるか否かの判定を行う。
Next, interrupt processing by the
When the CAN message arrives from the outside, the
CPU110において、到達したCANメッセージのIDがアクセプタンスフィルタに設定されたIDに該当すると判定されると、CPU110自身に割り込みを行い、図2に示されたCAN通信制御処理を開始させるようになっている。
先に説明した図4においては、”Interrupt”と表記された時点で、ID=0x301(16進表示)を有するCANメッセージの到達により割り込みが発生したことが一例として示されている。
When the
In FIG. 4 described above, it is shown as an example that an interrupt is generated due to the arrival of a CAN message having ID = 0x301 (in hexadecimal notation) when it is written as "Interrupt".
次に、上述の前提条件の下、CPU110によって実行される割り込み処理に基づくCAN通信制御処理の手順について、図2を参照しつつ説明する。
CPU110による処理が開始されると、テンポラリバッファメモリ130のメモリ番地が零に設定される(図2のステップS100参照)。
Next, a procedure of CAN communication control processing based on the interrupt processing executed by the
When the processing by the
ここで、テンポラリバッファメモリ番地は、テンポラリバッファメモリ130の各メッセージ格納域130−1〜130−10を識別するための番地である。
この例においては、第1のメッセージ格納域130−1の番地を”零”として、以下、昇順に番地が付与されており、第10のメッセージ格納域130−10のメモリ番地は”9”である。
Here, the temporary buffer memory address is an address for identifying each of the message storage areas 130-1 to 130-10 of the
In this example, the addresses of the first message storage area 130-1 are "zero" and addresses are assigned in ascending order, and the memory address of the tenth message storage area 130-10 is "9". is there.
次いで、テンポラリバッファメモリ番地が最大番地を下回っているか否かが判定される(図2のステップS110参照)。
ステップS110において、テンポラリバッファメモリ番地が最大番地を下回っていると判定された場合(YESの場合)には、次述するステップS120の処理へ進む。
Next, it is determined whether the temporary buffer memory address is below the maximum address (see step S110 in FIG. 2).
When it is determined in step S110 that the temporary buffer memory address is below the maximum address (in the case of YES), the process proceeds to the processing of step S120 described next.
一方、ステップS110において、テンポラリバッファメモリ番地は最大番地を下回っていないと判定された場合(NOの場合)には、テンポラリバッファメモリ番地は最大番地に達したとして、一旦、一連の処理は終了されることとなる。 On the other hand, if it is determined in step S110 that the temporary buffer memory address is not smaller than the maximum address (in the case of NO), the temporary buffer memory address reaches the maximum address, and the series of processing is temporarily ended. The Rukoto.
ステップS120においては、このステップS120の実行時点におけるテンポラリバッファメモリ番地の受信フラグが”1”以外か否かが判定される。すなわち、換言すれば、メッセージ格納域130−1〜130−10のなかから、受信フラグが上書き許可に設定されているメッセージ格納域の検出が行われる。
ステップS120において、受信フラグは”1”以外であると判定された場合(YESの場合)には、受信フラグは”0”であるとして次述するステップS130の処理へ進む。一方、ステップS120において、受信フラグは”1”以外ではないと判定された場合(NOの場合)には、受信フラグは”1”であるとして、後述するステップS140の処理へ進む。
In step S120, it is determined whether the reception flag of the temporary buffer memory address at the time of execution of step S120 is other than "1". In other words, among the message storage areas 130-1 to 130-10, detection of a message storage area whose reception flag is set to overwrite permission is performed.
If it is determined in step S120 that the reception flag is other than "1" (in the case of YES), the process proceeds to the processing of step S130 described next, assuming that the reception flag is "0". On the other hand, when it is determined in step S120 that the reception flag is not "1" (in the case of NO), the reception flag is determined to be "1", and the process proceeds to step S140 described later.
ステップS130においては、受信フラグがメッセージ格納域への書き込み可能であることを意味する”0”であることに基づいて、CANコントローラ210のメールボックス230のCANメッセージが、この受信フラグ”0”のテンポラリバッファメモリ130のメッセージ格納域130−1〜130−10の一つに書き込まれる(上書き)される。
In step S130, based on the fact that the reception flag is “0”, which means that the message storage area can be written, the CAN message of the
例えば、先の図4には、ID=0x301を有するCANメッセージの到達により割り込み処理が発生した例が示されているが、この場合であれば、ID=0x301を有するCANメッセージがID=0x301を受信可能とするアクセプタンスフィルタを設定したCANコントローラ210のメールボックス230から抽出され、テンポラリバッファメモリ130のメッセージ格納域130−1〜130−10の一つに書き込まることとなる。
For example, although FIG. 4 shows an example in which interrupt processing occurs due to the arrival of a CAN message having ID = 0x301, in this case, a CAN message having ID = 0x301 shows ID = 0x301. The acceptance filter for enabling reception is extracted from the
CANメッセージが上書きされた後は、該当するメッセージ格納域に対する受信フラグは”1”に設定され、後述する定常タスク処理により”0”にリセットされるまでは新たなCANメッセージの上書き禁止とされる。そして、一連の処理は一旦終了されて、図示されないメインルーチンへ戻ることとなる(図2のステップS130参照)。 After the CAN message is overwritten, the reception flag for the corresponding message storage area is set to "1", and the new CAN message is prohibited from being overwritten until it is reset to "0" by the regular task processing described later. . Then, the series of processes is temporarily ended, and the process returns to the main routine (not shown) (see step S130 in FIG. 2).
一方、ステップS120において、受信フラグは”1”以外ではないと判定された場合には、受信フラグは”1”であるとして、テンポラリバッファメモリ130の該当するメッセージ格納域130−1〜130−10に、CANメッセージの書き込みは行われない。そのため、テンポラリバッファメモリ番地が1番地更新され、先のステップS110の処理へ戻ることとなる(図2のステップS140参照)。
On the other hand, when it is determined in step S120 that the reception flag is not "1", the reception flag is "1", and the corresponding message storage areas 130-1 to 130-10 of
次に、定常タスク処理におけるテンポラリバッファメモリ130からのCANメッセージの転送処理について、図3を参照しつつ説明する。
CPU110による定常タスク処理が開始されると、最初に、テンポラリバッファメモリ番地が零に設定される(図3のステップS200参照)。
Next, transfer processing of the CAN message from the
When steady-state task processing by the
次いで、テンポラリバッファメモリ番地が最大番地を下回っているか否かが判定される(図2のステップS210参照)。
ここで、ステップS200及びS210の処理は、図2に示されたステップS100及びS110の処理と同一であるので、ここでの再度の詳細な説明は省略する。
Next, it is determined whether the temporary buffer memory address is below the maximum address (see step S210 in FIG. 2).
Here, since the processes of steps S200 and S210 are the same as the processes of steps S100 and S110 shown in FIG. 2, the detailed description thereof will be omitted here.
ステップS210において、テンポラリバッファメモリ番地が最大番地を下回っていると判定された場合(YESの場合)には、次述するステップS220の処理へ進む。
一方、ステップS210において、テンポラリバッファメモリ番地は最大番地を下回っていないと判定された場合(NOの場合)には、テンポラリバッファメモリ番地は最大番地に達したとして、一旦、一連の処理は終了されることとなる。
If it is determined in step S210 that the temporary buffer memory address is below the maximum address (in the case of YES), the process proceeds to the processing of step S220 described next.
On the other hand, if it is determined in step S210 that the temporary buffer memory address is not smaller than the maximum address (in the case of NO), the temporary buffer memory address reaches the maximum address, and the series of processing is temporarily ended. The Rukoto.
ステップS220においては、メッセージ転送が行われる。
すなわち、ステップS220の実行時におけるテンポラリバッファメモリ番地に該当するテンポラリバッファメモリ130のメッセージ格納域130−1〜130−10に格納されているCANメッセージが、そのCANメッセージの内容に応じた処理等の実行のため、CANメッセージの内容に応じて予め定められている他のRAM等の記憶領域へ転送される。
In step S220, message transfer is performed.
That is, the CAN message stored in the message storage areas 130-1 to 130-10 of the
次いで、CANメッセージの転送が行われたメッセージ格納域130−1〜130−10に対する受信フラグが”0”に設定され、以後、新たにCANメッセージの上書きが可能とされる(図2のステップ230参照)。
次いで、テンポラリバッファメモリ番地が1番地更新され、先のステップS210の処理へ戻り、テンポラリバッファメモリ番地が最大値に到達すまで同様の処理が繰り返されることとなる(図3のステップS240参照)。
Next, the reception flag for the message storage areas 130-1 to 130-10 to which the CAN message has been transferred is set to "0", and thereafter, the CAN message can be newly overwritten (
Next, the temporary buffer memory address is updated to 1, and the process returns to the previous step S210, and the same process is repeated until the temporary buffer memory address reaches the maximum value (see step S240 in FIG. 3).
なお、上述の実施例においては、外部から到達したCANデータのIDがアクセプタンスフィルタに設定されたIDに該当するとCPU110により判定されることが、図2に示されたCAN通信制御処理を開始する前提となる割込処理を開始する条件(割込条件)であるとして説明したが、割込条件は、これに限定され必要はない。
In the above-described embodiment, it is assumed that the
例えば、所定時間毎に割り込み処理を実行して、メールボックス230のデータ格納域230−1〜230−nをメモリ番地順に、図2のCAN通信制御処理の対象としても好適である。
また、メールボックス230のデータ格納域230−1〜230−nの各々においては、CANメッセージが格納される頻度が異なるので、その頻度が一定の基準以下の場合には、そのデータ格納域に対応するCANメッセージが到達しても割り込み処理を実行せず、頻度の高いものについてのみ割り込み処理を実行することで、割り込みによるCPU110の負担を軽減するようにしても好適である。
For example, the interrupt processing is executed at predetermined time intervals, and the data storage areas 230-1 to 230-n of the
Moreover, in each of the data storage areas 230-1 to 230-n of the
101…電子制御ユニット
120…CPU側メールボックス
130…テンポラリバッファメモリ
201…CAN通信制御装置
230…メールボックス
101 ... Electronic control unit
120 ... CPU side mailbox
130: Temporary buffer memory
201 ... CAN communication control device
230 ... mailbox
Claims (7)
前記メールボックス(230)に格納されたCANメッセージを格納するCPU側メールボックス(120)を有して、定常タスク処理により前記メールボックス(230)に格納されたCANメッセージを前記CPU側メールボックス(120)に格納するCPU(110)と
を有するCAN通信制御装置(201)であって、
前記CPU(110)には、複数のメッセージ格納域(130−1〜130−10)を有するテンポラリバッファメモリ(130)が設けられ、
前記CPU(110)は、
所定割込条件の下、実行中の処理に対して割り込みを行い、
前記複数のメッセージ格納域(130−1〜130−10)の中から受信フラグが上書き許可に設定されているメッセージ格納域(130−1〜130−10)を検出し、
当該検出されたメッセージ格納域(130−1〜130−10)に、前記メールボックス(230)に格納されたCANメッセージの中から所定の選択条件で選択されたCANメッセージを格納すると共に、当該CANメッセージを所要の箇所へ転送するまで前記受信フラグを上書き禁止状態に設定する
ことを特徴とするCAN通信制御装置。 CAN controller (210) which temporarily stores CAN messages arrived from the outside in mailbox (230),
The CPU-side mailbox (120) for storing the CAN message stored in the mailbox (230), the CAN message stored in the mailbox (230) by the routine task processing A CAN communication controller (201) having a CPU (110) stored in
The CPU (110) is provided with a temporary buffer memory (130) having a plurality of message storage areas (130-1 to 130-10),
The CPU (110) is
Interrupt the process being executed under the specified interrupt condition,
Among the plurality of message storage areas (130-1 to 130-10), a message storage area (130-1 to 130-10) in which the reception flag is set to overwrite permission is detected,
In the detected message storage area (130-1 to 130-10), a CAN message selected according to a predetermined selection condition from the CAN messages stored in the mail box (230) is stored, The CAN communication control device, wherein the reception flag is set in the overwrite inhibition state until the message is transferred to a desired place.
ことを特徴とする請求項1に記載のCAN通信制御装置。 The CAN communication control according to claim 1, wherein the predetermined interrupt condition detects that the CPU (110) has arrived at the CAN controller (210) of a CAN message having a preset ID. apparatus.
ことを特徴とする請求項2に記載のCAN通信制御装置。 The CAN communication control device according to claim 2, wherein the predetermined selection condition is that the ID detected by the CPU (110) matches the ID of the CAN message stored in the mailbox (230). .
ことを特徴とする請求項1に記載のCAN通信制御装置。 The predetermined interrupt condition is a fixed time interval
The CAN communication control device according to claim 1,
ことを特徴とする請求項4に記載のCAN通信制御装置。 The predetermined selection condition is memory address order
The CAN communication control device according to claim 4, characterized in that:
ことを特徴する請求項1〜5の何れか一項に記載のCAN通信制御装置。 The temporary buffer memory (130) is configured using another existing memory having a free space.
The CAN communication control device according to any one of claims 1 to 5, characterized in that:
前記メールボックス(230)に格納されたCANメッセージを格納するCPU側メールボックス(120)を有して、定常タスク処理により前記メールボックス(230)に格納されたCANメッセージを前記CPU側メールボックス(120)に格納するCPU(110)とを有するCAN通信制御装置(201)のCAN通信制御方法であって、
所定割込条件の下、実行中の処理に対して割込を行う第1のステップと、
前記CPU(110)に設けられたテンポラリバッファメモリ(130)の複数のメッセージ格納域(130−1〜130−10)の中から受信フラグが上書き可能に設定されているメッセージ格納域(130−1〜130−10)を検出する第2のステップと、
前記受信フラグが上書き可能に設定されているとして検出されたメッセージ格納域(130−1〜130−10)に、前記メールボックス(230)に格納されたCANメッセージの中から所定の選択条件で選択されたCANメッセージを格納する第3のステップと、
前記CANメッセージが格納されたメッセージ格納域(130−1〜130−10)に対する受信フラグを、当該CANメッセージを所要の箇所へ転送するまで上書き禁止状態とする第4のステップとを有する
ことを特徴とするCAN通信制御方法。 CAN controller (210) which temporarily stores CAN messages arrived from the outside in mailbox (230),
The CPU-side mailbox (120) for storing the CAN message stored in the mailbox (230), the CAN message stored in the mailbox (230) by the routine task processing 120) a CAN communication control method of a CAN communication control apparatus (201) having a CPU (110) stored in (120),
A first step of interrupting a process being executed under a predetermined interrupt condition;
A message storage area (130-1 in which the reception flag is set to be overwritable from among a plurality of message storage areas (130-1 to 130-10) of the temporary buffer memory (130) provided in the CPU (110) A second step of detecting .about.130-10);
In the message storage area (130-1 to 130-10) detected that the reception flag is set to be overwritable, selected from the CAN messages stored in the mailbox (230) according to a predetermined selection condition A third step of storing the identified CAN message,
And a fourth step of setting the reception flag for the message storage area (130-1 to 130-10) in which the CAN message is stored to the overwrite prohibition state until the CAN message is transferred to a desired location. CAN communication control method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017214731A JP2019087878A (en) | 2017-11-07 | 2017-11-07 | CAN communication control device and CAN communication control method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017214731A JP2019087878A (en) | 2017-11-07 | 2017-11-07 | CAN communication control device and CAN communication control method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2019087878A true JP2019087878A (en) | 2019-06-06 |
Family
ID=66763464
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017214731A Pending JP2019087878A (en) | 2017-11-07 | 2017-11-07 | CAN communication control device and CAN communication control method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2019087878A (en) |
-
2017
- 2017-11-07 JP JP2017214731A patent/JP2019087878A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110706069B (en) | Exception handling method, device, server and system for order payment request | |
CN110674065B (en) | Method and system for competitive arbitration on bus | |
CN102255804A (en) | Message processing method, device and network equipment | |
JP5082674B2 (en) | Image forming apparatus and program | |
CN105814861B (en) | Apparatus and method for transmitting data | |
CN113452770B (en) | Data synchronization method, device, computer equipment and storage medium | |
JP5237438B2 (en) | A subscriber node of a communication system with a functionally distinct transmission event memory | |
US8588234B2 (en) | Data processing apparatus, method, and computer-readable storage medium for dynamically controlling a transmission interval | |
KR102303424B1 (en) | Direct memory access control device for at least one processing unit having a random access memory | |
JP2019087878A (en) | CAN communication control device and CAN communication control method | |
JP2015111403A5 (en) | ||
JP6344348B2 (en) | Buffer control device, communication node, and relay device | |
JP5383564B2 (en) | Data transfer circuit and method | |
JP4563210B2 (en) | Communication control method, communication node, and communication system | |
JP7124681B2 (en) | repeater | |
JP6969410B2 (en) | In-vehicle relay device, relay method, information processing system, and vehicle | |
US8345684B2 (en) | Network linking device and method for transferring data packets by the same | |
JP2020042380A (en) | Information processing system, server device and information processing program | |
TWI486783B (en) | Method and system for accessing data | |
US20220286502A1 (en) | Communication control device, communication system, communication control method, and recording medium | |
US20240098144A1 (en) | Communication apparatus, information processing method, and information processing apparatus | |
JP2005094249A (en) | Packet relay method and packet relay apparatus | |
JP6690465B2 (en) | Wireless communication system and transmission timing distribution method for wireless device | |
JP6485338B2 (en) | Communications system | |
KR101430200B1 (en) | Method for controlling packet in wireless local area network |