JP2004005152A - Rewriting device for nonvolatile memory - Google Patents

Rewriting device for nonvolatile memory Download PDF

Info

Publication number
JP2004005152A
JP2004005152A JP2002159421A JP2002159421A JP2004005152A JP 2004005152 A JP2004005152 A JP 2004005152A JP 2002159421 A JP2002159421 A JP 2002159421A JP 2002159421 A JP2002159421 A JP 2002159421A JP 2004005152 A JP2004005152 A JP 2004005152A
Authority
JP
Japan
Prior art keywords
program
communication
rewriting
data
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2002159421A
Other languages
Japanese (ja)
Inventor
Nobuaki Kogure
木暮 伸昭
Toshinaka Arai
新井 敏央
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.)
Hitachi Unisia Automotive Ltd
Original Assignee
Hitachi Unisia Automotive Ltd
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 Hitachi Unisia Automotive Ltd filed Critical Hitachi Unisia Automotive Ltd
Priority to JP2002159421A priority Critical patent/JP2004005152A/en
Publication of JP2004005152A publication Critical patent/JP2004005152A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To automatically change over communication programs and to execute the rewriting when failing in the rewriting of an application program stored in a nonvolatile memory. <P>SOLUTION: A rewriting device stores the application program and a communication program (1) in a block B of a flash memory 4, stores a rewriting decision program and a communication program (2) in a block A of the flash memory 4, and rewrites decision data in the block B when the rewriting of the application program is completed. When the decision data is not rewritten in rewriting, the rewriting device decides that the rewriting fails, changes over to the communication program (2), and executes the rewriting. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、ブロック単位でデータが電気的に消去される不揮発性メモリであって、例えば車両のエンジンコントロールユニットなどに用いられる不揮発性メモリの書き換え装置に関する。
【0002】
【従来の技術】
従来、ブロック単位でデータが電気的に消去される不揮発性メモリ(フラッシュメモリ)の書き換え装置としては、特開2001−229014号公報に開示されるようなものがあった。
このものは、外部ツールと通信するための2つの通信プログラムを、フラッシュメモリの別々のブロックに格納する一方、これら2つの通信プログラムのいずれを用いるかを選択するためのスイッチを備える構成である。
【0003】
【発明が解決しようとする課題】
ところで、上記従来装置では、第1通信プログラムが格納されるブロックの書き換えに失敗したときに、スイッチ操作によって第2通信プログラムを選択して、再書き換え時に外部ツールとの通信を行わせることが可能であるが、スイッチを設けることによって部品数が増大し、また、スイッチ操作による工数の増大や効率の低下が問題となっていた。
【0004】
本発明は上記問題点に鑑みなされたものであり、書き換えエラーの発生を的確に判定して、通信プログラムの切り換えを自動的に行わせることができる不揮発性メモリの書き換え装置を提供することを目的とする。
【0005】
【課題を解決するための手段】
そのため、請求項1記載の発明では、外部ツールと通信を行うための複数の通信プログラムを別々のブロックに格納させる一方、プログラムの書き換え完了後に書き換えエラーを判定するための判定データを所定の格納領域に書き込み、プログラムの再書き換え開始前に前記判定データの正常・異常判定を行い、該判定結果に基づいて外部ツールとの通信に使用する通信プログラムを選択する構成とした。
【0006】
上記構成によると、プログラムの書き換えが完了した時点で、書き換えエラーを判定するためのデータを所定の格納領域に書き込むようにし、再書き換え開始前には、前記判定データが正常であるか異常であるかの判別を行って、再書き換えにおいて用いる通信プログラムを選択する。
従って、再書き換えを行うときに、前回の書き換えにおけるエラーの発生(書き込みの失敗,誤ったプログラムへの書き換え)が判定データに基づいて判断され、エラー発生時に書き換え処理が行われた通信プログラム以外の通信プログラムを自動的に選択させて、再書き換えを行わせることができる。
【0007】
請求項2記載の発明では、複数の通信プログラムとして、書き換えられるアプリケーションプログラムと同じブロックに格納される第1通信プログラムと、該第1通信プログラムとは異なるブロックに格納される第2通信プログラムとを備え、前記アプリケーションプログラムの再書き換え開始前に、判定データが正常であると判定されたときには第1通信プログラムを使用し、判定データが異常であると判定されたときには第2通信プログラムを使用して外部ツールとの通信を行わせる構成とした。
【0008】
上記構成によると、判定データからアプリケーションプログラムの書き換え失敗が判定されたときには、同じブロックに格納されている第1通信プログラムの書き換えも失敗しているから、書き換えが行われていない第2通信プログラムを使用して外部ツールとの通信を行わせることで、再書き換えを可能にする。
従って、アプリケーションプログラムの書き換えに失敗して、同時に、第1通信プログラムが使用不能になっても、第2通信プログラムに自動的に切り換えて、アプリケーションプログラムの再書き換えを行える。
【0009】
請求項3記載の発明では、前記判定データの格納領域がアプリケーションプログラム及び第1通信プログラムが格納されるブロックと同じブロック内に設定され、判定データが前記所定の格納領域に書き込まれていないときに、異常と判定する構成とした。
上記構成によると、書き換えに伴って判定データも消去された後、書き換えが完了せずに判定データの書き換えが行われなかった場合に、再書き換え時に異常と判定されて、第2通信プログラムを用いて通信を行わせる。
【0010】
従って、判定データに基づいて書き換え失敗が確実に判定されることになる。請求項4記載の発明では、判定データと比較させるための比較用データを予め第2通信プログラムが格納されるブロックに格納し、アプリケーションプログラムの書き換え完了後に、アプリケーションプログラム内に格納されている判定データを所定の格納領域に書き込み、比較用データと判定データとの不一致を異常と判定する構成とした。
【0011】
上記構成によると、アプリケーションプログラムが格納されるブロックとは異なるブロックに比較用データが予め格納される一方、書き換え完了に伴ってアプリケーションプログラム内に格納されている判定データを書き込み、該書き込まれた判定データと前記比較用データとの比較によって、不揮発性メモリに予め登録されている所望のアプリケーションプログラムに書き換えられたか否かを判別する。
【0012】
従って、不揮発性メモリ毎に、メモリと格納されるべきアプリケーションプログラムとの相関が設定されることになり、書き換えられたアプリケーションプログラムが不正なものであるか否かを確実に判定できる。
【0013】
【発明の実施の形態】
以下に本発明の実施の形態を説明する。
図1は、実施の形態における不揮発性メモリの書き換え装置の全体構成を示すブロック図である。
この図1において、エンジンコントロールユニット(以下、ECUと略す。)1は、車両用エンジンにおける燃料供給量や点火時期を制御するためのものであり、マイクロコンピュータ2,RAM3及びブロック単位でデータが電気的に消去されるフラッシュメモリ(不揮発性メモリ)4を含んで構成される。
【0014】
前記マイクロコンピュータ2は、CPU,内蔵RAM,タイマ,A/Dコンバータ,SCI等を備えて構成され、RAM3やフラッシュメモリ4に格納された各種のプログラムを実行する。
前記フラッシュメモリ4の記憶領域は、ブロックAとブロックBとを含んで構成される。
【0015】
前記ブロックAには、アプリケーションプログラムの書き換えエラーを判定するための書き換え判定プログラム、及び、書き換え時に外部ツールと通信を行うための通信プログラム(2)(第2通信プログラム)が格納されている。
前記書き換え判定プログラムは、電源投入時に後述する判定データが正常であるか否かを判定する機能を備えたプログラムである。
【0016】
尚、前記書き換え判定プログラムには、前記判定データと比較される比較用データ(基準データ)が予め記憶されている。
前記比較用データは、例えば、当該ECU1が対応する車種を識別する情報として設定される。
また、前記通信プログラム(2)は、起動時に通信システムを初期化する機能と、フラッシュメモリ4の書き換え要求時に外部ツールに格納されているプログラムをRAM3に転送させる機能とを備えたプログラムである。
【0017】
一方、前記ブロックBは、書き換えが行われるブロックであり、書き換え時に外部ツールと通信を行うための通信プログラム(1)(第1通信プログラム)、及び、エンジン制御用のアプリケーションプログラムが格納されると共に、判定データの格納領域が設定される。
前記通信プログラム(1)は、前記通信プログラム(2)と同様に、起動時に通信システムを初期化する機能と、フラッシュメモリ4の書き換え要求時に外部ツールに格納されているプログラムをRAM3に転送させる機能とを備えたプログラムである。
【0018】
また、エンジン制御用のアプリケーションプログラムは、車両用エンジンに備えられた各種センサからの検出信号を入力して演算処理し、燃料噴射弁や点火プラグ(パワートランジスタ)などの制御信号を出力する機能を備えたプログラムである。
前記判定データの格納領域は、フラッシュメモリ4のベリファイ実行後に、書き換えエラーの判定に用いる判定データが格納される領域である。
【0019】
外部ツールとしてのフラッシュ書き込みツール5には、消去&書き込みプログラム及び新たなエンジン制御用のアプリケーションプログラムが格納されており、前記ECU1と通信回線6を介して接続される。
上記構成におけるアプリケーションプログラムの書き換え処理を、図2〜図5のフローチャートに従って説明する。
【0020】
前記フラッシュ書き込みツール5とECU1とを通信回線6を介して接続し、ECU1に電源電圧を供給すると、図2のフローチャートのステップS100において、判定データ格納領域に格納されている判定データが正常であるか異常であるかの判定が、書き換え判定プログラムの機能によって行われる。
前記正常・異常の判定は、予め書き換え判定プログラムに記憶されている比較用データと、判定データ格納領域に格納されている判定データとが一致する場合を正常と判定し、両データが不一致であるとき及び判定データ格納領域にデータが格納されていない場合を異常と判断する。
【0021】
判定データが正常であると判別されると、ステップS110へ進んで通信プログラム(1)の処理を行わせ、判定データが異常であると判別されると、ステップS120へ進んで通信プログラム(2)の処理を行わせる。
図3のフローチャートは、前記通信プログラム(1)の処理を示すものであり、ステップS200では、ECU1とフラッシュ書き込みツール5との間の通信を確立させ、次のステップS210では、フラッシュ書き込みツール5に格納されている消去&書き込みプログラム及び新アプリケーションプログラムをRAM3へ転送させる。
【0022】
図4のフローチャートは、前記通信プログラム(2)の処理を示すものであり、前記通信プログラム(1)の処理と同様に、まず、ステップS300では、ECU1とフラッシュ書き込みツール5との間の通信を確立させ、次のステップS310では、フラッシュ書き込みツール5に格納されている消去&書き込みプログラム及び新アプリケーションプログラムをRAM3へ転送させる。
【0023】
前記通信プログラム(1)又は通信プログラム(2)によって、RAM3に消去&書き込みプログラム及び新アプリケーションプログラムが転送されると、図2のフローチャートのステップS130へ進んで、消去&書き込みプログラムの処理を行わせる。
図5のフローチャートは、消去&書き込みプログラムの処理を示すものであり、ステップS400では、フラッシュメモリ4のブロックBを消去し、その後、新アプリケーションプログラムをブロックBの記憶領域に書き込む。
【0024】
尚、上記ブロックBの消去によって、旧アプリケーションプログラムと共に、通信プログラム(1)が消去されるので、前記通信プログラム(1)の書き込みを同時に行わせる。
前記通信プログラム(1)の書き込みは、新アプリケーションプログラムと対にフラッシュ書き込みツール5側からRAM3に通信プログラム(1)を転送させて行わせるようにすれば良い。
【0025】
ステップS410では、ベリファイを実行する。
前記ベリファイは、フラッシュメモリ4に実際に書き込まれたプログラムと、フラッシュ書き込みツール5から送信されたプログラムとが、一致するか否かを判定するものである。
ステップS420では、前記ベリファイ判定により、プログラム内容が一致しているか、ノイズ等の影響で不一致が発生しているかを判別する。
【0026】
そして、プログラム内容の不一致が発生していると判定されたときには、ステップS400へ戻って、消去及び書き込みの動作を再度行わせる。
プログラム内容の一致していて、プログラムの書き換えの完了が判定されると、図2のフローチャートのステップS140へ進み、判定データを前記判定データ格納領域に格納させる。
【0027】
前記判定データは、予め新アプリケーションプログラム内に格納されており、例えば、新アプリケーションプログラムが対応する車種の情報を判定データとして、判定データ格納領域に格納させる。
上記ステップS140の判定データの格納を最後に、書き換え処理が終了するが、ステップS140の処理が終了する前に、電源が供給されなくなったり、通信に異常が発生するなどして、ステップS130の消去・書き込み処理が中断されると、ステップS140の処理に進まないので、判定データ格納領域には判定データの書き込みが行われない。
【0028】
判定データ格納領域に判定データの書き込みが行われないと、再書き換え処理時に、比較用データと比較させるべき判定データがないため、判定データが異常であると判断される。
そして、判定データが異常であると判定されると、消去・書き込みが行われない通信プログラム(2)が選択され、該通信プログラム(2)を用いてECU1とフラッシュ書き込みツール5との間の通信を確立させることになる。
【0029】
従って、書き換えに失敗し使用不能な通信プログラム(1)に代えて通信プログラム(2)が自動選択され、該通信プログラム(2)を使用してアプリケーションプログラムの再書き換え処理を行わせることができ、効率良く再書き換え処理を行わせることができる。
また、書き換えを完了した場合であっても、不正な(例えば異なる車種向けの)アプリケーションプログラムに書き換えられたときには、この不正なアプリケーションプログラムに記憶された、異なる車種に対応する判定データが書き換え完了時に格納される。
【0030】
このため、判定データと比較用データとが不一致であると判定されることで、当該ECU1が対応すべき車種に対応するアプリケーションプログラムではないアプリケーションプログラムに書き換えられてしまったことが判別される。
この場合も、判定データの異常判定に基づいて、通信プログラム(2)に切り換えられるから、書き換えられた通信プログラム(1)の内容に関わらずに、通常にフラッシュ書き込みツール5とECU1との間の通信を行わせて、正しいアプリケーションプログラムへの書き換えを行わせることができる。
【0031】
尚、上記実施形態では、ECU1に備えられるフラッシュメモリ4の書き換えについて示したが、ECU1に限定されるものではないことは明らかである。
更に、上記実施形態から把握し得る請求項以外の技術思想について、以下にその効果と共に記載する。
(イ)請求項1〜4記載のいずれか1つに記載の不揮発性メモリの書き換え装置において、
前記不揮発性メモリの消去・書き込み実行後にベリファイを実行し、該ベリファイで正常判定されてから、前記判定データの書き込みを行わせることを特徴とする不揮発性メモリの書き換え装置。
【0032】
上記構成によると、プログラムの書き込みが正しく行われたか否かをチェックするベリファイを実行し、ノイズ等の影響で書き込みエラーがあった場合には、再書き込みを行わせ、最終的に書き込みエラーがないと判断されてから、判定データの書き込みが行われる。
従って、一部に書き込みエラーがある状態で判定データの書き込みが行われることが回避され、判定データの有無から、書き換えの失敗を正しく判断して通信プログラムの選択を行わせることができる。
(ロ)請求項4記載の不揮発性メモリの書き換え装置において、
前記不揮発性メモリが、エンジンを制御するエンジンコントロールユニットに備えられた不揮発性メモリであって、
前記比較用データとして、当該エンジンコントロールユニットが対応する車種を示す情報を設定する一方、
書き換えられたアプリケーションプログラムが対応する車種を示すデータを、前記判定データとして書き込ませることを特徴とする不揮発性メモリの書き換え装置。
【0033】
上記構成によると、新たなアプリケーションプログラムが対応する車種を示すデータが判定データとして書き換え完了時に書き込まれ、この判定データが示す車種情報と、予め記憶された比較用データが示す車種情報とが異なる場合には、異なる車種に対応するアプリケーションプログラムが書き込まれたことが判定される。
【0034】
従って、車種別に適合させたアプリケーションプログラムが、異なる車種に対応するエンジンコントロールユニットに誤って書き込まれたことを確実に判定でき、この場合も、通信プログラムを切り換えて再書き換えを行わせることができる。
【図面の簡単な説明】
【図1】実施の形態におけるフラッシュメモリ(不揮発性メモリ)の書き換え装置の全体構成図。
【図2】フラッシュメモリの書き換え処理のメインルーチンを示すフローチャート。
【図3】通信プログラム(1)の処理を示すフローチャート。
【図4】通信プログラム(2)の処理を示すフローチャート。
【図5】消去&書き込みプログラムの処理を示すフローチャート。
【符号の説明】
1…エンジンコントロールユニット(ECU)、2…マイクロコンピュータ、3…RAM、4…フラッシュメモリ(不揮発性メモリ)、5…フラッシュ書き込みツール、6…通信回線
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a non-volatile memory in which data is electrically erased in block units, for example, a non-volatile memory rewriting device used for an engine control unit of a vehicle or the like.
[0002]
[Prior art]
Conventionally, as a rewriting device for a nonvolatile memory (flash memory) in which data is electrically erased in block units, there has been one disclosed in JP-A-2001-229014.
In this configuration, two communication programs for communicating with an external tool are stored in separate blocks of a flash memory, and a switch for selecting which of the two communication programs is used is provided.
[0003]
[Problems to be solved by the invention]
By the way, in the above-mentioned conventional device, when rewriting of the block storing the first communication program fails, it is possible to select the second communication program by a switch operation and to communicate with the external tool at the time of rewriting. However, the provision of the switch increases the number of parts, increases the number of steps by the switch operation, and lowers the efficiency.
[0004]
SUMMARY OF THE INVENTION The present invention has been made in view of the above problems, and has as its object to provide a rewriting device for a nonvolatile memory capable of accurately determining occurrence of a rewriting error and automatically switching communication programs. And
[0005]
[Means for Solving the Problems]
Therefore, according to the first aspect of the present invention, a plurality of communication programs for communicating with the external tool are stored in separate blocks, and the determination data for determining the rewriting error after the completion of the rewriting of the program is stored in a predetermined storage area. Before the rewriting of the program is started, the normal / abnormal judgment of the judgment data is performed, and a communication program used for communication with an external tool is selected based on the judgment result.
[0006]
According to the above configuration, when the rewriting of the program is completed, the data for determining the rewriting error is written to the predetermined storage area, and before the start of the rewriting, the judgment data is normal or abnormal. Is determined, and a communication program to be used for rewriting is selected.
Therefore, when rewriting is performed, the occurrence of an error in the previous rewriting (writing failure, rewriting to an incorrect program) is determined based on the determination data. The communication program can be automatically selected and rewritten.
[0007]
According to the second aspect of the present invention, as the plurality of communication programs, the first communication program stored in the same block as the application program to be rewritten and the second communication program stored in a block different from the first communication program Before the rewriting of the application program is started, the first communication program is used when the determination data is determined to be normal, and the second communication program is used when the determination data is determined to be abnormal. Communication with external tools is performed.
[0008]
According to the above configuration, when it is determined from the determination data that the rewriting of the application program has failed, the rewriting of the first communication program stored in the same block has also failed. Use it to communicate with external tools to enable rewriting.
Therefore, even if the rewriting of the application program fails and, at the same time, the first communication program becomes unusable, it is possible to automatically switch to the second communication program and rewrite the application program.
[0009]
In the invention according to claim 3, when the storage area of the determination data is set in the same block as the block in which the application program and the first communication program are stored, and the determination data is not written in the predetermined storage area, , It is configured to be determined to be abnormal.
According to the above configuration, after the judgment data is erased along with the rewriting, if the rewriting is not completed and the judgment data is not rewritten, it is determined that the rewriting is abnormal and the second communication program is used. Communication.
[0010]
Therefore, the rewriting failure is reliably determined based on the determination data. According to the fourth aspect of the present invention, the comparison data to be compared with the determination data is previously stored in a block in which the second communication program is stored, and the determination data stored in the application program after the rewriting of the application program is completed. Is written in a predetermined storage area, and a mismatch between the comparison data and the determination data is determined to be abnormal.
[0011]
According to the above configuration, the comparison data is stored in advance in a block different from the block in which the application program is stored, and the determination data stored in the application program is written upon completion of rewriting, and the written determination is performed. By comparing the data with the comparison data, it is determined whether the data has been rewritten to a desired application program registered in the nonvolatile memory in advance.
[0012]
Therefore, the correlation between the memory and the application program to be stored is set for each nonvolatile memory, and it is possible to reliably determine whether or not the rewritten application program is unauthorized.
[0013]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described.
FIG. 1 is a block diagram showing an overall configuration of a nonvolatile memory rewriting device according to the embodiment.
In FIG. 1, an engine control unit (hereinafter abbreviated as ECU) 1 is for controlling a fuel supply amount and an ignition timing in a vehicle engine. It is configured to include a flash memory (non-volatile memory) 4 that is erased in a permanent manner.
[0014]
The microcomputer 2 includes a CPU, a built-in RAM, a timer, an A / D converter, an SCI, and the like, and executes various programs stored in the RAM 3 and the flash memory 4.
The storage area of the flash memory 4 includes a block A and a block B.
[0015]
The block A stores a rewrite determination program for determining a rewrite error of the application program, and a communication program (2) (second communication program) for communicating with an external tool at the time of rewrite.
The rewriting determination program is a program having a function of determining whether or not determination data described later is normal when power is turned on.
[0016]
The rewriting determination program stores comparison data (reference data) to be compared with the determination data in advance.
The comparison data is set, for example, as information for identifying a vehicle type to which the ECU 1 corresponds.
The communication program (2) is a program having a function of initializing the communication system at the time of startup and a function of transferring a program stored in an external tool to the RAM 3 when a request for rewriting the flash memory 4 is made.
[0017]
On the other hand, the block B is a block where rewriting is performed, and stores a communication program (1) (first communication program) for communicating with an external tool at the time of rewriting, and an application program for engine control. , A storage area for the determination data is set.
Like the communication program (2), the communication program (1) has a function of initializing the communication system at startup and a function of transferring a program stored in an external tool to the RAM 3 when a request for rewriting the flash memory 4 is made. This is a program having
[0018]
The application program for engine control has a function of inputting detection signals from various sensors provided in a vehicle engine, performing arithmetic processing, and outputting control signals for a fuel injection valve, a spark plug (power transistor), and the like. It is a program equipped.
The storage area for the determination data is an area in which determination data used for determining a rewrite error is stored after the verification of the flash memory 4 is performed.
[0019]
The flash writing tool 5 as an external tool stores an erasing & writing program and a new engine control application program, and is connected to the ECU 1 via a communication line 6.
The rewriting process of the application program in the above configuration will be described with reference to the flowcharts of FIGS.
[0020]
When the flash writing tool 5 and the ECU 1 are connected via the communication line 6 and a power supply voltage is supplied to the ECU 1, the determination data stored in the determination data storage area is normal in step S100 of the flowchart of FIG. The determination as to whether the data is abnormal or not is performed by the function of the rewrite determination program.
The determination of normality / abnormality is determined as normal if the comparison data stored in the rewrite determination program in advance matches the determination data stored in the determination data storage area, and the two data do not match. The time and the case where no data is stored in the determination data storage area are determined to be abnormal.
[0021]
If it is determined that the determination data is normal, the process proceeds to step S110 to perform the processing of the communication program (1). If it is determined that the determination data is abnormal, the process proceeds to step S120 and the communication program (2) Is performed.
The flowchart of FIG. 3 shows the processing of the communication program (1). In step S200, communication between the ECU 1 and the flash writing tool 5 is established. In the next step S210, the flash writing tool 5 The stored erase & write program and new application program are transferred to the RAM 3.
[0022]
The flowchart of FIG. 4 shows the processing of the communication program (2). Like the processing of the communication program (1), first, in step S300, communication between the ECU 1 and the flash writing tool 5 is performed. In the next step S310, the erasing and writing program and the new application program stored in the flash writing tool 5 are transferred to the RAM 3.
[0023]
When the erase / write program and the new application program are transferred to the RAM 3 by the communication program (1) or the communication program (2), the process proceeds to step S130 in the flowchart of FIG. .
The flowchart of FIG. 5 shows the processing of the erase & write program. In step S400, the block B of the flash memory 4 is erased, and then the new application program is written in the storage area of the block B.
[0024]
Since the communication program (1) is erased together with the old application program by erasing the block B, the writing of the communication program (1) is performed simultaneously.
The writing of the communication program (1) may be performed by transferring the communication program (1) from the flash writing tool 5 to the RAM 3 together with the new application program.
[0025]
In step S410, verification is performed.
The verifying determines whether or not the program actually written in the flash memory 4 matches the program transmitted from the flash writing tool 5.
In step S420, it is determined from the verify determination whether the program contents match or a mismatch occurs due to the influence of noise or the like.
[0026]
Then, when it is determined that the program contents do not match, the process returns to step S400, and the erasing and writing operations are performed again.
If the program contents match, and it is determined that the rewriting of the program has been completed, the process proceeds to step S140 in the flowchart of FIG. 2, and the determination data is stored in the determination data storage area.
[0027]
The determination data is stored in advance in the new application program. For example, information on a vehicle type corresponding to the new application program is stored as determination data in the determination data storage area.
The rewriting process ends at the end of the storage of the determination data in step S140, but before the process in step S140 ends, the power supply is stopped or an error occurs in communication, so that the erasing process in step S130 is terminated. If the writing process is interrupted, the process does not proceed to step S140, so that the determination data is not written in the determination data storage area.
[0028]
If the judgment data is not written in the judgment data storage area, the judgment data is determined to be abnormal because there is no judgment data to be compared with the comparison data during the rewriting process.
If it is determined that the determination data is abnormal, a communication program (2) that is not erased / written is selected, and communication between the ECU 1 and the flash writing tool 5 is performed using the communication program (2). Will be established.
[0029]
Therefore, the communication program (2) is automatically selected in place of the communication program (1) that has failed to be rewritten and is unusable, and the application program can be rewritten using the communication program (2). The rewriting process can be performed efficiently.
Further, even when rewriting is completed, when an unauthorized (for example, for a different vehicle type) application program is rewritten, the determination data corresponding to the different vehicle type stored in the unauthorized application program is stored when the rewriting is completed. Is stored.
[0030]
Therefore, when it is determined that the determination data and the comparison data do not match, it is determined that the ECU 1 has been rewritten to an application program that is not an application program corresponding to a vehicle type to be supported.
Also in this case, since the communication program (2) is switched based on the abnormality determination of the determination data, the communication between the flash writing tool 5 and the ECU 1 is normally performed regardless of the contents of the rewritten communication program (1). By performing communication, rewriting to a correct application program can be performed.
[0031]
In the above embodiment, rewriting of the flash memory 4 provided in the ECU 1 has been described, but it is apparent that the present invention is not limited to the ECU 1.
Further, technical ideas other than the claims that can be grasped from the above embodiment will be described below together with their effects.
(A) The rewriting device for a nonvolatile memory according to any one of claims 1 to 4,
A rewriting device for a non-volatile memory, wherein a verify operation is performed after erasing and writing of the non-volatile memory, and the judgment data is written after a normal judgment is made by the verification.
[0032]
According to the above configuration, verification is performed to check whether or not the program has been correctly written. If there is a write error due to the influence of noise or the like, rewrite is performed, and finally there is no write error. After the determination is made, the determination data is written.
Therefore, it is possible to avoid writing of the determination data in a state where there is a writing error, and it is possible to correctly determine whether rewriting has failed based on the presence or absence of the determination data and to select a communication program.
(B) The rewriting device for a nonvolatile memory according to claim 4,
The nonvolatile memory is a nonvolatile memory provided in an engine control unit that controls an engine,
As the comparison data, while setting information indicating a vehicle type corresponding to the engine control unit,
A non-volatile memory rewriting device for writing data indicating a vehicle type corresponding to a rewritten application program as the determination data.
[0033]
According to the above configuration, when the data indicating the vehicle type corresponding to the new application program is written as the determination data when rewriting is completed, the vehicle type information indicated by the determination data is different from the vehicle type information indicated by the comparison data stored in advance. , It is determined that application programs corresponding to different vehicle types have been written.
[0034]
Therefore, it is possible to reliably determine that the application program adapted to the vehicle type is erroneously written in the engine control unit corresponding to the different vehicle type, and in this case, the communication program can be switched and rewritten.
[Brief description of the drawings]
FIG. 1 is an overall configuration diagram of a flash memory (nonvolatile memory) rewriting device according to an embodiment;
FIG. 2 is a flowchart showing a main routine of a flash memory rewriting process.
FIG. 3 is a flowchart showing processing of a communication program (1).
FIG. 4 is a flowchart showing processing of a communication program (2).
FIG. 5 is a flowchart showing processing of an erase & write program.
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 1 ... Engine control unit (ECU), 2 ... microcomputer, 3 ... RAM, 4 ... Flash memory (non-volatile memory), 5 ... Flash writing tool, 6 ... Communication line

Claims (4)

ブロック単位でデータが電気的に消去される不揮発性メモリの書き換え装置であって、
外部ツールと通信を行うための複数の通信プログラムを別々のブロックに格納させる一方、プログラムの書き換え完了後に書き換えエラーを判定するための判定データを所定の格納領域に書き込み、プログラムの再書き換え開始前に前記判定データの正常・異常判定を行い、該判定結果に基づいて前記外部ツールとの通信に使用する通信プログラムを前記複数の通信プログラムの中から選択することを特徴とする不揮発性メモリの書き換え装置。
A non-volatile memory rewriting device in which data is electrically erased in block units,
While a plurality of communication programs for communicating with the external tool are stored in separate blocks, judgment data for judging a rewrite error is written in a predetermined storage area after the rewrite of the program is completed, and before the rewrite of the program is started, A non-volatile memory rewriting device for performing a normal / abnormal judgment on the judgment data and selecting a communication program to be used for communication with the external tool from the plurality of communication programs based on the judgment result. .
前記複数の通信プログラムとして、書き換えられるアプリケーションプログラムと同じブロックに格納される第1通信プログラムと、該第1通信プログラムとは異なるブロックに格納される第2通信プログラムとを備え、
前記アプリケーションプログラムの再書き換え開始前に、前記判定データが正常であると判定されたときには、前記第1通信プログラムを使用して前記外部ツールとの通信を行わせ、前記判定データが異常であると判定されたときには、前記第2通信プログラムを使用して前記外部ツールとの通信を行わせることを特徴とする請求項1記載の不揮発性メモリの書き換え装置。
As the plurality of communication programs, a first communication program stored in the same block as the application program to be rewritten, and a second communication program stored in a block different from the first communication program,
Before the rewriting of the application program is started, when it is determined that the determination data is normal, the communication with the external tool is performed using the first communication program, and the determination data is abnormal. 2. The non-volatile memory rewriting device according to claim 1, wherein when it is determined, communication with the external tool is performed using the second communication program.
前記所定の格納領域が前記アプリケーションプログラム及び第1通信プログラムが格納されるブロックと同じブロック内に設定され、
前記プログラムの再書き換え開始前に、前記判定データが前記所定の格納領域に書き込まれていないときに、異常と判定することを特徴とする請求項2記載の不揮発性メモリの書き換え装置。
The predetermined storage area is set in the same block as the block where the application program and the first communication program are stored,
3. The non-volatile memory rewriting device according to claim 2, wherein before the rewriting of the program is started, when the judgment data is not written in the predetermined storage area, it is judged that there is an abnormality.
前記判定データと比較させるための比較用データを予め第2通信プログラムが格納されるブロックに格納し、前記アプリケーションプログラムの書き換え完了後に、前記アプリケーションプログラム内に格納されている判定データを所定の格納領域に書き込み、前記比較用データと判定データとの不一致を異常と判定することを特徴とする請求項2又は3記載の不揮発性メモリの書き換え装置。Comparison data for comparison with the determination data is stored in advance in a block in which a second communication program is stored, and after the rewriting of the application program is completed, the determination data stored in the application program is stored in a predetermined storage area. 4. The non-volatile memory rewriting device according to claim 2, wherein the comparison data and the determination data are determined as abnormal if the comparison data does not match.
JP2002159421A 2002-05-31 2002-05-31 Rewriting device for nonvolatile memory Pending JP2004005152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002159421A JP2004005152A (en) 2002-05-31 2002-05-31 Rewriting device for nonvolatile memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002159421A JP2004005152A (en) 2002-05-31 2002-05-31 Rewriting device for nonvolatile memory

Publications (1)

Publication Number Publication Date
JP2004005152A true JP2004005152A (en) 2004-01-08

Family

ID=30429202

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002159421A Pending JP2004005152A (en) 2002-05-31 2002-05-31 Rewriting device for nonvolatile memory

Country Status (1)

Country Link
JP (1) JP2004005152A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008068694A (en) * 2006-09-13 2008-03-27 Nsk Ltd Electric power steering control device, external connecting device for electric power steering control device, and external program transferring method of electric power steering control device
JP2013069005A (en) * 2011-09-21 2013-04-18 Hitachi Automotive Systems Ltd Electronic control device for automobile
JP2017084001A (en) * 2015-10-26 2017-05-18 日立オートモティブシステムズ株式会社 Electronic control unit for automobile
DE112017003641T5 (en) 2016-07-19 2019-04-11 Denso Corporation Data overwrite device and data overwrite program
CN111373368A (en) * 2018-09-12 2020-07-03 株式会社Lg化学 Non-volatile memory update apparatus and method
JP2022037729A (en) * 2020-08-25 2022-03-09 トヨタ自動車株式会社 Software update apparatus, update control method, update control program, and server

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008068694A (en) * 2006-09-13 2008-03-27 Nsk Ltd Electric power steering control device, external connecting device for electric power steering control device, and external program transferring method of electric power steering control device
JP2013069005A (en) * 2011-09-21 2013-04-18 Hitachi Automotive Systems Ltd Electronic control device for automobile
JP2017084001A (en) * 2015-10-26 2017-05-18 日立オートモティブシステムズ株式会社 Electronic control unit for automobile
DE112017003641T5 (en) 2016-07-19 2019-04-11 Denso Corporation Data overwrite device and data overwrite program
CN111373368A (en) * 2018-09-12 2020-07-03 株式会社Lg化学 Non-volatile memory update apparatus and method
JP2021509990A (en) * 2018-09-12 2021-04-08 エルジー・ケム・リミテッド Non-volatile memory update device and method
JP7072660B2 (en) 2018-09-12 2022-05-20 エルジー エナジー ソリューション リミテッド Non-volatile memory update device and method
CN111373368B (en) * 2018-09-12 2023-11-14 株式会社Lg新能源 Nonvolatile memory updating apparatus and method
JP2022037729A (en) * 2020-08-25 2022-03-09 トヨタ自動車株式会社 Software update apparatus, update control method, update control program, and server
US11755308B2 (en) 2020-08-25 2023-09-12 Toyota Jidosha Kabushiki Kaisha Software update device, update control method, and non-transitory storage medium
JP7396229B2 (en) 2020-08-25 2023-12-12 トヨタ自動車株式会社 Software update device, update control method, update control program and OTA master

