Software watchdog implementation method, apparatus and computer device
By delaying the start of the watchdog timer and monitoring the feeding signal in real time, the problem of insufficient diagnosis and indication of the feeding signal in the existing technology is solved. It realizes accurate diagnosis and indication of the feeding signal, has a wider range of applications, and the accuracy can reach the microsecond level, while simplifying the system circuit.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-17
- Publication Date
- 2026-03-17
AI Technical Summary
Existing watchdog technology relies on dedicated chips, has complex system circuits, cannot indicate unexpected watchdog feeding situations, cannot distinguish repeated watchdog feeding, and has limited time windows and reset signal pulse widths, thus limiting its applicability.
The watchdog timer is started with a delay and the watchdog signal is monitored in real time. The first watchdog signal is determined, the center of the monitoring window is set, the position of the watchdog signal is recorded, and a precise reset signal and alarm signal are output. The time window and pulse width can be set arbitrarily.
It enables accurate diagnosis and indication of dog feeding signals, has a wider range of applications, and achieves microsecond-level accuracy, simplifying system circuit design.
Smart Images

Figure CN114201321B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of watchdog technology, and more particularly to a software watchdog implementation method, apparatus, and computer device. Background Technology
[0002] Automated control systems may experience crashes, enter unknown states from which they cannot return, or fall into unexpected loops when subjected to interference or unforeseen circumstances. Although the probability is small, the potential harm is significant. Currently, the industry widely uses watchdog timer (WDG) technology to address these issues. Watchdog technology provides a reset signal when it detects such situations, allowing the system to automatically return to normal operation.
[0003] A watchdog timer is a timer circuit containing an input feed signal and an output reset signal. The timer starts counting from zero after power-on. The input feed signal clears the timer, causing it to restart from zero. If no feed signal is received within a specified time, the timer will exceed its set value and output a reset signal. The watchdog timer only limits the last feed time, not the start time or the number of feeds. A window watchdog timer (WWDG), in addition to the above watchdog functions, limits the start and end times of feeds, but does not limit the number of feeds or perform any checks. Specifically, the feed time must be within a specified time period to clear the internal timer; it cannot be too early or too late. Otherwise, a reset pulse will be output to reset the target device.
[0004] Existing watchdog timers primarily rely on dedicated watchdog chips, resulting in complex system circuitry. Furthermore, they cannot indicate unexpected watchdog feeding or differentiate between repeated feedings. Additionally, there are numerous limitations on the feed signal, time window size, and pulse width of the output reset signal, leading to significant application restrictions and a limited range of applicability. Summary of the Invention
[0005] The purpose of this application is to at least partially solve one of the aforementioned technical problems.
[0006] Therefore, the first objective of this application is to propose a software watchdog implementation method that can accurately diagnose and indicate the watchdog signal; the time window size and the pulse width of the output reset signal can be arbitrarily set, making it more applicable and achieving microsecond-level accuracy.
[0007] The second objective of this application is to propose a software watchdog implementation device.
[0008] The third objective of this application is to propose a computer device.
[0009] The fourth objective of this application is to provide a non-transitory computer-readable storage medium.
[0010] To achieve the above objectives, a first aspect of this application proposes a watchdog implementation method, comprising:
[0011] Delay the start of the watchdog and monitor the dog feeding signal in real time;
[0012] Upon receiving a watchdog feeding signal, determine whether the watchdog feeding signal is the first watchdog feeding signal after the watchdog is activated;
[0013] If it is the first feeding signal after the watchdog is activated, then the center position of the monitoring window is set at the start time of the first feeding signal;
[0014] After waiting for half a window of time, the watchdog timer is reset and the process returns to monitor the dog feeding signal for the next cycle.
[0015] Optionally, the method also includes:
[0016] If the feeding signal is not the first feeding signal after the watchdog is started, the feeding signals in this cycle are continuously counted, and the occurrence time and position of the feeding signal in this cycle are recorded.
[0017] Optionally, the method also includes:
[0018] At the end of the cycle, determine whether the watchdog received a feeding signal during the cycle.
[0019] If no watchdog feed signal is received, a reset signal is output when the watchdog timer overflows, and the process returns to the delayed start watchdog step.
[0020] If a dog-feeding signal is received, further determination is made as to whether any dog-feeding signals from this period appear within the effective monitoring window:
[0021] If a watchdog feed signal appears within the valid monitoring window during the current cycle, the timer, counter, and alarm signal will be cleared before the watchdog timer overflows, and the monitoring will return to the next cycle for watchdog feed signal monitoring.
[0022] Optionally, the method also includes:
[0023] If no dog feeding signal appears within the monitoring window during this period, an alarm signal will be output.
[0024] When the watchdog timer overflows, a reset signal is output, and the process returns to the delayed watchdog start step.
[0025] Optionally, the method also includes:
[0026] Before further determining whether a dog feeding signal from this period appears within the effective monitoring window, determine whether there is more than one dog feeding signal from this period.
[0027] If there is more than one dog-feeding signal in this cycle, the alarm signal will be set to 1.
[0028] The software watchdog implementation method of this application delays the start of the watchdog timer and monitors the watchdog feed signal in real time. When a watchdog feed signal is received, it determines whether the feed signal is the first feed signal after the watchdog timer is started. If it is the first feed signal after the watchdog timer is started, the center position of the monitoring window is set at the start time of the first feed signal, and after waiting for half a window time, the watchdog timer is cleared and the monitoring of the feed signal for the next cycle is resumed. This method can achieve accurate diagnosis and indication of the feed signal. The size of the time window and the pulse width of the output reset signal can be arbitrarily set, making it more applicable and achieving microsecond-level accuracy.
[0029] To achieve the above objectives, a second aspect of this application provides a software watchdog implementation apparatus, comprising:
[0030] The startup module is used to delay the startup of the watchdog and monitor the dog-feeding signal in real time;
[0031] The first judgment module is used to determine whether the dog feeding signal is the first dog feeding signal after the watchdog is started when the dog feeding signal is received.
[0032] The setting module is used to set the center position of the monitoring window to the start time of the first feeding signal if it is the first feeding signal after the watchdog is started.
[0033] The processing module is used to wait for half a window of time, then clear the watchdog timer and return to monitor the dog feeding signal for the next cycle.
[0034] Optionally, the device also includes:
[0035] The recording module is used to continuously count the dog feeding signals in the current cycle and record the occurrence time and position of the dog feeding signals in the current cycle if the dog feeding signal is not the first dog feeding signal after the watchdog is started.
[0036] Optionally, the device also includes:
[0037] The second judgment module is used to determine at the end of the current cycle whether the watchdog received a dog-feeding signal during the current cycle.
[0038] The output module is used to output a reset signal and return to the delayed start watchdog step when the watchdog timer overflows if no watchdog feed signal is received.
[0039] The third judgment module is used to further determine whether a dog feeding signal from the current period has appeared within the monitoring validity window if a dog feeding signal is received.
[0040] The processing module is also used to, if a watchdog feeding signal appears within the monitoring valid window in the current cycle, clear the timer, counter, and alarm signal before the watchdog timer overflows, and return to monitor the watchdog feeding signal for the next cycle.
[0041] Optionally, the device also includes:
[0042] The alarm module is used to output an alarm signal if no dog feeding signal appears within the monitoring validity window during the current cycle.
[0043] The output module is also used to output a reset signal and return to the delayed start watchdog step when the watchdog timer overflows.
[0044] Optionally, the device also includes:
[0045] The fourth judgment module is used to determine whether there is more than one dog feeding signal in the current period before further determining whether a dog feeding signal appears within the effective monitoring window in the current period;
[0046] The alarm setting module is used to set the alarm signal to 1 if there is more than one dog feeding signal in the current cycle.
[0047] The software watchdog implementation device of this application delays the start of the watchdog timer and monitors the watchdog feed signal in real time. When a watchdog feed signal is received, it determines whether the watchdog feed signal is the first watchdog feed signal after the watchdog timer is started. If it is the first watchdog feed signal after the watchdog timer is started, the center position of the monitoring window is set at the start time of the first watchdog feed signal, and after waiting for half a window time, the watchdog timer is cleared and the monitoring of the watchdog feed signal for the next cycle is resumed. This can achieve accurate diagnosis and indication of the watchdog feed signal. The size of the time window and the pulse width of the output reset signal can be set arbitrarily, making it more applicable and achieving microsecond-level accuracy.
[0048] To achieve the above objectives, a third aspect of this application provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the software watchdog implementation method as described in the first aspect embodiment.
[0049] To achieve the above objectives, a fourth aspect of this application also proposes a non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the software watchdog implementation method as described in the first aspect embodiment.
[0050] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0051] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0052] Figure 1 This is a flowchart of a software watchdog implementation method according to an embodiment of this application;
[0053] Figure 2 This is a flowchart of a software watchdog implementation method according to another embodiment of this application;
[0054] Figure 3 This is a flowchart of a software watchdog implementation method according to another embodiment of this application;
[0055] Figure 4 This is a flowchart of a software watchdog implementation method according to a specific embodiment of this application;
[0056] Figure 5 This is a flowchart of a software watchdog implementation method according to another specific embodiment of this application;
[0057] Figure 6 This is a flowchart of a software watchdog implementation method according to a specific embodiment of this application;
[0058] Figure 7 This is a schematic diagram of a watchdog integrated into the internal system of a smart chip;
[0059] Figure 8 This is a schematic diagram of a watchdog connected to the system being monitored.
[0060] Figure 9 This is a schematic diagram of the structure of a software watchdog implementation device according to an embodiment of this application;
[0061] Figure 10 This is a schematic diagram of the structure of a software watchdog implementation device according to another embodiment of this application;
[0062] Figure 11 This is a schematic diagram of the structure of a software watchdog implementation device according to another embodiment of this application;
[0063] Figure 12 This is a schematic diagram of the structure of a software watchdog implementation device according to a specific embodiment of this application;
[0064] Figure 13 This is a schematic diagram of the structure of a software watchdog implementation device according to another specific embodiment of this application. Detailed Implementation
[0065] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0066] The present application will be further described in detail below with reference to specific embodiments, which should not be construed as limiting the scope of protection claimed in the present application.
[0067] The following description, with reference to the accompanying drawings, outlines a software watchdog implementation method, apparatus, and computer device according to embodiments of this application.
[0068] Figure 1 This is a flowchart of a software watchdog implementation method according to an embodiment of this application, as follows: Figure 1 As shown, the method includes the following steps:
[0069] S1 delays the start of the watchdog and monitors the dog feeding signal in real time.
[0070] Before delaying the start of the watchdog timer, it can be initialized first. Specifically, first clear the timers, counters, and alarm messages, and then configure the watchdog's initial information. The initial information includes at least one or more of the following: the watchdog clock divider, the timer overflow cycle count, the size of the valid monitoring window, the pulse width of the output reset signal, and the delay start time. The pulse width of the output reset signal can be flexibly configured, ranging from microseconds to minutes.
[0071] After the delayed start time expires, the watchdog timer can be activated, and the watchdog feeding signal can be monitored in real time. At the same time, the watchdog timer and counter are controlled to continuously count.
[0072] In addition, after delaying the start of the watchdog timer, the timer, counter, and alarm information can be reset again.
[0073] S2, upon receiving the watchdog feed signal, determines whether the watchdog feed signal is the first watchdog feed signal after the watchdog is activated.
[0074] S3, if it is the first dog-feeding signal after the watchdog is started, then set the center position of the monitoring window to the start time of the first dog-feeding signal.
[0075] S4: After waiting for half a window of time, clear the watchdog timer and return to monitor the dog feeding signal for the next cycle.
[0076] The software watchdog implementation method of this application delays the start of the watchdog timer and monitors the watchdog feed signal in real time. Upon receiving the watchdog feed signal, it determines whether the feed signal is the first feed signal after the watchdog timer is started. If it is the first feed signal after the watchdog timer is started, the center position of the monitoring window is set at the start time of the first feed signal, and after waiting for half a window time, the watchdog timer is cleared and the monitoring of the feed signal for the next cycle is resumed. This method can achieve accurate diagnosis and indication of the feed signal. The size of the time window and the pulse width of the output reset signal can be arbitrarily set, making it more applicable and achieving microsecond-level accuracy.
[0077] In another embodiment of this application, such as Figure 2 As shown, it also includes:
[0078] S5. If the watchdog feed signal is not the first watchdog feed signal after the watchdog is started, then the watchdog feed signals in this cycle are continuously counted, and the occurrence time and position of the watchdog feed signals in this cycle are recorded.
[0079] It can accurately diagnose unexpected or recurring dog feeding signals and provide different instructions.
[0080] In yet another embodiment of this application, such as Figure 3 As shown, it also includes:
[0081] S6, at the end of this cycle, determine whether the watchdog received a feeding signal during this cycle.
[0082] S7 If no watchdog feed signal is received, a reset signal is output when the watchdog timer overflows, and the process returns to the delayed start watchdog step.
[0083] S8. If a dog-feeding signal is received, further determine whether a dog-feeding signal within the current cycle appears within the effective monitoring window.
[0084] S9, if a watchdog feed signal appears within the valid monitoring window during the current cycle, then before the watchdog timer overflows, clear the timer, counter, and alarm signal, and return to monitor the watchdog feed signal for the next cycle.
[0085] In one specific embodiment of this application, such as Figure 4 As shown, it also includes:
[0086] S10 If no dog feeding signal appears within the monitoring window during this cycle, an alarm signal will be output.
[0087] S11: When the watchdog timer overflows, output a reset signal and return to the delayed start watchdog step.
[0088] In another specific embodiment of this application, such as Figure 5 As shown, it also includes:
[0089] S12, before further determining whether there is a dog feeding signal within the current cycle that appears within the effective monitoring window, determine whether there is more than one dog feeding signal within the current cycle.
[0090] S13, if there is more than one dog feeding signal in this cycle, then set the alarm signal to 1.
[0091] The following detailed description is based on a specific example.
[0092] like Figure 6 As shown, it includes the following steps:
[0093] S101, watchdog function power-on initialization.
[0094] When the reset signal is turned off, all timers, counters, etc., are cleared to zero, and alarm signals are also cleared to zero.
[0095] S102 configures the watchdog time base, timer overflow cycle count value, size of the watchdog monitoring effective window, pulse width of the output reset signal, and watchdog delay start time.
[0096] Here, the time base refers to the clock's frequency division factor.
[0097] The purpose of setting a delayed start is to avoid the system getting stuck in an infinite loop due to an erroneous reset that occurs prematurely during the system power-on initialization process.
[0098] S103, delayed start countdown begins, watchdog monitoring function is activated after the countdown is complete.
[0099] S104 clears the timer, counter, and alarm signals.
[0100] S105 continuously monitors the dog feeding signal in real time, with timers and counters continuously counting.
[0101] S106, determine whether the received dog feeding signal is the first dog feeding signal after the watchdog is started.
[0102] S107, if it is the first dog feeding signal after startup, the center position of the monitoring window is set at the start time of this dog feeding signal.
[0103] S108: After waiting for half a window of time, the watchdog timer is cleared and the process returns to monitor the dog feeding signal for the next cycle.
[0104] S109, if the received dog feeding signal is not the first dog feeding signal after the watchdog is started, then continuously count the dog feeding signals received in this cycle and record the time and location of their occurrence.
[0105] S110, before the end of this cycle, determine whether a dog-feeding signal has been received in this cycle.
[0106] S111 If no watchdog feed signal is received, the watchdog timer will automatically trigger a reset signal when it overflows, thus stopping watchdog monitoring.
[0107] S112, if a dog feeding signal is received, determine whether there is only one dog feeding signal in this cycle.
[0108] S113, if there is not one, then set the alarm signal to 1.
[0109] S114, if there is only one, then determine whether the dog feeding signal in this cycle appears within the time window.
[0110] If S115 occurs within the time window, the timer, counter, and alarm signal will be cleared before the watchdog timer overflows, and then the current monitoring cycle will end and the monitoring cycle will begin.
[0111] S116, if it does not appear within the time window, the alarm signal outputs a pulse of equal width (such as a 1Hz frequency pulse, which can be used to make the alarm indicator flash), and then jumps to step S111.
[0112] The software watchdog implementation method in this embodiment does not rely on a dedicated watchdog chip; it can be implemented using software technology and can be integrated into existing logic devices or microprocessors, simplifying system circuit design. It can be implemented as follows: Figure 7 As shown, it can be integrated into the internal system of a smart chip, or it can be implemented as follows: Figure 8 The external connection to the system to be monitored is shown.
[0113] The software watchdog implementation method of this embodiment is flexible in application: it does not rely on a dedicated watchdog chip and can easily implement software watchdog functions based on existing FPGA, processor and other chips; it has high reliability: it can adapt to different watchdog signals and can diagnose and indicate erroneous or repetitive watchdog signals in a timely manner; it has high accuracy: the size of the time window can be set arbitrarily, and the pulse width of the output reset signal can be set arbitrarily.
[0114] To implement the above embodiments, this application also proposes a software watchdog implementation device.
[0115] Figure 9 This is a schematic diagram of the structure of a software watchdog implementation device according to an embodiment of this application.
[0116] like Figure 9 As shown, the device includes a startup module 10, a first judgment module 20, a setting module 30, and a processing module 40.
[0117] The startup module 10 is used to delay the startup of the watchdog and monitor the dog feeding signal in real time;
[0118] The first judgment module 20 is used to determine whether the dog feeding signal is the first dog feeding signal after the watchdog is started when the dog feeding signal is received.
[0119] Setting module 30 is used to set the center position of the monitoring window to the start time of the first feeding signal if it is the first feeding signal after the watchdog is started.
[0120] The processing module 40 is used to wait for half a window of time, then clear the watchdog timer and return to monitor the dog feeding signal for the next cycle.
[0121] It should be understood that the software watchdog implementation apparatus of this embodiment is consistent with the software watchdog implementation method of the first aspect embodiment, and will not be repeated here.
[0122] The software watchdog implementation device in this embodiment delays the start of the watchdog timer and monitors the watchdog feed signal in real time. Upon receiving the watchdog feed signal, it determines whether the signal is the first feed signal after the watchdog timer is started. If it is, the center of the monitoring window is set at the start time of the first feed signal, and after waiting for half a window of time, the watchdog timer is cleared, and the monitoring returns to the next cycle of feed signal monitoring. This allows for accurate diagnosis and indication of the feed signal. The time window size and the pulse width of the output reset signal can be arbitrarily set, making it more applicable and achieving microsecond-level accuracy.
[0123] In another embodiment of this application, such as Figure 10 As shown, the device also includes a recording module 50.
[0124] The recording module 50 is used to continuously count the dog feeding signals in the current cycle and record the occurrence time and position of the dog feeding signals in the current cycle if the dog feeding signal is not the first dog feeding signal after the watchdog is started.
[0125] In yet another embodiment of this application, such as Figure 11 As shown, the device also includes a second judgment module 60, an output module 70, and a third judgment module 80.
[0126] The second judgment module 60 is used to determine at the end of the current cycle whether the watchdog received a dog-feeding signal during the current cycle.
[0127] The output module 70 is used to output a reset signal and return to the delayed start watchdog step when the watchdog timer overflows if no watchdog feed signal is received.
[0128] The third judgment module 80 is used to further determine whether a dog feeding signal within the current cycle appears in the monitoring effective window if a dog feeding signal is received.
[0129] The processing module 40 is also used to, if a watchdog feeding signal appears within the monitoring valid window in the current cycle, clear the timer, counter and alarm signal before the watchdog timer overflows, and return to monitor the watchdog feeding signal for the next cycle.
[0130] In one specific embodiment of this application, such as Figure 12 As shown, the device also includes an alarm module 90.
[0131] Alarm module 90 is used to output an alarm signal if no dog feeding signal appears in the monitoring valid window during the current cycle;
[0132] The output module 70 is also used to output a reset signal and return to the delayed start watchdog step when the watchdog timer overflows.
[0133] In another specific embodiment of this application, such as Figure 13 As shown, the device also includes a fourth judgment module 100 and an alarm setting module 110.
[0134] The fourth judgment module 100 is used to determine whether there is more than one dog feeding signal in the current period before further determining whether a dog feeding signal in the current period appears in the effective monitoring window;
[0135] The alarm setting module 110 is used to set the alarm signal to 1 if there is more than one dog feeding signal in the current cycle.
[0136] To implement the above embodiments, this application also proposes a computer device.
[0137] The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the software watchdog implementation method as described in the first aspect embodiment.
[0138] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium.
[0139] The non-transitory computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the software watchdog implementation method as described in the first aspect embodiment.
[0140] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0141] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0142] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0143] It should be noted that, in the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0144] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
Claims
1. A software watchdog implementation method, characterized in that, The method comprises the following steps: delaying starting the watchdog, and monitoring the feeding signal in real time; when the feeding signal is received, judging whether the feeding signal is the first feeding signal after starting the watchdog; if the feeding signal is the first feeding signal after starting the watchdog, setting the center position of the monitoring window at the starting time of the first feeding signal; waiting for half of the window time, and then clearing the timer of the watchdog, and returning to the feeding signal monitoring of the next cycle; if the feeding signal is not the first feeding signal after starting the watchdog, continuously counting the feeding signals in the current cycle, and recording the time position of the feeding signals in the current cycle.
2. The method of claim 1, wherein, The method further comprises the following steps: at the end of the current cycle, judging whether the watchdog receives the feeding signal in the current cycle; if the feeding signal is not received, outputting a reset signal when the timer of the watchdog overflows, and returning to the step of delaying starting the watchdog; if the feeding signal is received, further judging whether the feeding signal in the current cycle appears in the monitoring effective window; if the feeding signal in the current cycle appears in the monitoring effective window, clearing the timer, the counter and the alarm signal before the timer of the watchdog overflows, and returning to the feeding signal monitoring of the next cycle.
3. The method of claim 2, wherein, The method further comprises the following steps: if the feeding signal in the current cycle does not appear in the monitoring effective window, outputting an alarm signal; outputting a reset signal when the timer of the watchdog overflows, and returning to the step of delaying starting the watchdog.
4. The method of claim 2, wherein, The method further comprises the following steps: before the further judgment whether the feeding signal in the current cycle appears in the monitoring effective window, judging whether the feeding signals in the current cycle are more than one; if the feeding signals in the current cycle are more than one, setting the alarm signal to 1.
5. A software watchdog implementation apparatus, characterized by The method comprises the following steps: a starting module, used for delaying starting the watchdog, and monitoring the feeding signal in real time; a first judging module, used for judging whether the feeding signal is the first feeding signal after starting the watchdog when the feeding signal is received; a setting module, used for setting the center position of the monitoring window at the starting time of the first feeding signal if the feeding signal is the first feeding signal after starting the watchdog; a processing module, used for waiting for half of the window time, and then clearing the timer of the watchdog, and returning to the feeding signal monitoring of the next cycle; a recording module, used for continuously counting the feeding signals in the current cycle, and recording the time position of the feeding signals in the current cycle if the feeding signal is not the first feeding signal after starting the watchdog.
6. The apparatus of claim 5, wherein, The method further comprises the following steps: a second judging module, used for judging whether the watchdog receives the feeding signal in the current cycle at the end of the current cycle; an output module, used for outputting a reset signal when the timer of the watchdog overflows if the feeding signal is not received, and returning to the step of delaying starting the watchdog; a third judging module, used for further judging whether the feeding signal in the current cycle appears in the monitoring effective window if the feeding signal is received; The processing module is further configured to, if the watchdog signal in the current period appears in the monitoring valid window, clear the timer, the counter and the alarm signal before the timer of the watchdog overflows, and return to monitoring the watchdog signal in the next period.
7. The apparatus of claim 6, wherein, Further comprising: an alarm module configured to output an alarm signal if the watchdog signal in the current period does not appear in the monitoring valid window; The output module is further configured to output a reset signal when the timer of the watchdog overflows, and return to the step of delaying starting the watchdog.
8. The apparatus of claim 6, wherein, Further comprising: a fourth judging module configured to judge whether the watchdog signal in the current period is more than one before further judging whether the watchdog signal in the current period appears in the monitoring valid window; an alarm setting module configured to set the alarm signal to 1 if the watchdog signal in the current period is more than one.
9. A computer device, comprising: The computer program is stored in the computer readable storage medium and is run by the processor to implement the software watchdog implementation method in any one of claims 1-4.
10. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium and is run by the processor to implement the software watchdog implementation method in any one of claims 1-4.
Citation Information
Patent Citations
Method for implementing watchdog on system on chip with multiple processor cores
CN105260255A