TECHNICAL FIELD

The present invention relates to an electronic control unit including a RAM to be used as a work area and a non-volatile memory for data storage, and relates to a data protection method therefor.

BACKGROUND ART

Patent Document 1 discloses an electronic control device for an automobile, configured to constantly store, into a battery-backed SRAM, data determined to be continuously stored and updated in the RAM and additionally store the same data into a non-volatile memory, and to restore the data from the non-volatile memory if it is determined that data corruption occurs in the SRAM when the operation of the electronic control device starts. In Patent Document 1, when receiving a data output request from an external device, the electronic control device outputs the requested data after storing, into the non-volatile memory, data determined to be continuously stored, in order to prevent latest data loss due to instantaneous power supply interruption or the like.

REFERENCE DOCUMENT LIST

Patent Document

Patent Document 1: JP 2004-178067 A

SUMMARY OF THE INVENTION

Problem to be Solved by the Invention

An electronic control unit of this type involves a risk of instantaneous power supply interruption which may occur when, for example, a large current is driven by activation of the starter unless a sufficient battery capacity is available. Such instantaneous power supply interruption may destroy even data stored in a battery-backed RAM. Furthermore, instantaneous power supply interruption may reset the microcomputer, and, in this case, shutdown processing of writing, into the non-volatile memory, data determined to be continuously stored and updated is not performed, and this data may be lost. As a result, data generated during operation may no longer be held, which makes it difficult, for example, to control the on/off of the malfunction indicator lamp and to update learned values. This is problematic.

The present invention has been made in view of the above circumstances, and an object thereof is to provide an electronic control unit that is capable of holding data generated during operation regardless of instantaneous power supply interruption and thus has improved merchantable quality and fault analysis capabilities.

Another object of the present invention is to provide a data protection method for an electronic control unit, which method being capable of protecting data generated during operation regardless of instantaneous power supply interruption.

Means for Solving the Problem

An electronic control unit according to an aspect of the present invention comprises a RAM to be used as a work area; a non-volatile memory for data storage; and a controller for controlling reading of data from, and writing of data into, the RAM and the non-volatile memory. The controller is configured to: store data generated during operation of the controller into the RAM, write the data into a storage area of the non-volatile memory when the operation stops, and read the data from the non-volatile memory into the RAM when the operation starts, and control a control target using the data. When the controller determines that an improper reset of the controller is expected, the controller writes at least part of the data generated during the operation and stored in the RAM into a save area of the non-volatile memory, the save area being different from the storage area of the data. When the operation restarts from the improper reset, the controller reads, into the RAM, the data that has been written in the storage area and the data that has been written in the save area.

A data protection method for an electronic control unit according to another aspect of the present invention comprises the steps of: storing data generated during operation of a controller into a random access memory (RAM); writing the data into a non-volatile memory when the operation stops; reading the data from the non-volatile memory into the RAM when the operation starts, and controlling a control target using the data; writing at least part of the data generated during the operation and stored in the RAM into a save area of the non-volatile memory, when it is determined that an improper reset of the controller is expected, the save area being different from a storage area of the data; and reading, into the RAM, the data that has been written in the storage area and the data that has been written in the save area when the operation restarts from the improper reset.

Effects of the Invention

According to the present invention, when it is determined that an improper reset of the controller is expected, the controller waits and writes at least part of the data generated during the operation into a save area, different from the data storage area, of the non-volatile memory, and when the operation restarts from the improper reset, the controller reads, into the RAM, the data that has been written in the storage and save areas and uses the data for control. Thus, even if the data in the RAM is lost due to instantaneous power supply interruption, the data generated during the operation may be restored using the data held in the storage and save areas of the non-volatile memory. This allows protecting data generated during operation of the controller regardless of instantaneous power supply interruption. Thus, the present invention provides an electronic control unit with improved merchantable quality and fault analysis capabilities.

