JP3489524B2 - Non-volatile memory rewriting device for vehicle - Google Patents

Non-volatile memory rewriting device for vehicle

Info

Publication number
JP3489524B2
JP3489524B2 JP2000039862A JP2000039862A JP3489524B2 JP 3489524 B2 JP3489524 B2 JP 3489524B2 JP 2000039862 A JP2000039862 A JP 2000039862A JP 2000039862 A JP2000039862 A JP 2000039862A JP 3489524 B2 JP3489524 B2 JP 3489524B2
Authority
JP
Japan
Prior art keywords
program
communication
communication program
rewriting
volatile memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2000039862A
Other languages
Japanese (ja)
Other versions
JP2001229014A (en
Inventor
惇 山口
義博 川瀬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2000039862A priority Critical patent/JP3489524B2/en
Publication of JP2001229014A publication Critical patent/JP2001229014A/en
Application granted granted Critical
Publication of JP3489524B2 publication Critical patent/JP3489524B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、外部ツールと通信
するための通信プログラムを格納した不揮発性メモリを
備え、その通信プログラムの書き替えを行う車両用不揮
発性メモリ書き替え装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention includes a nonvolatile memory rewriting for a vehicle , which has a non-volatile memory storing a communication program for communicating with an external tool and rewrites the communication program. It relates to the device.

【0002】[0002]

【従来の技術】図5に示すように、フラッシュ書き替え
装置として機能する電子制御装置(ECU)11は、フ
ラッシュメモリ12と、RAM13と、マイクロコンピ
ュータ(マイコン)14とを備えている。フラッシュメ
モリ12は、記憶領域が2つのブロックA,Bに分割さ
れ、その書き替え時には、ブロック毎に記憶データが消
去されるようになっている。このフラッシュメモリ12
において、ブロックAには、起動時にシステムの初期化
を行うためのブートプログラムと、外部ツール15と通
信するための通信プログラムとが格納され、ブロックB
には、各種制御を実行するためのアプリケーションプロ
グラムが格納されている。
2. Description of the Related Art As shown in FIG. 5, an electronic control unit (ECU) 11 functioning as a flash rewriting device includes a flash memory 12, a RAM 13, and a microcomputer 14. A storage area of the flash memory 12 is divided into two blocks A and B, and the stored data is erased for each block when rewriting. This flash memory 12
In block A, a boot program for initializing the system at the time of startup and a communication program for communicating with the external tool 15 are stored in block A.
Stores application programs for executing various controls.

【0003】フラッシュメモリ12の記憶プログラムの
書き替え時には、外部ツール15からの書き込み要求に
伴いフラッシュメモリ12に格納された通信プログラム
が実行され、外部ツール15からのフラッシュ書き込み
プログラムがRAM13に転送される。そして、この書
き込みプログラムが実行されることにより、書き替え対
象の記憶ブロック(A又はB)が消去された後、外部ツ
ール15からの新規のプログラムがその記憶ブロックに
書き込まれる。
At the time of rewriting the storage program of the flash memory 12, the communication program stored in the flash memory 12 is executed in response to the write request from the external tool 15, and the flash write program from the external tool 15 is transferred to the RAM 13. . Then, by executing this writing program, the storage block (A or B) to be rewritten is erased, and then a new program from the external tool 15 is written to the storage block.

【0004】[0004]

【発明が解決しようとする課題】ところで、アプリケー
ションプログラムを書き替える際には、ブロックBに格
納された旧アプリケーションプログラムが消去され、そ
のブロックBに新規のアプリケーションプログラムが書
き込まれる。この書き込み途中において、電源の遮断や
ノイズ等の影響によって書き替えに失敗したとしても、
ブロックAの通信プログラムは消去されていないので、
再びアプリケーションプログラムの書き替えを実行でき
る。
By the way, when rewriting the application program, the old application program stored in the block B is erased, and the new application program is written in the block B. In the middle of this writing, even if rewriting fails due to power cutoff or noise,
Since the communication program of block A is not erased,
The application program can be rewritten again.

【0005】ところが、通信プログラムを書き替える際
には、ブロックAに格納された旧プログラム(ブートプ
ログラム+通信プログラム)が消去されてしまうので、
その書き替えに失敗すると、正常なプログラムがブロッ
クAに存在しないこととなる。このため、ECU11
は、外部ツール15と通信できなくなり、フラッシュメ
モリ12の書き替えを実施できない。
However, when the communication program is rewritten, the old program (boot program + communication program) stored in the block A is erased.
If the rewriting fails, the normal program does not exist in the block A. Therefore, the ECU 11
Cannot communicate with the external tool 15 and cannot rewrite the flash memory 12.

【0006】 本発明は、上記問題に着目してなされた
ものであって、その目的とするところは、通信プログラ
ムの書き替えに失敗したとしても、外部ツールとの間で
通信することができる車両用不揮発性メモリ書き替え装
置を提供することである。
The present invention has been made in view of the above problems, and an object thereof is a vehicle capable of communicating with an external tool even if rewriting of a communication program fails. A non-volatile memory rewriting device is provided.

【0007】[0007]

【課題を解決するための手段】請求項1に記載の発明に
よれば、記憶領域が複数ブロックに分割された不揮発性
メモリに、外部ツールと通信するための複数の通信プロ
グラムが別々のブロックに格納される。前記複数の通信
プログラムは、通信方式の異なる通信プログラムを含ん
で構成されている。そして、プログラム選択手段により
複数の通信プログラムのうちいずれかの通信プログラム
が選択され、その通信プログラムが実行されることで外
部ツールとの間で通信が実施される。これにより、プロ
グラム選択手段によって選択された通信プログラム以外
の通信プログラムの書き替えが実施される。
According to the invention described in claim 1, in a nonvolatile memory having a storage area divided into a plurality of blocks, a plurality of communication programs for communicating with an external tool are provided in different blocks. Is stored. The plurality of communications
Programs include communication programs with different communication methods
It is composed of. Then, any one of the plurality of communication programs is selected by the program selecting means, and the communication program is executed to communicate with the external tool. As a result, the communication programs other than the communication program selected by the program selecting means are rewritten.

【0008】 不揮発性メモリにおいて、記憶データを
書き替える際には、記憶データの消去がブロック単位で
行われた後に新規のデータが書き込まれる。従って、電
源の遮断等により書き替えが中断されると、書き替え対
象のブロックに記憶されていた通信プログラムは消去さ
れる。つまり、通信プログラムを書き替えるとき、その
際に実行された通信プログラム自身を書き替える構成で
あると、書き替えの失敗により、外部ツールとの通信が
できなくなる。これに対し、本発明では、外部ツールと
通信するために実行された通信プログラムとは別の通信
プログラムの書き替えが実施される。この場合、通信プ
ログラムの書き替えに失敗したとしても、その書き替え
の際に実行した通信プログラムは消去されない。従っ
て、その後の再通信時において、消去されていない不揮
発性メモリの通信プログラムを用いて、外部ツールと通
信でき、通信プログラムの書き替えを再度実行できる。
つまり、通信プログラムの書き替えに失敗したとして
も、書き替えが正常に実施できなくなるといった不都合
は生じることはない。また、使用する外部ツールに応じ
た有効な通信方式の通信プログラムにより不揮発性メモ
リの書き換えが実施される。
When rewriting the stored data in the nonvolatile memory, new data is written after the stored data is erased in block units. Therefore, when the rewriting is interrupted due to the power interruption or the like, the communication program stored in the rewriting target block is erased. In other words, when the communication program is rewritten, if the communication program itself executed at that time is rewritten, communication with an external tool cannot be performed due to rewriting failure. On the other hand, in the present invention, a communication program different from the communication program executed to communicate with the external tool is rewritten. In this case, even if the rewriting of the communication program fails, the communication program executed at the time of rewriting is not erased. Therefore, in the subsequent re-communication, the communication program in the non-volatile memory that has not been erased can be used to communicate with the external tool, and the communication program can be rewritten again.
That is, even if the rewriting of the communication program fails, the inconvenience that the rewriting cannot be normally performed does not occur. Also, depending on the external tool used
A non-volatile memo is created by a communication program of an effective communication method.
Rewriting is performed.

【0009】請求項2に記載の発明によれば、起動時に
初期設定を行うために実行される初期プログラムが、前
記通信プログラムが格納されるブロックとは別のブロッ
クに格納される。この場合、通信プログラムとともに初
期プログラムを書き替える必要がないので、通信プログ
ラムの書き替えに失敗しても、起動時の初期設定を実施
できる。
According to the second aspect of the present invention, the initial program executed for initializing at the time of startup is stored in a block different from the block in which the communication program is stored. In this case, since it is not necessary to rewrite the initial program together with the communication program, even if the rewriting of the communication program fails, the initial setting at startup can be performed.

【0010】請求項3に記載の発明によれば、通信プロ
グラムの書き替え時において、作業者によりスイッチ手
段が操作されて、複数の通信プログラムのうちいずれか
が外部ツールと通信を実施するための有効なプログラム
として設定される。そして、プログラム選択手段により
スイッチ手段の状態がモニタされて、有効となる通信プ
ログラムが選択される。この場合、作業者は、外部ツー
ルと通信するための通信プログラムを選択できる。ま
た、通信プログラムの書き替えに失敗したとしても、ス
イッチ手段の状態を保持すれば、同じ通信プログラムが
有効とされ、それが実行されることにより書き替えが失
敗した通信プログラムの書き替えが再度実施できる。
According to the third aspect of the present invention, when the communication program is rewritten, the operator operates the switch means so that any one of the plurality of communication programs communicates with the external tool. Set as a valid program. Then, the state of the switch means is monitored by the program selecting means, and the effective communication program is selected. In this case, the operator can select a communication program for communicating with the external tool. Further, even if the communication program rewriting fails, if the state of the switch means is maintained, the same communication program is validated, and the rewriting of the communication program whose rewriting has failed due to the execution of the same communication program is performed again. it can.

【0011】請求項4に記載の発明によれば、前記複数
の通信プログラムのうち最新の通信プログラムが判定さ
れ、その最新の通信プログラムが外部ツールと通信を実
施する通信プログラムとして選択される。つまり、最新
の通信プログラムとは、不揮発性メモリ内で最後に書き
替えられた通信プログラムであり、その最新の通信プロ
グラムを用いてそれ以外の通信プログラムが書き替えら
れる。この場合、外部ツールとの通信時には毎回、複数
の通信プログラムのうち最新の通信プログラムが有効な
通信プログラムとして選択されるので、実用上好ましい
ものとなる。
According to the fourth aspect of the invention, the latest communication program is determined from among the plurality of communication programs, and the latest communication program is selected as the communication program for communicating with the external tool. That is, the latest communication program is the communication program last rewritten in the nonvolatile memory, and the other communication programs are rewritten using the latest communication program. In this case, the latest communication program of the plurality of communication programs is selected as an effective communication program each time communication with the external tool is performed, which is preferable in practice.

【0012】[0012]

【発明の実施の形態】以下、この発明を具体化した実施
の形態を図面に従って説明する。本実施の形態では、車
両制御システムに適用される電子制御装置(ECU)に
具体化している。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of the present invention will be described below with reference to the drawings. The present embodiment is embodied in an electronic control unit (ECU) applied to a vehicle control system.

【0013】図1には、本実施の形態におけるECU1
の概略構成を示す。図1において、ECU1は、フラッ
シュメモリ2と、RAM3と、マイクロコンピュータ
(マイコン)4とを備えている。
FIG. 1 shows an ECU 1 according to this embodiment.
The schematic configuration of is shown. In FIG. 1, the ECU 1 includes a flash memory 2, a RAM 3, and a microcomputer 4.

【0014】フラッシュメモリ2は、記憶領域が4つの
ブロックA,B,C,Dに分割され、書き替え時にはこ
のブロック単位で記憶データの消去及び書き込みが実施
される。フラッシュメモリ2において、ブロックAには
ブートプログラムと判定プログラムが、ブロックBには
第1の通信プログラムが、ブロックCには第2の通信プ
ログラムが、ブロックDには、アプリケーションプログ
ラムがそれぞれ格納されている。ブートプログラムは、
起動時にシステムの初期化を行うためのプログラムであ
り、判定プログラムは、第1の通信プログラムと第2の
通信プログラムとのうちいずれを実行するかを判定する
ためのプログラムである。また、第1の通信プログラム
と第2の通信プログラムは、外部との間で通信を行うた
めのプログラムであり、アプリケーションプログラム
は、車両の運転に必要な各種制御を実行するためのプロ
グラムである。なお、本実施の形態では、ブロックAに
格納されるブートプログラムと判定プログラムとが初期
プログラムに相当する。
The memory area of the flash memory 2 is divided into four blocks A, B, C, and D, and at the time of rewriting, erasing and writing of stored data are performed in block units. In the flash memory 2, a block A stores a boot program and a determination program, a block B stores a first communication program, a block C stores a second communication program, and a block D stores an application program. There is. The boot program is
The determination program is a program for initializing the system at startup, and the determination program is a program for determining which of the first communication program and the second communication program is to be executed. The first communication program and the second communication program are programs for communicating with the outside, and the application program is a program for executing various controls necessary for driving the vehicle. In the present embodiment, the boot program and the determination program stored in block A correspond to the initial program.

【0015】RAM3は、所定データを一時的に記憶す
るメモリであって、本実施の形態では、このRAM3
に、フラッシュ書き込みツール5から転送されてくるプ
ログラムデータを一旦格納するようになっている。
The RAM 3 is a memory for temporarily storing predetermined data. In the present embodiment, this RAM 3 is used.
In addition, the program data transferred from the flash writing tool 5 is temporarily stored.

【0016】マイコン4は、周知のCPU、内蔵RA
M、タイマ、A/Dコンバータ、SCI等を備え、フラ
ッシュメモリ2やRAM3等に格納された各種プログラ
ムを実行するよう構成されている。
The microcomputer 4 is a well-known CPU and built-in RA.
An M, a timer, an A / D converter, an SCI, and the like are provided, and are configured to execute various programs stored in the flash memory 2, the RAM 3, and the like.

【0017】また、マイコン4の入力端子P1は、スイ
ッチSW1に接続されており、同スイッチSW1がVc
(高電位)側、或いは、グランド(低電位)側に切り替
えられることで、入力端子P1が、Hi又はLoレベル
となる。そして、マイコン4は、入力端子P1の状態に
応じて、フラッシュメモリ2に格納されている第1の通
信プログラムと第2の通信プログラムとのうちいずれの
通信プログラムを実行するかを選択する。具体的には、
作業者によりスイッチSW1が操作され、入力端子P1
がHiレベルとなると、第1の通信プログラムが選択さ
れ、逆に、入力端子P1がLoレベルとなると、第2の
通信プログラムが選択される。
Further, the input terminal P1 of the microcomputer 4 is connected to the switch SW1, and the switch SW1 is connected to Vc.
By switching to the (high potential) side or the ground (low potential) side, the input terminal P1 becomes the Hi or Lo level. Then, the microcomputer 4 selects which of the first communication program and the second communication program stored in the flash memory 2 to execute, depending on the state of the input terminal P1. In particular,
The switch SW1 is operated by the operator and the input terminal P1
Goes to the Hi level, the first communication program is selected, and conversely, when the input terminal P1 goes to the Lo level, the second communication program is selected.

【0018】また、マイコン4の入力端子P2は、抵抗
R1を介して接地されるとともに、フラッシュ書き込み
ツール5に接続されている。この場合、入力端子P2
は、フラッシュ書き込みツール5から出力される信号に
よって、Hi又はLoレベルに切り替えられる。そし
て、マイコン4は、入力端子P2の状態に応じて、フラ
ッシュメモリ2の書き込み要求の有無を判断し、通信プ
ログラムを実行するのか、或いはアプリケーションプロ
グラムを実行するのかを選択する。具体的には、作業者
等によりフラッシュ書き込みツール5が操作され、その
出力信号によって、入力端子P2がHiレベルとなる
と、書き込み要求有りと判断され通信プログラムが実行
される。一方、入力端子P2がLoレベルとなると、書
き込み要求無しと判断されてアプリケーションプログラ
ムが実行される。
The input terminal P2 of the microcomputer 4 is grounded via the resistor R1 and is also connected to the flash writing tool 5. In this case, the input terminal P2
Is switched to the Hi or Lo level by the signal output from the flash writing tool 5. Then, the microcomputer 4 determines whether or not there is a write request of the flash memory 2 according to the state of the input terminal P2, and selects whether to execute the communication program or the application program. Specifically, when a worker or the like operates the flash writing tool 5 and the output signal thereof causes the input terminal P2 to reach the Hi level, it is determined that there is a writing request and the communication program is executed. On the other hand, when the input terminal P2 becomes Lo level, it is determined that there is no write request, and the application program is executed.

【0019】また、ECU1とフラッシュ書き込みツー
ル5との間は、通信ライン6によって接続されており、
同通信ライン6を介してECU1とフラッシュ書き込み
ツール5との間で通信が行われる。この通信によって、
フラッシュ書き込みプログラムと新通信プログラムがフ
ラッシュ書き込みツール5からECU1へ送信される。
このとき、フラッシュ書き込みプログラム及び新通信プ
ログラムは、RAM3に転送され、このRAM3に転送
されたフラッシュ書き込みプログラムがマイコン4にて
実行されることにより、新通信プログラムがRAM3か
らフラッシュメモリ2に書き込まれる。
The ECU 1 and the flash writing tool 5 are connected by a communication line 6,
Communication is performed between the ECU 1 and the flash writing tool 5 via the communication line 6. By this communication,
The flash writing program and the new communication program are transmitted from the flash writing tool 5 to the ECU 1.
At this time, the flash writing program and the new communication program are transferred to the RAM 3, and the flash writing program transferred to the RAM 3 is executed by the microcomputer 4, whereby the new communication program is written from the RAM 3 to the flash memory 2.

【0020】本実施の形態におけるECU1は、スイッ
チSW1がVc側に接続され、マイコン4により第1の
通信プログラムが実行された場合、第2の通信プログラ
ムの書き替えが実施される。一方、スイッチSW1がグ
ランド側に接続され、マイコン4により第2の通信プロ
グラムが実行された場合、第1の通信プログラムの書き
替えが実施される。
In the ECU 1 in the present embodiment, when the switch SW1 is connected to the Vc side and the microcomputer 4 executes the first communication program, the second communication program is rewritten. On the other hand, when the switch SW1 is connected to the ground side and the second communication program is executed by the microcomputer 4, the first communication program is rewritten.

【0021】なお、本実施の形態では、フラッシュ書き
込みツール5が外部ツールに相当し、スイッチSW1が
スイッチ手段に相当する。ここで、マイコン4により実
行される各種処理のうち、フラッシュメモリ2に格納さ
れた通信プログラムの書き替え処理を図2及び図3を用
いて説明する。なお、通信プログラムの書き替えの際に
は、作業者は、先ず次の(a)〜(c)の操作を順次実
施する。 (a)書き替え対象の通信プログラムを選択すべくスイ
ッチSW1を操作して、入力端子P1をHi又はLoレ
ベルとする。 (b)フラッシュ書き込みツール5をECU1に接続す
ると共に、そのフラッシュ書き込みツール5を操作し
て、入力端子P2をHiレベルとする。 (c)電源スイッチをオンし、ECU1に電源電圧を供
給する。
In this embodiment, the flash writing tool 5 corresponds to an external tool, and the switch SW1 corresponds to a switch means. Of the various processes executed by the microcomputer 4, the process of rewriting the communication program stored in the flash memory 2 will be described with reference to FIGS. 2 and 3. When rewriting the communication program, the operator first sequentially performs the following operations (a) to (c). (A) The switch SW1 is operated to select the communication program to be rewritten, and the input terminal P1 is set to the Hi or Lo level. (B) The flash writing tool 5 is connected to the ECU 1, and the flash writing tool 5 is operated to set the input terminal P2 to the Hi level. (C) The power switch is turned on to supply the power voltage to the ECU 1.

【0022】この(c)の操作の後、マイコン4にて前
記判定プログラムが実行され、図2の処理が行われる。
詳しくは、図2のステップ100にてマイコン4は、入
力端子P1の状態(電位レベル)を検出し、続くステッ
プ110にて、その電位レベルがHiレベルか否かを判
定する。そして、ステップ110にて肯定判別された場
合、マイコン4は、フラッシュメモリ2のブロックBに
格納されている第1の通信プログラムへジャンプし、図
3に示す第1の通信処理を実行する。一方、ステップ1
10にて、否定判別された場合、マイコン4は、フラッ
シュメモリ2のブロックCに格納されている第2の通信
プログラムへジャンプし、図4に示す第2の通信処理を
実行する。
After the operation (c), the determination program is executed by the microcomputer 4 and the processing shown in FIG. 2 is performed.
Specifically, the microcomputer 4 detects the state (potential level) of the input terminal P1 in step 100 of FIG. 2, and determines in step 110 whether or not the potential level is the Hi level. Then, when a positive determination is made in step 110, the microcomputer 4 jumps to the first communication program stored in the block B of the flash memory 2 and executes the first communication process shown in FIG. On the other hand, step 1
When a negative determination is made in 10, the microcomputer 4 jumps to the second communication program stored in the block C of the flash memory 2 and executes the second communication processing shown in FIG.

【0023】図3のステップ200において、マイコン
4は、入力端子P2の状態(電位レベル)を検出し、続
くステップ210にて、その電位レベルがHiレベルか
否かを判定する。そして、ステップ210にて肯定判別
された場合、フラッシュ書き込みツール5からの書き込
み要求有りと判断して、ステップ220以降の書き替え
処理を実施する。一方、ステップ210にて否定判別さ
れた場合、マイコン4は、書き込み要求無しと判断し
て、書き替え処理を実施することなく、アプリケーショ
ンプログラムへジャンプする。
In step 200 of FIG. 3, the microcomputer 4 detects the state (potential level) of the input terminal P2, and in the following step 210, it determines whether or not the potential level is Hi level. Then, if an affirmative determination is made in step 210, it is determined that there is a write request from the flash writing tool 5, and the rewriting processing from step 220 onward is executed. On the other hand, when a negative determination is made in step 210, the microcomputer 4 determines that there is no write request, and jumps to the application program without executing the rewriting process.

【0024】ステップ220にてマイコン4は、フラッ
シュ書き込みツール5から受信したフラッシュ書き込み
プログラム及び新通信プログラムを、RAM3へ転送す
る。その後、ステップ230にてマイコン4は、RAM
3に転送されたフラッシュ書き込みプログラムへジャン
プして、フラッシュ書き込みプログラムを実行する。こ
のプログラムの実行により、マイコン4は、ステップ2
40にてブロックCの記憶領域を消去し、続くステップ
250にて、ブロックCの記憶領域へ、RAM3に一旦
記憶した新通信プログラムを第2の通信プログラとして
書き込んだ後、本処理を終了する。
At step 220, the microcomputer 4 transfers the flash writing program and the new communication program received from the flash writing tool 5 to the RAM 3. After that, in step 230, the microcomputer 4 sets the RAM
3 jumps to the flash writing program transferred to step 3, and executes the flash writing program. By executing this program, the microcomputer 4 executes step 2
The storage area of the block C is erased at 40, and in the following step 250, the new communication program once stored in the RAM 3 is written as a second communication program into the storage area of the block C, and then this processing is terminated.

【0025】また、図4のステップ300において、マ
イコン4は、入力端子P2の状態(電位レベル)を検出
し、続くステップ310にて、その電位レベルがHiレ
ベルか否かを判定する。そして、ステップ310にて肯
定判別された場合、マイコン4は、フラッシュ書き込み
ツール5からの書き込み要求有りと判断して、ステップ
320以降の書き替え処理を実施する。一方、ステップ
310にて否定判別された場合、マイコン4は、書き込
み要求無しと判断して、書き替え処理を実施することな
く、アプリケーションプログラムへジャンプする。
Further, in step 300 of FIG. 4, the microcomputer 4 detects the state (potential level) of the input terminal P2, and in the following step 310, it is determined whether or not the potential level is Hi level. Then, when the determination in step 310 is affirmative, the microcomputer 4 determines that there is a write request from the flash writing tool 5, and executes the rewriting process from step 320 onward. On the other hand, when a negative determination is made in step 310, the microcomputer 4 determines that there is no write request, and jumps to the application program without executing the rewriting process.

【0026】ステップ320にてマイコン4は、フラッ
シュ書き込みツール5から受信したフラッシュ書き込み
プログラム及び新通信プログラムを、RAM3へ転送す
る。その後、ステップ330にてマイコン4は、RAM
3に転送されたフラッシュ書き込みプログラムへジャン
プして、フラッシュ書き込みプログラムを実行する。こ
のプログラムの実行により、マイコン4は、ステップ3
40にてブロックBの記憶領域を消去し、続くステップ
350にて、ブロックBの記憶領域へ、RAM3に一旦
記憶した新通信プログラムを第1の通信プログラムとし
て書き込んだ後、本処理を終了する。
At step 320, the microcomputer 4 transfers the flash writing program and the new communication program received from the flash writing tool 5 to the RAM 3. After that, in step 330, the microcomputer 4 sets the RAM
3 jumps to the flash writing program transferred to step 3, and executes the flash writing program. By executing this program, the microcomputer 4 executes step 3
At 40, the storage area of the block B is erased, and at step 350, the new communication program once stored in the RAM 3 is written as the first communication program in the storage area of the block B, and then this processing is terminated.

【0027】このように、スイッチSW1をVc側に切
り替えたときには、第1の通信プログラムが選択され、
そのプログラムが実行されることにより、第1の通信プ
ログラムとは別のブロックCに格納された第2の通信プ
ログラムの書き替えが実施される。一方、スイッチSW
1をグランド側に切り替えたときには、第2の通信プロ
グラムが選択され、そのプログラムが実行されることに
より、第2の通信プログラムとは別のブロックBに格納
された第1の通信プログラムの書き替えが実施される。
As described above, when the switch SW1 is switched to the Vc side, the first communication program is selected,
By executing the program, the second communication program stored in the block C different from the first communication program is rewritten. On the other hand, switch SW
When 1 is switched to the ground side, the second communication program is selected and executed, thereby rewriting the first communication program stored in the block B different from the second communication program. Is carried out.

【0028】また、上記通信プログラムの書き替え中
に、電源の遮断やノイズ等の影響によってその書き替え
に失敗した場合、フラッシュ書き込みツール5によっ
て、書き替えが失敗した旨が警告される。この場合、ス
イッチSW1の状態を保持し、上記(b),(c)の操
作を再度行うことで、同じ通信プログラムについてその
書き替えが実施される。
Further, during the rewriting of the communication program, if the rewriting fails due to the influence of power interruption or noise, the flash writing tool 5 warns that the rewriting has failed. In this case, the state of the switch SW1 is held and the operations (b) and (c) are performed again, so that the same communication program is rewritten.

【0029】具体的に、スイッチSW1がグランド側に
接続された状態で、第1の通信プログラムの書き替えに
失敗した場合、第1の通信プログラムは書き替え時に消
去されるため、フラッシュメモリ2に存在しないが、そ
の際に実行した第2の通信プログラムは、そのままフラ
ッシュメモリ2に記憶されている。従って、スイッチS
W1をグランド側に接続したまま、再度上記(b)と
(c)の操作を行う。これにより、上述した図2と図4
の処理が実施されて、第1の通信プログラムの書き替え
が実施される。一方、スイッチSW1をVc側に接続し
た場合も同様に、スイッチSW1をVc側に接続したま
ま、再度上記(b)と(c)の操作を行う。これによ
り、上述した図2と図3の処理が実施されて、第2の通
信プログラムの書き替えが実施される。
Specifically, when the switch SW1 is connected to the ground side and the rewriting of the first communication program fails, the first communication program is erased at the time of rewriting, so that the flash memory 2 is stored. Although not present, the second communication program executed at that time is stored in the flash memory 2 as it is. Therefore, the switch S
The above operations (b) and (c) are performed again with W1 connected to the ground side. As a result, FIG. 2 and FIG.
Is performed, and the first communication program is rewritten. On the other hand, when the switch SW1 is connected to the Vc side, the above operations (b) and (c) are performed again with the switch SW1 being connected to the Vc side. As a result, the processes of FIGS. 2 and 3 described above are performed, and the second communication program is rewritten.

【0030】また、正常に動作しない通信プログラムを
フラッシュメモリ2に誤って書き込んだ場合では、その
通信プログラムが実行されるようにスイッチSW1が切
り替えられたときに、作業者によって正常動作しない旨
が判断される。この場合、作業者によりスイッチ状態が
元に戻されて、正常動作する通信プログラムが再び選択
されて、誤書き込みした通信プログラムの再書き替えが
実施される。
When a communication program that does not operate normally is written in the flash memory 2 by mistake, it is determined by the operator that the communication program does not operate normally when the switch SW1 is switched to execute the communication program. To be done. In this case, the operator returns the switch state to the original state, the communication program which operates normally is selected again, and the rewritten communication program is rewritten.

【0031】なお、アプリケーションプログラムの書き
替え時には、フラッシュ書き込みツール5からフラッシ
ュ書き込みプログラムと新規のアプリケーションプログ
ラムがRAM3に転送される。そして、フラッシュ書き
込みプログラムが実行されることによって、RAM3に
転送された新規アプリケーションプログラムがフラッシ
ュメモリ2の記憶ブロックDに書き込まれる。
When the application program is rewritten, the flash writing tool 5 transfers the flash writing program and the new application program to the RAM 3. Then, by executing the flash writing program, the new application program transferred to the RAM 3 is written in the storage block D of the flash memory 2.

【0032】また、本実施の形態のECU1において、
通信プロトコルの異なる2つのプログラムを前記第1及
び第2の通信プログラムとしてフラッシュメモリ2に格
納することにより、2種類の通信方式でフラッシュメモ
リ2の書き換えが実施される。具体的には、例えば、通
信インターフェース(RS232CやUSB等)が異な
る2種類のフラッシュ書き込みツール5に対応した第1
及び第2の通信プログラムがフラッシュメモリ2に格納
される。この場合、作業者は、書き換え時に使用するフ
ラッシュ書き込みツール5に応じてスイッチSW1を切
り替えることで有効な通信プログラムを選択しフラッシ
ュメモリ2の書き換えを実施する。
Further, in the ECU 1 of the present embodiment,
By storing two programs having different communication protocols in the flash memory 2 as the first and second communication programs, the flash memory 2 is rewritten by two types of communication methods. Specifically, for example, the first compatible with two types of flash writing tools 5 having different communication interfaces (RS232C, USB, etc.)
And the second communication program is stored in the flash memory 2. In this case, the operator rewrites the flash memory 2 by selecting the effective communication program by switching the switch SW1 according to the flash writing tool 5 used at the time of rewriting.

【0033】なお、本実施の形態では、図2の処理がプ
ログラム選択手段に相当し、図3のステップ220〜2
50及び図4のステップ320〜350の処理がプログ
ラム書き替え手段に相当する。
In the present embodiment, the process of FIG. 2 corresponds to the program selecting means, and steps 220 to 2 of FIG.
50 and the processing of steps 320 to 350 in FIG. 4 correspond to the program rewriting means.

【0034】以上詳述した本実施の形態によれば、以下
に示す効果が得られる。 (1)外部と通信するための2つの通信プログラムがフ
ラッシュメモリ2の別々のブロックB,Cに格納され、
フラッシュ書き込みツールと通信するために実行された
通信プログラムとは別の通信プログラムの書き替えが実
施される。この場合、通信プログラムの書き替えに失敗
したとしても、その書き替えの際に実行した通信プログ
ラムは消去されない。従って、その後の再通信時におい
て、消去されていない通信プログラムを用いて、フラッ
シュ書き込みツールと通信でき、通信プログラムの書き
替えを再度実行できる。よって、通信プログラムの書き
替えに失敗したとしても、書き替えが実施できなくなる
といった不都合は生じることはない。
According to this embodiment described in detail above, the following effects can be obtained. (1) Two communication programs for communicating with the outside are stored in separate blocks B and C of the flash memory 2,
A communication program different from the communication program executed to communicate with the flash writing tool is rewritten. In this case, even if the rewriting of the communication program fails, the communication program executed at the time of rewriting is not erased. Therefore, in the subsequent re-communication, the communication program that has not been erased can be used to communicate with the flash writing tool, and the communication program can be rewritten again. Therefore, even if the rewriting of the communication program fails, the inconvenience that the rewriting cannot be performed does not occur.

【0035】(2)図5の従来装置11におけるフラッ
シュメモリ12では、ブートプログラムと通信プログラ
ムとが同一のブロックAに格納されており、通信プログ
ラムの書き替えを実施するには、通信プログラムととも
にブートプログラムの書き替えが必要となっていた。こ
れに対し、本実施の形態では、初期プログラム(ブート
プログラム+判定プログラム)と第1及び第2の通信プ
ログラムとがそれぞれ別々のブロックA,B,Cに格納
されている。そのため、初期プログラムを書き替えるこ
となく第1の通信プログラム或いは第2の通信プログラ
ムを書き替えることができる。また、ブートプログラム
は、システムの初期設定を行うためのプログラムである
ため、その書き替えに失敗すると、システムが誤動作し
てしまうが、従来のように通信プログラムとともにブー
トプログラムを書き替える必要がないので、通信プログ
ラムの書き替え失敗によってシステムが誤動作するとい
った不都合を招くことがない。
(2) In the flash memory 12 in the conventional device 11 of FIG. 5, the boot program and the communication program are stored in the same block A. To rewrite the communication program, the boot program and the communication program are booted together. The program had to be rewritten. On the other hand, in the present embodiment, the initial program (boot program + judgment program) and the first and second communication programs are stored in separate blocks A, B, and C, respectively. Therefore, the first communication program or the second communication program can be rewritten without rewriting the initial program. Since the boot program is a program for initializing the system, if the rewriting fails, the system malfunctions, but it is not necessary to rewrite the boot program together with the communication program as in the past. Therefore, there is no inconvenience that the system malfunctions due to the failure to rewrite the communication program.

【0036】(3)作業者がスイッチSW1を切り替え
ることにより、マイコン4が実行する通信プログラムを
選択できるとともに、書き替え対象の通信プログラムを
選択できる。
(3) The operator can select the communication program executed by the microcomputer 4 and the communication program to be rewritten by switching the switch SW1.

【0037】なお本発明は、上記以外に次の形態にて具
体化できる。上記実施の形態では、作業者の操作によ
り、通信プログラムの選択を行う構成であったが、マイ
コン自身が通信プログラムの選択を行うようにしてもよ
い。具体的には、マイコン4は、フラッシュ書き込みツ
ール5からの書き込み要求に伴い第1の通信プログラム
を実行し第2の通信プログラムの書き替えを実施する。
そして、その書き替えが完了した場合、マイコン4は、
第2の通信プログラムを有効な通信プログラムとして選
択する。その後、マイコン4は、フラッシュ書き込みツ
ール5からの書き込み要求に伴い第2の通信プログラム
を実行し第1の通信プログラムの書き替えを実施する。
そして、その書き替えが完了した場合、マイコン4は、
第1の通信プログラムを有効な通信プログラムとして選
択する。このように構成すれば、フラッシュメモリ2内
で最後に書き替えられた最新の通信プログラムを用い
て、それとは別の通信プログラムが書き替えられる。つ
まり、フラッシュ書き込みツール5との通信時には毎
回、最新の通信プログラムが有効な通信プログラムとし
て選択されるので実用上好ましいものとなる。またこの
とき、作業者による指示も不要となる。
The present invention can be embodied in the following modes other than the above. In the above-described embodiment, the configuration is such that the operator selects the communication program, but the microcomputer itself may select the communication program. Specifically, the microcomputer 4 executes the first communication program and rewrites the second communication program in response to the write request from the flash writing tool 5.
When the rewriting is completed, the microcomputer 4
Select the second communication program as a valid communication program. After that, the microcomputer 4 executes the second communication program in response to the write request from the flash writing tool 5, and rewrites the first communication program.
When the rewriting is completed, the microcomputer 4
Select the first communication program as a valid communication program. According to this structure, the latest communication program last rewritten in the flash memory 2 is used to rewrite a different communication program. In other words, the latest communication program is selected as an effective communication program every time when communicating with the flash writing tool 5, which is practically preferable. Further, at this time, the instruction by the operator is unnecessary.

【0038】上記実施の形態では、入力端子P1の電位
レベルをスイッチSW1により切り替えるよう構成した
が、入力端子P2と同様に、入力端子P1を抵抗を介し
て接地し、フラッシュ書き込みツール5からの出力信号
によってその電位レベルを切り替える構成としてもよ
い。この場合、フラッシュ書き込みツール5がスイッチ
手段に相当し、同ツール5を作業者が操作することによ
り、入力端子P1の電位レベルが切り替えられ、それに
基づいて第1の通信プログラムと第2の通信プログラム
とのうちいずれかの通信プログラムが有効とされる。
In the above-described embodiment, the potential level of the input terminal P1 is switched by the switch SW1. However, like the input terminal P2, the input terminal P1 is grounded via a resistor to output from the flash writing tool 5. The potential level may be switched by a signal. In this case, the flash writing tool 5 corresponds to the switch means, and the operator operates the tool 5 to switch the potential level of the input terminal P1, and based on this, the first communication program and the second communication program. Either of the communication programs is effective.

【0039】上記実施の形態では、フラッシュメモリ2
に通信プロトコルの異なる2つの通信プログラムを格納
したがこれに限定するものではない。つまり、同一の通
信プログラムをフラッシュメモリ2のブロックB,Cに
書き込むようにし、一方の通信プログラムを常時使用
し、他方の通信プログラムを予備として使用してもよ
い。この場合、通信プログラムの書き替え時には、第1
の通信プログラムを使用して、第2の通信プログラムを
最新のものに書き替えるとともに、スイッチSW1を切
り替え、その第2の通信プログラムを使用して、第1の
通信プログラムも同じ最新の通信プログラムに書き替え
る。
In the above embodiment, the flash memory 2
Although two communication programs having different communication protocols are stored in, the present invention is not limited to this. That is, the same communication program may be written in the blocks B and C of the flash memory 2 so that one communication program is always used and the other communication program is used as a spare. In this case, when rewriting the communication program, the first
The second communication program is rewritten to the latest one using the communication program of the above, and the switch SW1 is switched, and the first communication program is also changed to the same latest communication program by using the second communication program. Rewrite.

【0040】また、上記実施の形態では、第1の通信プ
ログラムと第2の通信プログラムの2つの通信プログラ
ムをブロックB,Cに格納するものであったが、3つ以
上の通信プログラムをフラッシュメモリ2の別々のブロ
ックに格納してもよい。
Further, in the above embodiment, the two communication programs of the first communication program and the second communication program are stored in the blocks B and C, but three or more communication programs are stored in the flash memory. It may be stored in two separate blocks.

【0041】上記実施の形態では、不揮発性メモリとし
てフラッシュメモリに具体化したがこれに限定するもの
ではなく、例えば、不揮発性メモリとしてEEPROM
に具体化してもよい。要は、不揮発性メモリは、その記
憶データの書き替え時において、ブロック毎に消去を実
施するものであればよい。
In the above embodiment, the flash memory is embodied as the non-volatile memory, but the present invention is not limited to this. For example, the non-volatile memory is an EEPROM.
May be embodied in. The point is that the non-volatile memory only needs to erase each block when rewriting the stored data.

【0042】[0042]

【図面の簡単な説明】[Brief description of drawings]

【図1】発明の実施の形態におけるECUの概要を示す
構成図。
FIG. 1 is a configuration diagram showing an outline of an ECU according to an embodiment of the invention.

【図2】フラッシュメモリの書き込み処理を説明するた
めのフローチャート。
FIG. 2 is a flowchart illustrating a flash memory writing process.

【図3】第1の通信処理を説明するためのフローチャー
ト。
FIG. 3 is a flowchart for explaining a first communication process.

【図4】第2の通信処理を説明するためのフローチャー
ト。
FIG. 4 is a flowchart for explaining a second communication process.

【図5】従来のフラッシュメモリ書き替え装置の概要を
示す構成図。
FIG. 5 is a configuration diagram showing an outline of a conventional flash memory rewriting device.

【符号の説明】[Explanation of symbols]

1…フラッシュメモリ書き替え装置としてのECU、2
…不揮発性メモリとしてのフラッシュメモリ、4…マイ
コン、5…外部ツールとしてのフラッシュ書き込みツー
ル、SW1…スイッチ手段としてのスイッチ。
1 ... ECU as flash memory rewriting device, 2
... Flash memory as nonvolatile memory, 4 ... Microcomputer, 5 ... Flash writing tool as external tool, SW1 ... Switch as switch means.

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G06F 9/06 ─────────────────────────────────────────────────── ─── Continuation of front page (58) Fields surveyed (Int.Cl. 7 , DB name) G06F 9/06

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 記憶領域が複数ブロックに分割され、外
部ツールと通信するための複数の通信プログラムが前記
複数ブロックにおける別々のブロックに格納される不揮
発性メモリと、 前記不揮発性メモリに格納される複数の通信プログラム
のうち、外部ツールとの通信を実施する通信プログラム
を選択するプログラム選択手段と、 前記プログラム選択手段により選択された通信プログラ
ムとは別の通信プログラムの書き替えを実施するプログ
ラム書き替え手段を備え 前記複数の通信プログラムは、通信方式の異なる通信プ
ログラムを含んで構成されている ことを特徴とする車両
不揮発性メモリ書き替え装置。
1. A storage area is divided into a plurality of blocks, and a plurality of communication programs for communicating with an external tool are provided.
A non-volatile memory that will be stored in separate blocks in a plurality of blocks, among the plurality of communication program stored in the nonvolatile memory, a program selecting means for selecting a communication program for performing the communication with an external tool, the program The communication program selected by the selecting means, and a program rewriting means for rewriting a communication program different from the communication program , wherein the plurality of communication programs are communication programs having different communication methods.
A vehicle characterized by including a program
Use non-volatile memory rewriting apparatus.
【請求項2】 請求項1に記載の車両用不揮発性メモリ
書き替え装置において、 前記不揮発性メモリには、起動時に初期設定を行うため
に実行される初期プログラムが、前記通信プログラムが
格納されるブロックとは別のブロックに格納されること
を特徴とする車両用不揮発性メモリ書き替え装置。
2. The vehicle non-volatile memory rewriting device according to claim 1, wherein the non-volatile memory stores an initial program executed to perform initial setting at startup, and the communication program. A non-volatile memory rewriting device for a vehicle, which is stored in a block different from the block.
【請求項3】 請求項1又は2に記載の車両用不揮発性
メモリ書き替え装置において、 通信プログラムの書き替え時に作業者により操作され、
前記複数の通信プログラムのうち、外部ツールと通信を
実施する通信プログラムを設定するためのスイッチ手段
を備え、 前記プログラム選択手段は、スイッチ手段の状態をモニ
タし、その状態に基づいて通信プログラムを選択するこ
とを特徴とする車両用不揮発性メモリ書き替え装置。
3. The vehicle non-volatile memory rewriting device according to claim 1, wherein the rewriting of the communication program is operated by an operator,
Of the plurality of communication programs, a switch means for setting a communication program for communicating with an external tool is provided, and the program selection means monitors a state of the switch means and selects a communication program based on the state. A non-volatile memory rewriting device for a vehicle, comprising:
【請求項4】 請求項1又は2に記載の車両用不揮発性
メモリ書き替え装置において、 前記プログラム選択手段は、前記複数の通信プログラム
のうち最新の通信プログラムを判定し、それを外部ツー
ルと通信を実施する通信プログラムとして選択すること
を特徴とする車両用不揮発性メモリ書き替え装置。
4. The non-volatile memory rewriting device for a vehicle according to claim 1, wherein the program selection means determines the latest communication program among the plurality of communication programs and communicates it with an external tool. A non-volatile memory rewriting device for a vehicle, which is selected as a communication program for carrying out.
JP2000039862A 2000-02-17 2000-02-17 Non-volatile memory rewriting device for vehicle Expired - Fee Related JP3489524B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000039862A JP3489524B2 (en) 2000-02-17 2000-02-17 Non-volatile memory rewriting device for vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000039862A JP3489524B2 (en) 2000-02-17 2000-02-17 Non-volatile memory rewriting device for vehicle

Publications (2)

Publication Number Publication Date
JP2001229014A JP2001229014A (en) 2001-08-24
JP3489524B2 true JP3489524B2 (en) 2004-01-19

Family

ID=18563365

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000039862A Expired - Fee Related JP3489524B2 (en) 2000-02-17 2000-02-17 Non-volatile memory rewriting device for vehicle

Country Status (1)

Country Link
JP (1) JP3489524B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006221274A (en) * 2005-02-08 2006-08-24 Denso Corp Electronic control device for vehicle and rewriting method of control program
US20060259207A1 (en) 2005-04-20 2006-11-16 Denso Corporation Electronic control system for automobile
JP5956505B2 (en) * 2014-05-15 2016-07-27 日立オートモティブシステムズ株式会社 Electronic control unit for automobile
JP6798413B2 (en) * 2017-05-09 2020-12-09 株式会社オートネットワーク技術研究所 In-vehicle relay device, control program and memory sharing method
JP6803957B2 (en) * 2019-10-10 2020-12-23 ラピスセミコンダクタ株式会社 Memory control device and memory control method
JP7396229B2 (en) * 2020-08-25 2023-12-12 トヨタ自動車株式会社 Software update device, update control method, update control program and OTA master

Also Published As

Publication number Publication date
JP2001229014A (en) 2001-08-24

Similar Documents

Publication Publication Date Title
US6745278B2 (en) Computer capable of rewriting an area of a non-volatile memory with a boot program during self mode operation of the computer
JP5173818B2 (en) Initializing flash storage via embedded controller
US20030163664A1 (en) Method and apparatus for updating a distributed program
JP4302113B2 (en) In-vehicle control device
JPH09288573A (en) On-vehicle controller
JP2000259420A (en) Device for updating learning value for electronic controller
JP3489524B2 (en) Non-volatile memory rewriting device for vehicle
JP6415990B2 (en) Electronic control unit for automobile
JP3805195B2 (en) Program rewriting apparatus and program rewriting method
JP3489306B2 (en) Electronic control unit
JP2001344156A (en) Device with flash memory and data rewriting method
JP2003271420A (en) Electronic control device
JP2000293376A (en) Circuit and method for switching boot program
JP2002149412A (en) Electronic controller
JP5158883B2 (en) Firmware update method and firmware update apparatus
JPH11282690A (en) Method for writing control program, information processor and information processing system
JPH04276838A (en) Cpu with built-in memory
JPH10283172A (en) Flash rom data rewrite system
JP2001147863A (en) Flash memory rewrite device
JPH10283171A (en) Information processor and control method therefor
JPH1083358A (en) Program rewriting method and controller provided with program rewriting function
JPH1055278A (en) Memory mixed microcomputer
JP2006252278A (en) Microcomputer
JP2004054818A (en) Program execution apparatus
JPH11219288A (en) Booting system and booting method for system

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101107

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20111107

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20111107

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20121107

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20131107

Year of fee payment: 10

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees