The present invention relates to a method for monitoring a microprocessor and a circuit arrangement having a microprocessor.
Using a watchdog to monitor the function of a microprocessor, which is also understood to include microcontrollers according to the present application, is known. Watchdogs are circuits assigned to the microprocessor which check whether a reset pulse has been generated by the microprocessor within a time interval of predetermined duration. The periodic generation of a reset pulse indicates the proper function of the microprocessor. If no reset pulse is received, a reset of the microprocessor is performed, through which the microprocessor is to be returned to a proper state.
Checking the function of a watchdog by using a second watchdog is known from German Published Patent Application No. 43 30 940, for example. For this purpose, the watchdogs are alternately disrupted by the microprocessor and the microprocessor checks whether the other watchdog triggers an alarm and/or generates a reset.
A disadvantage of the watchdog described above is that it is not capable of monitoring the microprocessor for a clock frequency which is too high. In order to avoid at least this problem, a modified watchdog in which the time interval monitored has not only an upper limit but also a lower limit, so that the reset pulse must be received between the upper and the lower limit of the time interval during proper operation, is known from PCT Publication No. WO 97/32282. If the clock frequency of the microprocessor is too high, the reset pulse is received before the lower interval limit and an alarm signal is generated.
A disadvantage of the known related art is that both measures result in increased construction cost and a more complicated structure of the watchdog. The arrangement of two watchdogs and their mutual monitoring is a significantly increased construction cost. In addition, the construction cost for a modified watchdog which is capable of monitoring both an upper limit and a lower limit is significantly increased in comparison to a watchdog which monitors only an upper interval limit.
In contrast, it is an object of the present invention to allow monitoring of both the function of the watchdog and the clock frequency of the microprocessor using an unmodified watchdog.
In the method according to the present invention and the circuit arrangement according to the present invention, a microprocessor is monitored using an assigned watchdog. The watchdog monitors whether reset pulses are received within a time interval of predetermined duration. When the reset pulse is received, the time interval is reset and restarted. If reset pulses are not received, a reset of the microprocessor is initiated. According to the present invention, a check function of the watchdog is activated in suitable operating phases of the microprocessor. During the execution of the check function, a reset of the watchdog is executed first, followed by a sequence of waiting loops, whose duration is greater than the duration of the time interval of the watchdog.
A defined starting state of the watchdog is generated through the reset of the watchdog initially performed using a reset pulse. Through the subsequent execution of the sequence of waiting loops, the processing of the sequence taking longer than the time interval, a reset is generated by the watchdog if the watchdog is functioning and the clock frequency of the microprocessor is not too high. If the reset occurs, further steps are no longer executed, and the microprocessor is restarted. The processes executed until the suitable operating state is reached may then be continued further. If, however, the clock frequency is so high that, due to the increased clock frequency, the waiting loops have ended before the time interval expires, there is a defect. This is also true for the case in which the microprocessor does not generate a reset due to a defect of the watchdog. According to an advantageous embodiment of the present invention, an error message is generated in this case, so that a suitable intervention may be performed.
In order that a check function is not executed continuously during proper operation of the microprocessor, the execution is linked to the existence of specific suitable operating states.
The normal function of the watchdog may be executed independently of the execution of the check function. In particular, this means that the microprocessor is monitored by the watchdog during its normal operation for the regular generation of the reset pulse within the time interval and a reset of the microprocessor is executed if no reset pulse is received.
According to a further embodiment of the present invention, a counter content is first checked at the beginning of the check function, the counter is incremented, and the check function is only performed as a function of the counter content. Thus, a counter having a word length of one bit may be provided, and the check function may be executed at only one of the two counter contents. The counter content may be stored on a non-volatile memory in particular, such as an EEPROM, so that the counter content is not lost when the processor is reset. This measure is especially necessary when the start of operation of the microprocessor is a suitable operating state. In this case, a check may not be started again during the execution of the sequence of waiting loops after a proper reset of the microprocessor, since otherwise an endless loop may arise. After one or a specific number of executions of a check function, the microprocessor returns to its normal operation.
According to embodiments of the present invention, it is possible to differentiate between multiple, in particular four, counter contents. During each of the first counter contents, in particular three counter contents, a check function is executed, but during the last counter content, a check function is no longer executed. In this case, the counter content may also simultaneously be a parameter which is taken into consideration in the execution of the check function. Thus, the duration of the sequence of waiting loops, i.e., in particular the number of executions of the waiting loops, may be a function of the counter content. If the duration of the sequence of waiting loops is selected to be shorter and shorter and is shorter than the duration of the time interval for the last execution of the check function, it is also possible to differentiate between the error sources of malfunction of the watchdog and too high a frequency of the microprocessor.
One embodiment of the present invention is provided by a memory component, such as a ROM, which contains a computer program, executable on a microprocessor, which is capable of executing a method according to the present invention.
A circuit arrangement according to the present invention provides a watchdog, assigned to the microprocessor, for performing a reset of the microprocessor if a reset pulse has not been generated by the microprocessor and received by the watchdog within a time interval of predetermined duration. According to the present invention, the watchdog is supplied with a different clock pulse than the microprocessor. In addition, a non-volatile memory, such as an EEPROM, in which a counter content of a counter may be stored, is assigned to the microprocessor.
Because the watchdog has a separate clock pulse, independent of the microprocessor, it is made capable of monitoring the clock pulse duration during the execution of a check function. Since the clock signal of the watchdog is independent of the clock signal of the microprocessor, too high a clock frequency may be monitored during the monitoring of the microprocessor. Due to the too high clock frequency of the microprocessor, the duration of the sequence of waiting loops ends before the correctly measured time interval ends.
The present invention may be used in all microprocessors which are monitored using an external watchdog. In particular, the present invention may be used in connection with sensors and control units of a motor vehicle. The rotational speed and acceleration sensors of a control unit which influences the vehicle dynamics are cited as examples here. However, the present invention is in no way solely restricted to such applications.
The flow chart of a monitoring function of a method according to the present invention of monitoring a microprocessor is illustrated in
First, a reset of the microprocessor, which may also be a microcontroller, is performed in step 101. The reset is performed in the first step of the method because the microprocessor is in startup, i.e., is being initialized. If a different operating phase than the startup of the processor is also recognized as a suitable operating phase, step 101 may be left out at the beginning of the check function and step 102 may be performed immediately. The sequence then passes over to step 102. In step 102, the counter content of the counter is read out of the non-volatile memory.
Subsequently, it is checked in step 103 whether the counter content has the value “0”. If not, the sequence jumps to step 109, and the counter content is set to the value “0” and then stored in the non-volatile memory.
If it is determined in step 103 that the counter content has the value “0”, step 104 is executed. In step 104, the counter content is first incremented. It then has the value “1” and is stored in the non-volatile memory. Subsequently, a reset pulse is generated for the watchdog in step 105. The watchdog is thus reset, i.e., the time interval within which the next reset pulse is received is restarted at zero. A sequence of waiting loops is then started in step 106. The sequence of waiting loops contains a sufficient number of waiting loops in this case so that the execution of the sequence of waiting loops lasts longer than the time interval of the watchdog at a normal clock rate. The number of waiting loops may preferably be selected in this case so that the duration of the execution is below the time interval if the clock rate is only slightly above the upper tolerance limit.
If the watchdog is functioning properly and the clock rate of the microprocessor is within the tolerance range, it determines that the time interval is exceeded during the execution of step 106, and a reset of the microprocessor is initiated, so that the watchdog forces the microprocessor to jump to step 101, as indicated by the dashed line. Steps 107 to 109 are not executed. After the counter was set to “1” in step 104, it will be determined upon the next query in step 103 that the counter content differs from “0” and the sequence thus jumps directly to step 109, and the check function is not actually executed per se.
If the time interval being exceeded was not registered during step 106, the sequence continues to step 107. In step 107, a reset pulse is first output so that any reset performed too late by the watchdog is prevented before execution of the next step. This would be the case if the watchdog functioned properly, but the microprocessor was being operated using a clock rate above the tolerance. Subsequently, an error message is generated in step 108, which may be processed appropriately. The sequence then jumps to step 109.
The counter content of the counter is set back to “0” and/or incremented in step 109. For a binary counter of length 1 bit, incrementing by “1” corresponds to a reset of the counter, since the counter content was previously “1”, no matter how step 109 was reached. If the counter has a larger word length, the counter content may be increased through normal incrementation. If the counter has a word length of 4 bits, for example, the counter content “0” is reached through overrun of the word length only every sixteenth time. The check function is then not executed upon each suitable state, but accordingly less often.
The counter used here may have a word length of two bits, for example, i.e., it differentiates between the counter contents 0, 1, 2, and 3.
In accordance with the description of
If the sequence jumps to step 210 from step 203 because the counter content is “0”, the counter content is first incremented to “1” in step 210. It then has the value “1”. This value is stored in the non-volatile memory. Therefore, the sequence jumps from step 203 to step 220 upon the next call of a check function.
Subsequently, the value of a first parameter A is set to “0” and also stored in a non-volatile memory in step 211. A reset pulse of the watchdog is then generated in step 212. A sequence of waiting loops is then executed in step 213. The number of waiting loops is selected in this case in such a way that the sequence of waiting loops only ends before the time interval expires if the clock rate has a value far enough above the setpoint clock rate that the microprocessor may no longer be properly functioning. This may, for example, be a clock rate in the range of twice or five times the setpoint clock rate and is a function of the corresponding microprocessor and its use. Clock rates of this type do not occur in the operation of a microprocessor, and a reset would not be executed before reaching the end of the sequence of waiting loops only in case of a defective watchdog.
If the watchdog is functioning, a reset of the microprocessor is forced by the watchdog in that the sequence jumps to step 201. This jump is shown in the drawing using the dashed line.
Otherwise, a reset pulse is first generated for the watchdog in step 214, so that an undesired, delayed reset of the microprocessor is avoided. Subsequently, the value of parameter A is changed in step 215; it now assumes the value “1” and is stored in the non-volatile memory. The sequence then jumps to step 202.
Since the value of the counter is now “1”, the sequence subsequently jumps from step 203 to step 220. In step 220, the counter is first incremented to “2” and the value is stored in the non-volatile memory. In step 221, parameter B is set to “0” and stored in the non-volatile memory. A reset pulse for the watchdog is then generated in step 222.
A sequence of waiting loops is then executed in step 223. In this case, the number of waiting loops is selected in such a way that the duration of the execution of the sequence of waiting loops is less than the time interval if the clock rate of the microprocessor is only slightly above the upper limit of the tolerance range, for example, 10% above the setpoint value of the clock rate. If the clock rate of the microprocessor is less than the upper limit of the tolerance range, a reset is performed by the watchdog, assuming proper function, before the end of the execution of the sequence of waiting loops, so that the sequence jumps back to step 201.
Otherwise, a reset pulse is generated in step 224 and parameter B is then set to “1” in step 225 and this value is stored. The sequence then jumps to step 202.
In step 202, the counter content, now “2”, is read out and then the sequence jumps to step 230 in step 203. In step 230, the counter is first incremented to “3” and the value is stored in the non-volatile memory. Parameter C is then set to “0” in step 231 and stored in the non-volatile memory. A reset pulse for the watchdog is then generated in step 232.
A sequence of waiting loops is then executed in step 233. In this case, the number of waiting loops is selected in such a way that the duration of the execution of the sequence of waiting loops exceeds the time interval if the clock rate of the microprocessor is only slightly below the lower limit of the tolerance range, for example, 10% below the setpoint value of the clock rate. If the clock rate of the microprocessor is lower than the lower limit of the tolerance range, a reset is performed by the watchdog, assuming proper function, before the end of the execution of the sequence of waiting loops, so that the sequence jumps back to step 201.
Otherwise, a reset pulse is generated in step 234 and subsequently parameter C is set to “1” in step 235 and this value is stored. Subsequently, the sequence jumps to step 202.
The next time step 203 is reached, the counter content read out in step 202 is at “3”. No further check function is executed, but rather an analysis is performed. For this purpose, the sequence jumps from step 203 to step 204. In step 204, the values of parameters A, B, C are read out, i.e., a 3 bit long data word. Proper functioning or a malfunction and its type is then concluded in step 205 as a function of the value of the data word in accordance with the table. A corresponding error message is generated. Subsequently, the counter content is reset to “0” again in step 206 and the method of monitoring is ended. Depending on the status message generated, corresponding measures may be performed and/or the microprocessor may execute other processes or, if these processes have been interrupted to execute the check, continue them.
According to the method shown in
| Number | Date | Country | Kind |
|---|---|---|---|
| 102 35 564 | Aug 2002 | DE | national |
| Number | Name | Date | Kind |
|---|---|---|---|
| 4598355 | Shepler et al. | Jul 1986 | A |
| 4809280 | Shonaka | Feb 1989 | A |
| 4956842 | Said | Sep 1990 | A |
| 5184025 | McCurry et al. | Feb 1993 | A |
| 5522040 | Hofsass et al. | May 1996 | A |
| 5768496 | Lidgett et al. | Jun 1998 | A |
| 5879374 | Powers et al. | Mar 1999 | A |
| 6260162 | Typaldos et al. | Jul 2001 | B1 |
| 6618825 | Shaw | Sep 2003 | B1 |
| 6883123 | Hashimoto et al. | Apr 2005 | B2 |
| 6957353 | Bresniker et al. | Oct 2005 | B2 |
| 7137036 | Urahama | Nov 2006 | B2 |
| 20020116670 | Oshima et al. | Aug 2002 | A1 |
| Number | Date | Country |
|---|---|---|
| 43 30 940 | Mar 1995 | DE |
| WO 9732282 | Sep 1997 | WO |
| Number | Date | Country | |
|---|---|---|---|
| 20040093508 A1 | May 2004 | US |