Similar Documents

Publication Publication Date Title
EP2040166B1 (en) Memory management apparatus
RU2142168C1 (en) Method for complete rewriting of cleared non- volatile memory
US4402057A (en) Method of and apparatus for ensuring correct operation of a microcomputer in the event of power outage
JP2003256228A (en) Program rewriting device
JP2007507016A (en) Software update method for electronic control device by flash programming via serial interface and state automatic device corresponding thereto
US8095263B2 (en) Electronic control unit and vehicle control system
US20090187305A1 (en) Method of detecting manipulation of a programmable memory device of a digital controller
US6401163B1 (en) Apparatus and method for rewriting data from volatile memory to nonvolatile memory
JP4552982B2 (en) Electronic control unit
JP3830867B2 (en) Single-chip microcomputer and its boot area switching method
JP2010269657A (en) Electronic control device and vehicle control system
JP4880105B2 (en) Memory function protection method for control device and control device
JP2004005152A (en) Rewriting device for nonvolatile memory
KR101601751B1 (en) Ecu of vehicle and boot software re-programming method thereof
JP2009042850A (en) Control device for vehicle, and device for updating vehicle control program
JP3972429B2 (en) Memory rewriting device for vehicle control
JP2002041367A (en) Vehicle controller
JP6708596B2 (en) Electronic control device and control program verification method
JP3743271B2 (en) Data recovery device
JP2005338955A (en) Electronic control device
JP5516509B2 (en) Program writing system
JP3489524B2 (en) Non-volatile memory rewriting device for vehicle
US20100083073A1 (en) Data processing apparatus, memory controlling circuit, and memory controlling method
JP2004021520A (en) Electronic controller for vehicle
JP2007192167A (en) Internal combustion engine control device

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20041217

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050315

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070921

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071030

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080304