JP2016091308A - Electronic control apparatus and memory rewrite method - Google Patents

Electronic control apparatus and memory rewrite method Download PDF

Info

Publication number
JP2016091308A
JP2016091308A JP2014225082A JP2014225082A JP2016091308A JP 2016091308 A JP2016091308 A JP 2016091308A JP 2014225082 A JP2014225082 A JP 2014225082A JP 2014225082 A JP2014225082 A JP 2014225082A JP 2016091308 A JP2016091308 A JP 2016091308A
Authority
JP
Japan
Prior art keywords
data
cpu
received
rewriting
control program
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.)
Granted
Application number
JP2014225082A
Other languages
Japanese (ja)
Other versions
JP6394291B2 (en
Inventor
一隆 福田
Kazutaka Fukuda
一隆 福田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2014225082A priority Critical patent/JP6394291B2/en
Publication of JP2016091308A publication Critical patent/JP2016091308A/en
Application granted granted Critical
Publication of JP6394291B2 publication Critical patent/JP6394291B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To reduce the time required for rewriting a control program.SOLUTION: An ECU 1 includes CPUs 11, 12, and executes control processing for controlling an engine. The ECU 1 includes a flash ROM 13 (hereinafter referred to as ROM 13). The ROM 13 is allowed to rewrite data stored therein, and stores a control program for executing the control processing. When the ECU 1 externally receives rewrite data for rewriting the contents of the control program stored in the ROM 13, the CPU 11 stores the received rewrite data in a receiving buffer 21. The CPU 12 writes the rewrite data stored in the receiving buffer 21 to the ROM 13, to rewrite the contents of the control program stored in the ROM 13. The CPU 12 confirms coincidence between the received rewrite data and the rewrite data written to the ROM 13.SELECTED DRAWING: Figure 1

Description

本発明は、所定の制御対象の制御に用いる制御プログラムを書き換え可能な電子制御装置およびメモリ書換方法に関する。   The present invention relates to an electronic control device and a memory rewriting method capable of rewriting a control program used for controlling a predetermined control target.

従来、記憶内容の書き換えが可能な不揮発性メモリに制御プログラムを記憶する電子制御装置において、制御プログラムの書き換えに要する時間を短縮するために、外部から受信した書換データを受信バッファに格納する格納処理と、受信バッファに格納された書換データを不揮発性メモリに書き込むことにより制御プログラムを書き換える書込処理とを並行に実行するものが知られている(例えば、特許文献1を参照)。   2. Description of the Related Art Conventionally, in an electronic control device that stores a control program in a non-volatile memory capable of rewriting stored contents, a storage process for storing rewrite data received from the outside in a reception buffer in order to shorten the time required for rewriting the control program And a writing process for rewriting a control program by writing rewrite data stored in a reception buffer in a nonvolatile memory is known (see, for example, Patent Document 1).

特開2000−20389号公報JP 2000-20389 A

このように制御プログラムの書き換えが可能な電子制御装置では、受信バッファに格納された書換データと不揮発性メモリに書き込まれたデータとの一致を確認するベリファイ処理が実行される。   In the electronic control device capable of rewriting the control program in this way, a verify process for confirming a match between the rewritten data stored in the reception buffer and the data written in the nonvolatile memory is executed.

しかし、特許文献1に記載の技術では、短い時間単位で見ると、格納処理と、書込処理およびベリファイ処理との何れか一方の処理しか実行できない時間が存在し、制御プログラムの書き換えに要する時間が長くなってしまうという問題があった。   However, in the technique described in Patent Document 1, when viewed in a short time unit, there is a time during which only one of the storage process, the write process, and the verify process can be executed, and the time required for rewriting the control program There was a problem that would become longer.

本発明は、こうした問題に鑑みてなされたものであり、制御プログラムの書き換えに要する時間を短縮することを目的とする。   The present invention has been made in view of these problems, and an object thereof is to shorten the time required for rewriting a control program.

上記目的を達成するためになされた第1発明は、複数のCPUを有し、所定の制御対象を制御するための制御処理を実行するように構成された電子制御装置であって、不揮発性メモリを備える。不揮発性メモリは、記憶内容の書き換えが可能であり、制御処理を実行するための制御プログラムを記憶する。   In order to achieve the above object, a first invention is an electronic control device having a plurality of CPUs and configured to execute a control process for controlling a predetermined control object. Is provided. The nonvolatile memory can rewrite the stored contents and stores a control program for executing control processing.

また、複数のCPUのうちの1つのCPUである第1CPUは、第1格納手段を備える。第1格納手段は、不揮発性メモリに記憶される制御プログラムの内容を書き換えるためのデータである書換データを当該電子制御装置が外部から受信すると、受信した書換データを、不揮発性メモリに書き込む前に一時的に記憶する受信バッファに格納する第1格納処理を実行する。   The first CPU, which is one of the plurality of CPUs, includes first storage means. When the electronic control unit receives rewrite data, which is data for rewriting the contents of the control program stored in the non-volatile memory, from the outside, the first storage means writes the received rewrite data to the non-volatile memory. A first storage process is executed for storing in a temporarily stored reception buffer.

また、複数のCPUのうち第1CPUと異なる1つのCPUである第2CPUは、第1書込手段と、第1確認手段とを備える。第1書込手段は、受信バッファに格納された書換データを不揮発性メモリに書き込むことにより、不揮発性メモリに記憶される制御プログラムの内容を書き換える第1書込処理を実行する。第1確認手段は、受信した書換データと、不揮発性メモリに書き込まれた書換データとの一致を確認する第1確認処理を実行する。   The second CPU, which is one CPU different from the first CPU among the plurality of CPUs, includes first writing means and first confirmation means. The first writing means executes a first writing process for rewriting the contents of the control program stored in the nonvolatile memory by writing the rewritten data stored in the reception buffer in the nonvolatile memory. The first confirmation means executes a first confirmation process for confirming a match between the received rewrite data and the rewrite data written in the nonvolatile memory.

このように構成された電子制御装置では、第1CPUが第1格納処理を実行するとともに、第2CPUが第1書込処理と第1確認処理を実行する。このように第1発明の電子制御装置は、書換データを受信バッファに格納する処理と、不揮発性メモリに書換データを書き込むとともに書換データの一致を確認する処理とをそれぞれ別のCPUで実行することができる。   In the electronic control device configured as described above, the first CPU executes the first storing process, and the second CPU executes the first writing process and the first confirmation process. As described above, the electronic control device according to the first aspect of the invention executes the process of storing the rewrite data in the reception buffer and the process of writing the rewrite data to the nonvolatile memory and confirming the rewrite data match by different CPUs. Can do.

これにより、第1発明の電子制御装置は、第1格納処理と、第1書込処理および第1確認処理との何れか一方しか実行できないという事態の発生を抑制し、制御プログラムの書き換えに要する時間を短縮することができる。   As a result, the electronic control device according to the first aspect of the present invention suppresses the occurrence of a situation in which only one of the first storage process, the first writing process, and the first confirmation process can be executed, and is required for rewriting the control program. Time can be shortened.

また、上記目的を達成するためになされた第2発明は、複数のCPUを有する電子制御装置のメモリ書換方法であって、第1格納手順と、第1書込手順と、第1確認手順とを備える。   A second invention made to achieve the above object is a memory rewriting method for an electronic control unit having a plurality of CPUs, wherein a first storing procedure, a first writing procedure, a first confirmation procedure, Is provided.

第1格納手順は、不揮発性メモリに記憶される制御プログラムの内容を書き換えるためのデータである書換データを当該電子制御装置が外部から受信すると、受信した書換データを、不揮発性メモリに書き込む前に一時的に記憶する受信バッファに格納する第1格納処理を、複数のCPUのうちの1つのCPUである第1CPUに実行させる。不揮発性メモリは、記憶内容の書き換えが可能であり所定の制御対象を制御するための制御プログラムを記憶する。   In the first storage procedure, when the electronic control device receives rewrite data, which is data for rewriting the contents of the control program stored in the nonvolatile memory, from the outside, the received rewrite data is written to the nonvolatile memory. A first storage process, which is one CPU among a plurality of CPUs, is caused to execute a first storage process that is stored in a reception buffer that is temporarily stored. The nonvolatile memory can rewrite the stored contents and stores a control program for controlling a predetermined control target.

第1書込手順は、受信バッファに格納された書換データを不揮発性メモリに書き込むことにより、不揮発性メモリに記憶される制御プログラムの内容を書き換える第1書込処理を、複数のCPUのうち第1CPUと異なる1つのCPUである第2CPUに実行させる。   In the first write procedure, the first write process of rewriting the contents of the control program stored in the nonvolatile memory by writing the rewritten data stored in the reception buffer in the nonvolatile memory The second CPU, which is one CPU different from the one CPU, is executed.

第1確認手順は、受信した書換データと、不揮発性メモリに書き込まれた書換データとの一致を確認する第1確認処理を第2CPUに実行させる。
第2発明のメモリ書換方法は、第1発明の電子制御装置にて実行される方法であり、当該方法を実行することで、第1発明の電子制御装置と同様の効果を得ることができる。
The first confirmation procedure causes the second CPU to execute a first confirmation process for confirming a match between the received rewrite data and the rewrite data written in the nonvolatile memory.
The memory rewriting method of the second invention is a method executed by the electronic control device of the first invention, and the same effect as that of the electronic control device of the first invention can be obtained by executing this method.

第1実施形態のECU1の構成を示すブロック図である。It is a block diagram which shows the structure of ECU1 of 1st Embodiment. CPU11で実行される処理を示すフローチャートである。It is a flowchart which shows the process performed by CPU11. CPU12で実行される処理を示すフローチャートである。It is a flowchart which shows the process performed by CPU12. 第1実施形態の第1書換処理を示すフローチャートである。It is a flowchart which shows the 1st rewriting process of 1st Embodiment. 第1実施形態の第2書換処理を示すフローチャートである。It is a flowchart which shows the 2nd rewriting process of 1st Embodiment. CPU11,12の動作を示すタイミングチャートである。3 is a timing chart showing the operation of CPUs 11 and 12. 第2実施形態のECU1の構成を示すブロック図である。It is a block diagram which shows the structure of ECU1 of 2nd Embodiment. 第2実施形態の第1書換処理を示すフローチャートである。It is a flowchart which shows the 1st rewriting process of 2nd Embodiment. 第2実施形態の第2書換処理を示すフローチャートである。It is a flowchart which shows the 2nd rewriting process of 2nd Embodiment.

(第1実施形態)
以下に本発明の第1実施形態を図面とともに説明する。
本実施形態の電子制御装置(Electronic Control Unit)1(以下、ECU1という)は、車両に搭載され、車両に搭載されたエンジン(不図示)を制御する。
(First embodiment)
A first embodiment of the present invention will be described below with reference to the drawings.
An electronic control unit (Electronic Control Unit) 1 (hereinafter referred to as ECU 1) according to the present embodiment is mounted on a vehicle and controls an engine (not shown) mounted on the vehicle.

ECU1は、図1に示すように、マイクロコンピュータ(以下、マイコンという)2と、通信回路3とを備える。
マイコン2は、CPU11、CPU12、フラッシュROM13、RAM14およびCAN(登録商標:Controller Area Network)モジュール15を備える。
As shown in FIG. 1, the ECU 1 includes a microcomputer (hereinafter referred to as a microcomputer) 2 and a communication circuit 3.
The microcomputer 2 includes a CPU 11, a CPU 12, a flash ROM 13, a RAM 14, and a CAN (registered trademark: Controller Area Network) module 15.

CPU11,12は、フラッシュROM13に記憶されたプログラムに基づいて各種処理を実行する。
フラッシュROM13は、記憶内容を書き換え可能な不揮発性メモリである。フラッシュROM13には、ブートプログラムと、制御プログラムと、書換プログラムとが記憶されている。ブートプログラムは、マイコン2のリセット解除直後に実行されるプログラムである。制御プログラムは、エンジンを制御するためのプログラムである。制御プログラムは、エンジン制御用の制御プログラムを構成するデータと、その制御プログラムの実行時に参照される制御データとを含む。書換プログラムは、フラッシュROM13の記憶内容(すなわち、制御プログラムを構成するデータと、制御データ)を書き換えるためのプログラムである。
The CPUs 11 and 12 execute various processes based on programs stored in the flash ROM 13.
The flash ROM 13 is a nonvolatile memory that can rewrite stored contents. The flash ROM 13 stores a boot program, a control program, and a rewrite program. The boot program is a program that is executed immediately after the microcomputer 2 is reset. The control program is a program for controlling the engine. The control program includes data constituting a control program for engine control and control data referred to when the control program is executed. The rewrite program is a program for rewriting the storage contents of the flash ROM 13 (that is, data constituting the control program and control data).

ブートプログラム、制御プログラムおよび書換プログラムは、CPU11が実行するプログラムと、CPU12が実行するプログラムとを含む。
以下、CPU11が実行するブートプログラム、制御プログラムおよび書換プログラムをそれぞれ、第1ブートプログラム、第1制御プログラムおよび第1書換プログラムという。また、CPU12が実行するブートプログラム、制御プログラムおよび書換プログラムをそれぞれ、第2ブートプログラム、第2制御プログラムおよび第2書換プログラムという。
The boot program, the control program, and the rewrite program include a program executed by the CPU 11 and a program executed by the CPU 12.
Hereinafter, the boot program, control program, and rewrite program executed by the CPU 11 are referred to as a first boot program, a first control program, and a first rewrite program, respectively. The boot program, control program, and rewrite program executed by the CPU 12 are referred to as a second boot program, a second control program, and a second rewrite program, respectively.

RAM14は、揮発性メモリであり、CPU11,12の演算結果等を一時的に記憶する。またRAM14には、受信バッファ21が設けられている。受信バッファ21は、フラッシュROM13に記憶されるプログラムの書き換え等を行うためのプログラム書換装置6から受信したデータを一時的に記憶するための記憶領域である。   The RAM 14 is a volatile memory, and temporarily stores calculation results of the CPUs 11 and 12. The RAM 14 is provided with a reception buffer 21. The reception buffer 21 is a storage area for temporarily storing data received from the program rewriting device 6 for rewriting a program stored in the flash ROM 13.

CANモジュール15は、通信回路3を介して通信フレームを送受信する送受信制御、および複数のECU(不図示)から同時に通信フレームが送信された場合の調停を行う調停制御等のCAN通信プロトコルに従った制御を実行する。   The CAN module 15 conforms to a CAN communication protocol such as transmission / reception control for transmitting / receiving a communication frame via the communication circuit 3 and arbitration control for performing arbitration when a communication frame is simultaneously transmitted from a plurality of ECUs (not shown). Execute control.

また、CPU11とCPU12との間、CPU11,12とフラッシュROM13との間、CPU11,12とRAM14との間、およびCPU11とCANモジュール15との間は、データ通信可能に接続されている。   Further, the CPU 11 and the CPU 12, the CPUs 11 and 12 and the flash ROM 13, the CPUs 11 and 12 and the RAM 14, and the CPU 11 and the CAN module 15 are connected so as to be capable of data communication.

通信回路3は、マイコン2のCANモジュール15から入力するデジタル信号をCAN通信プロトコルに従う差動信号に変換して通信線7へ出力するとともに、通信線7から入力する差動信号をデジタル信号に変換してCANモジュール15へ出力する。   The communication circuit 3 converts a digital signal input from the CAN module 15 of the microcomputer 2 into a differential signal according to the CAN communication protocol and outputs the differential signal to the communication line 7 and converts the differential signal input from the communication line 7 into a digital signal. And output to the CAN module 15.

また通信回路3には、プログラム書換装置6が通信線7を介して接続される。プログラム書換装置6は、例えば、コネクタ8を介して着脱可能になっており、プログラムの書き換え時等にECU1に接続される。なおプログラム書換装置6は、マイコンおよび表示装置を備えたハンディタイプの装置または小型のパソコン等である。   A program rewriting device 6 is connected to the communication circuit 3 via a communication line 7. The program rewriting device 6 is detachable through, for example, a connector 8 and is connected to the ECU 1 when the program is rewritten. The program rewriting device 6 is a handy type device provided with a microcomputer and a display device or a small personal computer.

このように構成されたECU1において、マイコン2のCPU11は、リセット解除直後に、フラッシュROM13内の第1ブートプログラムを実行し、マイコン2のCPU12は、リセット解除直後に、フラッシュROM13内の第2ブートプログラムを実行する。   In the ECU 1 configured as described above, the CPU 11 of the microcomputer 2 executes the first boot program in the flash ROM 13 immediately after the reset is released, and the CPU 12 of the microcomputer 2 executes the second boot in the flash ROM 13 immediately after the reset is released. Run the program.

次に、マイコン2のCPU11で実行される処理を説明する。図2は、CPU11で実行される処理を示すフローチャートである。図2におけるS10〜S50の処理が、フラッシュROM13内の第1ブートプログラムによって実行される。S60の処理が、フラッシュROM13内の第1制御プログラムによって実行される。S70の処理が、フラッシュROM13内の第1書換プログラムによって実行される。   Next, processing executed by the CPU 11 of the microcomputer 2 will be described. FIG. 2 is a flowchart showing processing executed by the CPU 11. The processing of S10 to S50 in FIG. 2 is executed by the first boot program in the flash ROM 13. The process of S60 is executed by the first control program in the flash ROM 13. The process of S70 is executed by the first rewriting program in the flash ROM 13.

車両のイグニッションスイッチ(不図示)のオンに伴い電源が投入されると、マイコン2のCPU11がリセット状態から動作を開始して、第1ブートプログラムの実行を開始し、図2に示すように、まずS10にて、プログラム書換装置6からプログラム書換要求を受信したか否かを判断する。なお、プログラム書換要求には、書き込まれるプログラムの総データ量を示す総書込データ量情報が含まれる。   When power is turned on when an ignition switch (not shown) of the vehicle is turned on, the CPU 11 of the microcomputer 2 starts operation from the reset state and starts executing the first boot program, as shown in FIG. First, in S10, it is determined whether or not a program rewrite request is received from the program rewriting device 6. The program rewrite request includes total write data amount information indicating the total data amount of the program to be written.

ここで、プログラム書換要求を受信していない場合には(S10:NO)、S20にて、第1制御プログラムが既にフラッシュROM13に書き込まれているか否かを判断する。ここで、第1制御プログラムが書き込まれていない場合には(S20:NO)、S10に移行して、上述の処理を繰り返す。一方、第1制御プログラムが書き込まれている場合には(S20:YES)、S30にて、フラッシュROM13内の第1制御プログラムへジャンプする。これにより、フラッシュROM13内の第1制御プログラムが実行されて、S60に示すように、エンジンを制御するための制御処理が行われることとなる。   If no program rewrite request has been received (S10: NO), it is determined in S20 whether or not the first control program has already been written in the flash ROM 13. If the first control program is not written (S20: NO), the process proceeds to S10 and the above-described process is repeated. On the other hand, if the first control program is written (S20: YES), the process jumps to the first control program in the flash ROM 13 in S30. As a result, the first control program in the flash ROM 13 is executed, and control processing for controlling the engine is performed as shown in S60.

一方、プログラム書換要求を受信した場合には(S10:YES)、S40にて、受信したプログラム書換要求をCPU12へ送信する。そしてS50にて、フラッシュROM13内の第1書換プログラムへジャンプする。これにより、フラッシュROM13内の第1書換プログラムが実行されて、S70に示すように、第1書換処理が行われる。   On the other hand, when the program rewrite request is received (S10: YES), the received program rewrite request is transmitted to the CPU 12 in S40. In S50, the process jumps to the first rewriting program in the flash ROM 13. Thereby, the first rewriting program in the flash ROM 13 is executed, and the first rewriting process is performed as shown in S70.

次に、マイコン2のCPU12で実行される処理を説明する。図3は、CPU12で実行される処理を示すフローチャートである。図3におけるS110〜S140の処理が、フラッシュROM13内の第2ブートプログラムによって実行される。S150の処理が、フラッシュROM13内の第2制御プログラムによって実行される。S160の処理が、フラッシュROM13内の第2書換プログラムによって実行される。   Next, processing executed by the CPU 12 of the microcomputer 2 will be described. FIG. 3 is a flowchart showing processing executed by the CPU 12. The processes of S110 to S140 in FIG. 3 are executed by the second boot program in the flash ROM 13. The process of S150 is executed by the second control program in the flash ROM 13. The process of S160 is executed by the second rewrite program in the flash ROM 13.

車両のイグニッションスイッチ(不図示)のオンに伴い電源が投入されると、マイコン2のCPU12がリセット状態から動作を開始して、第2ブートプログラムの実行を開始し、図3に示すように、まずS110にて、CPU11からプログラム書換要求を受信したか否かを判断する。   When power is turned on when an ignition switch (not shown) of the vehicle is turned on, the CPU 12 of the microcomputer 2 starts operation from the reset state and starts executing the second boot program, as shown in FIG. First, in S110, it is determined whether a program rewrite request is received from the CPU 11.

ここで、プログラム書換要求を受信していない場合には(S110:NO)、S120にて、第2制御プログラムが既にフラッシュROM13に書き込まれているか否かを判断する。ここで、第2制御プログラムが書き込まれていない場合には(S120:NO)、S110に移行して、上述の処理を繰り返す。一方、第2制御プログラムが書き込まれている場合には(S120:YES)、S130にて、フラッシュROM13内の第2制御プログラムへジャンプする。これにより、フラッシュROM13内の第2制御プログラムが実行されて、S140に示すように、エンジンを制御するための制御処理が行われることとなる。   If no program rewrite request has been received (S110: NO), it is determined in S120 whether or not the second control program has already been written to the flash ROM 13. If the second control program is not written (S120: NO), the process proceeds to S110 and the above-described process is repeated. On the other hand, if the second control program is written (S120: YES), the process jumps to the second control program in the flash ROM 13 in S130. As a result, the second control program in the flash ROM 13 is executed, and control processing for controlling the engine is performed as shown in S140.

一方、プログラム書換要求を受信した場合には(S110:YES)、S140にて、フラッシュROM13内の第2書換プログラムへジャンプする。これにより、フラッシュROM13内の第2書換プログラムが実行されて、S160に示すように、第2書換処理が行われる。   On the other hand, if a program rewrite request is received (S110: YES), the process jumps to the second rewrite program in the flash ROM 13 in S140. Thereby, the second rewriting program in the flash ROM 13 is executed, and the second rewriting process is performed as shown in S160.

次に、CPU11がS70で実行する第1書換処理の手順を説明する。
この第1書換処理が実行されると、CPU11は、図4に示すように、まずS210にて、プログラム書換装置6から送信されて来る書換データをCANモジュール15が新たに受信したか否かを判断する。ここで、書換データを受信していない場合には(S210:NO)、S250に移行する。
Next, the procedure of the first rewriting process executed by the CPU 11 in S70 will be described.
When the first rewriting process is executed, the CPU 11 first determines whether or not the CAN module 15 has newly received the rewriting data transmitted from the program rewriting device 6 in S210, as shown in FIG. to decide. Here, when rewrite data is not received (S210: NO), it transfers to S250.

一方、書換データを新たに受信した場合には(S210:YES)、S220にて、受信した書換データをRAM14内の受信バッファ21に格納する。
次にS230にて、受信バッファ21に格納された書換データのデータ量(以下、格納データ量という)が予め設定された書込実行データ量以上であるか否かを判断する。ここで、格納データ量が書込実行データ量未満である場合には(S230:NO)、S250に移行する。一方、格納データ量が書込実行データ量以上である場合には(S230:YES)、S240にて、CPU12へ書込処理要求を送信し、S250に移行する。
On the other hand, when the rewrite data is newly received (S210: YES), the received rewrite data is stored in the reception buffer 21 in the RAM 14 in S220.
Next, in S230, it is determined whether or not the amount of rewritten data stored in the reception buffer 21 (hereinafter referred to as stored data amount) is greater than or equal to a preset write execution data amount. If the stored data amount is less than the write execution data amount (S230: NO), the process proceeds to S250. On the other hand, if the stored data amount is equal to or greater than the write execution data amount (S230: YES), a write processing request is transmitted to the CPU 12 in S240, and the process proceeds to S250.

そしてS250に移行すると、CPU12から書込完了応答(後述)を受信したか否かを判断する。ここで、書込完了応答を受信していない場合には(S250:NO)、S210に移行して、上述の処理を繰り返す。   In S250, it is determined whether a write completion response (described later) is received from the CPU 12. Here, when the write completion response has not been received (S250: NO), the process proceeds to S210 and the above-described processing is repeated.

一方、書込完了応答を受信した場合には(S250:YES)、S260にて、RAM14に設けられた第1書込回数カウンタをインクリメント(1加算)する。そしてS270にて、第1書込回数カウンタの値(以下、第1書込回数という)が終了判定回数以上であるか否かを判断する。なお終了判定回数は、総書込データ量情報が示すデータ量を書込実行データ量で除した除算値である。   On the other hand, when a write completion response is received (S250: YES), the first write number counter provided in the RAM 14 is incremented (added by 1) in S260. In S270, it is determined whether or not the value of the first write number counter (hereinafter referred to as the first write number) is equal to or greater than the end determination number. Note that the end determination count is a division value obtained by dividing the data amount indicated by the total write data amount information by the write execution data amount.

ここで、第1書込回数が終了判定回数未満である場合には(S270:NO)、S210に移行して、上述の処理を繰り返す。一方、第1書込回数が終了判定回数以上である場合には(S270:YES)、今回のプログラム書換要求で書き込むべきプログラムに関する全ての書き込みが終了したと判断し、第1書換処理を終了する。   If the first write count is less than the end determination count (S270: NO), the process proceeds to S210 and the above-described process is repeated. On the other hand, if the first write count is equal to or greater than the end determination count (S270: YES), it is determined that all writing related to the program to be written in the current program rewrite request has been completed, and the first rewrite processing is terminated. .

次に、CPU12がS160で実行する第2書換処理の手順を説明する。
この第2書換処理が実行されると、CPU12は、図5に示すように、まずS310にて、CPU11から書込処理要求を受信したか否かを判断する。ここで、書込処理要求を受信していない場合には(S310:NO)、S310の処理を繰り返すことにより、書込処理要求を受信するまで待機する。
Next, the procedure of the second rewriting process executed by the CPU 12 in S160 will be described.
When this second rewriting process is executed, the CPU 12 first determines in S310 whether or not a write process request has been received from the CPU 11, as shown in FIG. If no write process request has been received (S310: NO), the process of S310 is repeated until the write process request is received.

そして、書込処理要求を受信すると(S310:YES)、S320にて、RAM14内の受信バッファ21から、フラッシュROM13に書き込まれていないデータ(以下、未書込データという)を書込実行データ量分だけ読み出し、読み出した未書込データをフラッシュROM13に書き込む。   When a write processing request is received (S310: YES), data that has not been written to the flash ROM 13 (hereinafter referred to as unwritten data) is written from the reception buffer 21 in the RAM 14 in S320. Read only the amount and write the read unwritten data to the flash ROM 13.

そして、書込実行データ量分の未書込データの書き込みが終了すると、S330にて、書き込んだデータのベリファイ(verify)を実行する。具体的には、受信バッファ21から読み出したデータと、フラッシュROM13に書き込まれたデータが互いに一致しているか否かを確認する。   When the writing of the unwritten data corresponding to the write execution data amount is completed, the written data is verified in S330. Specifically, it is confirmed whether or not the data read from the reception buffer 21 and the data written in the flash ROM 13 match each other.

そしてS340にて、S330でのベリファイの結果に基づいて、受信バッファ21から読み出したデータと、フラッシュROM13に書き込まれたデータが互いに一致しているかを判断する。ここで、両データが一致していない場合には(S340:NO)、S320に移行し、上述の処理を繰り返す。   In S340, based on the result of verification in S330, it is determined whether the data read from the reception buffer 21 and the data written in the flash ROM 13 match each other. Here, when both data do not correspond (S340: NO), it transfers to S320 and repeats the above-mentioned process.

一方、両データが一致している場合には(S340:YES)、S350にて、RAM14に設けられた第2書込回数カウンタをインクリメントする。さらにS360にて、CPU11へ書込完了応答を送信する。   On the other hand, if the two data match (S340: YES), the second write number counter provided in the RAM 14 is incremented in S350. In step S360, a write completion response is transmitted to the CPU 11.

そしてS370にて、第2書込回数カウンタの値(以下、第2書込回数という)が終了判定回数以上であるか否かを判断する。
ここで、第2書込回数が終了判定回数未満である場合には(S370:NO)、S310に移行して、上述の処理を繰り返す。一方、第2書込回数が終了判定回数以上である場合には(S370:YES)、第2書換処理を終了する。
In S370, it is determined whether or not the value of the second write number counter (hereinafter referred to as the second write number) is equal to or greater than the end determination number.
If the second write count is less than the end determination count (S370: NO), the process proceeds to S310 and the above process is repeated. On the other hand, when the second write count is equal to or greater than the end determination count (S370: YES), the second rewrite process is terminated.

このように構成されたECU1は、CPU11およびCPU12を有し、エンジンを制御するための制御処理を実行する。そしてECU1は、フラッシュROM13を備える。フラッシュROM13は、記憶内容の書き換えが可能であり、制御処理を実行するための制御プログラムを記憶する。   ECU1 comprised in this way has CPU11 and CPU12, and performs the control processing for controlling an engine. The ECU 1 includes a flash ROM 13. The flash ROM 13 can rewrite the stored contents, and stores a control program for executing control processing.

またCPU11は、フラッシュROM13に記憶される制御プログラムの内容を書き換えるためのデータである書換データをECU1が外部から受信すると、受信した書換データを、フラッシュROM13に書き込む前に一時的に記憶する受信バッファ21に格納する(S220)。   Further, when the ECU 1 receives rewrite data, which is data for rewriting the contents of the control program stored in the flash ROM 13, from the outside, the reception buffer that temporarily stores the received rewrite data before writing it to the flash ROM 13. 21 (S220).

またCPU12は、受信バッファ21に格納された書換データをフラッシュROM13に書き込むことにより、フラッシュROM13に記憶される制御プログラムの内容を書き換える(S320)。   Further, the CPU 12 rewrites the contents of the control program stored in the flash ROM 13 by writing the rewrite data stored in the reception buffer 21 into the flash ROM 13 (S320).

またCPU12は、受信した書換データと、フラッシュROM13に書き込まれた書換データとの一致を確認する(S330)。
このようにECU1は、例えば図6に示すように、書換データを受信バッファ21に格納する処理と、フラッシュROM13に書換データを書き込むとともに書換データの一致を確認する処理とをそれぞれ別のCPUで実行することができる。
In addition, the CPU 12 checks whether the received rewrite data matches the rewrite data written in the flash ROM 13 (S330).
In this way, as shown in FIG. 6, for example, the ECU 1 executes processing for storing rewrite data in the reception buffer 21 and processing for writing rewrite data in the flash ROM 13 and confirming the rewrite data match with different CPUs. can do.

図6では、CPU11が、プログラム書換装置6から受信した書換データD1,D2,D3,D4,D5,D6,D7,D8,D9,・・・を順次、受信バッファ21に格納する。そしてCPU12は、CPU11が書換データD4,D5,D6,D7,D8,D9,・・・を格納する処理を行っている間に、書換データD1,D2,D3をフラッシュROM13に書き込む処理と、書換データD1,D2,D3のベリファイを実行している。   6, the CPU 11 sequentially stores the rewrite data D1, D2, D3, D4, D5, D6, D7, D8, D9,... Received from the program rewriting device 6 in the reception buffer 21. Then, the CPU 12 performs a process of writing the rewrite data D1, D2, D3 into the flash ROM 13 while the CPU 11 performs the process of storing the rewrite data D4, D5, D6, D7, D8, D9,. Data D1, D2, and D3 are verified.

これによりECU1は、書換データを受信バッファ21に格納する処理と、フラッシュROM13に書換データを書き込むとともに書換データの一致を確認する処理との何れか一方しか実行できないという事態の発生を抑制し、制御プログラムの書き換えに要する時間を短縮することができる。   As a result, the ECU 1 suppresses the occurrence of a situation where only one of the process of storing the rewrite data in the reception buffer 21 and the process of writing the rewrite data to the flash ROM 13 and confirming the match of the rewrite data can be executed. The time required for rewriting the program can be shortened.

以上説明した実施形態において、フラッシュROM13は本発明における不揮発性メモリ、CPU11は本発明における第1CPU、CPU12は本発明における第2CPU、S220の処理は本発明における第1格納手段および第1格納手順、S320の処理は本発明における第1書込手段および第1書込手順、S330の処理は本発明における第1確認手段および第1確認手順である。   In the embodiment described above, the flash ROM 13 is the non-volatile memory in the present invention, the CPU 11 is the first CPU in the present invention, the CPU 12 is the second CPU in the present invention, and the processing of S220 is the first storage means and the first storage procedure in the present invention. The process of S320 is the first writing means and the first writing procedure in the present invention, and the process of S330 is the first confirmation means and the first confirmation procedure in the present invention.

(第2実施形態)
以下に本発明の第2実施形態を図面とともに説明する。なお第2実施形態では、第1実施形態と異なる部分を説明する。
(Second Embodiment)
A second embodiment of the present invention will be described below with reference to the drawings. In the second embodiment, parts different from the first embodiment will be described.

第2実施形態のECU1は、図7に示すように、フラッシュROM13の代わりにフラッシュROM18,19を備える点が第1実施形態と異なる。
また第2実施形態のECU1は、CPU11,12とフラッシュROM13との間が接続される代わりに、CPU11とフラッシュROM18との間、およびCPU12とフラッシュROM19との間がデータ通信可能に接続される点が第1実施形態と異なる。
As shown in FIG. 7, the ECU 1 of the second embodiment differs from the first embodiment in that it includes flash ROMs 18 and 19 instead of the flash ROM 13.
In the ECU 1 of the second embodiment, instead of connecting the CPUs 11 and 12 and the flash ROM 13, the CPU 11 and the flash ROM 18 and the CPU 12 and the flash ROM 19 are connected so that data communication is possible. Is different from the first embodiment.

また第2実施形態のプログラム書換装置6は、フラッシュROM18に書き込むプログラムを送信した後に、フラッシュROM19に書き込むプログラムを送信するように構成されている。なお、プログラム書換装置6が送信するプログラム書換要求には、第1総書込データ量情報と第2総書込データ量情報が含まれる。第1総書込データ量情報は、フラッシュROM18に書き込まれるプログラムの総データ量を示す。第2総書込データ量情報は、フラッシュROM19に書き込まれるプログラムの総データ量を示す。   The program rewriting device 6 of the second embodiment is configured to transmit a program to be written to the flash ROM 19 after transmitting a program to be written to the flash ROM 18. The program rewrite request transmitted by the program rewriting device 6 includes first total write data amount information and second total write data amount information. The first total write data amount information indicates the total data amount of the program written to the flash ROM 18. The second total write data amount information indicates the total data amount of the program written in the flash ROM 19.

また第2実施形態のECU1は、CPU12とCANモジュール15との間がデータ通信可能に接続されている点が、第1実施形態と異なる。
また第2実施形態のECU1は、第1書換処理と第2書換処理が第1実施形態と異なる。
The ECU 1 of the second embodiment is different from the first embodiment in that the CPU 12 and the CAN module 15 are connected so that data communication is possible.
The ECU 1 of the second embodiment is different from the first embodiment in the first rewriting process and the second rewriting process.

次に、第2実施形態の第1書換処理の手順を説明する。
第2実施形態の第1書換処理が実行されると、CPU11は、図8に示すように、まずS410にて、CPU12から書込処理要求を受信したか否かを判断する。ここで、書込処理要求を受信していない場合には(S410:NO)、S410の処理を繰り返すことにより、書込処理要求を受信するまで待機する。
Next, the procedure of the first rewriting process of the second embodiment will be described.
When the first rewrite process of the second embodiment is executed, the CPU 11 first determines whether or not a write process request has been received from the CPU 12 in S410, as shown in FIG. If no write process request has been received (S410: NO), the process of S410 is repeated to wait until a write process request is received.

そして、書込処理要求を受信すると(S410:YES)、S420にて、まず、RAM14内の受信バッファ21から、フラッシュROM18に書き込まれていないデータ(以下、第1未書込データという)を書込実行データ量分だけ読み出し、読み出した第1未書込データをフラッシュROM18に書き込む。   When a write processing request is received (S410: YES), first, in S420, data that has not been written to the flash ROM 18 (hereinafter referred to as first unwritten data) is written from the reception buffer 21 in the RAM 14. The amount of read execution data is read, and the read first unwritten data is written to the flash ROM 18.

そして、書込実行データ量分の第1未書込データの書き込みが終了すると、S430にて、書き込んだデータのベリファイを実行する。具体的には、受信バッファ21から読み出したデータと、フラッシュROM18に書き込まれたデータが互いに一致しているか否かを確認する。   When the writing of the first unwritten data corresponding to the write execution data amount is completed, the written data is verified in S430. Specifically, it is confirmed whether or not the data read from the reception buffer 21 and the data written in the flash ROM 18 match each other.

そしてS440にて、S430でのベリファイの結果に基づいて、受信バッファ21から読み出したデータと、フラッシュROM18に書き込まれたデータが互いに一致しているかを判断する。ここで、両データが一致していない場合には(S440:NO)、S420に移行し、上述の処理を繰り返す。   In S440, based on the result of verification in S430, it is determined whether the data read from the reception buffer 21 and the data written in the flash ROM 18 match each other. Here, when both data do not correspond (S440: NO), it transfers to S420 and repeats the above-mentioned process.

一方、両データが一致している場合には(S440:YES)、S450にて、RAM14に設けられた第1書込回数カウンタをインクリメントする。さらにS460にて、CPU12へ書込完了応答を送信する。   On the other hand, if the two data match (S440: YES), the first write number counter provided in the RAM 14 is incremented in S450. In S460, a write completion response is transmitted to CPU 12.

そしてS470にて、第1書込回数カウンタの値(以下、第1書込回数という)が第1終了判定回数以上であるか否かを判断する。なお第1終了判定回数は、第1総書込データ量情報が示すデータ量を書込実行データ量で除した除算値である。   In S470, it is determined whether or not the value of the first write number counter (hereinafter referred to as the first write number) is equal to or greater than the first end determination number. The first end determination number is a division value obtained by dividing the data amount indicated by the first total write data amount information by the write execution data amount.

ここで、第1書込回数が第1終了判定回数未満である場合には(S470:NO)、S410に移行して、上述の処理を繰り返す。一方、第1書込回数が第1終了判定回数以上である場合には(S470:YES)、S480にて、CPU12へ役割交代要求を送信する。   If the first write count is less than the first end determination count (S470: NO), the process proceeds to S410 and the above-described processing is repeated. On the other hand, if the first write count is equal to or greater than the first end determination count (S470: YES), a role change request is transmitted to the CPU 12 at S480.

そしてS490にて、CPU12から役割交代応答を受信したか否かを判断する。ここで、役割交代応答を受信していない場合には(S490:NO)、S490の処理を繰り返すことにより、役割交代応答を受信するまで待機する。   In S490, it is determined whether a role change response is received from CPU 12. If the role change response has not been received (S490: NO), the process of S490 is repeated until the role change response is received.

そして、役割交代応答を受信すると(S490:YES)、S500にて、第1書込回数カウンタをリセット(0に設定)する。
その後S510にて、プログラム書換装置6から送信されて来る書換データをCANモジュール15が新たに受信したか否かを判断する。ここで、書換データを受信していない場合には(S510:NO)、S550に移行する。一方、書換データを新たに受信した場合には(S510:YES)、S520にて、受信した書換データをRAM14内の受信バッファ21に格納する。
When a role change response is received (S490: YES), the first writing number counter is reset (set to 0) in S500.
Thereafter, in S510, it is determined whether or not the CAN module 15 newly receives rewrite data transmitted from the program rewriting device 6. Here, when rewrite data is not received (S510: NO), it transfers to S550. On the other hand, when the rewrite data is newly received (S510: YES), the received rewrite data is stored in the reception buffer 21 in the RAM 14 in S520.

次にS530にて、格納データ量が予め設定された書込実行データ量以上であるか否かを判断する。ここで、格納データ量が書込実行データ量未満である場合には(S530:NO)、S550に移行する。一方、格納データ量が書込実行データ量以上である場合には(S530:YES)、S540にて、CPU12へ書込処理要求を送信し、S550に移行する。   Next, in S530, it is determined whether or not the amount of stored data is greater than or equal to a preset write execution data amount. If the stored data amount is less than the write execution data amount (S530: NO), the process proceeds to S550. On the other hand, if the stored data amount is equal to or greater than the write execution data amount (S530: YES), a write processing request is transmitted to the CPU 12 in S540, and the process proceeds to S550.

そしてS550に移行すると、CPU12から書込完了応答を受信したか否かを判断する。ここで、書込完了応答を受信していない場合には(S550:NO)、S510に移行して、上述の処理を繰り返す。   In S550, it is determined whether a write completion response is received from the CPU 12. Here, when the write completion response has not been received (S550: NO), the process proceeds to S510 and the above-described processing is repeated.

一方、書込完了応答を受信した場合には(S550:YES)、S560にて、RAM14に設けられた第1書込回数カウンタをインクリメントする。そしてS570にて、第1書込回数カウンタの値(第1書込回数)が第2終了判定回数以上であるか否かを判断する。なお第2終了判定回数は、第2総書込データ量情報が示すデータ量を書込実行データ量で除した除算値である。   On the other hand, if a write completion response is received (S550: YES), the first write number counter provided in the RAM 14 is incremented in S560. In S570, it is determined whether or not the value of the first write number counter (first write number) is equal to or greater than the second end determination number. The second end determination number is a division value obtained by dividing the data amount indicated by the second total write data amount information by the write execution data amount.

ここで、第1書込回数が第2終了判定回数未満である場合には(S570:NO)、S510に移行して、上述の処理を繰り返す。一方、第1書込回数が第2終了判定回数以上である場合には(S570:YES)、今回のプログラム書換要求で書き込むべきプログラムに関する全ての書き込みが終了したと判断し、第1書換処理を終了する。   If the first write count is less than the second end determination count (S570: NO), the process proceeds to S510 and the above-described processing is repeated. On the other hand, if the first write count is equal to or greater than the second end determination count (S570: YES), it is determined that all writing related to the program to be written in the current program rewrite request has been completed, and the first rewrite processing is performed. finish.

次に、第2実施形態の第2書換処理の手順を説明する。
第2実施形態の第2書換処理が実行されると、CPU12は、図9に示すように、まずS610にて、プログラム書換装置6から送信されて来る書換データをCANモジュール15が新たに受信したか否かを判断する。ここで、書換データを受信していない場合には(S610:NO)、S650に移行する。
Next, the procedure of the second rewriting process of the second embodiment will be described.
When the second rewriting process of the second embodiment is executed, the CPU 12 first receives the rewriting data transmitted from the program rewriting device 6 in S610, as shown in FIG. Determine whether or not. If no rewrite data is received (S610: NO), the process proceeds to S650.

一方、書換データを新たに受信した場合には(S610:YES)、S620にて、受信した書換データをRAM14内の受信バッファ21に格納する。
次にS630にて、受信バッファ21に格納された書換データのデータ量(格納データ量)が書込実行データ量以上であるか否かを判断する。ここで、格納データ量が書込実行データ量未満である場合には(S630:NO)、S650に移行する。一方、格納データ量が書込実行データ量以上である場合には(S630:YES)、S640にて、CPU11へ書込処理要求を送信し、S650に移行する。
On the other hand, when the rewrite data is newly received (S610: YES), the received rewrite data is stored in the reception buffer 21 in the RAM 14 in S620.
Next, in S630, it is determined whether or not the data amount (stored data amount) of the rewritten data stored in the reception buffer 21 is equal to or larger than the write execution data amount. If the stored data amount is less than the write execution data amount (S630: NO), the process proceeds to S650. On the other hand, if the amount of stored data is equal to or greater than the amount of write execution data (S630: YES), a write processing request is transmitted to the CPU 11 in S640, and the process proceeds to S650.

そしてS650に移行すると、CPU11から書込完了応答を受信したか否かを判断する。ここで、書込完了応答を受信していない場合には(S650:NO)、S610に移行して、上述の処理を繰り返す。   In step S650, it is determined whether a write completion response is received from the CPU 11. If a write completion response has not been received (S650: NO), the process proceeds to S610 and the above-described processing is repeated.

一方、書込完了応答を受信した場合には(S650:YES)、S660にて、RAM14に設けられた第2書込回数カウンタをインクリメントする。そしてS670にて、第2書込回数カウンタの値(以下、第2書込回数という)が第1終了判定回数以上であるか否かを判断する。   On the other hand, when the write completion response is received (S650: YES), the second write number counter provided in the RAM 14 is incremented in S660. In S670, it is determined whether or not the value of the second write number counter (hereinafter referred to as the second write number) is equal to or greater than the first end determination number.

ここで、第2書込回数が第1終了判定回数未満である場合には(S670:NO)、S610に移行して、上述の処理を繰り返す。一方、第2書込回数が第1終了判定回数以上である場合には(S670:YES)、S680にて、CPU11から役割交代要求を受信したか否かを判断する。ここで、役割交代要求を受信していない場合には(S680:NO)、S680の処理を繰り返すことにより、役割交代要求を受信するまで待機する。   If the second write count is less than the first end determination count (S670: NO), the process proceeds to S610 and the above process is repeated. On the other hand, if the second write count is equal to or greater than the first end determination count (S670: YES), it is determined in S680 whether a role change request has been received from the CPU 11. Here, when the role change request has not been received (S680: NO), the processing of S680 is repeated to wait until the role change request is received.

そして、役割交代要求を受信すると(S680:YES)、S690にて、CPU11へ役割交代応答を送信し、S700にて、第2書込回数カウンタをリセットする。
その後S710にて、CPU11から書込処理要求を受信したか否かを判断する。ここで、書込処理要求を受信していない場合には(S710:NO)、S710の処理を繰り返すことにより、書込処理要求を受信するまで待機する。
When a role change request is received (S680: YES), a role change response is transmitted to the CPU 11 in S690, and the second writing number counter is reset in S700.
Thereafter, in S710, it is determined whether a write processing request has been received from CPU 11. If no write process request has been received (S710: NO), the process of S710 is repeated to wait until a write process request is received.

そして、書込処理要求を受信すると(S710:YES)、S720にて、RAM14内の受信バッファ21から、フラッシュROM19に書き込まれていないデータ(以下、第2未書込データという)を書込実行データ量分だけ読み出し、読み出した第2未書込データをフラッシュROM19に書き込む。   When a write processing request is received (S710: YES), data that has not been written in the flash ROM 19 (hereinafter referred to as second unwritten data) is written from the reception buffer 21 in the RAM 14 in S720. Reads the data amount, and writes the read second unwritten data to the flash ROM 19.

そして、書込実行データ量分の第2未書込データの書き込みが終了すると、S730にて、書き込んだデータのベリファイを実行する。具体的には、受信バッファ21から読み出したデータと、フラッシュROM19に書き込まれたデータが互いに一致しているか否かを確認する。   When the writing of the second unwritten data corresponding to the write execution data amount is completed, the written data is verified in S730. Specifically, it is confirmed whether or not the data read from the reception buffer 21 and the data written in the flash ROM 19 match each other.

そしてS740にて、S730でのベリファイの結果に基づいて、受信バッファ21から読み出したデータと、フラッシュROM19に書き込まれたデータが互いに一致しているかを判断する。ここで、両データが一致していない場合には(S740:NO)、S720に移行し、上述の処理を繰り返す。   In step S740, based on the result of verification in step S730, it is determined whether the data read from the reception buffer 21 and the data written in the flash ROM 19 match each other. Here, when both data do not correspond (S740: NO), it transfers to S720 and repeats the above-mentioned process.

一方、両データが一致している場合には(S740:YES)、S750にて、第2書込回数カウンタをインクリメントする。さらにS760にて、CPU11へ書込完了応答を送信する。   On the other hand, if the two data match (S740: YES), the second write number counter is incremented in S750. In S760, a write completion response is transmitted to CPU 11.

そしてS770にて、第2書込回数カウンタの値(第2書込回数)が第2終了判定回数以上であるか否かを判断する。
ここで、第2書込回数が第2終了判定回数未満である場合には(S770:NO)、S710に移行して、上述の処理を繰り返す。一方、第2書込回数が第2終了判定回数以上である場合には(S770:YES)、今回のプログラム書換要求で書き込むべきプログラムに関する全ての書き込みが終了したと判断し、第2書換処理を終了する。
In S770, it is determined whether or not the value of the second write number counter (second write number) is equal to or greater than the second end determination number.
If the second write count is less than the second end determination count (S770: NO), the process proceeds to S710 and the above process is repeated. On the other hand, if the second write count is equal to or greater than the second end determination count (S770: YES), it is determined that all writing related to the program to be written in the current program rewrite request has been completed, and the second rewrite processing is performed. finish.

このように構成されたECU1は、CPU11およびCPU12を有し、エンジンを制御するための制御処理を実行する。そしてECU1は、フラッシュROM18,19を備える。フラッシュROM18は、CPU11が制御処理を実行するための第1制御プログラムを記憶する。フラッシュROM19は、CPU12が制御処理を実行するための第2制御プログラムを記憶する。   ECU1 comprised in this way has CPU11 and CPU12, and performs the control processing for controlling an engine. The ECU 1 includes flash ROMs 18 and 19. The flash ROM 18 stores a first control program for the CPU 11 to execute control processing. The flash ROM 19 stores a second control program for the CPU 12 to execute control processing.

CPU11は、フラッシュROM19に記憶される第2制御プログラムの内容を書き換えるためのデータである第2書換データを外部から受信すると、受信した第2書換データを受信バッファ21に格納する(S520)。   When the CPU 11 receives second rewrite data, which is data for rewriting the contents of the second control program stored in the flash ROM 19, from the outside, the CPU 11 stores the received second rewrite data in the reception buffer 21 (S520).

CPU12は、受信バッファ21に格納された第2書換データをフラッシュROM19に書き込むことにより、フラッシュROM19に記憶される第2制御プログラムの内容を書き換える(S720)。またCPU12は、受信した第2書換データと、フラッシュROM19に書き込まれた第2書換データとの一致を確認する(S730)。   The CPU 12 rewrites the content of the second control program stored in the flash ROM 19 by writing the second rewrite data stored in the reception buffer 21 into the flash ROM 19 (S720). In addition, the CPU 12 confirms the coincidence between the received second rewrite data and the second rewrite data written in the flash ROM 19 (S730).

CPU12は、更に、フラッシュROM18に記憶される第1制御プログラムの内容を書き換えるためのデータである第1書換データをECU1が外部から受信すると、受信した第1書換データを受信バッファ21に格納する(S620)。   Further, when the ECU 1 receives the first rewrite data, which is data for rewriting the content of the first control program stored in the flash ROM 18, from the outside, the CPU 12 stores the received first rewrite data in the reception buffer 21 ( S620).

CPU11は、更に、受信バッファ21に格納された第1書換データをフラッシュROM18に書き込むことにより、フラッシュROM18に記憶される第1制御プログラムの内容を書き換える(S420)。またCPU11は、受信した第1書換データと、フラッシュROM18に書き込まれた第1書換データとの一致を確認する(S430)。   Further, the CPU 11 rewrites the contents of the first control program stored in the flash ROM 18 by writing the first rewrite data stored in the reception buffer 21 into the flash ROM 18 (S420). Further, the CPU 11 confirms the coincidence between the received first rewrite data and the first rewrite data written in the flash ROM 18 (S430).

このようにECU1は、CPU11がフラッシュROM18に第1書換データを書き込む場合と、CPU12がフラッシュROM19に第2書換データを書き込む場合との両方で、書換データを格納する処理と、書換データを書き込むとともに書換データの一致を確認する処理とをそれぞれ別のCPUで実行することができる。   In this way, the ECU 1 writes the rewrite data and the rewrite data both when the CPU 11 writes the first rewrite data to the flash ROM 18 and when the CPU 12 writes the second rewrite data to the flash ROM 19. The process of confirming the rewrite data match can be executed by different CPUs.

これによりECU1は、CPU11,12がそれぞれフラッシュROM19,18にアクセスすることができない場合であっても、制御プログラムの書き換えに要する時間を短縮することができる。   As a result, the ECU 1 can shorten the time required for rewriting the control program even when the CPUs 11 and 12 cannot access the flash ROMs 19 and 18, respectively.

以上説明した実施形態において、フラッシュROM18は本発明における第1不揮発性メモリ、フラッシュROM19は本発明における第2不揮発性メモリ、S520の処理は本発明における第1格納手段および第1格納手順、S720の処理は本発明における第1書込手段および第1書込手順、S730の処理は本発明における第1確認手段および第1確認手順である。   In the embodiment described above, the flash ROM 18 is the first non-volatile memory according to the present invention, the flash ROM 19 is the second non-volatile memory according to the present invention, and the process of S520 is the first storage means and the first storage procedure according to the present invention. The processing is the first writing means and the first writing procedure in the present invention, and the processing of S730 is the first checking means and the first checking procedure in the present invention.

また、S620の処理は本発明における第2格納手段および第2格納手順、S420の処理は本発明における第2書込手段および第2書込手順、S430の処理は本発明における第2確認手段および第2確認手順である。   The process of S620 is the second storing means and the second storing procedure in the present invention, the process of S420 is the second writing means and the second writing procedure in the present invention, and the process of S430 is the second confirming means in the present invention and This is the second confirmation procedure.

以上、本発明の一実施形態について説明したが、本発明は上記実施形態に限定されるものではなく、本発明の技術的範囲に属する限り種々の形態を採ることができる。
例えば上記実施形態では、マイコン2が2個のCPU11,12を備えるものを示したが、3個以上のCPUを備えるようにしてもよい。
As mentioned above, although one Embodiment of this invention was described, this invention is not limited to the said embodiment, As long as it belongs to the technical scope of this invention, a various form can be taken.
For example, in the above-described embodiment, the microcomputer 2 includes two CPUs 11 and 12, but may include three or more CPUs.

また上記実施形態では、ECU1の制御対象が車両のエンジンであるものを示したが、これに限定されるものではなく、例えば自動変速機であってもよい。
また上記実施形態では、フラッシュROM13に制御プログラムを記憶するものを示したが、制御プログラムの記憶媒体としてはこれに限定されるものではなく、例えばEEPROMのように記憶内容の書き換えが可能な不揮発性メモリであればよい。
In the above-described embodiment, the control target of the ECU 1 is the vehicle engine. However, the present invention is not limited to this, and may be an automatic transmission, for example.
In the above embodiment, the control program is stored in the flash ROM 13. However, the storage medium for the control program is not limited to this, and for example, nonvolatile storage that can rewrite the storage content such as an EEPROM. Any memory can be used.

また、上記実施形態における1つの構成要素が有する機能を複数の構成要素として分散させたり、複数の構成要素が有する機能を1つの構成要素に統合させたりしてもよい。また、上記実施形態の構成の少なくとも一部を、同様の機能を有する公知の構成に置き換えてもよい。また、上記実施形態の構成の一部を省略してもよい。また、上記実施形態の構成の少なくとも一部を、他の上記実施形態の構成に対して付加または置換してもよい。なお、特許請求の範囲に記載した文言のみによって特定される技術思想に含まれるあらゆる態様が本発明の実施形態である。   In addition, the functions of one component in the above embodiment may be distributed as a plurality of components, or the functions of a plurality of components may be integrated into one component. Further, at least a part of the configuration of the above embodiment may be replaced with a known configuration having the same function. Moreover, you may abbreviate | omit a part of structure of the said embodiment. Further, at least a part of the configuration of the above embodiment may be added to or replaced with the configuration of the other embodiment. In addition, all the aspects included in the technical idea specified only by the wording described in the claim are embodiment of this invention.

1…ECU、2…マイコン、11,12…CPU、13,18,19…フラッシュROM、14…RAM、21…受信バッファ   DESCRIPTION OF SYMBOLS 1 ... ECU, 2 ... Microcomputer, 11, 12 ... CPU, 13, 18, 19 ... Flash ROM, 14 ... RAM, 21 ... Reception buffer

Claims (4)

複数のCPUを有し、所定の制御対象を制御するための制御処理を実行するように構成された電子制御装置(1)であって、
記憶内容の書き換えが可能であり、前記制御処理を実行するための制御プログラムを記憶する不揮発性メモリ(13,18,19)を備え、
複数の前記CPUのうちの1つの前記CPUである第1CPU(11)は、
前記不揮発性メモリに記憶される前記制御プログラムの内容を書き換えるためのデータである書換データを当該電子制御装置が外部から受信すると、受信した前記書換データを、前記不揮発性メモリに書き込む前に一時的に記憶する受信バッファ(21)に格納する第1格納処理を実行する第1格納手段(S220,S520)を備え、
複数の前記CPUのうち前記第1CPUと異なる1つの前記CPUである第2CPU(12)は、
前記受信バッファに格納された前記書換データを前記不揮発性メモリに書き込むことにより、前記不揮発性メモリに記憶される前記制御プログラムの内容を書き換える第1書込処理を実行する第1書込手段(S320,S720)と、
受信した前記書換データと、前記不揮発性メモリに書き込まれた前記書換データとの一致を確認する第1確認処理を実行する第1確認手段(S330,S730)とを備える
ことを特徴とする電子制御装置。
An electronic control device (1) having a plurality of CPUs and configured to execute a control process for controlling a predetermined control target,
The memory content can be rewritten, and includes a non-volatile memory (13, 18, 19) for storing a control program for executing the control process.
The first CPU (11), which is one of the plurality of CPUs,
When rewriting data, which is data for rewriting the contents of the control program stored in the non-volatile memory, is received from the outside by the electronic control unit, the received rewriting data is temporarily stored before being written to the non-volatile memory. Comprising first storage means (S220, S520) for executing a first storage process stored in the reception buffer (21) stored in
A second CPU (12), which is one of the CPUs, which is different from the first CPU,
First writing means (S320) that executes a first writing process for rewriting the contents of the control program stored in the nonvolatile memory by writing the rewritten data stored in the reception buffer to the nonvolatile memory. , S720),
Electronic control comprising: first confirmation means (S330, S730) for executing first confirmation processing for confirming a match between the received rewrite data and the rewrite data written in the nonvolatile memory apparatus.
前記不揮発性メモリは、
少なくとも、前記第1CPUが前記制御処理を実行するための第1制御プログラムを記憶する第1不揮発性メモリ(18)と、前記第2CPUが前記制御処理を実行するための第2制御プログラムを記憶する第2不揮発性メモリ(19)とから構成され、
前記第1CPUが備える前記第1格納手段(S520)は、
前記第2不揮発性メモリに記憶される前記第2制御プログラムの内容を書き換えるためのデータである第2書換データを外部から受信すると、受信した前記第2書換データを前記受信バッファに格納する処理を前記第1格納処理として実行し、
前記第2CPUが備える前記第1書込手段(S720)は、
前記受信バッファに格納された前記第2書換データを前記第2不揮発性メモリに書き込むことにより、前記第2不揮発性メモリに記憶される前記第2制御プログラムの内容を書き換える処理を前記第1書込処理として実行し、
前記第2CPUが備える前記第1確認手段(S730)は、
受信した前記第2書換データと、前記第2不揮発性メモリに書き込まれた前記第2書換データとの一致を確認する処理を前記第1確認処理として実行し、
前記第2CPUは、更に、
前記第1不揮発性メモリに記憶される前記第1制御プログラムの内容を書き換えるためのデータである第1書換データを当該電子制御装置が外部から受信すると、受信した前記第1書換データを前記受信バッファに格納する第2格納処理を実行する第2格納手段(S620)を備え、
前記第1CPUは、更に、
前記受信バッファに格納された前記第1書換データを前記第1不揮発性メモリに書き込むことにより、前記第1不揮発性メモリに記憶される前記第1制御プログラムの内容を書き換える第2書込処理を実行する第2書込手段(S420)と、
受信した前記第1書換データと、前記第1不揮発性メモリに書き込まれた前記第1書換データとの一致を確認する第2確認処理を実行する第2確認手段(S430)とを備える
ことを特徴とする請求項1に記載の電子制御装置。
The nonvolatile memory is
At least a first non-volatile memory (18) for storing a first control program for the first CPU to execute the control process, and a second control program for the second CPU to execute the control process. A second non-volatile memory (19),
The first storage means (S520) provided in the first CPU is:
When the second rewrite data, which is data for rewriting the content of the second control program stored in the second nonvolatile memory, is received from the outside, the received second rewrite data is stored in the reception buffer. Executing as the first storage process,
The first writing means (S720) included in the second CPU includes:
A process of rewriting the content of the second control program stored in the second nonvolatile memory by writing the second rewritten data stored in the reception buffer to the second nonvolatile memory. Run as a process,
The first confirmation means (S730) included in the second CPU is:
A process of confirming a match between the received second rewrite data and the second rewrite data written in the second nonvolatile memory is executed as the first confirmation process;
The second CPU further includes:
When the electronic control unit receives from the outside first rewrite data that is data for rewriting the contents of the first control program stored in the first non-volatile memory, the received first rewrite data is received by the reception buffer. 2nd storage means (S620) which performs the 2nd storage processing to store in,
The first CPU further includes:
Executes a second writing process for rewriting the contents of the first control program stored in the first nonvolatile memory by writing the first rewritten data stored in the reception buffer to the first nonvolatile memory. Second writing means (S420),
And a second confirmation unit (S430) for performing a second confirmation process for confirming a match between the received first rewritten data and the first rewritten data written in the first nonvolatile memory. The electronic control device according to claim 1.
複数のCPUを有する電子制御装置(1)のメモリ書換方法であって、
記憶内容の書き換えが可能であり所定の制御対象を制御するための制御プログラムを記憶する不揮発性メモリ(13,18,19)に記憶される前記制御プログラムの内容を書き換えるためのデータである書換データを当該電子制御装置が外部から受信すると、受信した前記書換データを、前記不揮発性メモリに書き込む前に一時的に記憶する受信バッファ(21)に格納する第1格納処理を、複数の前記CPUのうちの1つの前記CPUである第1CPU(11)に実行させる第1格納手順(S220,S520)と、
前記受信バッファに格納された前記書換データを前記不揮発性メモリに書き込むことにより、前記不揮発性メモリに記憶される前記制御プログラムの内容を書き換える第1書込処理を、複数の前記CPUのうち前記第1CPUと異なる1つの前記CPUである第2CPU(12)に実行させる第1書込手順(S320,S720)と、
受信した前記書換データと、前記不揮発性メモリに書き込まれた前記書換データとの一致を確認する第1確認処理を前記第2CPUに実行させる第1確認手順(S330,S730)とを備える
ことを特徴とするメモリ書換方法。
A memory rewriting method for an electronic control unit (1) having a plurality of CPUs,
Rewrite data which is data for rewriting the contents of the control program stored in the nonvolatile memory (13, 18, 19) which can rewrite the stored contents and stores a control program for controlling a predetermined control target Is received from the outside, the first storage process of storing the received rewrite data in the reception buffer (21) for temporarily storing the rewritten data before writing to the nonvolatile memory is performed. A first storage procedure (S220, S520) to be executed by a first CPU (11) which is one of the CPUs;
A first writing process of rewriting the contents of the control program stored in the nonvolatile memory by writing the rewritten data stored in the reception buffer to the nonvolatile memory is performed among the CPUs. A first writing procedure (S320, S720) to be executed by a second CPU (12) which is one CPU different from one CPU;
A first confirmation procedure (S330, S730) for causing the second CPU to execute a first confirmation process for confirming a match between the received rewrite data and the rewrite data written in the nonvolatile memory. Memory rewriting method.
前記不揮発性メモリは、
少なくとも、前記第1CPUが前記制御処理を実行するための第1制御プログラムを記憶する第1不揮発性メモリ(18)と、前記第2CPUが前記制御処理を実行するための第2制御プログラムを記憶する第2不揮発性メモリ(19)とから構成され、
前記第1格納手順(S520)は、
前記第2不揮発性メモリに記憶される前記第2制御プログラムの内容を書き換えるためのデータである第2書換データを当該電子制御装置が外部から受信すると、受信した前記第2書換データを前記受信バッファに格納する処理を前記第1格納処理として実行させ、
前記第1書込手順(S720)は、
前記受信バッファに格納された前記第2書換データを前記第2不揮発性メモリに書き込むことにより、前記第2不揮発性メモリに記憶される前記第2制御プログラムの内容を書き換える処理を前記第1書込処理として実行させ、
前記第1確認手順(S730)は、
受信した前記第2書換データと、前記第2不揮発性メモリに書き込まれた前記第2書換データとの一致を確認する処理を前記第1確認処理として実行させ、
更に、
前記第1不揮発性メモリに記憶される前記第1制御プログラムの内容を書き換えるためのデータである第1書換データを当該電子制御装置が外部から受信すると、受信した前記第1書換データを前記受信バッファに格納する第2格納処理を、前記第2CPUに実行させる第2格納手順(S620)と、
前記受信バッファに格納された前記第1書換データを前記第1不揮発性メモリに書き込むことにより、前記第1不揮発性メモリに記憶される前記第1制御プログラムの内容を書き換える第2書込処理を、前記第1CPUに実行させる第2書込手順(S420)と
受信した前記第1書換データと、前記第1不揮発性メモリに書き込まれた前記第1書換データとの一致を確認する第2確認処理を、前記第1CPUに実行させる第2確認手順(S430)とを備える
ことを特徴とする請求項3に記載のメモリ書換方法。
The nonvolatile memory is
At least a first non-volatile memory (18) for storing a first control program for the first CPU to execute the control process, and a second control program for the second CPU to execute the control process. A second non-volatile memory (19),
The first storing procedure (S520) includes:
When the second rewrite data, which is data for rewriting the content of the second control program stored in the second non-volatile memory, is received from the outside by the electronic control unit, the received second rewrite data is received in the reception buffer. The process to store in is executed as the first storage process,
The first writing procedure (S720)
A process of rewriting the content of the second control program stored in the second nonvolatile memory by writing the second rewritten data stored in the reception buffer to the second nonvolatile memory. As a process,
The first confirmation procedure (S730) includes:
A process for confirming a match between the received second rewrite data and the second rewrite data written in the second nonvolatile memory is executed as the first confirmation process;
Furthermore,
When the electronic control unit receives from the outside first rewrite data that is data for rewriting the contents of the first control program stored in the first non-volatile memory, the received first rewrite data is received by the reception buffer. A second storage procedure (S620) for causing the second CPU to execute a second storage process to be stored in
A second writing process for rewriting the contents of the first control program stored in the first nonvolatile memory by writing the first rewritten data stored in the reception buffer to the first nonvolatile memory; A second write procedure (S420) to be executed by the first CPU and a second confirmation process for confirming a match between the received first rewrite data and the first rewrite data written to the first nonvolatile memory. The memory rewriting method according to claim 3, further comprising: a second confirmation procedure (S430) that is executed by the first CPU.
JP2014225082A 2014-11-05 2014-11-05 Electronic control device and memory rewriting method Active JP6394291B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014225082A JP6394291B2 (en) 2014-11-05 2014-11-05 Electronic control device and memory rewriting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014225082A JP6394291B2 (en) 2014-11-05 2014-11-05 Electronic control device and memory rewriting method

