JP5643708B2 - Electronic control unit - Google Patents
Electronic control unit Download PDFInfo
- Publication number
- JP5643708B2 JP5643708B2 JP2011074828A JP2011074828A JP5643708B2 JP 5643708 B2 JP5643708 B2 JP 5643708B2 JP 2011074828 A JP2011074828 A JP 2011074828A JP 2011074828 A JP2011074828 A JP 2011074828A JP 5643708 B2 JP5643708 B2 JP 5643708B2
- Authority
- JP
- Japan
- Prior art keywords
- block
- data
- blank
- flash memory
- cpu
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Description
本発明は、電子制御装置に関する。 The present invention relates to an electronic control device.
近年の車載ECU(Electronic Control Unit)は、イグニション・オン期間中に一定周期で取得した車両情報をバックアップデータとしてRAM(Random Access Memory)等の揮発性メモリに上書き保存しておき、所定条件の成立をトリガとして、揮発性メモリに保存されているバックアップデータをフラッシュメモリ等の不揮発性メモリに保存するバックアップ機能を備えている。 In-vehicle ECU (Electronic Control Unit) in recent years overwrites and saves vehicle information acquired in a fixed cycle during ignition ON period in volatile memory such as RAM (Random Access Memory), and the predetermined condition is satisfied. As a trigger, a backup function for storing backup data stored in a volatile memory in a nonvolatile memory such as a flash memory is provided.
例えば下記特許文献1には、フラッシュメモリをバックアップ用の不揮発性メモリとして備える車載ECUにおいて、フラッシュメモリの記憶領域に常に消去済み領域を確保しておき、RAMに保存されているバックアップデータをフラッシュメモリに保存する際には、消去済み領域の先頭アドレスから順番にバックアップデータの書込みを行う技術が開示されている。
For example, in
上記特許文献1の技術では、例えばフラッシュメモリのデータ消去中或いはデータ書込み中にCPU(Central Processing Unit)がリセットされると、フラッシュメモリのデータが不定となるため、故障を報知するための信号を出力する機能をCPUに持たせる必要があった(文献中の段落0035参照)。
In the technique disclosed in
また、従来では、バックアップデータの確からしさを、それらバックアップデータのSUM値を用いて判断していたが、フラッシュメモリのデータ消去中或いはデータ書込み中にCPUがリセットされると、正確なSUM値が得られなくなり、バックアップデータの確からしさを判断できなくなる可能性がある。 Conventionally, the accuracy of backup data has been determined using the SUM value of the backup data. However, if the CPU is reset during data erasure or data writing in the flash memory, an accurate SUM value is obtained. There is a possibility that the reliability of backup data cannot be determined.
本発明は上述した事情に鑑みてなされたものであり、フラッシュメモリのデータ消去中或いはデータ書込み中に、フラッシュメモリのデータ消去動作或いは書込み動作を中断させるような事象が発生した場合でも、適切なバックアップ動作を継続可能な電子制御装置を提供することを目的とする。 The present invention has been made in view of the above-described circumstances, and even when an event that interrupts the data erasing operation or writing operation of the flash memory occurs during the data erasing or data writing of the flash memory, the present invention is appropriate. An object of the present invention is to provide an electronic control device capable of continuing a backup operation.
上記目的を達成するために、本発明では、電子制御装置に係る第1の解決手段として、揮発性メモリと、フラッシュメモリと、前記揮発性メモリに保存されているバックアップデータを所定条件の成立をトリガとして前記フラッシュメモリに保存するメモリ制御部とを備える電子制御装置であって、前記メモリ制御部は、電源投入時において、前記フラッシュメモリの消去単位ブロックの内、データが全く保存されていない消去単位ブロックをブランクブロックとして特定し、前記ブランクブロックを基準として消去すべき消去単位ブロックを消去ブロックとして特定すると共に最新データが保存されている消去単位ブロックを最新ブロックとして特定することを特徴とする。 In order to achieve the above object, according to the present invention, as a first solution means for the electronic control device, the volatile memory, the flash memory, and the backup data stored in the volatile memory are satisfied with a predetermined condition. An electronic control device comprising a memory control unit that stores data in the flash memory as a trigger, wherein the memory control unit erases data that is not stored at all in the erase unit block of the flash memory when the power is turned on. A unit block is specified as a blank block, an erase unit block to be erased is specified as an erase block based on the blank block, and an erase unit block in which the latest data is stored is specified as the latest block.
また、本発明では、電子制御装置に係る第2の解決手段として、上記第1の解決手段において、前記メモリ制御部は、前記ブランクブロックの1つ先の消去単位ブロックを前記消去ブロックとして特定すると共に、前記ブランクブロックの1つ前の消去単位ブロックを前記最新ブロックとして特定することを特徴とする。 According to the present invention, as the second solving means relating to the electronic control device, in the first solving means, the memory control unit specifies an erasing unit block one ahead of the blank block as the erasing block. At the same time, the erase unit block immediately before the blank block is specified as the latest block.
また、本発明では、電子制御装置に係る第3の解決手段として、上記第2の解決手段において、前記メモリ制御部は、前記最新ブロックとして特定した消去単位ブロックにデータが保存されていない領域が一部でも存在する場合、最初に特定した前記ブランクブロックの1つ前の消去単位ブロックを前記消去ブロック及びブランクブロックとして改めて特定すると共に、最初に特定した前記ブランクブロックの2つ前の消去単位ブロックを前記最新ブロックとして改めて特定することを特徴とする。 According to the present invention, as a third solving means relating to the electronic control device, in the second solving means, the memory control unit includes an area in which no data is stored in the erase unit block specified as the latest block. If there is even a part, the erase unit block immediately preceding the first identified blank block is identified again as the erase block and the blank block, and the erase unit block two previous to the first identified blank block Is newly identified as the latest block.
また、本発明では、電子制御装置に係る第4の解決手段として、上記第2または第3の解決手段において、前記メモリ制御部は、前記最新ブロックとして特定した消去単位ブロックに保存されているデータを読み出して前記揮発性メモリに保存することを特徴とする。 Further, in the present invention, as a fourth solving means related to the electronic control device, in the second or third solving means, the memory control unit stores data stored in the erase unit block specified as the latest block. Is read out and stored in the volatile memory.
本発明に係る電子制御装置によれば、フラッシュメモリのデータ消去中或いはデータ書込み中に、リセットやイグニション・オンなど、フラッシュメモリのデータ消去動作或いは書込み動作を中断させるような事象が発生した場合でも、適切なバックアップ動作を継続可能である。 According to the electronic control device of the present invention, even when an event that interrupts the data erasing operation or writing operation of the flash memory, such as reset or ignition on, occurs during the data erasing or data writing of the flash memory. Appropriate backup operation can be continued.
以下、本発明の一実施形態について、図面を参照しながら説明する。なお、以下では、本発明に係る電子制御装置として、車両に搭載され、イグニション・オン期間中に一定周期で取得した車両情報をバックアップデータとしてRAMに上書き保存しておき、所定条件の成立をトリガとして、RAMに保存されているバックアップデータをフラッシュメモリに保存するバックアップ機能を備えたECUを例示して説明する。 Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the following, as an electronic control device according to the present invention, vehicle information that is mounted on a vehicle and acquired at regular intervals during an ignition ON period is overwritten and saved in RAM as backup data, and triggers the establishment of a predetermined condition. As an example, an ECU having a backup function for storing backup data stored in a RAM in a flash memory will be described.
図1は、本実施形態に係るECU1のブロック構成図である。この図に示すように、ECU1は、ROM(Read Only Memory)11、RAM12、フラッシュメモリ13、通信回路14及びCPU15を備えている。
FIG. 1 is a block diagram of the
ROM11は、CPU15に各種処理を実行させるための制御プログラムや各種設定データを予め記憶している不揮発性メモリである。RAM12は、CPU15が各種処理を実行する際にバックアップデータを含む各種データの一時保存先として用いられる書き換え可能な揮発性メモリである。フラッシュメモリ13は、CPU15による制御に応じて、RAM12に一時的に保存されたバックアップデータを保存する書き換え可能な不揮発性メモリである。
The
図2(a)は、RAM12及びフラッシュメモリ13の記憶領域の構造を模式的に表した図である。この図2(a)に示すように、RAM12には、バックアップデータ保存用の記憶領域として例えば8kバイトの領域が確保されている。この8kバイトの記憶領域の内、例えばアドレス「0000」〜「1FF7」までの領域にバックアップデータ(実データ)が保存され、アドレス「1FF8」〜「1FFB」までの4バイトの領域にバックアップデータのSUM値が保存され、アドレス「1FFC」〜「1FFF」までの4バイトの領域に書込み完了コードが保存される。
FIG. 2A is a diagram schematically showing the structure of the storage areas of the
また、図2(a)に示すように、フラッシュメモリ13には、バックアップデータ保存用の記憶領域として例えば32kバイトの領域が確保されている。この32kバイトの記憶領域は、それぞれ8kバイトの記憶容量を有する4つの消去単位ブロックに区分されている。公知のように、フラッシュメモリ13は、記憶領域内のある一定範囲の領域に保存されているデータを一括消去する機能を有しており、その一括消去可能な最小範囲を消去単位ブロックと呼ぶ。
As shown in FIG. 2A, the
つまり、フラッシュメモリ13の各消去単位ブロックは、それぞれRAM12に保存された8kバイト分のバックアップデータ(SUM値及び書込み完了コードも含む)を保存可能な記憶容量を有している。なお、以下では、4つの消去単位ブロックを、先頭アドレスの小さい方から順にブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕と呼ぶ。
That is, each erase unit block of the
また、以下では、図2(b)のような、データが全く保存されていないブロック(つまり全領域ブランクのブロック)をブランクブロックと呼ぶ。また、図2(c)のような、前半ブランク無し(データ有り)で後半ブランク(書込み完了コード無し)のブロック、或いは図2(d)のような、前半ブランク(データ無し)で後半ブランク無し(書込み完了コード有り)のブロック、つまりデータが保存されていない領域が一部でも存在するブロックを一部ブランクブロックと呼ぶ。また、図2(e)のような、SUM値及び書込み完了コードも含むバックアップデータの全てが保存されているブロックを読出し可能ブロックと呼ぶ。 In the following, a block in which no data is stored (that is, a block of the entire area blank) as shown in FIG. 2B is referred to as a blank block. Also, as shown in FIG. 2C, the first half blank (with data) and the second half blank (no write completion code) block, or as shown in FIG. 2D, the first half blank (no data) and the second half blank. A block (with a write completion code), that is, a block in which a part of an area where data is not stored exists is called a partially blank block. A block in which all backup data including the SUM value and the write completion code as shown in FIG. 2E is stored is called a readable block.
図1に戻り、通信回路14は、ECU1(正確にはCPU15)と他の車載ECU或いは各種センサ(図示省略)とのシリアル通信を実現するシリアル通信インターフェースである。CPU15(メモリ制御部)は、ROM11に記憶されている制御プログラムに従って各種処理を実行する中央演算処理装置である。
Returning to FIG. 1, the
このCPU15は、イグニション・オン期間中(電源オン期間中)に、通信回路14を介して他の車載ECU或いは各種センサから一定周期で取得した車両情報をバックアップデータとしてRAM12に上書き保存し、所定条件の成立(イグニション・オフ)をトリガとして、RAM12に保存されているバックアップデータをフラッシュメモリ13に保存するバックアップ機能を有している。
During the ignition ON period (power ON period), the
なお、図1では図示を省略しているが、ECU1はイグニション・オフ、つまりバッテリによる電源電圧の供給が停止した後、ROM11、RAM12、フラッシュメモリ13、通信回路14及びCPU15等の各電子部品に電源電圧を一定時間供給するバックアップ電源(例えばバックアップコンデンサ)を備えている。つまり、CPU15は、イグニションがオフされると、上記のバックアップ電源から電源電圧の供給を受けながらバックアップ処理(フラッシュメモリ13へのバックアップデータの保存)を実行する。
Although not shown in FIG. 1, the
また、詳細は後述するが、CPU15は、電源投入時(イグニション・オン時)のイニシャル処理として、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の内、データが全く保存されていないブロックをブランクブロックとして特定し、このブランクブロックを基準として消去すべきブロックを消去ブロックとして特定すると共に最新データが保存されているブロックを最新ブロックとして特定する。
As will be described in detail later, the
次に、上記のように構成された本実施形態に係るECU1の動作、特に車両情報(バックアップデータ)のバックアップ動作について詳細に説明する。
Next, the operation of the
まず、始めに、CPU15がイグニション・オン時に実行するイニシャル処理について図3のフローチャートを参照しながら詳細に説明する。
この図3に示すように、CPU15は、イグニションがオンされると、まず、変数CNT及びiを「0」にリセットする(ステップS1)。そして、CPU15は、フラッシュメモリ13のブロックB〔i〕の状態調査を行う(ステップS2)。具体的には、ステップS2において、CPU15は、ブロックB〔i〕がブランクブロック、一部ブランクブロック、或いは読出し可能ブロックのいずれの状態に当てはまるのかを調査する。
First, initial processing executed by the
As shown in FIG. 3, when the ignition is turned on, the
そして、CPU15は、ブロックB〔i〕が読出し可能ブロックか否かを判定し(ステップS3)、「Yes」の場合には変数CNTをインクリメントしてステップS5の処理に移行し(ステップS4)、「No」の場合には直接ステップS5の処理に移行する。
Then, the
CPU15は、上記ステップS4の終了後、或いは上記ステップS3で「No」と判定された場合、変数iをインクリメントし(ステップS5)、変数iが「4」より小さいか否かを判定する(ステップS6)。CPU15は、ステップS6において「Yes」の場合にステップS2の処理に戻る一方、「No」の場合にはステップS7の処理に移行する。
CPU15は、上記ステップS2〜S6の実行により、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の状態を把握すると共に、変数CNTのインクリメントによって読出し可能ブロックの数をカウントする。
The
The
そして、CPU15は、ステップS6において「No」の場合、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の中からブランクブロックをサーチし、そのブランクブロックのブロック番号を変数ABBに代入する(ステップS7)。つまり、この変数ABBは、ブランクブロックのブロック番号を示す変数である。例えばブロックB〔2〕がブランクブロックの場合、変数ABBには「2」が代入される。
If “No” in step S6, the
そして、CPU15は、変数ABBから「1」を減算して得られる値を変数RBに代入し(ステップS8)、変数ABBに「1」を加算して得られる値を変数EBに代入する(ステップS9)。つまり、この変数RBは、ブランクブロックの1つ前のブロック(最新データが保存されている最新ブロック)のブロック番号を示す変数であり、変数EBは、ブランクブロックの1つ先のブロック(消去すべきブロック)のブロック番号を示す変数である。
Then, the
例えばブロックB〔2〕がブランクブロックの場合、変数RBには「1」が代入され、変数EBには「3」が代入される。なお、例えばブロックB〔0〕がブランクブロックの場合、変数RBには「−1」ではなく「3」が代入される。また、例えばブロックB〔3〕がブランクブロックの場合、変数EBには「4」ではなく「0」が代入される。
CPU15は、上記ステップS7〜S9の実行により、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の中から、ブランクブロック、消去ブロック及び最新ブロックを特定する。
For example, when the block B [2] is a blank block, “1” is assigned to the variable RB, and “3” is assigned to the variable EB. For example, when the block B [0] is a blank block, “3” is assigned to the variable RB instead of “−1”. For example, when the block B [3] is a blank block, “0” is assigned to the variable EB instead of “4”.
By executing the above steps S7 to S9, the
続いて、CPU15は、ブロックB〔RB〕、つまり最新ブロックが一部ブランクブロックか否かを判定する(ステップS10)。CPU15は、ステップS10において「No」の場合には直接ステップS13の処理に移行する一方、「Yes」の場合には、変数ABBから「2」を減算して得られる値を変数RBに代入し(ステップS11)、変数ABBから「1」を減算して得られる値を変数EBに代入し(ステップS12)、さらに、変数ABBから「1」を減算して得られる値を新たに変数ABBに代入する(ステップS13)。
Subsequently, the
例えばブロックB〔2〕がブランクブロックの場合、変数RBには「0」が代入され、変数EB及び変数ABBには「1」が代入される。なお、例えばブロックB〔0〕がブランクブロックの場合、変数RBには「−2」ではなく「2」が代入され、変数EB及び変数ABBには「−1」ではなく「3」が代入される。 For example, when the block B [2] is a blank block, “0” is substituted for the variable RB, and “1” is substituted for the variable EB and the variable ABB. For example, when the block B [0] is a blank block, “2” instead of “−2” is assigned to the variable RB, and “3” is assigned to the variable EB and the variable ABB instead of “−1”. The
つまり、CPU15は、上記ステップS10〜12の実行により、最初に特定した最新ブロックが一部ブランクブロックの場合に、最初に特定したブランクブロックの1つ前のブロックを消去ブロックとして改めて特定すると共に、最初に特定したブランクブロックの2つ前のブロックを最新ブロックとして改めて特定し、さらに最初に特定したブランクブロックの1つ前のブロックをブランクブロックとして改めて特定する。
That is, when the latest block identified first is a partial blank block by executing steps S10 to S12, the
続いて、CPU15は、変数CNTが「0」か否か、つまり読出し可能ブロックの数が「0」か否かを判定し(ステップS14)、「No」の場合にはブロックB〔RB〕、つまり最新ブロックが読出し可能ブロックか否かを判定する(ステップS15)。このステップS15において「Yes」の場合、CPU15は、ブロックB〔RB〕、つまり最新ブロックに保存されているバックアップデータを読み出して、RAM12のバックアップデータ記憶領域(図2(a)参照)に書き込む(ステップS16)。
Subsequently, the
一方、上記ステップS14において「Yes」の場合、或いは上記ステップS15において「No」の場合、CPU15は、ROM11に予め保存されている代替データを読み出して、RAM12のバックアップデータ記憶領域に書き込む(ステップS17)。
On the other hand, if “Yes” in step S14 or “No” in step S15, the
以上説明したイニシャル処理によって、イグニションがオンされると、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の中から、ブランクブロック、消去ブロック及び最新ブロックが特定され、RAM12のバックアップデータ記憶領域には、フラッシュメモリ13の最新ブロックに保存されていたバックアップデータ、或いはROM11に予め保存されていた代替データが書き込まれることになる。
When the ignition is turned on by the above-described initial processing, the blank block, the erase block, and the latest block are selected from the blocks B [0], B [1], B [2], and B [3] of the
次に、前述のイニシャル処理がイグニション・オン時に実行されることを前提として、CPU15がイグニション・オフ時にバックアップ処理を実行することにより、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の状態がどのように変化するのかを図4を参照しながら詳細に説明する。
なお、以下の説明において、CPU15は、イグニション・オン期間中に、通信回路14を介して他の車載ECU或いは各種センサから一定周期で取得した車両情報をバックアップデータとしてRAM12に上書き保存していることに留意されたい。
Next, on the assumption that the above-described initial process is executed when the ignition is turned on, the
In the following description, the
図4(a)は、フラッシュメモリ13が初期状態(全ブロックがブランクブロック状態)にある場合に、CPU15がイグニション・オフ時にバックアップ処理を実行することにより、フラッシュメモリ13の各ブロックB〔0〕、B〔1〕、B〔2〕、B〔3〕の状態がどのように変化するかを表したものである。
FIG. 4A shows that each block B [0] of the
まず、フラッシュメモリ13の全ブロックがブランクブロック状態にある時(図中のa−1参照)にイグニションがオフされると、CPU15は、バックアップ電源から電源電圧の供給を受けながら、RAM12からバックアップデータを読み出し、フラッシュメモリ13のブロックB〔3〕にバックアップデータを保存する(図中のa−2参照)。
First, when the ignition is turned off when all the blocks of the
詳細には、CPU15は、フラッシュメモリ13に対して書込み要求信号、書込み先アドレス信号(ブロックB〔3〕内のアドレスを示す信号)及びバックアップデータを送信し、フラッシュメモリ13は、CPU15からの書込み要求信号に応じて、書込み先アドレス信号で指定されたアドレスにバックアップデータを書込む。このようにして、フラッシュメモリ13のブロックB〔3〕に全てのバックアップデータが保存されると、ブロックB〔3〕が最新データを保存する最新ブロックとなる(図中のa−3参照)。
Specifically, the
そして、次のイグニション・オフ時において、CPU15は、バックアップ電源から電源電圧の供給を受けながら、RAM12からバックアップデータを読み出し、次はフラッシュメモリ13のブロックB〔0〕にバックアップデータを保存する。このようにして、フラッシュメモリ13のブロックB〔0〕に全てのバックアップデータが保存されると、ブロックB〔0〕が最新ブロックとなり、ブロックB〔3〕が古いデータを保有する古いブロックとなる(図中のa−4参照)。
At the next ignition off time, the
さらに、次のイグニション・オフ時において、CPU15は、バックアップ電源から電源電圧の供給を受けながら、RAM12からバックアップデータを読み出し、次はフラッシュメモリ13のブロックB〔1〕にバックアップデータを保存する。このようにして、フラッシュメモリ13のブロックB〔1〕に全てのバックアップデータが保存されると、ブロックB〔1〕が最新ブロックとなり、ブロックB〔0〕、B〔3〕が古いブロックとなる(図中のa−5参照)。
Further, at the next ignition-off, the
このように、CPU15は、フラッシュメモリ13が初期状態(全ブロックがブランクブロック状態)にある場合、イグニションがオフされる度に、ブロックB〔3〕→ブロックB〔0〕→ブロックB〔1〕の順でバックアップデータの保存を行う。
In this way, when the
CPU15は、フラッシュメモリ13の各ブロックの内、1つのブロックのみがブランクブロックの状態となった後、イグニションがオンされる度に、図3に示したイニシャル処理を実行すると共に、イグニションがオフされる度に、イニシャル処理で特定された消去ブロックの保存データを消去して新たなブランクブロックを生成した後、同イニシャル処理で特定されたブランクブロックにバックアップデータを保存する。
The
例えば、図4(b)に示すように、イグニション・オン時に実行されたイニシャル処理によって、フラッシュメモリ13のブロックB〔0〕が最新ブロック、ブロックB〔1〕がブランクブロック、ブロックB〔2〕が消去ブロックとして特定されたと仮定する(図中のb−1参照)。このようなブロック状態でイグニションがオフされると、CPU15は、バックアップ電源から電源電圧の供給を受けながら、消去ブロックとして特定されたブロックB〔2〕の保存データを消去する(図中のb−2参照)。
For example, as shown in FIG. 4B, by the initial process executed when the ignition is turned on, the block B [0] of the
詳細には、CPU15は、フラッシュメモリ13に対してブロックB〔2〕の消去命令を送信し、フラッシュメモリ13は、CPU15からの消去命令に応じて、ブロックB〔2〕の保存データを消去する(全て「1」にする)。このようにして、ブロックB〔2〕の保存データが全て消去されると、ブロックB〔2〕はブランクブロックとなる(図中のb−3参照)。
Specifically, the
そして、CPU15は、RAM12からバックアップデータを読み出し、イニシャル処理によってブランクブロックとして特定されたブロックB〔1〕にバックアップデータを保存する(図中のb−4参照)。このようにして、フラッシュメモリ13のブロックB〔1〕に全てのバックアップデータが保存されると、次回のイグニション・オン時に実行されるイニシャル処理によって、ブロックB〔1〕が最新ブロック、ブロックB〔2〕がブランクブロック、ブロックB〔3〕が消去ブロックとして特定されることになる(図中のb−5参照)。
Then, the
ここで、図4(c)に示すように、消去ブロックとして特定されたブロックB〔2〕の保存データの消去中に、CPUリセット(バックアップ電源による電源電圧の供給が停止する)やイグニション・オン(バッテリからの電源電圧の供給が再開される)など、フラッシュメモリ13のデータ消去動作を中断させるような事象が発生した場合を想定する(図中のc−1、c−2参照)。
Here, as shown in FIG. 4C, during the erasure of the stored data of the block B [2] specified as the erase block, the CPU reset (power supply voltage supply by the backup power supply stops) or the ignition on A case is assumed in which an event that interrupts the data erasing operation of the
この場合、イグニション・オン時に実行されるイニシャル処理によって、ブロックB〔0〕が最新ブロック、ブロックB〔1〕がブランクブロック、ブロックB〔2〕が消去ブロックとして特定されることになる(図中のc−3参照)。ここで、消去ブロックとして特定されたブロックB〔2〕は、図2(d)に示すような一部ブランクブロック状態となっている。 In this case, block B [0] is identified as the latest block, block B [1] as the blank block, and block B [2] as the erase block by the initial processing executed when the ignition is turned on (in the figure). C-3). Here, the block B [2] specified as the erase block is in a partially blank block state as shown in FIG.
このようなブロック状態でイグニションがオフされると、CPU15は、バックアップ電源から電源電圧の供給を受けながら、消去ブロックとして特定されたブロックB〔2〕、つまり一部ブランクブロックの保存データを消去する。このようにして、ブロックB〔2〕の保存データが全て消去されると、ブロックB〔2〕はブランクブロックとなる(図中のc−4参照)。
When the ignition is turned off in such a block state, the
そして、CPU15は、RAM12からバックアップデータを読み出し、イニシャル処理によってブランクブロックとして特定されたブロックB〔1〕にバックアップデータを保存する。このようにして、フラッシュメモリ13のブロックB〔1〕に全てのバックアップデータが保存されると、次回のイグニション・オン時に実行されるイニシャル処理によって、ブロックB〔1〕が最新ブロック、ブロックB〔2〕がブランクブロック、ブロックB〔3〕が消去ブロックとして特定されることになる(図中のc−5参照)。
Then, the
一方、図4(d)に示すように、ブランクブロックとして特定されたブロックB〔1〕のデータ書込み中に、CPUリセットやイグニション・オンなどの、フラッシュメモリ13のデータ書込み動作を中断させるような事象が発生した場合を想定する(図中のd−1、d−2参照)。
On the other hand, as shown in FIG. 4D, the data write operation of the
この場合、イグニション・オン時に実行されるイニシャル処理のステップS1〜S9の処理によって、始めはブロックB〔1〕が最新ブロック、ブロックB〔2〕がブランクブロック、ブロックB〔3〕が消去ブロックとして特定されることになる(図中のd−3参照)。ここで、最新ブロックとして特定されたブロックB〔1〕は、図2(b)に示すような一部ブランクブロック状態となっている。 In this case, block B [1] is the latest block, block B [2] is the blank block, and block B [3] is the erase block by the processes of steps S1 to S9 of the initial process executed when the ignition is turned on. (See d-3 in the figure). Here, the block B [1] specified as the latest block is in a partially blank block state as shown in FIG.
このため、イニシャル処理のステップS10〜S13の処理によって、最終的にブロックB〔0〕が最新ブロック、ブロックB〔1〕が消去ブロック及びブランクブロックとして特定されることになる(図中のd−4参照)。このようなブロック状態でイグニションがオフされると、CPU15は、バックアップ電源から電源電圧の供給を受けながら、消去ブロックとして特定されたブロックB〔1〕、つまり一部ブランクブロックの保存データを消去する。
For this reason, block B [0] is finally identified as the latest block, and block B [1] is identified as the erase block and blank block by the processes of steps S10 to S13 of the initial process (d- in the figure). 4). When the ignition is turned off in such a block state, the
このようにして、ブロックB〔1〕の保存データが全て消去されると、ブロックB〔1〕はブランクブロックとなる。そして、CPU15は、RAM12からバックアップデータを読み出し、イニシャル処理によってブランクブロックとして特定されたブロックB〔1〕にバックアップデータを保存する。
In this way, when all the stored data of the block B [1] is erased, the block B [1] becomes a blank block. Then, the
このようにして、フラッシュメモリ13のブロックB〔1〕に全てのバックアップデータが保存されると、次回のイグニション・オン時に実行されるイニシャル処理によって、ブロックB〔1〕が最新ブロック、ブロックB〔2〕がブランクブロック、ブロックB〔3〕が消去ブロックとして特定されることになる(図中のd−5参照)。
In this way, when all backup data is stored in the block B [1] of the
以上説明したように、本実施形態に係るECU1によれば、フラッシュメモリ13のデータ消去中或いはデータ書込み中に、CPUリセットやイグニション・オンなど、フラッシュメモリ13のデータ消去動作或いは書込み動作を中断させるような事象が発生した場合でも、適切なバックアップ動作を継続可能である。
As described above, according to the
また、前述の特許文献1(特開2010−113580号公報)の技術では、例えばフラッシュメモリのデータ消去中或いはデータ書込み中にCPUがリセットされると、フラッシュメモリのデータが不定となるため、故障を報知するための信号を出力する機能をCPUに持たせる必要があったが、本実施形態に係るECU1では、不定となったブロック(一部ブランクブロック)を必ず消去するため、そのような機能をCPU15に持たせる必要はない。
Further, in the technique disclosed in Patent Document 1 (Japanese Patent Laid-Open No. 2010-113580), for example, if the CPU is reset during data erasure or data writing in the flash memory, the data in the flash memory becomes indefinite. However, in the
また、従来では、フラッシュメモリのデータ消去中或いはデータ書込み中にCPUがリセットされると、正確なSUM値が得られなくなり、バックアップデータの確からしさを判断できなくなる可能性があったが、本実施形態に係るECU1では、不定となったブロック(一部ブランクブロック)を必ず消去し、後にそのブロックに正常なバックアップデータを保存するため、バックアップデータの確からしさを判断できなくなる可能性は無い。
Also, in the past, if the CPU was reset during flash memory data erasing or data writing, the correct SUM value could not be obtained, and the accuracy of backup data could not be determined. In the
以上、本発明の一実施形態について説明したが、この実施形態はあくまで一例であって本発明の趣旨を逸脱しない範囲において実施形態の細部を種々変更可能であることは勿論である。例えば、上記実施形態では、本発明に係る電子制御装置として、イグニション・オン期間中に一定周期で取得した車両情報をバックアップデータとしてRAMに上書き保存しておき、所定条件の成立をトリガとして、RAMに保存されているバックアップデータをフラッシュメモリに保存するバックアップ機能を備えたECU1を例示して説明したが、本発明はこのような車載ECUに限らず、フラッシュメモリをバックアップ用メモリとして備える電子制御装置に広く適用することが可能である。
Although one embodiment of the present invention has been described above, this embodiment is merely an example, and it is needless to say that various details of the embodiment can be changed without departing from the spirit of the present invention. For example, in the above embodiment, as the electronic control device according to the present invention, the vehicle information acquired at a constant cycle during the ignition-on period is overwritten and saved in the RAM as backup data, and the establishment of a predetermined condition is used as a trigger. The
1…ECU(電子制御装置)、11…ROM、12…RAM(揮発性メモリ)、13…フラッシュメモリ、14…通信回路、15…CPU(メモリ制御部)
DESCRIPTION OF
Claims (2)
前記メモリ制御部は、電源投入時において、前記フラッシュメモリの消去単位ブロックの内、データが全く保存されていない消去単位ブロックをブランクブロックとして特定し、前記ブランクブロックの1つ先の消去単位ブロックを前記消去ブロックとして特定すると共に、前記ブランクブロックの1つ前の消去単位ブロックを前記最新ブロックとして特定し、前記最新ブロックとして特定した消去単位ブロックにデータが保存されていない領域が一部でも存在する場合には、最初に特定した前記ブランクブロックの1つ前の消去単位ブロックを前記消去ブロック及びブランクブロックとして改めて特定すると共に、最初に特定した前記ブランクブロックの2つ前の消去単位ブロックを前記最新ブロックとして改めて特定することを特徴とする電子制御装置。 An electronic control device comprising: a volatile memory; a flash memory; and a memory control unit that stores backup data stored in the volatile memory in the flash memory using a predetermined condition as a trigger,
The memory control unit identifies, as a blank block, an erase unit block in which no data is stored among the erase unit blocks of the flash memory at the time of power-on, and selects an erase unit block one ahead of the blank block. The erase block is specified as the erase block, the erase unit block immediately before the blank block is specified as the latest block, and there is a part of the area where no data is stored in the erase unit block specified as the latest block. In this case, the erase unit block immediately before the first identified blank block is identified as the erase block and the blank block, and the erase unit block immediately before the first identified blank block is identified as the latest block. It is characterized by newly identified as block The electronic control unit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011074828A JP5643708B2 (en) | 2011-03-30 | 2011-03-30 | Electronic control unit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011074828A JP5643708B2 (en) | 2011-03-30 | 2011-03-30 | Electronic control unit |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2012208803A JP2012208803A (en) | 2012-10-25 |
JP5643708B2 true JP5643708B2 (en) | 2014-12-17 |
Family
ID=47188456
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011074828A Expired - Fee Related JP5643708B2 (en) | 2011-03-30 | 2011-03-30 | Electronic control unit |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5643708B2 (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH06236327A (en) * | 1993-02-10 | 1994-08-23 | Omron Corp | Data storage system |
JP4131116B2 (en) * | 2002-03-06 | 2008-08-13 | 松下電工株式会社 | Storage device and storage device backup method |
JP4586469B2 (en) * | 2004-09-15 | 2010-11-24 | ソニー株式会社 | MEMORY CONTROL DEVICE, MEMORY CONTROL METHOD, PROGRAM |
JP2007122419A (en) * | 2005-10-28 | 2007-05-17 | Seiko Epson Corp | Non-volatile data update system, non-volatile data update method and program |
US8006030B2 (en) * | 2006-03-13 | 2011-08-23 | Panasonic Corporation | Memory controller for identifying the last valid page/segment in a physical block of a flash memory |
JP4647010B2 (en) * | 2009-01-28 | 2011-03-09 | 三菱電機株式会社 | Electronic control unit |
-
2011
- 2011-03-30 JP JP2011074828A patent/JP5643708B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2012208803A (en) | 2012-10-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI436369B (en) | Methods for measuring usable lifespan and replacing an in-system programming code of a memory device, and data storage system using the same | |
JPH08202626A (en) | Memory controller | |
JP2011095952A (en) | Method for updating firmware and electronic equipment | |
US20160085456A1 (en) | Data read apparatus, data read method, and storage medium storing data read program | |
JP5695112B2 (en) | Data storage device, data storage method, and in-vehicle control device | |
JP6028670B2 (en) | Data storage | |
WO2015098894A1 (en) | Data storage device, vehicle-mounted data storage device, and data storage method | |
JP6009290B2 (en) | Electronic control device for vehicle | |
JP5983512B2 (en) | Writing device | |
JP5643708B2 (en) | Electronic control unit | |
JP2018028830A (en) | Electronic controller and information storage method thereof | |
US11314634B2 (en) | Electronic control unit and data protection method therefor | |
JP2009116521A (en) | Data rewriting method for memory | |
JP2008225922A (en) | Nonvolatile storage device | |
JP6040895B2 (en) | Microcomputer and non-volatile memory block management method | |
JP2013200919A (en) | Nonvolatile semiconductor memory device and control method thereof | |
US20110082995A1 (en) | Information processing apparatus | |
CN109558274B (en) | Information processing method, device and computer readable storage medium | |
JP2009223435A (en) | Data storage method and device, and program | |
JP2006063939A (en) | Program rewritable electronic control device | |
JP5930940B2 (en) | Electronic control device for vehicle | |
JP5787095B2 (en) | Method for storing data in non-volatile memory | |
JP5991239B2 (en) | Nonvolatile semiconductor memory write control method and microcomputer | |
JP6568826B2 (en) | Electronic control unit | |
JP6317653B2 (en) | Electronic control device for automobile and data storage method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20140106 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140715 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140722 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140922 |
|
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: 20141014 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20141031 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5643708 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |