1. Field of the Invention
The present invention relates to an electronic control unit and method using a microcomputer, specifically to an electronic control unit and method in which a control program and control data used for the microcomputer performing a control process can be rewritten on board.
2. Related Art
As an electronic control unit to control, for example, a vehicle engine, there has been proposed the on-board rewritable type, which contains a microcomputer including a rewritable nonvolatile memory such as an EEPROM or a flash EEPROM storage contents of which can electrically be rewritten (specifically, erased and newly written), and enables a control program and control data stored in the rewritable nonvolatile memory to be rewritten in a state that the concerned unit is completely assembled.
In Japanese Patent Publication JP-A-9-44216 U.S. Pat. No. 5,828,977), an electronic control unit is designed to be connected to a memory rewrite unit not only through a communication line, but also through a mode determining control signal line. Immediately after a microcomputer of the electronic control unit starts its operation at the reset state, the microcomputer executes a starting program (boot program) in a non-rewrite-object nonvolatile memory, and thereby checks the state of a signal inputted from the memory rewrite unit through the mode determining control signal line. In accordance with the state of the signal, the microcomputer switches the self operation mode into either one of the normal mode that executes the control program in the rewritable nonvolatile memory and the rewrite mode that executes the rewrite process.
Therefore, after the electronic control unit is powered, if it is arranged to operate the microcomputer from the reset state, and to output a signal indicating the rewrite mode to the mode determining control signal line from the memory rewrite unit, the microcomputer will execute the rewrite process without relation to the control program in the rewritable nonvolatile memory. Accordingly, even when the control program is not yet written into the rewritable nonvolatile memory, or when the control program stored in the rewritable nonvolatile memory becomes abnormal by any cause, the data write (that is, a new data write, or rewrite) into the rewritable nonvolatile memory can be executed.
However, if the mode determining control signal line is provided between the electronic control unit and the memory rewrite unit, the following problems will occur.
{circle around (1)} It is necessary to add a dedicated terminal for the mode determining control signal line to the connector that connects the electronic control unit and the memory rewrite unit. Although the mode determining control signal line is rarely used in practice, a new connector terminal has to be provided additionally.
{circle around (2)} Maintenance shops of vehicles and the like have been using a trouble diagnostic service tool whereby self-diagnostics data stored in the electronic control unit can be read through the communication line. Accordingly, there arises a request from them such that the function of the memory rewrite unit is incorporated into the foregoing service tool, and thereby the control program and control data can be written by using the communication line only.
However, if the mode determining control signal line is provided, the foregoing request will not be satisfied, which lacks in flexibility. That is, a special one will be needed as the memory rewrite unit. In addition, the wire harness for connecting the memory rewrite unit and the wire harness for connecting the other service tools cannot be integrated into one.
{circle around (3)} In general, the connection of the electronic control unit and the memory rewrite unit of this type is made such that the connector provided on the end of the wire harness extended from the electronic control unit side is engaged in the connector of the memory rewrite unit side. However, if the mode determining control signal line inside the wire harness extended from the electronic control unit side is short-circuited to a part of the voltage level indicating the rewrite mode in a vehicle, the normal control program will not be executed.
Here, when writing the control program and the control data, for example, if the operator takes a procedure to open the cover of the electronic control unit, and to directly apply a mode determining signal to the input terminal (input port) of the microcomputer, it will be possible to dispense with the mode determining control signal line. However, from the workability and the reliability of the electronic control unit, this is not practicable.
The present invention has an object to provide an electronic control unit and method that can execute a data write into a rewritable nonvolatile memory without a signal line for determining the mode furnished between an external unit and the electronic control unit, even when a control program is not written into the rewritable nonvolatile memory, or when the control program stored in the rewritable nonvolatile memory becomes abnormal.
According to the present invention, a microcomputer is programmed to execute a control program composed of data stored in a rewritable nonvolatile memory, and executes a control process for controlling a control object. A monitor circuit monitors whether an execution state of the control program by the microcomputer is normal or not.
In this electronic control unit, specially, when the monitor circuit determines that the execution state of the control program is abnormal, the microcomputer executes a rewrite process for updating to write a rewrite data transmitted from an external unit into the rewritable nonvolatile memory.
Thus, in case the control program is not yet written into the rewritable nonvolatile memory, or in case the control program stored in the rewritable nonvolatile memory becomes abnormal by any cause, the microcomputer is not able to execute the control program normally. Therefore, in both of the foregoing cases, the monitor circuit determines the execution state by the microcomputer to be abnormal, and the microcomputer shifts the mode to the rewrite mode to execute the rewrite process.
Accordingly, although a signal line for determining the mode is not furnished between the external unit and the electronic control unit, it is possible to write a new control program and new control data into the rewritable nonvolatile memory from a state that the control program is not written into the rewritable nonvolatile memory. When the control program stored in the rewritable nonvolatile memory is brought into an abnormal state, it is possible to rewrite the concerned control program into a program of normal contents.
Here, as the rewritable nonvolatile memory, an EEPROM or flash EEPROM is generally used, however other rewritable ROMs may also be used.