Publications (2)

Publication Number Publication Date
JP2016091308A true JP2016091308A (en) 2016-05-23
JP6394291B2 JP6394291B2 (en) 2018-09-26

Family

ID=56017028

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014225082A Active JP6394291B2 (en) 2014-11-05 2014-11-05 Electronic control device and memory rewriting method

Country Status (1)

Country Link
JP (1) JP6394291B2 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000020389A (en) * 1998-07-03 2000-01-21 Denso Corp Electronic controller
JP2001014170A (en) * 1999-05-25 2001-01-19 Robert Bosch Gmbh Controller and programming method of controller
JP2005122759A (en) * 2001-01-31 2005-05-12 Renesas Technology Corp Data processing system
JP2013147209A (en) * 2012-01-23 2013-08-01 Denso Corp Electronic device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000020389A (en) * 1998-07-03 2000-01-21 Denso Corp Electronic controller
JP2001014170A (en) * 1999-05-25 2001-01-19 Robert Bosch Gmbh Controller and programming method of controller
JP2005122759A (en) * 2001-01-31 2005-05-12 Renesas Technology Corp Data processing system
JP2013147209A (en) * 2012-01-23 2013-08-01 Denso Corp Electronic device

Also Published As

Publication number Publication date
JP6394291B2 (en) 2018-09-26

