Watchdog device, watchdog control method and electronic equipment
By introducing multi-threshold and step-by-step reset mechanisms into the watchdog circuit, the existing watchdog circuit misjudgment system faults and inflexible processing are solved, and higher fault detection accuracy and fault handling flexibility are achieved.
Patent Information
- Application Number
- CN202411660417.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-28
AI Technical Summary
When the existing watchdog circuit detects the operating status of the system, it is easy to misjudgment the system as a fault status, resulting in unnecessary system resets and is not flexible enough to handle different types of faults.
Using a multi-threshold watchdog device, by setting at least two thresholds, each threshold corresponds to a different reset signal and a module to be reset. If the timer count reaches any threshold, no dog feeding signal is received, a corresponding reset signal is generated for the module to reset step by step.
It improves the accuracy of fault detection and flexibility in fault handling, avoids unnecessary system resets, and can face different types of faults more effectively.
Smart Images

Figure CN119718734A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of embedded systems, and in particular to a watchdog device, a watchdog control method and electronic equipment. Background Art
[0002] A watchdog is a timer circuit widely used in embedded systems to detect and handle system abnormalities to ensure that the system can be restarted in a timely and stable manner.
[0003] The watchdog circuit usually contains a timer and a reset controller. Under normal working conditions, the system needs to periodically send a "feed the dog" signal to the watchdog circuit to reset the timer. If the system is stuck or in an endless loop due to a fault and cannot send the "feed the dog" signal on time, the timer will time out, triggering the reset controller to reset the system and resume normal operation.
[0004] The main functions of the watchdog circuit include preventing the program from looping or running away, handling reset exceptions, preventing cache failure, preventing operation timeouts, monitoring system status, detecting system crashes, and detecting hardware failures. It can ensure the stability and reliability of the system, especially in situations where long-term continuous operation is required, such as network servers, etc., the watchdog circuit is an indispensable part. Summary of the invention
[0005] The present invention provides a watchdog device, a watchdog control method and an electronic device, which can improve the accuracy of fault detection and the flexibility of fault processing.
[0006] In one aspect of the present invention, a watchdog device is provided. The device comprises: a register configuration module configured to set at least two thresholds, each threshold corresponding to a different reset signal, each reset signal corresponding to a different module to be reset; and a multi-level reset generation module configured to generate a reset signal corresponding to any threshold if no dog feeding signal is received when the current timer count reaches any of the at least two thresholds, and send the reset signal to the corresponding module to be reset.
[0007] In another aspect of the present invention, a watchdog control method is provided. The method comprises: setting at least two thresholds, each of which corresponds to a different reset signal, and each of which corresponds to a different module to be reset; and if the dog feeding signal is still not received when the current timer count reaches any of the at least two thresholds, generating a reset signal corresponding to any of the thresholds, and sending the reset signal to the corresponding module to be reset.
[0008] In another aspect of the present invention, an electronic device is provided, comprising a memory configured to store an executable program and a processor configured to execute the program to perform the above-mentioned watchdog control method.
[0009] According to the present invention, the register configuration module is configured to set at least two thresholds, each threshold corresponds to a different reset signal, each reset signal corresponds to a different module to be reset, and the multi-level reset generation module is configured to generate a reset signal corresponding to any threshold if the dog feeding signal is still not received when the count of the current timer reaches any threshold, and send the reset signal to the corresponding module to be reset. In this way, by setting different thresholds and executing different reset strategies corresponding to different thresholds, different modules can be reset step by step, which can more effectively deal with different types of faults, thereby improving the accuracy of fault detection and the flexibility of fault handling. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic diagram of a watchdog device according to an embodiment of the present invention; Figure 2 is a schematic diagram of the overall environment of a watchdog device according to an embodiment of the present invention; Figure 3 is a flow chart of a watchdog control method according to an embodiment of the present invention; Figure 4 A schematic diagram of a flow chart of a watchdog control method according to an embodiment of the present invention; Figure 5 A control schematic diagram of a watchdog control method according to an embodiment of the present invention; Figure 6 FIG. 4 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0012] The existing standard watchdog usually has only one fixed time threshold to detect the operating status of the system. The standard watchdog determines whether the system is operating normally by detecting whether the system sends a "feed the dog" signal within the specified time. However, in some cases, the system may not be able to send a "feed the dog" signal in time for some reason, but it does not mean that the system has failed. At this time, the standard watchdog may misjudge the system as a fault state, resulting in unnecessary system reset. In addition, the standard watchdog usually only provides a reset signal to handle system failures. However, in actual applications, the system may face different types of failures, such as power failures, hardware failures, software failures, etc. Different processing measures may be required for different types of failures.
[0013] In order to solve at least the above-mentioned technical problems, the present disclosure provides a watchdog device. According to the present disclosure, a multi-threshold watchdog can be used to improve the accuracy of fault detection by setting multiple time thresholds. In addition, the multi-threshold watchdog can set different processing strategies according to different fault types, and provide a more flexible fault handling mechanism by resetting different modules step by step. Specifically, the register configuration module is configured to set at least two thresholds, each threshold corresponds to a different reset signal, and each reset signal corresponds to a different module to be reset. The multi-level reset generation module is configured to generate a reset signal corresponding to any threshold if the dog feeding signal is still not received when the count of the current timer reaches any threshold, and send the reset signal to the corresponding module to be reset. In this way, by setting different thresholds, and reaching different thresholds corresponding to the execution of different reset strategies, different modules are reset step by step, which can more effectively face different types of faults, thereby improving the accuracy of fault detection and improving the flexibility of fault handling.
[0014] According to the disclosed embodiments, a multi-threshold watchdog can provide a hierarchical reset strategy for complex systems, achieving more sophisticated and safe fault management. The implemented multi-threshold watchdog has multiple adjustable thresholds. In the standard watchdog, a maximum threshold is set. When the counter counts to the maximum threshold, if there is still no dog feeding signal, the system reset is triggered. Compared with the standard watchdog, the multi-threshold watchdog can set multiple thresholds between the maximum thresholds. When the count reaches the first threshold, if there is no dog feeding signal, a first-level reset signal is generated, the first module is reset, and the counter continues to count. When the count reaches the second threshold, if there is still no dog feeding signal, a second-level reset signal is generated, the second module is reset, and the counter continues to count, and so on, until the count reaches the maximum threshold. If there is still no dog feeding signal, the last-level reset signal is generated, which is a global reset signal to fully reset the system.
[0015] In addition, the multi-threshold watchdog provides pause counting and accelerated counting functions. Pause counting can pause the current counter count to prevent the watchdog from continuing to reset each module, and can be used to wait for the reset initialization time of each module. Accelerated counting can accelerate the counter count in multiples so that the counter value reaches each threshold faster. It can be used for simulation or other application scenarios, and the acceleration multiple can be configured by the system. Pause counting and accelerated counting are controlled by the chip processor and implemented in the multi-level reset generation module in the watchdog module. The processor chooses whether to accelerate counting based on the program running situation. For example, if the controller wants to shorten the reset waiting time during the program running process, it can be configured to the accelerated counting mode without reconfiguring all thresholds to smaller values to achieve the same effect.
[0016] In addition, the clock of the multi-threshold watchdog is obtained by passing the clock source through the frequency divider. A wider range of reset times can be set in combination with the clock frequency and threshold. For example, for the same threshold, the reset time becomes longer when the clock frequency is reduced, and the reset time becomes shorter when the clock frequency is increased, making the reset control of the multi-threshold watchdog more flexible. The clock source and the frequency division ratio are controlled by the chip processor. The processor configures the registers of the watchdog IP through the bus, and the register values are saved to the clock generation module, thereby changing the working clock of the watchdog module.
[0017] Hereinafter, the technical solution according to the present disclosure will be described with reference to specific embodiments and in conjunction with the accompanying drawings.
[0018] Figure 1 1 is a block diagram showing a watchdog device 100 according to an embodiment of the present invention. Figure 1 The watchdog device 100 includes a register configuration module 102 and a multi-level reset generation module 104 .
[0019] The register configuration module 102 is configured to set at least two thresholds, each of which corresponds to a different reset signal, and each of which corresponds to a different module to be reset.
[0020] The multi-level reset generating module 104 is configured to generate a reset signal corresponding to any threshold value if no dog feeding signal is received when the current timer count reaches any threshold value of the at least two threshold values, and send the reset signal to the corresponding module to be reset.
[0021] In some embodiments, the multi-level reset generation module 104 is further configured to generate a local reset signal corresponding to the non-highest threshold value if the dog feeding signal is still not received when the current timer count reaches the non-highest threshold value among the at least two threshold values, and send the local reset signal to the local module of the corresponding system. In addition, the multi-level reset generation module 104 is further configured to generate a global reset signal corresponding to the highest threshold value if the dog feeding signal is still not received when the current timer count reaches the highest threshold value among the at least two threshold values, and send the global reset signal to all modules of the corresponding system.
[0022] In this way, two or more thresholds can be set, including a non-maximum threshold and a maximum threshold. When the non-maximum threshold is reached, a local reset is performed if no dog feeding signal is received. When the maximum threshold is reached, a global reset is performed if no dog feeding signal is received. A hierarchical reset strategy is provided, which also avoids misjudgment of faults and can achieve accurate and flexible fault detection.
[0023] Optionally, in some embodiments, the device 100 may further include an interrupt generation module 106. The interrupt generation module 106 is configured to send an interrupt signal to the processor to prompt the processor to feed the dog in time if the dog feeding signal is still not received when the count of the current timer reaches the highest threshold of the at least two thresholds. In this embodiment, the multi-level reset generation module 104 is configured to wait for a first preset time after the interrupt signal is generated, and if the dog feeding signal is still not received, generate a global reset signal corresponding to the highest threshold, and send the global reset signal to all modules of the corresponding system.
[0024] In this way, if the timer count reaches the highest threshold and still has not received the dog feeding signal, you can avoid performing a global reset immediately. Instead, you can prompt the processor to feed the dog in time. If the dog feeding signal is still not received after a period of time, then perform a global reset again to confirm whether the processor has lost the ability to feed the dog, thereby further improving the accuracy of fault detection.
[0025] In some embodiments, the multi-level reset generation module 104 is further configured to determine whether the processor of the system is running a long-time program, and if so, to pause the counting of the timer by pausing the timer, wherein the long-time program is a program whose running time is greater than a second preset time.
[0026] In this way, if the processor is running a long program and cannot perform the dog feeding operation, the current count is paused by pausing the timer to avoid a reset that interrupts the program execution.
[0027] In some embodiments, the multi-stage reset generation module 104 is further configured to accelerate the counting of the timer according to a preset acceleration multiple by accelerating the timer.
[0028] In this way, the acceleration timer can accelerate the counting of the timer by multiples, so that the timer reaches each threshold faster, which can be used for simulation or other application scenarios. For example, if the controller wants to shorten the reset waiting time during program running, the acceleration timer can be used to accelerate the counting without reconfiguring all thresholds to smaller values to achieve the same effect, thereby improving the flexibility of reset control.
[0029] Optionally, in some embodiments, the device 100 may further include a clock generation module 108. The clock generation module 108 is configured to set a clock frequency, and obtain a clock according to the clock frequency through a clock source through a frequency divider. In this embodiment, the multi-stage reset generation module 304 is configured to count based on the clock using the timer. Specifically, the clock source and the frequency divider are controlled by a chip processor, and the processor configures the register through a bus, and saves the register value as the clock frequency to the clock generation module 108, thereby changing the watchdog working clock.
[0030] In this way, under the same threshold, the reset time can be lengthened by reducing the clock frequency, and the reset time can be shortened by increasing the clock frequency, thereby improving the flexibility of the watchdog reset control.
[0031] In some embodiments, the multi-level reset generating module 104 is further configured to reset the timer if a dog feeding signal is received when the count of the current timer reaches any one of the at least two thresholds.
[0032] In this way, the timer is reset to facilitate the next round of fault detection.
[0033] Figure 2 FIG. 1 is a schematic diagram showing the overall environment of the watchdog device 100 according to an embodiment of the present invention. Figure 2 , the clock source is electrically coupled to the clock generation module 108 of the watchdog device 100, and the multi-stage reset generation module 104 of the watchdog device 100 is electrically coupled to a plurality of modules to be reset. In addition, Figure 2 The register configuration module 102 of the watchdog device 100 is schematically shown to set or store four thresholds, and the multi-level reset generation module 104 of the watchdog device 100 generates four levels of reset signals. However, the present disclosure is not limited thereto, and the register configuration module 102 can set or store other numbers of thresholds, and the multi-level reset generation module 104 can generate other numbers of reset signals.
[0034] In some embodiments, the multi-level reset generation module 104 is configured to generate a first-level reset signal, a second-level reset signal, and / or a third-level reset signal corresponding to the non-highest threshold. In addition, the multi-level reset generation module 104 is configured to send the first-level reset signal to the interrupt service module, send the second-level reset signal to the peripheral power module, and / or send the third-level reset signal to the input and output module. In this embodiment, the first threshold corresponding to the first-level reset signal is less than the second threshold corresponding to the second-level reset signal, and the second threshold corresponding to the second-level reset signal is less than the third threshold corresponding to the third-level reset signal.
[0035] In some embodiments, the multi-level reset generation module 104 is configured to generate a fourth-level reset signal corresponding to the highest threshold as a global reset signal, and send the global reset signal to all modules of the corresponding system.
[0036] The watchdog device of the embodiment of the present invention may be integrated into a SOC chip (system on chip).
[0037] Figure 3 FIG. 2 is a flowchart of a watchdog control method 200 according to an embodiment of the present disclosure. Figure 3 The method 200 includes the following steps 202 to 204.
[0038] In step 202, at least two thresholds are set, each of the thresholds corresponds to a different reset signal, and each of the reset signals corresponds to a different module to be reset.
[0039] In step 204, if the dog feeding signal is still not received when the current timer count reaches any one of the at least two thresholds, a reset signal corresponding to the threshold is generated and sent to the corresponding module to be reset.
[0040] Hereinafter, application scenarios of the watchdog device, the watchdog control method, and the electronic device according to the embodiments of the present invention will be described by way of examples.
[0041] Figure 4 is a flow chart showing a watchdog control method according to an embodiment of the present invention. Figure 5 2 is a control schematic diagram showing a watchdog control method according to an embodiment of the present invention. Figure 4 The method includes the following steps 301 to 307.
[0042] In step 301, the clock frequency is set; a clock is obtained according to the clock frequency through a clock source through a frequency divider; and a timer is used to count based on the clock.
[0043] In step 302, at least two thresholds are set, each threshold corresponds to a different reset signal, and each reset signal corresponds to a different module to be reset.
[0044] Specifically, four thresholds are set, including a first threshold, a second threshold, a third threshold and a fourth threshold which increase in sequence, wherein the first threshold corresponds to a first-level reset signal, the first-level reset signal corresponds to the first module of the system, the second threshold corresponds to a second-level reset signal, the second-level reset signal corresponds to the second module of the system, the third threshold corresponds to a third-level reset signal, the third-level reset signal corresponds to the third module of the system, and the fourth threshold corresponds to a fourth-level reset signal, and the fourth-level reset signal corresponds to all modules of the system.
[0045] From the first module to the third module, the impact of reset on program operation becomes more and more serious, and the content covered by reset becomes more and more extensive. In some embodiments, the first module is an interrupt service module, which solves the abnormal problem caused by the interrupt service routine execution time being too long, the second module is a peripheral power supply, which solves the abnormal problem caused by the peripheral, and the third module is a GPIO (general input and output interface), which solves the abnormal problem related to the IO (input and output) port.
[0046] The hierarchical reset strategy is suitable for scenarios that require high reliability and stability, such as in smart manufacturing, automotive electronics, medical equipment, etc. Through this strategy, different countermeasures can be taken at different fault levels to reduce system-wide resets caused by single module failures, thereby avoiding unnecessary restarts of the entire system, reducing system downtime, and allowing the system to solve local problems without completely shutting down, thereby improving the efficiency of fault recovery and further improving system stability and reliability.
[0047] In step 303, if the dog feeding signal is still not received when the count of the current timer reaches the first threshold, a first level reset signal corresponding to the first threshold is generated and sent to the first module of the corresponding system.
[0048] In step 304, if the dog feeding signal is still not received when the count of the current timer reaches the second threshold, a second level reset signal corresponding to the second threshold is generated and sent to the corresponding second module of the system.
[0049] In step 305, if the dog feeding signal is still not received when the count of the current timer reaches the third threshold, a third level reset signal corresponding to the third threshold is generated and sent to the third module of the corresponding system.
[0050] In step 306, if the dog feeding signal is still not received when the current timer count reaches the fourth threshold, a fourth level reset signal corresponding to the fourth threshold is generated and sent to all modules of the corresponding system.
[0051] In some embodiments, if the dog feeding signal is not received when the current timer count reaches the fourth threshold, an interrupt signal is sent to the processor to prompt the processor to feed the dog in time; after waiting for the first preset time, if the dog feeding signal is still not received, a fourth-level reset signal corresponding to the fourth threshold is generated, and the fourth-level reset signal is sent to all modules of the corresponding system.
[0052] Reset signals of different levels are output to corresponding modules through different output ports.
[0053] In step 307, if a dog feeding signal is received when the count of the current timer reaches any threshold, the timer is reset.
[0054] In some embodiments, the method may further include: determining whether the processor of the system is running a long-time program, and if so, pausing the counting of the above timer by pausing the timer, such as Figure 5 The long-time program is a program whose running time is greater than the second preset time.
[0055] In some embodiments, the method may further include: accelerating the counting of the timer according to a preset acceleration multiple by accelerating the timer, such as Figure 5 shown.
[0056] According to yet another aspect of the present invention, Figure 6 4 is a schematic diagram showing an electronic device 400 according to an embodiment of the present invention. Figure 6 , the electronic device 400 includes a memory 402 and a processor 404. The memory 402 is configured to store an executable program that can be run on the processor 404. The processor 404 is configured to execute the program to implement the various steps or actions of the watchdog control method described above.
[0057] In summary, according to the watchdog device, watchdog control method and electronic device provided by the present invention, the register configuration module is configured to set at least two thresholds, each threshold corresponds to a different reset signal, each reset signal corresponds to a different module to be reset, and the multi-level reset generation module is configured to generate a reset signal corresponding to any threshold if the dog feeding signal is still not received when the current timer count reaches any threshold, and send the reset signal to the corresponding module to be reset, so that by setting different thresholds and executing different reset strategies corresponding to different thresholds, different modules can be reset step by step, which can more effectively deal with different types of faults, thereby improving the accuracy of fault detection and the flexibility of fault handling. In addition, the count of the timer can be accelerated by multiples by accelerating the timer, so that the timer reaches each threshold faster, which can be used for simulation or other application scenarios. For example, the controller hopes to shorten the reset waiting time during program running. At this time, the count is accelerated by accelerating the timer, and all thresholds do not need to be reconfigured to smaller values to achieve the same effect, thereby improving the flexibility of reset control.
[0058] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A watchdog device, characterized in that: include: A register configuration module, configured to set at least two thresholds, each of the thresholds corresponds to a different reset signal, and each of the reset signals corresponds to a different module to be reset; as well as The multi-level reset generation module is configured to generate a reset signal corresponding to any of the at least two thresholds if the dog feeding signal is still not received when the current timer count reaches any of the at least two thresholds, and send the reset signal to the corresponding module to be reset.
2. The watchdog device according to claim 1, characterized in that: The multi-stage reset generation module is further configured to: If the dog feeding signal is still not received when the count of the current timer reaches a non-highest threshold value among the at least two threshold values, a local reset signal corresponding to the non-highest threshold value is generated, and the local reset signal is sent to a local module of the corresponding system; as well as If the dog feeding signal is still not received when the count of the current timer reaches the highest threshold of the at least two thresholds, a global reset signal corresponding to the highest threshold is generated and sent to all modules of the corresponding system.
3. The watchdog device according to claim 2, characterized in that: Also includes: The interrupt generation module is configured to send an interrupt signal to the processor to prompt the processor to feed the dog in time if the dog feeding signal is not received when the current timer count reaches the highest threshold of the at least two thresholds, The multi-level reset generation module is configured to generate a global reset signal corresponding to the highest threshold after waiting for a first preset time after the interrupt signal is generated, if the dog feeding signal is still not received, and send the global reset signal to all modules of the corresponding system.
4. The watchdog device according to claim 1, characterized in that: The multi-stage reset generation module is further configured to: Determine whether the processor of the system is running a long-time program, and if so, pause the counting of the timer by pausing the timer, The long-time program is a program whose running time is greater than a second preset time.
5. The watchdog device according to claim 1, characterized in that: The multi-stage reset generation module is further configured to: The counting of the timer is accelerated by the acceleration timer according to a preset acceleration multiple.
6. The watchdog device according to claim 1, characterized in that: Also includes: The clock generation module is configured to set the clock frequency and obtain the clock according to the clock frequency through the clock source through the frequency divider, The multi-stage reset generation module is configured to count using the timer based on the clock.
7. The watchdog device according to claim 1, characterized in that: The multi-stage reset generation module is further configured to: If a dog feeding signal is received when the count of the current timer reaches any one of the at least two thresholds, the timer is reset.
8. The watchdog device according to claim 2, characterized in that: The multi-stage reset generation module is configured as follows: generating a first level reset signal, a second level reset signal and / or a third level reset signal corresponding to the non-highest threshold; and sending the first level reset signal to an interrupt service module, sending the second level reset signal to an external power supply module, and / or sending the third level reset signal to an input / output module, The first threshold corresponding to the first-level reset signal is smaller than the second threshold corresponding to the second-level reset signal, and the second threshold corresponding to the second-level reset signal is smaller than the third threshold corresponding to the third-level reset signal.
9. A watchdog control method, characterized in that: include: Setting at least two thresholds, each of which corresponds to a different reset signal, and each of which corresponds to a different module to be reset; as well as If the dog feeding signal is still not received when the count of the current timer reaches any one of the at least two thresholds, a reset signal corresponding to the threshold is generated and sent to the corresponding module to be reset.
10. An electronic device, characterized in that: include: a memory configured to store an executable program; as well as A processor is configured to execute the program to perform the watchdog control method according to claim 9.