JP6699598B2 - Vehicle control device - Google Patents

Vehicle control device Download PDF

Info

Publication number
JP6699598B2
JP6699598B2 JP2017036560A JP2017036560A JP6699598B2 JP 6699598 B2 JP6699598 B2 JP 6699598B2 JP 2017036560 A JP2017036560 A JP 2017036560A JP 2017036560 A JP2017036560 A JP 2017036560A JP 6699598 B2 JP6699598 B2 JP 6699598B2
Authority
JP
Japan
Prior art keywords
data
writing
write
control circuit
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.)
Active
Application number
JP2017036560A
Other languages
Japanese (ja)
Other versions
JP2018142211A (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 JP2017036560A priority Critical patent/JP6699598B2/en
Publication of JP2018142211A publication Critical patent/JP2018142211A/en
Application granted granted Critical
Publication of JP6699598B2 publication Critical patent/JP6699598B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、車両制御装置に関する。   The present invention relates to a vehicle control device.

車両制御装置において、フラッシュメモリに代表される不揮発性メモリのデータ管理をするものでは、不揮発性メモリ内のデータ領域をデータ管理部とデータ保存部に分けて管理するものがある。これは実際のデータをデータ保存部に書き込み、データが書き込まれているかどうかを示す値をデータ管理部に書き込むことでデータ管理を行うものである。   Some vehicle control devices manage data in a non-volatile memory typified by a flash memory, and separately manage a data area in the non-volatile memory into a data management unit and a data storage unit. This is for performing data management by writing actual data in the data storage unit and writing a value indicating whether or not the data is written in the data management unit.

この場合、例えばリプログラミングなどでフラッシュメモリへのプログラムデータの書き込みの処理では、まず、データ管理部に記憶されたデータからデータ保存部の未使用領域を検索し、見つかったデータ保存部の未使用領域に対してデータ書き込みを行う。そして、データ書き込み完了後にデータ管理部にデータ書き込み済みを示す値を書き込む。   In this case, for example, in the process of writing the program data to the flash memory by reprogramming or the like, first, an unused area of the data storage unit is searched from the data stored in the data management unit, and the found data storage unit is not used. Data is written to the area. Then, after the data writing is completed, a value indicating that the data has been written is written in the data management unit.

このような技術においては、データ書き込み中に電源断が発生すると、データ保存部は電源断発生前までのデータが書き込まれているが、データ管理部は未使用領域を示す状態となる。このため、電源復帰後再度データ書き込みを実施する場合に、データ管理部の状態とデータ保存部の状態が不一致となり、データ保存部の同一領域に2重に書き込むといった問題が生じる。   In such a technique, when the power is cut off during data writing, the data storage unit has written the data up to the time before the power cut, but the data management unit is in a state indicating an unused area. Therefore, when data is written again after the power is restored, the state of the data management unit and the state of the data storage unit do not match, and there is a problem that the data is written twice in the same region of the data storage unit.

また、一般に、不揮発性メモリでは、書き込み単位サイズより消去単位サイズのほうが大きいため、データ管理部は消去単位サイズで設定される。このため、データ管理部は、データ保存部へのデータ書き込みの時点で消去され、データが正常に書き込まれるとデータ管理部に書き込みがなされる。   In general, in a non-volatile memory, the erase unit size is larger than the write unit size, so the data management unit is set in the erase unit size. Therefore, the data management unit is erased at the time of writing data to the data storage unit, and when the data is normally written, the data management unit is written.

したがって、データ管理部に複数のデータ保存部の管理データを配置すると、各データ保存部は1回の消去動作であっても、データ管理部は複数のデータ保存部のデータ書き込み毎に消去動作が行われることとなる。   Therefore, by arranging the management data of a plurality of data storage units in the data management unit, even if each data storage unit performs one erasing operation, the data management unit can perform the erasing operation every time data is written in the plurality of data storage units. Will be done.

この結果、データ管理部の書き込み回数がデータ保存部の書き込み回数に比べて多くなり、データ管理部が先に書き換え可能な回数に到達してしまうこととなる。   As a result, the number of times of writing in the data management unit becomes larger than the number of times of writing in the data storage unit, and the number of times that the data management unit can be rewritten is reached first.

特開2005−62981号公報JP, 2005-62981, A

本発明は、上記事情を考慮してなされたもので、その目的は、データ保存部へのデータの書き込みに伴うデータ管理部の消去動作を低減することができ、不揮発性メモリの書き換え可能な使用回数に達するのを抑制することができる車両制御装置を提供することにある。   The present invention has been made in view of the above circumstances, and an object thereof is to reduce the erasing operation of the data management unit accompanying the writing of data to the data storage unit, and to use rewritable nonvolatile memory. It is an object of the present invention to provide a vehicle control device capable of suppressing the number of times.

請求項1に記載の車両制御装置は、車両を制御するためのデータが記憶されるデータ保存部および前記データ保存部にデータが正常に書き込めたか否かを示すデータ管理部を有する書き換え可能な不揮発性メモリと、前記不揮発性メモリに対してデータの書き込み処理をする制御回路とを備え、前記制御回路は、前記不揮発性メモリの前記データ保存部へのデータ書き込み更新時に前記データ管理部の未使用領域に更新情報を追記する方式を採用し、前記データ書き込み更新開始時にデータ書き込み中を示す状態のデータを追記し、前記データ書き込み更新終了時にデータ書き込み済みを示す状態を追記し、前記不揮発性メモリの前記データ保存部へのデータ書き込み更新時に前記データ管理部の未使用領域に更新情報を追記する方式としてリスト構造を採用し、前記データ書き込み更新開始時に次の書き込みアドレスを追記し、前記データ書き込み更新終了時にデータ書き込み済みを示す状態を追記するThe vehicle control device according to claim 1, wherein the rewritable nonvolatile memory includes a data storage unit that stores data for controlling the vehicle and a data management unit that indicates whether or not the data has been normally written in the data storage unit. Non-volatile memory and a control circuit for writing data to the non-volatile memory, wherein the control circuit is an unused part of the data management section at the time of writing/updating data to the data storage section of the non-volatile memory. Adopting a method of additionally writing update information in the area, additionally writing data in a state indicating that data is being written at the start of the data writing update, and additionally writing a state indicating that data has been written at the end of the data writing update , and the nonvolatile memory Adopting a list structure as a method of additionally writing update information to an unused area of the data management unit at the time of updating the data write to the data storage unit, and additionally writing the next write address at the start of the data write update to write the data A state indicating that data has been written is added at the end of updating .

上記構成を採用することにより、不揮発性メモリのデータ保存部へのデータ書き込み更新時に、制御回路は、データ管理部の未使用領域に更新情報を追記する方式を採用し、データ書き込み更新開始時にデータ書き込み中を示す状態のデータを追記し、データ書き込み更新終了時にデータ書き込み済みを示す状態を追記する。これにより、通常のデータ書き込み処理において、データ管理部への更新情報の書き込み時に、その都度データをブロック消去することがなくなる。また、書き込み中において電源断が発生した場合でも、再電源オンでデータ書き込みを実施する場合に、制御回路によりデータ管理部のブロック消去をすることがなくなり、不揮発性メモリの書き換え回数が増えるのを抑制することができる。   By adopting the above configuration, the control circuit adopts a method of additionally writing the update information to the unused area of the data management section when the data is written and updated in the data storage section of the nonvolatile memory, and the data is updated at the start of the data writing and update. The data indicating the state of being written is added, and the state indicating that the data has been written is added at the end of the data write update. As a result, in the normal data writing process, the block of data is not erased each time the update information is written to the data management unit. Further, even if the power is cut off during writing, when the data is written by turning on the power again, the control circuit does not erase the block of the data management section, which increases the number of times of rewriting of the nonvolatile memory. Can be suppressed.

第1実施形態を示すブロック構成図Block diagram showing the first embodiment 電源オン時の処理の流れを示す図Diagram showing the process flow when the power is turned on プログラム起動判定処理の流れを示す図The figure which shows the flow of program start decision processing プログラム書き込み処理の流れを示す図Diagram showing the flow of program write processing フラッシュメモリのデータ領域の説明図Illustration of data area of flash memory プログラム書き込み処理の状態の変化図(その1)Change diagram of program writing process (Part 1) プログラム書き込み処理の状態の変化図(その2)Change diagram of program writing process (Part 2) 第2実施形態を示すプログラム起動判定処理の流れを示す図The figure which shows the flow of the program start determination process which shows 2nd Embodiment. プログラム書き込み処理の流れを示す図Diagram showing the flow of program write processing フラッシュメモリのデータ領域の説明図Illustration of data area of flash memory プログラム書き込み処理の状態の変化図(その1)Change diagram of state of program writing process (1) プログラム書き込み処理の状態の変化図(その2)Change diagram of program writing process (Part 2) 第3実施形態を示す電源オン時の処理の流れを示す図The figure which shows the flow of the process at the time of power supply ON which shows 3rd Embodiment フラッシュメモリのデータ領域の説明図Illustration of data area of flash memory

(第1実施形態)
以下、本発明の第1実施形態について、図1〜図7を参照して説明する。
図1は概略的なブロック構成を示すもので、車両制御装置1は、車両に設けられ、図示しない他の装置を制御する。車両制御装置1は、CPU(central processing unit)などの制御回路2を中心として、通信部3、RAM(random access memory)4および不揮発性メモリであるフラッシュメモリ5などを備えている。フラッシュメモリ5は、内部の記憶領域としてデータ保存部5aおよびデータ管理部5bを区分した領域に設定されている。
(First embodiment)
Hereinafter, a first embodiment of the present invention will be described with reference to FIGS.
FIG. 1 shows a schematic block configuration. A vehicle control device 1 is provided in a vehicle and controls other devices (not shown). The vehicle control device 1 mainly includes a control circuit 2 such as a CPU (central processing unit), a communication unit 3, a RAM (random access memory) 4, a flash memory 5 that is a non-volatile memory, and the like. The flash memory 5 is set as an internal storage area in which the data storage section 5a and the data management section 5b are divided.

制御回路2は、外部に設けられるデータ送受信装置10との間で通信部3を介してデータの授受を行い、フラッシュメモリ5に書き込み制御を行う。車両制御装置1は、例えば、外部からデータ送受信装置10を介してリプログラミングのデータを取り込み、フラッシュメモリ5のデータを書き換える。このとき、制御回路2は、後述するプログラムに基づいて、フラッシュメモリ5への書き込み処理の制御を行う。   The control circuit 2 transmits/receives data to/from an externally provided data transmission/reception device 10 via the communication unit 3 and controls writing to the flash memory 5. The vehicle control device 1 takes in reprogramming data from the outside via the data transmitting/receiving device 10, and rewrites the data in the flash memory 5, for example. At this time, the control circuit 2 controls the writing process to the flash memory 5 based on a program described later.

次に、上記構成の作用について、図2から図7も参照して説明する。
図2は、電源オン時に制御回路2により実行される処理内容を示している。電源がオンされると、制御回路2は、まずステップA1で、プログラム起動判定処理を実施する。図3は、ステップA1のプログラム起動判定処理の具体的な内容を示している。制御回路2は、ステップB1で、フラッシュメモリ5の書き込み位置を、データ管理部5aの先頭に設定する。次に、制御回路2は、ステップB2で、書き込み位置の「書き込み中」がブランクであるか否かを確認する。制御回路2は、ステップB2で、「書き込み中」のデータがブランクであれば、YESと判断して書き込み位置を確定してプログラム起動判定処理を終了する。
Next, the operation of the above configuration will be described with reference to FIGS. 2 to 7.
FIG. 2 shows the processing contents executed by the control circuit 2 when the power is turned on. When the power is turned on, the control circuit 2 first executes a program start determination process in step A1. FIG. 3 shows the specific contents of the program activation determination processing in step A1. The control circuit 2 sets the write position of the flash memory 5 to the head of the data management unit 5a in step B1. Next, in step B2, the control circuit 2 confirms whether or not "writing" in the writing position is blank. In step B2, the control circuit 2 determines YES if the "writing in progress" data is blank, determines the writing position, and ends the program activation determination process.

また、制御回路2は、ステップB2で、「書き込み中」のデータがブランク以外すなわち判定値が書き込まれている場合には、ステップB2でNOと判断してステップB3に進み、書き込み位置を次の書き込み位置に設定する。この後、制御回路2は、ステップB2に戻り次の書き込み位置が「書き込み中」がブランクであるか否かを判断し、YESになるまでステップB2、B3を繰り返し実行する。   In step B2, if the data "writing" is other than blank, that is, the judgment value is written, the control circuit 2 judges NO in step B2, proceeds to step B3, and moves the writing position to the next position. Set to the writing position. After that, the control circuit 2 returns to step B2 to determine whether or not the next writing position "writing" is blank, and repeatedly executes steps B2 and B3 until YES.

制御回路2は、上記のようにしてプログラム起動判定処理が終了すると、図2の電源オン時の処理に戻ってステップA2に進む。制御回路2は、ステップA2で、アプリケーションが起動可能か否かを判断する。具体的には、書き込み位置の「書き込み完」が判定値と等しいとき、アプリケーション起動可能と判断する。ここで、制御回路2は、アプリケーションが起動可能であれば、YESと判断してステップA3に進み、アプリケーションにおけるメイン処理を実行する。このとき、制御回路2は、ステップA3でアプリケーションを実行しながら、ステップA4で外部からのリプログラミング指示すなわちプログラム書き込み指示があるか否かをチェックしている。   When the program activation determination process is completed as described above, the control circuit 2 returns to the process when the power is turned on in FIG. 2 and proceeds to step A2. The control circuit 2 determines in step A2 whether the application can be started. Specifically, when "write complete" at the write position is equal to the determination value, it is determined that the application can be started. Here, if the application can be started, the control circuit 2 determines YES and proceeds to step A3 to execute the main processing in the application. At this time, the control circuit 2 executes the application in step A3 and checks in step A4 whether or not there is an external reprogramming instruction, that is, a program write instruction.

制御回路2は、ステップA3、A4を実行して、アプリケーションのメイン処理を実施しているときに、外部からプログラム書き込み指示があると、ステップA4でYESと判断してステップA5に進み、プログラム書き込み処理を実行する。   The control circuit 2 executes steps A3 and A4 to determine YES in step A4 when a program write instruction is issued from the outside while executing the main processing of the application, and proceeds to step A5 to write the program. Execute the process.

上記の場合において、外部からプログラム書き込み指示は、外部のデータ送受信装置10からユーザなどによりプログラムの書き込みの指示が発生することであり、通信部3を介して制御回路2に取り込まれるものである。   In the above case, the program write instruction from the outside means that a user or the like issues an instruction to write the program from the external data transmitter/receiver 10, and is taken into the control circuit 2 via the communication unit 3.

また、制御回路2は、ステップA2でアプリケーションが起動可ではなかった場合には、NOと判断してステップA6に移行する。制御回路2は、ステップA6で、外部からのプログラム書き込み指示があるまで待機状態となり、プログラム書き込み指示があると、YESと判断してステップA5に進んでプログラム書き込み処理を実行する。   When the application is not ready to be started in step A2, the control circuit 2 determines NO and moves to step A6. In step A6, the control circuit 2 stands by until there is a program write instruction from the outside, and if there is a program write instruction, the control circuit 2 determines YES and proceeds to step A5 to execute the program write processing.

次に、図4および図5を参照して上記したプログラム書き込み処理について説明する。図4は、上記したステップA5のプログラム書き込み処理の具体的な流れを示している。また、図5はフラッシュメモリ5の内部におけるアドレスに対応したブロックを示している。   Next, the program writing process described above will be described with reference to FIGS. 4 and 5. FIG. 4 shows a specific flow of the program write processing in step A5 described above. Further, FIG. 5 shows blocks corresponding to addresses inside the flash memory 5.

まず、図5において、フラッシュメモリ5のデータ保存部5aは、アドレス0000 0000〜EFFF FFFFの領域に対応して設定され、データ管理部5bは、アドレスF0000〜FFFF FFFFの領域に対応して設定されている。ここで、データ管理部5bのサイズは、フラッシュメモリ5におけるデータ消去の最小単位である1ブロックに相当している。   First, in FIG. 5, the data storage unit 5a of the flash memory 5 is set corresponding to the area of addresses 0000 0000 to EFFF FFFF, and the data management unit 5b is set corresponding to the area of addresses F0000 to FFFF FFFF. ing. Here, the size of the data management unit 5b corresponds to one block which is the minimum unit of data erasing in the flash memory 5.

データ管理部5bは、書き込み状態を示すデータ「書き込み状態n」で構成されるものである。「書き込み状態n」を示すデータは、データ保存部5aが書き込み中かどうかを示す例えば4バイトのデータ「書き込み中」とデータ保存部5aが書き込み完了しているかどうかを示す例えば4バイトのデータ「書き込み完」のペアで構成される。   The data management unit 5b is composed of data "writing state n" indicating the writing state. The data indicating the "writing state n" is, for example, 4-byte data "writing" indicating whether the data storage unit 5a is writing, and the 4-byte data "indicating whether the data storage unit 5a has completed writing. It is composed of a pair of "writing completed".

なお、図示の例では、「書き込み状態n」のサイズは8バイト単位のデータ長で構成される場合を示したが、これに限らず、データ保存部5aとデータ管理部5bのサイズおよび、配置は任意に設定できるものとする。また、「書き込み状態n」のアドレスも上記設定と異なる設定にすることができる。   In addition, in the illustrated example, the size of the “write state n” is shown to be configured with a data length of 8 bytes, but the size and arrangement of the data storage unit 5a and the data management unit 5b are not limited to this. Can be set arbitrarily. Further, the address of the "writing state n" can be set differently from the above setting.

この実施形態では、図5に示しているように、データ保存部5aへのプログラム書き込み処理が実行される毎に、データ管理部5bでは、先頭のアドレス「F000 0000」から「書き込み状態1」が書き込まれ、以下順次、次のアドレスに「書き込み状態2」…と追記される。そして最後に書き込みが行われた書き込み位置に「書き込み状態n」のデータが書き込まれている。   In this embodiment, as shown in FIG. 5, every time the program writing process to the data storage unit 5a is executed, the data management unit 5b switches from the head address "F000 0000" to "write state 1". The data is written, and subsequently, "write state 2"... Is additionally written at the next address. Then, the data of the "writing state n" is written at the writing position where the writing is performed last.

次に、プログラム書き込み処理の流れについて図4を参照して説明する。制御回路2は、先に前述した図3のプログラム起動判定処理を実行しているので、フラッシュメモリ5のデータ管理部5bの書き込み位置を確定している。制御回路2は、まず、ステップC1で、データ管理部5bが満杯かどうかを確認する。すなわち、制御回路2は、データ管理部5bの書き込み位置がアドレスの末尾に相当する場合には、このままでは書き込みが実施できない満杯の状態である。   Next, the flow of the program writing process will be described with reference to FIG. Since the control circuit 2 has previously executed the program activation determination process of FIG. 3, the write position of the data management unit 5b of the flash memory 5 is fixed. The control circuit 2 first confirms in step C1 whether the data management unit 5b is full. That is, when the write position of the data management unit 5b corresponds to the end of the address, the control circuit 2 is in a full state in which writing cannot be performed as it is.

ここで、データ管理部5bが満杯状態の場合は、制御回路2は、ステップC1でYESと判断し、ステップC2に進んでデータ管理部5bのデータを全て消去する。そして、制御回路2は、続くステップC3で、書き込み位置をデータ管理部5bの先頭に設定する。   Here, when the data management unit 5b is full, the control circuit 2 determines YES in step C1, proceeds to step C2, and erases all the data in the data management unit 5b. Then, in the subsequent step C3, the control circuit 2 sets the writing position at the head of the data management unit 5b.

なお、上記のステップC1で、「満杯状態」とは「書き込み中」がブランクである領域がデータ管理部5b内で残り「1」領域の状態を指すものとする。これは、「満杯状態」をブランク残り「0」領域と定義すると、プログラム書き込み完了後の電源オフ、オン時におけるプログラム起動判定処理のステップA1にて無限ループとなるからであり、このような無限ループとなるのを避けるため残り「1」領域と定義している。   In step C1 described above, the "full state" refers to the state of the "1" area in which the "writing" blank area remains in the data management unit 5b. This is because if the "full state" is defined as a blank remaining "0" area, an infinite loop will be formed in step A1 of the program start determination process at the time of power-off and power-on after the completion of program writing. The remaining "1" area is defined to avoid a loop.

この後、制御回路2は、ステップC4に進んで書き込み位置の「書き込み中」に判定値を書き込む。また、データ管理部5bが満杯状態でない場合は、制御回路2は、ステップC1でNOと判断してステップC4にジャンプし、書き込み位置の「書き込み中」に判定値を書き込む。   After that, the control circuit 2 proceeds to step C4 to write the determination value in "writing" at the writing position. If the data management unit 5b is not full, the control circuit 2 determines NO in step C1, jumps to step C4, and writes the determination value in the "writing" position at the write position.

この後、制御回路2は、ステップC5に進み、データ保存部5aの書き込み対象となる領域のデータを消去し、次のステップC6で、外部から通信部3を介して取り込まれるプログラムのデータをデータ保存部5aにデータを書き込む処理を実行する。続いて、制御回路2は、ステップC7で、データ管理部5bの書き込み位置の「書き込み完」に判定値を書き込み、プログラム書き込みの処理を終了させる。   After that, the control circuit 2 proceeds to step C5, erases the data in the area to be written in the data storage unit 5a, and in the next step C6, the data of the program fetched from the outside via the communication unit 3 is converted into data. A process of writing data in the storage unit 5a is executed. Subsequently, in step C7, the control circuit 2 writes the determination value in the "writing complete" of the writing position of the data management unit 5b, and ends the program writing process.

以上のようにして、電源オンの後に、外部からプログラム書き込みの指示があるときの制御回路2による動作が実行される。図6および図7は、上記のプログラム書き込み処理を実行した場合の具体例を示すものである。なお、この具体例では、フラッシュメモリ5におけるデータ管理部5bの書き込み状態は実施されておらず、先頭のアドレス「F000 0000」がブランクである場合で説明する。   As described above, after the power is turned on, the operation by the control circuit 2 when the program write instruction is given from the outside is executed. 6 and 7 show specific examples in the case where the above program writing process is executed. In this specific example, the case where the writing state of the data management unit 5b in the flash memory 5 is not executed and the leading address "F000 0000" is blank will be described.

まず、図6は、フラッシュメモリ5において正常にデータ保存部5aのプログラム書き込みが完了した場合のデータ管理部5bの状態を示している。プログラム書き込みの開始前の状態では、制御回路2は、プログラム起動判定処理を実行することで、ステップB2で書き込み位置の「書き込み中」がブランクであることからYESとなり、図6(a)に示すように、アドレス「F000 0000」が書き込み位置となる。   First, FIG. 6 shows a state of the data management unit 5b when the program writing in the data storage unit 5a is normally completed in the flash memory 5. In the state before the start of the program writing, the control circuit 2 executes the program activation determination processing, and the result is YES because "writing in progress" at the writing position is blank in step B2, and is shown in FIG. 6A. Thus, the address “F00000000” is the writing position.

この状態で、制御回路2は、図6(b)に示すように、ステップC4を実行して書き込み開始時に書き込み位置のアドレス「F000 0000」の「書き込み中」に判定値を書き込む。これにより、現在プログラムのデータをデータ保存部5aに書き込み中の状態であることが示される。   In this state, as shown in FIG. 6B, the control circuit 2 executes step C4 to write the determination value to the “writing in progress” at the write position address “F000 0000” at the start of writing. This indicates that the program data is currently being written to the data storage unit 5a.

この後、制御回路2は、ステップC5、C6を実行してプログラムの書き込み処理が完了すると、図6(c)に示すように、ステップC7で、書き込み位置のアドレス「F000 0000」の「書き込み完」に判定値を書き込む処理を行う。これにより、データ管理部5bに、プログラムの書き込み処理が実行されて、正常に書き込み処理が終了したことが記録される。   After this, when the control circuit 2 executes steps C5 and C6 to complete the program write processing, as shown in FIG. 6C, in step C7, the write position address “F000 0000” “write complete” is completed. The process of writing the judgment value into "" is performed. As a result, the fact that the program writing process has been executed and the writing process has been completed normally is recorded in the data management unit 5b.

次に、図7を参照して、プログラム書き込み中に電源断が発生し、再度プログラム書き込みを実行した場合のデータ管理部の状態について説明する。プログラム書き込みの開始前の状態では、プログラム起動判定処理を実行することで、ステップB2で、書き込み位置の「書き込み中」がブランクであることからYESとなる。この結果、制御回路2は、図7(a)に示すように、アドレス「F000 0000」を書き込み位置として設定する。   Next, with reference to FIG. 7, a state of the data management unit when the power supply is cut off during program writing and the program writing is executed again will be described. In the state before the start of the program writing, the program start determination process is executed, and the result of step B2 is YES because "writing in progress" at the writing position is blank. As a result, the control circuit 2 sets the address “F000 0000” as the write position, as shown in FIG.

この状態で、制御回路2は、図7(b)に示すように、ステップC4を実行して書き込み開始時に書き込み位置のアドレス「F000 0000」の「書き込み中」に判定値を書き込む。これにより、現在プログラムのデータをデータ保存部5aに書き込み中の状態であることが示される。   In this state, as shown in FIG. 7B, the control circuit 2 executes step C4 to write the determination value to the “writing in progress” at the write position address “F000 0000” at the start of writing. This indicates that the program data is currently being written to the data storage unit 5a.

この後、前述のようにして、制御回路2は、ステップC5、C6を実施して、フラッシュメモリ5のデータ保存部5aにプログラム書き込み処理を実行する。そして、プログラム書き込み処理の実行中に、電源断が発生すると、データ管理部5bの書き込み位置の「書き込み完」はブランク状態のままとなる。   Then, as described above, the control circuit 2 executes steps C5 and C6 to execute the program writing process in the data storage unit 5a of the flash memory 5. Then, if the power is cut off during the execution of the program writing process, the "writing complete" at the writing position of the data management unit 5b remains blank.

そして、再度電源オンとなったときには、制御回路2は、前述同様にして電源オン時の処理を実施し、ステップA1のプログラム起動判定処理を実施する。ここでは制御回路2は、ステップB1からB2に進むと、前回のプログラム書き込み処理時に、プログラムの書き込み処理が完了していないうちに断電となっているので、NOと判断する。   Then, when the power is turned on again, the control circuit 2 carries out the processing at the time of turning on the power in the same manner as described above, and carries out the program start determination processing of step A1. Here, when the control circuit 2 proceeds from step B1 to step B2, the control circuit 2 determines that the power supply is cut off before the program writing process is completed before the previous program writing process, and thus determines NO.

すなわち、図7(c)に示すように、書き込み位置のアドレス「F000 0000」の「書き込み中」に判定値が書き込まれているので、ブランクではない状態となっている。このため、制御回路2は、ステップB2でNOと判断してステップB3に移行する。制御回路2は、ここで、書き込み位置を次の書き込み位置であるアドレス「F000 0008」に設定する。   That is, as shown in FIG. 7C, the judgment value is written in the “writing in progress” of the address “F00000000” at the writing position, so that the state is not blank. Therefore, the control circuit 2 determines NO in step B2 and proceeds to step B3. Here, the control circuit 2 sets the writing position to the address "F000 0008" which is the next writing position.

制御回路2は、ステップB2に戻ると、新たに書き込み位置として設定されたアドレス「F000 0008」の「書き込み中」がブランクとなっているので、このアドレスを書き込み位置として設定する。この後、制御回路2は、プログラム書き込み開始時に、ステップC4を実行して、図7(d)に示すように、書き込み位置のアドレス「F000 0008」の「書き込み中」に判定値を書き込む。   When the control circuit 2 returns to step B2, the address "F00000008", which is newly set as the write position, is "blank", so that the address is set as the write position. After that, the control circuit 2 executes step C4 at the start of writing the program, and writes the determination value in the “writing in progress” at the address “F000 0008” at the writing position, as shown in FIG. 7D.

そして、制御回路2は、ステップC5、C6を実行してプログラムの書き込み処理が完了すると、図7(e)に示すように、ステップC7で、書き込み位置のアドレス「F000 0008」の「書き込み完」に判定値を書き込む処理を行う。これにより、データ管理部5bに、プログラムの書き込み処理が実行されて、断電後に正常に書き込み処理が終了したことが記録される。   Then, when the control circuit 2 executes steps C5 and C6 to complete the program writing process, as shown in FIG. 7E, in step C7, the write position address “F000 0008” “write complete” is completed. The process of writing the judgment value to is performed. As a result, it is recorded in the data management unit 5b that the writing process of the program is executed and the writing process is normally completed after the power is cut off.

このような本実施形態によれば、制御回路2により、フラッシュメモリ5のデータ保存部5aに対してプログラム書き込み開始時に、データ管理部5bの書き込み位置のアドレスに「書き込み中」を判定値として設定するようにした。   According to the present embodiment as described above, the control circuit 2 sets “writing in progress” as the determination value to the address of the write position of the data management unit 5b at the start of writing the program to the data storage unit 5a of the flash memory 5. I decided to do it.

これにより、プログラム書き込み中に電源断が発生した場合でも、データ管理部5bの書き込み位置のデータをブロック消去して書き換えるのではなく、新たに書き込み位置の書き込み中を追記することで設定し、データ書き込みを行うことでプログラム書き込み中の電源断発生後も正常にプログラム書き込みが完了できる。   As a result, even if the power is cut off during the writing of the program, the data at the writing position of the data management unit 5b is not erased and rewritten, but is set by newly writing during writing of the writing position. By writing, the program writing can be completed normally even after the power failure during the program writing.

この結果、プログラム書き込み処理を実行する毎に、データ管理部5bのブロック消去をすることがなくなり、フラッシュメモリ5の書き換え回数を大幅に低減して長寿命化を図ることができる。   As a result, the block erasing of the data management unit 5b is not performed every time the program writing process is executed, and the number of rewritings of the flash memory 5 can be significantly reduced and the life of the flash memory 5 can be extended.

(第2実施形態)
図8から図12は第2実施形態を示すもので、以下、第1実施形態と異なる部分について説明する。この実施形態では、制御回路2によるフラッシュメモリ5のデータ管理部5bへの書き込み処理の方式を変更している。第1実施形態の方式が「非リスト構造」であったのに対して、この実施形態では「リスト構造」を採用している。
(Second embodiment)
FIG. 8 to FIG. 12 show the second embodiment, and the portions different from the first embodiment will be described below. In this embodiment, the method of writing processing to the data management unit 5b of the flash memory 5 by the control circuit 2 is changed. While the method of the first embodiment is the “non-list structure”, the “list structure” is adopted in this embodiment.

この実施形態では、図10に示すように、フラッシュメモリ5のデータ管理部5bは、書き込み状態を示すデータ「書き込み状態n」で構成される「リスト構造」である。書き込み状態を示すデータは、データ保存部5aへの書き込みが完了したかどうかを示す例えば4バイトのデータ「書き込み完」と、次の書き込み状態へのアドレスである「書き込みアドレス」のペアで構成される。   In this embodiment, as shown in FIG. 10, the data management unit 5b of the flash memory 5 has a “list structure” configured by data “write state n” indicating the write state. The data indicating the write state is composed of a pair of, for example, 4-byte data “write complete” indicating whether the write to the data storage unit 5a is completed and a “write address” that is an address to the next write state. It

また、この実施形態においても、書き込み状態のアドレス、サイズは任意のアドレス、データ長で構成され、データ保存部5aとデータ管理部5bのサイズおよび、配置は任意に設定できるものとする。なお、図10では、「書き込み状態n」の「書き込みアドレス」を連続的に設定するように示しているが、上記のとおり、必ずしも連続的に設定する必要はなく、任意の設定条件にしたがってブランクな書き込み位置に「書き込みアドレス」を設定することができる。   Also in this embodiment, it is assumed that the address and size in the written state are composed of arbitrary addresses and data lengths, and the size and arrangement of the data storage unit 5a and the data management unit 5b can be set arbitrarily. Note that, in FIG. 10, the "write address" of the "write state n" is set to be continuously set, but as described above, it is not always necessary to set continuously, and the blank is set according to an arbitrary setting condition. A "write address" can be set at any write position.

次に、この実施形態における制御回路2による処理内容の相違点を説明する。
プログラム起動判定処理の流れを示す図8において、制御回路2は、ステップB2に代えて、ステップB2aとして書き込み位置の「書き込みアドレス」がブランクであるか否かを判断するものとしている。
Next, differences in processing contents by the control circuit 2 in this embodiment will be described.
In FIG. 8 showing the flow of the program start determination process, the control circuit 2 determines whether or not the “write address” of the write position is blank as step B2a instead of step B2.

ここでは、ステップB1で、最初に設定する書き込み位置は、データ管理部5bの先頭位置つまりアドレス「F000 0000」としているので、このアドレスの「書き込みアドレス」が設定されていなければ、先頭位置を書き込み位置として設定することができる。   In this case, in step B1, the write position to be set first is the start position of the data management unit 5b, that is, the address "F000 0000", so if the "write address" of this address is not set, the write position It can be set as a position.

また、ステップB2aで、「書き込みアドレス」が設定されている場合つまりブランクではない場合いは、制御回路2は、ステップB3aに移行し、「書き込みアドレス」で設定されている書き込み位置を設定する。以下、順次書き込み位置の「書き込みアドレス」をたどることで、制御回路2は、最後の書き込み位置で設定した「書き込みアドレス」の書き込み位置がブランク状態であること判定することができる。   In step B2a, if the "write address" is set, that is, if it is not blank, the control circuit 2 moves to step B3a and sets the write position set in the "write address". Hereinafter, the control circuit 2 can determine that the write position of the “write address” set at the last write position is in the blank state by tracing the “write address” of the write position in sequence.

プログラム書き込み処理の流れを示す図9において、制御回路2は、第1実施形態と同様にして処理を実行するが、ステップC4では、これに代えてステップC4aおよびステップC4bを実行する。制御回路2は、ステップC4aでは、現在の書き込み位置の「書き込みアドレス」に次の書き込み位置を示すアドレスを書き込む。これにより、書き込み処理が実施されている状態を示すこととなり、第1実施形態における「判定値」と同等の状態となる。制御回路2は、ステップC4bでは、現在の書き込み位置をステップC4aで書き込んだアドレスに設定する。   In FIG. 9 showing the flow of the program writing process, the control circuit 2 executes the process in the same manner as in the first embodiment, but in step C4, instead of this, steps C4a and C4b are executed. In step C4a, the control circuit 2 writes the address indicating the next write position in the "write address" of the current write position. As a result, the state in which the writing process is being performed is indicated, and the state is equivalent to the “judgment value” in the first embodiment. In step C4b, the control circuit 2 sets the current write position to the address written in step C4a.

図11および図12は、上記のプログラム書き込み処理を実行した場合の具体例を示すものである。なお、この具体例では、フラッシュメモリ5におけるデータ管理部5bの書き込み状態は実施されておらず、先頭のアドレス「F000 0000」がブランクである場合で説明する。   11 and 12 show a specific example of the case where the above program writing process is executed. In this specific example, the case where the write state of the data management unit 5b in the flash memory 5 is not executed and the leading address "F000 0000" is blank will be described.

まず、図11は、フラッシュメモリ5において正常にデータ保存部5aのプログラム書き込みが完了した場合のデータ管理部5bの状態を示している。プログラム書き込みの開始前の状態では、制御回路2は、図8のプログラム起動判定処理を実行する。これにより、制御回路2は、ステップB2aで書き込み位置の「書き込みアドレス」がブランクであることからYESとなり、図11(a)に示すように、アドレス「F000 0000」が書き込み位置であることを判定できる。   First, FIG. 11 shows a state of the data management unit 5b when the program writing in the data storage unit 5a is normally completed in the flash memory 5. In the state before the start of the program writing, the control circuit 2 executes the program activation determination process of FIG. As a result, the control circuit 2 determines YES in step B2a because the "write address" of the write position is blank, and determines that the address "F000 0000" is the write position, as shown in FIG. 11(a). it can.

この状態で、制御回路2は、図11(b)に示すように、図9のステップC4aを実行して書き込み開始時に書き込み位置のアドレス「F000 0000」の「書き込みアドレス」に次の書き込みアドレスを書き込む。これにより、現在プログラムのデータをデータ保存部5aに書き込み中の状態であることが示される。次に、制御回路2は、ステップC4bを実行し書き込み位置を更新する。   In this state, as shown in FIG. 11B, the control circuit 2 executes step C4a in FIG. 9 to set the next write address to the “write address” of the write position address “F000 0000” at the start of writing. Write. This indicates that the program data is currently being written to the data storage unit 5a. Next, the control circuit 2 executes step C4b to update the write position.

この後、制御回路2は、ステップC5、C6を実行してプログラムの書き込み処理が完了すると、図11(c)に示すように、ステップC7で、書き込み位置のアドレス「F000 0008」の「書き込み完」に判定値を書き込む処理を行う。これにより、データ管理部5bに、プログラムの書き込み処理が実行されて、正常に書き込み処理が終了したことが記録される。   After this, when the control circuit 2 executes steps C5 and C6 to complete the program write processing, as shown in FIG. 11(c), in step C7, the write position address “F000 0008” “write complete” is completed. The process of writing the judgment value into "" is performed. As a result, the fact that the program writing process has been executed and the writing process has been completed normally is recorded in the data management unit 5b.

次に、図12を参照して、プログラム書き込み中に電源断が発生し、再度プログラム書き込みを実行した場合のデータ管理部の状態について説明する。プログラム書き込みの開始前の状態では、プログラム起動判定処理を実行することで、ステップB2aで、書き込み位置の「書き込みアドレス」がブランクであることからYESとなる。この結果、制御回路2は、図12(a)に示すように、アドレス「F000 0000」を書き込み位置として設定する。   Next, with reference to FIG. 12, a state of the data management unit when the power supply is cut off during the program writing and the program writing is executed again will be described. In the state before the program writing is started, the program start determination process is executed, and the result is YES because the "write address" of the write position is blank in step B2a. As a result, the control circuit 2 sets the address “F000 0000” as the write position, as shown in FIG.

この状態で、制御回路2は、図12(b)に示すように、ステップC4aを実行して書き込み開始時に書き込み位置のアドレス「F000 0000」の「書き込みアドレス」に次の「書き込みアドレス」を書き込む。これにより、現在プログラムのデータをデータ保存部5aに書き込み中の状態であることが示される。次に、制御回路2は、ステップC4bを実行し書き込み位置を更新する。   In this state, as shown in FIG. 12B, the control circuit 2 executes step C4a to write the next “write address” to the “write address” of the write position address “F00000000” at the start of writing. .. This indicates that the program data is currently being written to the data storage unit 5a. Next, the control circuit 2 executes step C4b to update the write position.

この後、前述のようにして、制御回路2は、ステップC5、C6を実施して、フラッシュメモリ5のデータ保存部5aにプログラム書き込み処理を実行する。そして、プログラム書き込み処理の実行中に、電源断が発生すると、データ管理部5bの書き込み位置の「書き込み完」はブランク状態のままとなる。   Then, as described above, the control circuit 2 executes steps C5 and C6 to execute the program writing process in the data storage unit 5a of the flash memory 5. Then, if the power is cut off during the execution of the program writing process, the "writing complete" at the writing position of the data management unit 5b remains blank.

そして、再度電源オンとなったときには、制御回路2は、前述同様にして電源オン時の処理を実施し、ステップA1のプログラム起動判定処理を実施する。ここでは制御回路2は、ステップB1からB2aに進むと、前回のプログラム書き込み処理時に、プログラムの書き込み処理が完了していないうちに断電となっているので、NOと判断する。   Then, when the power is turned on again, the control circuit 2 carries out the processing at the time of turning on the power in the same manner as described above, and carries out the program start determination processing of step A1. Here, when the control circuit 2 proceeds from step B1 to B2a, the control circuit 2 determines that the power is cut off during the previous program writing process before the program writing process is completed, and thus determines NO.

すなわち、図12(c)に示すように、書き込み位置のアドレス「F000 0000」の「書き込みアドレス」に次の書き込みアドレスが書き込まれているので、ブランクではない状態となっている。このため、制御回路2は、ステップB2aでNOと判断してステップB3aに移行する。制御回路2は、ここで、書き込み位置を次の「書き込みアドレス」で設定されている書き込み位置であるアドレス「F000 0008」に設定する。   That is, as shown in FIG. 12C, since the next write address is written in the “write address” of the write position address “F0000 0000”, the state is not blank. Therefore, the control circuit 2 determines NO in step B2a, and proceeds to step B3a. Here, the control circuit 2 sets the write position to the address “F000 0008” which is the write position set by the next “write address”.

制御回路2は、ステップB2aに戻ると、新たに書き込み位置として設定されたアドレス「F000 0008」の「書き込みアドレス」がブランクとなっているので、このアドレスを書き込み位置として設定する。この後、制御回路2は、プログラム書き込み開始時に、ステップC4aを実行して、図12(d)に示すように、書き込み位置のアドレス「F000 0008」の「書き込みアドレス」に次の書き込みを行うアドレスを書き込む。次に、制御回路2は、ステップC4bを実行し書き込み位置を更新する。   When the control circuit 2 returns to step B2a, the "write address" of the address "F00000008" that has been newly set as the write position is blank, so this address is set as the write position. After that, the control circuit 2 executes step C4a at the start of writing the program, and as shown in FIG. 12D, the address to write next to the "write address" of the address "F000 0008" at the write position. Write. Next, the control circuit 2 executes step C4b to update the write position.

そして、制御回路2は、ステップC5、C6を実行してプログラムの書き込み処理が完了すると、図12(e)に示すように、ステップC7で、書き込み位置のアドレス「F000 0010」の「書き込み完」に判定値を書き込む処理を行う。これにより、データ管理部5bに、プログラムの書き込み処理が実行されて、断電後に正常に書き込み処理が終了したことが記録される。   Then, when the program writing process is completed by executing steps C5 and C6, the control circuit 2 at step C7, as shown in FIG. 12(e), "write complete" at the address "F000 0010" at the write position. The process of writing the judgment value to is performed. As a result, it is recorded in the data management unit 5b that the writing process of the program is executed and the writing process is normally completed after the power is cut off.

このような本実施形態によっても、第1実施形態と同様の効果を得ることができる。
また、本実施形態によれば、データ管理部5bでの書き込み位置のアドレス設定を、「リスト構造」を採用することで、データの書き込み位置をブロック内で平均的にばらつくように設定することもできる。これによって、さらに、フラッシュメモリ5の書き換え回数を少なくして長寿命化を図ることができる。
According to the present embodiment as described above, the same effect as that of the first embodiment can be obtained.
Further, according to the present embodiment, by adopting the “list structure” for the address setting of the write position in the data management unit 5b, it is possible to set the write position of the data so as to be dispersed evenly within the block. it can. As a result, it is possible to further reduce the number of times of rewriting of the flash memory 5 and prolong the life of the flash memory 5.

なお、上記実施形態では、データ管理部5bの「書き込み状態n」の「書き込みアドレス」を、順次次のアドレスに指定する方式としているが、これに限らず、任意のアドレスを設定することができる。例えば、一定の条件のもとで次の書き込みアドレスを設定することで、データ管理部5bの中のアドレスを平均的に使用することができ、書き換え回数を部分的に増加させることなく使用することもできる。   In the above embodiment, the "write address" of the "write state n" of the data management unit 5b is sequentially designated as the next address, but the present invention is not limited to this, and any address can be set. .. For example, by setting the next write address under a certain condition, the address in the data management unit 5b can be used evenly, and can be used without partially increasing the number of rewrites. You can also

(第3実施形態)
図13および図14は第3実施形態を示すもので、以下、第1実施形態と異なる部分について説明する。この実施形態では、フラッシュメモリ20の領域の設定を複数のデータ保存部20a、20bおよび複数のデータ管理部20c、20dとして設ける場合に適用している。
(Third Embodiment)
FIG. 13 and FIG. 14 show the third embodiment, and the portions different from the first embodiment will be described below. In this embodiment, the setting of the area of the flash memory 20 is applied when a plurality of data storage units 20a and 20b and a plurality of data management units 20c and 20d are provided.

図14はフラッシュメモリ20のデータ領域区分を示している。2つのデータ保存部20a、20bは、アプリケーション・データ保存部20aおよびキャリブレーション・データ保存部20bとして設けられる。アプリケーション・データ保存部20aは、アドレス「0000 0000」〜「BFFF FFFF」の範囲に設定され、キャリブレーション・データ保存部20bは、アドレス「C000 0000」〜「EFFF FFFF」の範囲に設定される。   FIG. 14 shows the data area division of the flash memory 20. The two data storage units 20a and 20b are provided as an application data storage unit 20a and a calibration data storage unit 20b. The application data storage unit 20a is set in the range of addresses "0000 0000" to "BFFF FFFF", and the calibration data storage unit 20b is set in the range of addresses "C000 0000" to "EFFF FFFF".

ここで、アプリケーションとキャリブレーションを別々に保存するのは、例えば、制御プログラムをアプリケーションとし、車種や制御内容に応じてキャリブレーション・データだけを異なるように設定する場合などに適した方式となるからである。このように、キャリブレーション・データを別にして提供することで、アプリケーションを汎用化した状態で提供できるというメリットがある。   Here, the application and the calibration are stored separately because, for example, the control program is an application and is suitable for setting only the calibration data differently according to the vehicle type and the control content. Is. By separately providing the calibration data in this way, there is an advantage that the application can be provided in a generalized state.

2つのデータ管理部20c、20dは、アプリケーション・データ管理部20cおよびキャリブレーション・データ管理部20dとして設けられる。アプリケーション・データ管理部20cは、アドレス「F000 0000」〜「F7FF FFFF」の範囲に設定され、キャリブレーション・データ管理部20dは、アドレス「F800 0000」〜「FFFF FFFF」の範囲に設定される。   The two data management units 20c and 20d are provided as an application data management unit 20c and a calibration data management unit 20d. The application/data management unit 20c is set in the range of addresses “F000 0000” to “F7FF FFFF”, and the calibration/data management unit 20d is set in the range of addresses “F800 0000” to “FFFF FFFF”.

上記したデータ領域は、アプリケーション・データ保存部20aはアプリケーション・データ管理部20cにより管理され、キャリブレーション・データ保存部20bはキャリブレーション・データ管理部20dにより管理される構成とし、それぞれが単独でプログラムの書き換えを実施できる。   The above-mentioned data area is configured such that the application data storage unit 20a is managed by the application data management unit 20c and the calibration data storage unit 20b is managed by the calibration data management unit 20d. Can be rewritten.

図13は、上記構成の場合における電源オン時に、制御回路2により実行される処理を示している。制御回路2は、ステップA10で、フラッシュメモリ5に設けられたデータ管理部20cおよび20dに対応して2つに対応したループ1を開始する。このループ1では、制御回路2は、ステップA11で、図3に示したプログラム起動判定処理を実施し、書き込み位置を確定する。続くステップA12で、制御回路2は、アプリケーションが起動可能か判断する。   FIG. 13 shows a process executed by the control circuit 2 when the power is turned on in the case of the above configuration. In step A10, the control circuit 2 starts the loop 1 corresponding to the two data management units 20c and 20d provided in the flash memory 5. In this loop 1, the control circuit 2 executes the program activation determination process shown in FIG. 3 in step A11 to determine the write position. At the subsequent step A12, the control circuit 2 determines whether the application can be started.

制御回路2は、最初のデータ管理部20cについて、アプリケーションが起動可能で、且つ次のデータ管理部20dがある場合は、ステップA13でループ1を繰り返すために、ステップA11に戻り、次のデータ管理部20dについて処理を実行する。そして、制御回路2は、全てのデータ管理部20c、20dの検索が完了した場合は、ステップA14でアプリケーションにおけるメイン処理を実行する。このとき、制御回路2は、ステップA14でアプリケーションを実行しながら、ステップA15で外部からのプログラム書き込み指示があるか否かをチェックしている。   The control circuit 2 returns to step A11 in order to repeat loop 1 in step A13 when the application can be started for the first data management section 20c and there is the next data management section 20d, and the next data management is performed. The process is executed for the unit 20d. Then, when the search of all the data management units 20c and 20d is completed, the control circuit 2 executes the main processing in the application in step A14. At this time, the control circuit 2 executes the application in step A14, and checks in step A15 whether or not there is an external program write instruction.

制御回路2は、ステップA14、A15を繰り返し実行して、アプリケーションのメイン処理を実施しているときに、外部からプログラム書き込み指示があると、ステップA15でYESと判断してステップA16に進み、プログラム書き込み処理のループ2(ステップA16〜A18)を実行する。   The control circuit 2 repeatedly executes steps A14 and A15, and while executing the main processing of the application, if there is a program write instruction from the outside, the control circuit 2 determines YES in step A15, proceeds to step A16, and executes the program. The loop 2 (steps A16 to A18) of the writing process is executed.

また、制御回路2は、ステップA12でアプリケーションが起動可ではなかった場合には、NOと判断してステップA19に移行する。制御回路2は、ステップA19で、外部からのプログラム書き込み指示があるまで待機状態となり、プログラム書き込み指示があると、YESと判断してステップA16に進んでプログラム書き込み処理のループ2を実行する。   If the application is not ready to be activated in step A12, the control circuit 2 makes a negative decision and proceeds to step A19. In step A19, the control circuit 2 stands by until there is a program write instruction from the outside, and if there is a program write instruction, the control circuit 2 determines YES and proceeds to step A16 to execute loop 2 of the program write processing.

プログラム書き込み処理のループ2では、制御回路2は、ステップA17のプログラム書き込み処理を実施する。この場合、制御回路2は、ステップA15で受けたプログラム書き込み指示の数だけ、ループ2のプログラム書き込み処理を実行し、これらが終了すると電源オン時の処理を終了(エンド)する。   In loop 2 of the program writing process, the control circuit 2 carries out the program writing process of step A17. In this case, the control circuit 2 executes the program write processing of the loop 2 for the number of program write instructions received in step A15, and when these are completed, the processing at power-on is ended (end).

また、上記のようなプログラム書き込み処理を実行する場合においても、書き込み処理を実行しているときに断電になった場合には、第1実施形態と同様にして、電源オン時の処理を実行することで、データ管理部20cあるいは20dの書き込み位置のデータをブロック消去して書き換えるのではなく、新たに書き込み位置の書き込み中を追記することで設定し、データ書き込みを行うことでプログラム書き込み中の電源断発生後も正常にプログラム書き込みが完了できる。   Further, even when the program writing process as described above is executed, if the power is cut during the writing process, the power-on process is executed as in the first embodiment. By doing so, the data at the writing position of the data management unit 20c or 20d is not block-erased and rewritten, but it is set by additionally writing that the writing position is newly written. Program writing can be completed normally even after power failure.

この結果、プログラム書き込み処理を実行する毎に、データ管理部20cあるいは20dのブロック消去をすることがなくなり、フラッシュメモリ20の書き換え回数を大幅に低減して長寿命化を図ることができる。
また、本実施形態によれば、キャリブレーション・データだけを別途書き換えることができるので、短時間で書き込み処理が行えるという利点がある。
As a result, it is not necessary to erase the block of the data management unit 20c or 20d each time the program writing process is executed, and the number of times of rewriting of the flash memory 20 can be greatly reduced to prolong the service life.
Further, according to the present embodiment, since only the calibration data can be rewritten separately, there is an advantage that the writing process can be performed in a short time.

(他の実施形態)
なお、本発明は、上述した実施形態のみに限定されるものではなく、その要旨を逸脱しない範囲で種々の実施形態に適用可能であり、例えば、以下のように変形または拡張することができる。
(Other embodiments)
The present invention is not limited to the above-described embodiments, but can be applied to various embodiments without departing from the scope of the invention, and can be modified or expanded as follows, for example.

上記第1および第2実施形態では、データ書き込み処理としてプログラム書き込み処理の場合について説明したが、プログラム中に含まれるデータだけを書き換えるために、データ書き込み処理をすることもできる。この場合には、例えば、データ部分を予め指定した領域として設定することができる。また、フラッシュメモリ中に書き込まれているプログラムと書き換えるデータが含まれたプログラムとの差分だけを書き換えるようにすることができる。   In the first and second embodiments described above, the case of the program writing process is described as the data writing process, but the data writing process may be performed in order to rewrite only the data included in the program. In this case, for example, the data portion can be set as a previously designated area. Further, only the difference between the program written in the flash memory and the program containing the data to be rewritten can be rewritten.

不揮発性メモリは、フラッシュメモリ以外のEEPROM(Electrically Erasable Programmable Read-Only Memory)などの不揮発性メモリを用いる場合にも適用することができる。   The non-volatile memory can be applied to a case where a non-volatile memory such as an EEPROM (Electrically Erasable Programmable Read-Only Memory) other than the flash memory is used.

不揮発性メモリのデータ管理部への書き換えデータの記載の方式は、第1および第2実施形態で示した方法以外に、書き換えの度に追記していく方式であれば他の方法を採用することができる。   As a method of writing the rewrite data in the data management unit of the non-volatile memory, in addition to the method shown in the first and second embodiments, another method may be adopted as long as it is a method of additionally writing each time rewriting. You can

第3実施形態では、フラッシュメモリ20に2つのデータ保存部20a、20bを設定する例を示したが、3つ以上のデータ保存部を設定する場合においても適用することができる。   In the third embodiment, an example in which two data storage units 20a and 20b are set in the flash memory 20 has been shown, but the present invention can be applied to the case where three or more data storage units are set.

本開示は、実施例に準拠して記述されたが、本開示は当該実施例や構造に限定されるものではないと理解される。本開示は、様々な変形例や均等範囲内の変形をも包含する。加えて、様々な組み合わせや形態、さらには、それらに一要素のみ、それ以上、あるいはそれ以下、を含む他の組み合わせや形態をも、本開示の範疇や思想範囲に入るものである。   Although the present disclosure has been described with reference to examples, it is understood that the present disclosure is not limited to the examples and structures. The present disclosure also includes various modifications and modifications within an equivalent range. In addition, various combinations and forms, and other combinations and forms including only one element, more, or less than those, also fall within the scope and spirit of the present disclosure.

図面中、1は車両制御装置、2は制御回路、3は通信部、5、20はフラッシュメモリ(不揮発性メモリ)、5a、20a、20bはデータ保存部、5b、20c、20dはデータ管理部、10はデータ送受信装置である。   In the drawings, 1 is a vehicle control device, 2 is a control circuit, 3 is a communication unit, 5 and 20 are flash memories (nonvolatile memories), 5a, 20a and 20b are data storage units, 5b, 20c and 20d are data management units. Reference numeral 10 is a data transmission/reception device.

Claims (4)

車両を制御するためのデータが記憶されるデータ保存部および前記データ保存部にデータが正常に書き込めたか否かを示すデータ管理部を有する書き換え可能な不揮発性メモリと、
前記不揮発性メモリに対してデータの書き込み処理をする制御回路とを備え、
前記制御回路は、前記不揮発性メモリの前記データ保存部へのデータ書き込み更新時に前記データ管理部の未使用領域に更新情報を追記する方式を採用し、前記データ書き込み更新開始時にデータ書き込み中を示す状態のデータを追記し、前記データ書き込み更新終了時にデータ書き込み済みを示す状態を追記し、前記不揮発性メモリの前記データ保存部へのデータ書き込み更新時に前記データ管理部の未使用領域に更新情報を追記する方式としてリスト構造を採用し、前記データ書き込み更新開始時に次の書き込みアドレスを追記し、前記データ書き込み更新終了時にデータ書き込み済みを示す状態を追記する車両制御装置。
A rewritable non-volatile memory having a data storage unit in which data for controlling a vehicle is stored and a data management unit indicating whether or not data has been normally written in the data storage unit,
A control circuit for writing data to the nonvolatile memory,
The control circuit employs a method of additionally writing update information to an unused area of the data management unit at the time of updating data writing to the data storage unit of the nonvolatile memory, and indicates that data is being written at the start of the data writing update. State data is added, and a state indicating that data has been written is added at the end of the data write update, and update information is written to an unused area of the data management unit when the data is written to the data storage unit of the nonvolatile memory and updated. A vehicle control device that adopts a list structure as a method of additional writing, additionally writes the next write address at the start of the data write update, and additionally writes a state indicating that data has been written at the end of the data write update .
前記制御回路は、電源オン時に前記不揮発性メモリの前記データ管理部の先頭アドレスから書き込み位置を探索し、有効となる書き込み状態を判断してその書き込み状態からデータ保存部にデータが正常に書き込まれたことを判断する請求項に記載の車両制御装置。 When the power is turned on, the control circuit searches for a write position from the start address of the data management unit of the nonvolatile memory, determines a valid write state, and normally writes data to the data storage unit from the write state. The vehicle control device according to claim 1 , wherein the vehicle control device determines that the fact is satisfied. 前記制御回路は、前記不揮発性メモリのデータ保存部にデータ書き込みをする際に、前記データ管理部の使用領域が満杯になっている場合には、前記データ管理部のデータを消去する請求項1または2に記載の車両制御装置。 The control circuit erases the data of the data management unit when the used area of the data management unit is full when writing data to the data storage unit of the nonvolatile memory. Alternatively, the vehicle control device according to item 2 . 前記制御回路は、前記不揮発性メモリに前記データ保存部が複数設定されている場合には、前記データ管理部を複数設定する請求項1からのいずれか一項に記載の車両制御装置。 The vehicle control device according to any one of claims 1 to 3 , wherein the control circuit sets a plurality of the data management units when a plurality of the data storage units is set in the nonvolatile memory.
JP2017036560A 2017-02-28 2017-02-28 Vehicle control device Active JP6699598B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017036560A JP6699598B2 (en) 2017-02-28 2017-02-28 Vehicle control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017036560A JP6699598B2 (en) 2017-02-28 2017-02-28 Vehicle control device

Publications (2)

Publication Number Publication Date
JP2018142211A JP2018142211A (en) 2018-09-13
JP6699598B2 true JP6699598B2 (en) 2020-05-27

Family

ID=63528063

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017036560A Active JP6699598B2 (en) 2017-02-28 2017-02-28 Vehicle control device

Country Status (1)

Country Link
JP (1) JP6699598B2 (en)

Also Published As

Publication number Publication date
JP2018142211A (en) 2018-09-13

Similar Documents

Publication Publication Date Title
US9164756B2 (en) Software updating process for an embedded device
US10241807B2 (en) Vehicle control device, reprogramming system
JP2011129192A (en) Semiconductor memory device
JP2015011475A (en) Information processing device, control method thereof, and program
JP2010020586A (en) Data processing device
JP3212960B2 (en) Data management method using flash memory
US20070198767A1 (en) Apparatus and method for controlling flash memory
JP5695112B2 (en) Data storage device, data storage method, and in-vehicle control device
JP6575157B2 (en) Firmware download method and firmware embedded device
JP6699598B2 (en) Vehicle control device
JP2001306543A (en) Microcomputer, and data reloading method for flash memory
JP4826232B2 (en) Information processing apparatus and boot program rewriting method
WO2012077604A1 (en) Processing device, program update method, and program
US20110082995A1 (en) Information processing apparatus
JP5521437B2 (en) Portable terminal device, software update method and program
JP4910402B2 (en) Nonvolatile memory rewriting device and rewriting method
JP6935694B2 (en) Electronic control device
JP2008225922A (en) Nonvolatile storage device
JP5787095B2 (en) Method for storing data in non-volatile memory
JP7317609B2 (en) electronic controller
JP2011108161A (en) Information processor
CN112732309B (en) Flash memory updating method and device and electronic equipment
JP2016071447A (en) Nonvolatile storage and control method thereof
JP2006004177A (en) Method for downloading program
JP2018128924A (en) Electronic control device, program for rewriting non-volatile memory, and method for rewriting non-volatile memory

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190409

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200129

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20200212

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200312

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200413

R151 Written notification of patent or utility model registration

Ref document number: 6699598

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250