Similar Documents

Publication Publication Date Title
JP4404147B2 (en) In-vehicle electronic control device and information updating method for in-vehicle electronic control device
JP2015056171A (en) Memory system and information processing apparatus
US10037170B2 (en) Motherboard and a method for boot-up
WO2018112942A1 (en) Device authentication method, apparatus, electronic device and slave device
JP6115482B2 (en) Electronic control unit
US20100153622A1 (en) Data Access Controller and Data Accessing Method
JP5304815B2 (en) Microcomputer
CN113870926A (en) Drive signal generation method, device, equipment and readable storage medium
WO2017036101A1 (en) Method and device for updating register
JP2014021807A (en) Electronic device and start-up control method
JP6394291B2 (en) Electronic control device and memory rewriting method
JP6421635B2 (en) Electronic control device and memory rewriting method
JP5900168B2 (en) Electronic control unit
JP6717184B2 (en) In-vehicle control device
JP5010065B2 (en) Microcomputer
JP6432464B2 (en) In-vehicle electronic control unit
US9323516B2 (en) Electronic device system and electronic device
JP2005276113A (en) Pseudo random number generating method, security check method and controller
US9400758B2 (en) Reset method and network device
JP2013232028A (en) Microcomputer
JP2012212272A (en) Electronic control device for vehicle
US20050138236A1 (en) Direct memory access control device and method for automatically updating data transmisson size from peripheral
JP5435647B2 (en) Computer system, memory initialization method, and program
JP4793798B2 (en) Microcomputer
TWI556171B (en) Motherboard and method for booting

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170417

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180131

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180220

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20180404

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180813

R151 Written notification of patent or utility model registration

Ref document number: 6394291

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

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