A watchdog circuit and control method thereof

By designing a simplified watchdog circuit and using limited pins to turn on and off the watchdog function, the problems of complexity and high resource occupation of the watchdog circuit in the existing technology are solved, and the functions are simplified and the cost is reduced. .

CN118245266BActive Publication Date: 2024-09-10SHENZHEN HUIDU TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410627973.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-09-10
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

The existing watchdog circuit has a complex structure, takes up a lot of circuit resources, has a high cost, and has complex function implementation, making it difficult to simplify.

Method used

A simplified watchdog circuit is designed, using only a limited number of pins of the watchdog chip. It receives a control signal through the third pin to control the opening and closing of the watchdog function, and when the first pin is not When the dog feeding signal is received, a reset signal is sent to reset the main control unit.

Benefits of technology

It realizes the simple and easy use of the watchdog function, greatly reduces the occupation of circuit resources and costs, and at the same time provides effective reset and function control of the main control unit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118245266B
    Figure CN118245266B
Patent Text Reader

Abstract

The present invention discloses a watchdog circuit and a control method thereof, and belongs to the technical field of electronic circuits. The watchdog circuit includes a watchdog chip; the watchdog chip includes a first pin, a second pin and a third pin; the first pin is connected to the dog feeding signal output end of the main control unit, and the first pin is used to receive the dog feeding signal sent by the main control unit; the second pin is connected to the reset end of the main control unit; the watchdog chip is used to control the second pin to send a first reset signal to the reset end of the main control unit when the first pin does not receive the dog feeding signal within a first preset time when the watchdog function is turned on, so as to reset the main control unit; the third pin is connected to a control signal, and the watchdog chip is also used to determine whether to turn off the watchdog function according to the control signal. The watchdog circuit provided by the embodiment of the present invention has a simple structure, simple and easy-to-use control logic, and simple function implementation, which greatly reduces the occupied circuit resources and costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of electronic circuits, and in particular to a watchdog circuit and a control method thereof. Background Art

[0002] In computer control systems, interference from external electromagnetic fields often occurs, causing the program in the computer control system to run away and fall into an infinite loop. In order to monitor the running status of the main control system in the computer in real time, a chip specifically used to monitor the running status of the main control system program was developed, commonly known as a watchdog.

[0003] The watchdog can automatically reset the main control system, restart and work normally when the system or circuit is disturbed, thereby ensuring that the system recovers normal operation from software and hardware errors and preventing the system from working abnormally. However, in the prior art, the watchdog circuit requires many pins, the circuit implementation is cumbersome, the function implementation is complex, the watchdog circuit occupies more circuit resources, and the cost is high. Summary of the invention

[0004] The present invention provides a watchdog circuit and a control method thereof, so as to simplify the structure of the watchdog circuit, make the control logic of the watchdog circuit simple and easy to use, and greatly reduce circuit resources and costs.

[0005] In a first aspect, an embodiment of the present invention provides a watchdog circuit, including a watchdog chip; the watchdog chip includes a first pin, a second pin, and a third pin;

[0006] The first pin is connected to the dog feeding signal output terminal of the main control unit, and the first pin is used to receive the dog feeding signal sent by the main control unit;

[0007] The second pin is connected to the reset end of the main control unit; the watchdog chip is used to control the second pin to send a first reset signal to the reset end of the main control unit when the first pin does not receive the dog feeding signal within a first preset time when the watchdog function is turned on, so as to reset the main control unit; and the watchdog chip is used to control the second pin to stop outputting the first reset signal when the watchdog function is turned off;

[0008] The third pin is connected to a control signal, and the watchdog chip is further used to determine whether to turn off the watchdog function according to the control signal.

[0009] Furthermore, the watchdog circuit further includes: a voltage control unit; a first input end of the voltage control unit is connected to a first power supply signal, a second input end of the voltage control unit is connected to a second power supply signal, and an output end of the voltage control unit is connected to the third pin; the voltage control unit is used to output the first power supply signal or the second power supply signal as the control signal; the voltage of the first power supply signal is different from that of the second power supply signal;

[0010] The watchdog chip is used to enable the watchdog function when the third pin receives the first power signal, and to disable the watchdog function when the third pin receives the second power signal.

[0011] Further, the voltage control unit includes: a jumper cap and a first resistor;

[0012] The first end of the first resistor is connected to the first input end of the voltage control unit, the first end of the jumper cap is connected to the second input end of the voltage control unit, and the second end of the jumper cap is respectively connected to the second end of the first resistor and the output end of the voltage control unit.

[0013] Furthermore, the third pin is also connected to the signal receiving end of the main control unit;

[0014] The watchdog chip is also used to control the third pin to send a square wave signal to the signal receiving end of the main control unit when it detects that the control signal received by the third pin continues to be the second power signal for a third preset time after power-on; wherein, the main control unit is used to determine that the watchdog program in the watchdog chip is normal when receiving the square wave signal, and the watchdog chip can execute the watchdog function.

[0015] Furthermore, the watchdog chip further includes a fourth pin;

[0016] The fourth pin is connected to the control end of the power control unit, and the power control unit is used to supply power to the main control unit; the watchdog chip is also used to, when the watchdog function is turned on, after the second pin sends the first reset signal to the main control unit at least twice, when it is detected that the first pin still does not receive the dog feeding signal within a second preset time, send a restart control signal to the power control unit through the fourth pin, so that the power control unit controls the main control unit to power off and restart according to the restart control signal; wherein, the second preset time is greater than the first preset time.

[0017] Furthermore, the watchdog circuit also includes a third resistor, a first end of the third resistor is connected to the reset end of the main control unit, and a second end of the third resistor is connected to the first power supply signal.

[0018] Furthermore, the watchdog circuit also includes a reset chip;

[0019] The power supply end of the reset chip is connected to the first power supply signal, the ground end of the reset chip is grounded, and the output end of the reset chip is connected to the reset end of the main control unit; the reset chip is used to send a second reset signal to the reset end of the main control unit when the reset chip is powered on, so as to reset the main control unit.

[0020] Further, the watchdog circuit further comprises: a watchdog circuit power supply, the watchdog circuit power supply being used to provide the first power supply signal;

[0021] The watchdog chip further includes a fifth pin and a sixth pin, wherein the fifth pin is connected to the first power supply signal and the sixth pin is grounded.

[0022] In a second aspect, an embodiment of the present invention further provides a watchdog circuit control method, which is applied to the watchdog circuit described in any embodiment of the present invention and is executed by the watchdog chip. The watchdog circuit control method includes:

[0023] Determining whether to turn off the watchdog function of the watchdog circuit according to the control signal;

[0024] When the watchdog function is turned on, when the first pin does not receive a dog feeding signal within a first preset time, the second pin is controlled to send a first reset signal to a reset end of the main control unit to reset the main control unit.

[0025] Furthermore, the watchdog chip further includes a fourth pin; and the watchdog circuit control method further includes:

[0026] When the watchdog function is turned on, after the second pin sends the first reset signal to the main control unit at least twice, when it is detected that the first pin still does not receive the dog feeding signal within a second preset time, a restart control signal is sent to the power control unit through the fourth pin, so that the power control unit controls the main control unit to power off and restart according to the restart control signal; wherein the second preset time is greater than the first preset time;

[0027] The step of sending the restart control signal to the power control unit through the fourth pin includes:

[0028] Controlling the output voltage of the fourth pin to be the first voltage and then changing to the second voltage after the voltage lasts for a fourth preset time, so that the power control unit controls the main control unit to power off and shut down;

[0029] After the fifth preset time, the output voltage of the fourth pin is controlled to be the first voltage and lasts for the sixth preset time before jumping to the second voltage, so that the power control unit controls the main control unit to power on; wherein the sixth preset time is less than the fourth preset time.

[0030] The present invention provides a watchdog circuit and a control method thereof, wherein the watchdog circuit comprises a watchdog chip; the watchdog chip comprises a first pin, a second pin and a third pin; based on a control signal received by the third pin, the watchdog chip can control whether the watchdog function of the watchdog circuit is enabled, and when necessary, for example, when the main control unit is performing firmware burning, turning off the watchdog function can effectively prevent the main control unit from being restarted by mistake, and ensure that the working state such as firmware burning can proceed normally and smoothly. When the watchdog function is turned on, when the first pin does not receive a dog feeding signal within a first preset time, the second pin is controlled to send a first reset signal to the reset end of the main control unit, so that the main control unit is reset, and the reset function of the watchdog circuit can be easily realized. Therefore, the watchdog circuit provided in the embodiment of the present invention only needs to occupy a limited number of pins of the watchdog chip to normally realize the watchdog function and control the opening or closing of the watchdog function. Compared with the prior art, the watchdog circuit provided in the embodiment of the present invention has a simple structure, simple and easy-to-use control logic, and simple function implementation, which greatly reduces the occupied circuit resources and costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A schematic diagram of a watchdog circuit provided in an embodiment of the present invention.

[0032] Figure 2 A schematic structural diagram of a watchdog chip provided in an embodiment of the present invention.

[0033] Figure 3 It is a structural schematic diagram of another watchdog circuit provided by an embodiment of the present invention.

[0034] Figure 4 It is a schematic diagram of another watchdog circuit provided by an embodiment of the present invention.

[0035] Figure 5 A circuit diagram of a watchdog circuit power supply provided by an embodiment of the present invention.

[0036] Figure 6 A flow chart of a watchdog circuit control method provided by an embodiment of the present invention.

[0037] Figure 7 A flowchart of sending a restart control signal to a power control unit provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0039] An embodiment of the present invention provides a watchdog circuit. Figure 1 A schematic diagram of a watchdog circuit provided by an embodiment of the present invention, Figure 2 A schematic diagram of the structure of a watchdog chip provided by an embodiment of the present invention is shown in FIG. Figure 1 and Figure 2 As shown, the watchdog circuit includes a watchdog chip 110; the watchdog chip 110 includes a first pin IOB1, a second pin IOB2 and a third pin IOB3. The first pin IOB1 is connected to the dog feeding signal output terminal WDI of the main control unit 210, and the first pin IOB1 is used to receive the dog feeding signal W1 sent by the main control unit 210; the second pin IOB2 is connected to the reset terminal RESET of the main control unit 210; the watchdog chip 110 is used to control the second pin IOB2 to send a first reset signal S1 to the reset terminal RESET of the main control unit 210 when the first pin IOB1 does not receive the dog feeding signal W1 within a first preset time when the watchdog function is turned on, so as to reset the main control unit 210; and the watchdog chip 110 is used to control the second pin IOB2 to stop outputting the first reset signal S1 when the watchdog function is turned off; the third pin IOB3 is connected to the control signal C1, and the watchdog chip 110 is also used to determine whether to turn off the watchdog function according to the control signal C1.

[0040] Among them, the watchdog chip 110 can be a single-chip microcomputer with a watchdog program burned in it, such as a microcontroller (MicroController Unit, MCU); the first pin IOB1, the second pin IOB2 and the third pin IOB3 are all pins on the single-chip microcomputer. The main control unit 210 can be a main control system of a computer control system, for example, including a microprocessor (Advanced RISCMachine, ARM). Exemplarily, the main control unit 210 is a sending card system for the light-emitting diode industry. The control signal C1 can be a high-level signal or a low-level signal, which can be sent by the relevant control hardware in the watchdog circuit. The dog feeding signal W1 can be a 1Hz square wave. The first preset time can be set according to the time interval between the main control unit 210 sending the dog feeding signal W1. Optionally, the first preset time is greater than the time interval between two adjacent times when the main control unit 210 sends the dog feeding signal W1. Exemplarily, the first preset time is 90s, which is not limited in this application.

[0041] Specifically, refer to Figure 1 and Figure 2, the watchdog chip 110 can receive the dog-feeding signal W1 sent by the main control unit 210 and send the first reset signal S1 to the main control unit 210. When the watchdog function is enabled, the first pin IOB1 of the watchdog chip 110 receives the dog-feeding signal W1 sent by the main control unit 210. When the watchdog chip 110 does not receive the dog-feeding signal W1 within the first preset time, the second pin IOB2 is controlled to send the first reset signal S1 to the reset terminal RESET of the main control unit 210, so as to reset the main control unit 210 and prevent the program of the main control unit 210 from running away. It can be understood that each time the watchdog chip 110 receives the dog-feeding signal W1, the previous timing is cleared and the timing is restarted. The watchdog chip 110 starts timing when it receives a dog-feeding signal W1. If it does not receive the next dog-feeding signal W1 after a first preset time, it can be determined that there is a problem with the internal program of the main control unit 210 and the dog-feeding signal W1 cannot be sent regularly at the specified time interval. In this case, the main control unit 210 is controlled to reset, which can effectively prevent the program of the main control unit 210 from running away.

[0042] The watchdog chip 110 can also receive a control signal C1 from the third pin IOB3, and determine whether to turn off the watchdog function according to the control signal C1. Specifically, when the control signal C1 received by the third pin IOB3 of the watchdog chip 110 is at the second level, the watchdog chip 110 turns off the watchdog function and controls the second pin IOB2 to stop sending the first reset signal S1. For example, the second level is a low level. When the third pin IOB3 is at a low level, the watchdog chip 110 turns off the watchdog function, and even if the first pin IOB1 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 does not send the first reset signal S1. For example, when the main control unit 210 is debugging, firmware burning or other working states that may not be able to send the dog feeding signal W1 in time but need to maintain a long time, the watchdog function of the watchdog chip 110 can be turned off to prevent the main control unit 210 from being reset by the watchdog chip 110 in the above working state. The watchdog chip 110 only needs the first pin IOB1, the second pin IOB2 and the third pin IOB3 to realize the watchdog function and control the opening or closing of the watchdog function. The control logic is simple, which greatly reduces the occupied microcontroller resources.

[0043] The technical solution of the embodiment of the present invention provides a watchdog circuit, the watchdog circuit includes a watchdog chip 110; the watchdog chip includes a first pin IOB1, a second pin IOB2 and a third pin IOB3; based on the control signal C1 received by the third pin IOB3, the watchdog chip 110 can control whether the watchdog function of the watchdog circuit is enabled. When necessary, for example, when the main control unit 210 performs firmware burning, turning off the watchdog function can effectively prevent the main control unit 210 from being restarted by mistake, and ensure that the working state such as firmware burning can proceed normally and smoothly. When the watchdog function is turned on, when the first pin IOB1 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 is controlled to send a first reset signal S1 to the reset terminal RESET of the main control unit 210, so that the main control unit 210 is reset, and the reset function of the watchdog circuit can be simply realized. Therefore, the watchdog circuit provided by the embodiment of the present invention only needs to occupy a limited number of pins of the watchdog chip 110 to normally realize the watchdog function and control the opening or closing of the watchdog function. Compared with the prior art, the watchdog circuit provided by the embodiment of the present invention has a simple structure, simple and easy-to-use control logic, simple function implementation, and greatly reduces the occupied circuit resources and costs.

[0044] The embodiment of the present invention further provides another watchdog circuit, which is improved on the basis of the above embodiment. Figure 3 FIG. 1 is a schematic diagram of the structure of another watchdog circuit provided by an embodiment of the present invention. Figure 3 As shown, the watchdog circuit also includes: a voltage control unit 120; a first input terminal of the voltage control unit 120 is connected to a first power signal, a second input terminal of the voltage control unit 120 is connected to a second power signal, and an output terminal of the voltage control unit 120 is connected to a third pin IOB3; the voltage control unit 120 is used to output the first power signal or the second power signal as a control signal C1; the voltage of the first power signal is different from that of the second power signal; wherein the watchdog chip 110 is used to turn on the watchdog function when the third pin IOB3 receives the first power signal, and turn off the watchdog function when the third pin IOB3 receives the second power signal.

[0045] The voltage of the first power signal is different from that of the second power signal. The first power signal may be a high level signal, such as Figure 3 As shown, the first power signal can be a 3.3V power supply; the second power signal is a low-level signal, and the first power signal can be provided by the power supply of the watchdog chip 110, and the second power signal is obtained by grounding the second input terminal of the voltage control unit 120. Alternatively, the first power signal can also be a low-level signal, and the second power signal can be a high-level signal.

[0046] Specifically, when the first input terminal and the output terminal of the voltage control unit 120 are connected, the third pin 10B3 receives the first power signal, and the watchdog chip 110 turns on the watchdog function. When the second input terminal and the output terminal of the voltage control unit 120 are connected, the third pin 10B3 receives the second power signal, and the watchdog chip 110 turns off the watchdog function. The voltage control unit 120 controls the watchdog chip 110 to turn on or off the watchdog function by controlling the third pin 10B3 to be high or low, thereby realizing active control of the watchdog function of the watchdog chip 110 through one pin of the watchdog chip 110, and the control logic is simple.

[0047] Further, such as Figure 3 As shown, the voltage control unit 120 includes: a jumper cap 1201 and a first resistor R1; the first end of the first resistor R1 is connected to the first input end of the voltage control unit 120, the first end of the jumper cap 1201 is connected to the second input end of the voltage control unit 120, and the second end of the jumper cap 1201 is respectively connected to the second end of the first resistor R1 and the output end of the voltage control unit 120.

[0048] The first end of the jumper cap 1201 is connected to the second input end of the voltage control unit 120, and the second input end of the voltage control unit 120 is connected to the second power supply signal, that is, the first end of the jumper cap 1201 is connected to the second power supply signal. Figure 3 As shown, the first end of the jumper cap 1201 is grounded, and the second power supply signal is a low-level signal. The second end of the jumper cap 1201 is connected to the third pin IOB3. It should be noted that the jumper cap 1201 is a connector. When the jumper cap 1201 is short-circuited, the jumper cap 1201 can be used as a wire to connect the first end and the second end of the jumper cap 1201, so that the third pin IOB3 receives the second power supply signal. The first end of the first resistor R1 is connected to the first power supply signal through the first input end of the voltage control unit 120. Optionally, the first power supply signal is a high-level signal; then, the first resistor is equivalent to a pull-up resistor. When the jumper cap is not short-circuited, the third pin IOB3 can be pulled to a high level through the first resistor.

[0049] Specifically, when the first end and the second end of the jumper cap 1201 are in a disconnected state, the third pin 10B3 receives the first power signal, the watchdog function is in an on state, and the watchdog chip 110 works normally. When the jumper cap 1201 is short-circuited, the third pin 10B3 can receive the second power signal, turning off the watchdog function of the watchdog chip 110. By controlling the jumper cap 1201 to be short-circuited, the watchdog function of the watchdog chip 110 can be actively controlled to be turned off, the control logic is simple, and the circuit hardware cost is low.

[0050] Figure 4is a schematic diagram of another watchdog circuit provided by an embodiment of the present invention. Figure 3 and Figure 4 , the third pin IOB3 is also connected to the signal receiving end WD_CTL of the main control unit 210; the watchdog chip 110 is also used to control the third pin IOB3 to send a square wave signal WD1 to the signal receiving end WD_CTL of the main control unit 210 when it detects that the control signal C1 received by the third pin IOB3 is the second power signal for a third preset time after power-on; wherein the main control unit 210 is used to determine that the watchdog program in the watchdog chip 110 is normal when receiving the square wave signal WD1, and the watchdog chip 110 can perform the watchdog function.

[0051] Specifically, in addition to turning on the watchdog function when the third pin IOB3 receives the first power signal, and turning off the watchdog function when the third pin IOB3 receives the second power signal, the watchdog chip 110 can also send a signal to the signal receiving terminal WD_CTL to allow the main control unit 210 to determine whether the watchdog program in the watchdog chip 110 is normal. The judgment principle is as follows: The following functions can be configured in the watchdog program: after the watchdog chip 110 is powered on, if it is detected that the control signal C1 received by the third pin IOB3 continues to be the second power signal for a third preset time, the square wave signal WD1 is sent to the main control unit 210 through the third pin IOB3. In the case that the watchdog chip 110 is normally burned with the watchdog program, if the control signal C1 received by the third pin IOB3 after the watchdog chip 110 is powered on meets the above regulations, the watchdog chip 110 sends the square wave signal WD1 to the signal receiving terminal WD_CTL of the main control unit 210 through the third pin IOB3. When the main control unit 210 receives the square wave signal WD1, it determines that the watchdog program in the watchdog chip 110 is normal, that is, the watchdog program has been burned into the watchdog chip 110, and the watchdog chip 110 can perform the watchdog function; if the main control unit 210 does not receive the square wave signal WD1, it determines that the watchdog program in the watchdog chip 110 is abnormal or the watchdog program has not been burned into the watchdog chip 110.

[0052] In addition, the jumper cap 1201 is short-circuited before the watchdog chip 110 is powered on, so that the control signal C1 received by the third pin IOB3 can be the second power signal for a third preset time, that is, the third pin IOB3 can be low level for a third preset time. The third pin IOB3 of the watchdog chip 110 sends a signal to the signal receiving terminal WD_CTL of the main control unit 210 to realize the incoming material burning program function detection function of the watchdog circuit. Optionally, the square wave signal WD1 is a 1Hz square wave, and the third preset time can be set according to the usage scenario. For example, in order to determine whether the watchdog program is burned in the watchdog chip 110 as soon as possible, the third preset time can be set to 10s, which is not limited in this application. For example, the watchdog chip 110 only needs to determine once whether the square wave signal WD1 is output through the third pin IOB3 when it is powered on. After powering on, if the third pin IOB3 is continuously pulled low during the operation of the system, it is only necessary to adaptively turn off the watchdog function without outputting the 1Hz square wave.

[0053] Based on the above embodiments, optionally, Figure 3 and Figure 4 As shown, the watchdog chip 110 also includes a fourth pin IOB4; the fourth pin IOB4 is connected to the control end PWRON of the power control unit 220, and the power control unit 220 is used to supply power to the main control unit 210; the watchdog chip 110 is also used to, when the watchdog function is turned on, after sending the first reset signal S1 to the main control unit 210 at least twice on the second pin IOB2, when it is detected that the first pin IOB1 still has not received the dog feeding signal W1 within the second preset time, send a restart control signal PW1 to the power control unit 220 through the fourth pin IOB4, so that the power control unit 220 controls the main control unit 210 to power off and restart according to the restart control signal PW1; wherein the second preset time is greater than the first preset time.

[0054] The power control unit 220 can supply power to the main control unit 210. When the power control unit 220 is turned off or the power supply path to the main control unit 210 is cut off, the power supply to the main control unit 210 is stopped, so that the main control unit 210 is powered off and turned off; when the power control unit 220 is turned on or the power supply path to the main control unit 210 is connected, the power supply to the main control unit 210 is powered on, so that the main control unit 210 is powered on. The first preset time is the interval time for the main control unit 210 to send the dog feeding signal W1. The second preset time is set to be greater than the first preset time to ensure that after the second pin IOB2 sends the first reset signal S1 to the main control unit 210 at least twice, there is enough interval time to receive the dog feeding signal W1.

[0055] Specifically, when the watchdog function is turned on, after the second pin IOB2 sends the first reset signal S1 to the main control unit 210 at least twice, when it detects that the first pin IOB1 has not received the dog feeding signal W1 within the second preset time, it indicates that the main control unit 210 has not been successfully reset after receiving the first reset signal S1 at least twice, which further indicates that the main control unit 210 has a program runaway or crashed, resulting in the main control unit 210 still not sending the dog feeding signal W1 to the first pin IOB1 after the second preset time. At this time, the main control unit 210 can be forcibly powered off and restarted to reset the main control unit 210. Exemplarily, when the watchdog chip 110 detects that the first pin IOB1 has not received the dog feeding signal W1 within the second preset time, the process of sending the restart control signal PW1 includes: sending a low-level signal to the power control unit 220 through the fourth pin IOB4, pulling down the level of the control terminal PWRON of the power control unit 220 for the fourth preset time, so that the power control unit 220 is turned off and the power supply to the main control unit 210 is stopped; after the fifth preset time, the level of the control terminal PWRON of the power control unit 220 is pulled down again for the sixth preset time, so that the power control unit 220 is turned on, the control terminal PWRON of the power control unit 220 is restored to a high level, and the power control unit 220 supplies power to the main control unit 210, thereby realizing the process of powering off and restarting the main control unit 210, and realizing the forced reset of the main control unit 210. The power control unit 220 is, for example, a power management unit (Power Management Unit, PMU).

[0056] It should be noted that the fourth preset time, the fifth preset time and the sixth preset time are set according to the power on and off program of the power control unit 220. For example, when the power control unit 220 is turned off, it needs to be pressed for 8 seconds, and when it is turned on, it needs to be pressed for 600ms, and the interval between shutting down and starting up must be greater than 500ms. The fourth preset time is set to 8 seconds, the fifth preset time is set to 500ms, and the sixth preset time is set to 600ms, so as to meet the shutdown program of the power control unit 220 and restart the power control unit 220.

[0057] On the basis of the above embodiments, optionally, Figure 3As shown, the watchdog circuit also includes: a third resistor R3, the first end of the third resistor R3 is connected to the reset end of the main control unit 210, and the second end of the third resistor R3 is connected to the first power supply signal. Exemplarily, the first reset signal S1 can be a low-level signal. When the first pin IOB1 of the watchdog chip 110 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 is controlled to send the first reset signal S1 to the reset end RESET of the main control unit 210, and the level of the reset end RESET of the main control unit 210 of the preset reset time is pulled down to reset the main control unit 210. The third resistor R3 is equivalent to a pull-up resistor of the reset end RESET. When the second pin IOB2 does not output the first reset signal S1, the potential of the reset end RESET can be pulled up by the third resistor R3. The preset reset time can be set according to the reset mechanism of the main control unit 210, for example, 500ms.

[0058] Continue to see Figure 3 Optionally, when debugging the watchdog chip 110, a second resistor R2 may be set. Specifically, the second pin 10B2 is connected to the first end of the second resistor R2, the second end of the second resistor R2 is respectively connected to the reset end RESET of the main control unit 210 and the first end of the third resistor R3, and the second end of the third resistor R3 is connected to the first power signal. The second resistor R2 may be a 0 ohm resistor, a jumper or a dip switch.

[0059] Optional, such as Figure 3 and Figure 4 As shown, the watchdog circuit also includes a reset chip 130; the power supply terminal VCC of the reset chip 130 is connected to the first power supply signal, the ground terminal GND2 of the reset chip 130 is grounded, and the output terminal of the reset chip 130 is connected to the reset terminal RESET of the main control unit 210; the reset chip 130 is used to send a second reset signal S2 to the reset terminal RESET of the main control unit 210 when the reset chip 130 is powered on, so as to reset the main control unit 210.

[0060] Among them, the power supply terminal VCC of the reset chip 130 and the fifth pin VDD of the watchdog chip 110 are connected to the same first power supply signal, and the reset chip 130 and the watchdog chip 110 have the same power supply. The power supply of the reset chip 130 and the power control unit 220 are powered by the same main power supply. When the main control unit 210 is powered on, the reset chip 130 is also powered on. Therefore, the reset chip 130 is equivalent to performing a reset operation on the main control unit 210 when it is powered on. The second reset signal S2 can be of the same type as the first reset signal S1. Optionally, the second reset signal S2 and the first reset signal S1 are both low-level signals, and the duration of the low-level signal is a preset reset time. The preset reset time can be set according to the reset mechanism of the main control unit 210.

[0061] Specifically, the reset chip 130 sends the second reset signal S2 to the reset terminal RESET of the main control unit 210 only when the reset chip 130 is powered on, so that the main control unit 210 is reset as soon as it is powered on, so that the main control unit 210 is restored to initialization as soon as it is powered on, and it is ensured that the main control unit 210 can normally send the dog feeding signal W1 to the watchdog chip 110 during the power-on period. After the reset chip 130 sends the second reset signal S2 to the reset terminal RESET of the main control unit 210 once after power-on, the reset chip 130 will no longer send the second reset signal S2 to the reset terminal RESET of the main control unit 210, and the main control unit 210 is reset through the watchdog chip 110 during the power-on period of the main control unit 210.

[0062] On the basis of the above embodiments, optionally, Figure 3 and Figure 4 As shown, the watchdog circuit also includes: a watchdog circuit power supply 140, which is used to provide a first power signal; the watchdog chip 110 also includes a fifth pin VDD and a sixth pin GND1, the fifth pin VDD is connected to the first power signal, and the sixth pin GND1 is grounded.

[0063] Among them, Figure 3 and Figure 4 As shown, the watchdog circuit power supply 140 can provide a first power supply signal for the corresponding pins of the watchdog chip 110, the voltage control unit 120 and the reset chip 130, so that the corresponding pins of the watchdog chip 110, the voltage control unit 120 and the reset chip 130 maintain a high level, and the watchdog circuit power supply 140 can be used as a power supply to power the watchdog chip 110 and the reset chip 130. The watchdog circuit power supply 140 and the power control unit 220 are powered by the same main power supply of the system, and when the watchdog chip 110, the voltage control unit 120 and the reset chip 130 are powered on, the main control unit 210 is also powered on.

[0064] Specifically, Figure 5 A circuit diagram of a watchdog circuit power supply provided by an embodiment of the present invention, such as Figure 5As shown, the input terminal VIN of the voltage conversion chip U1 of the watchdog circuit power supply 140 can be connected to a 5.5V voltage, the ground terminal of the voltage conversion chip U1 is grounded, and a capacitor C1 is set between the input terminal VIN and the ground terminal of the voltage conversion chip U1, and capacitors C2 and C3 are set between the output terminal VOUT and the ground terminal of the voltage conversion chip U1. The capacitors C1, C2 and C3 are used for filtering and voltage stabilization. The voltage conversion chip U1 converts the 5.5V voltage into a 3.3V voltage and outputs it from the output terminal VOUT of the voltage conversion chip U1 as the first power signal, so as to power the watchdog chip 110 and the reset chip 130, and provide the first power signal for the corresponding pins of the watchdog chip 110, the voltage control unit 120 and the reset chip 130. Optionally, the capacitance value of capacitor C1 is 10uF, the capacitance value of capacitor C2 is 10uF, and the capacitance value of capacitor C3 is 0.1uF. The voltage conversion chip U1 can be a low dropout regulator (LDO).

[0065] It should be noted that the watchdog chip 110 in the embodiment of the present invention has only 6 pins, and a 6-pin single-chip microcomputer can be used to implement the watchdog function in the embodiment of the present invention, which greatly reduces circuit resources and costs. The software control logic is simple and easy to use, and there is a reset master control mechanism. An additional reset chip 130 is added to ensure that the master control reset time is sufficient, and it has a function of detecting the function of burning the program for incoming materials.

[0066] The technical solution of the embodiment of the present invention provides a simple watchdog circuit. When the first pin IOB1 of the watchdog chip 110 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 is controlled to send the first reset signal S1 to the reset terminal RESET of the main control unit 210, so that the main control unit 210 is reset, thereby realizing the reset function of the watchdog circuit; when the watchdog function is turned off, the watchdog chip 110 controls the second pin IOB2 to stop outputting the first reset signal S1; the third pin IOB3 is connected to the control signal C1, and the watchdog chip 110 determines whether to turn off the watchdog function according to the control signal C1, so that the watchdog circuit controls the turning on and off of the watchdog function according to the control signal C1, and realizes the incoming material burning program function detection function of the watchdog circuit through the third pin IOB3; the main control unit 210 is controlled to be powered off and restarted through the fourth pin of the watchdog chip 110, so as to realize the forced reset of the main control unit 210. The watchdog circuit of the present invention can use a 6-pin single-chip microcomputer to implement the watchdog function in the embodiment of the present invention. The control logic is simple and easy to use, the function is simple to implement, and the occupied single-chip microcomputer resources are greatly reduced, thereby reducing circuit resources and costs.

[0067] The embodiment of the present invention further provides a watchdog circuit control method, which is applied to the watchdog circuit in any embodiment of the present invention and is executed by the watchdog chip in any embodiment of the present invention. Figure 6 A flowchart of a watchdog circuit control method provided by an embodiment of the present invention, referring to Figure 6 , the watchdog circuit control method includes:

[0068] S110, judging whether to turn off the watchdog function of the watchdog circuit according to the control signal.

[0069] Specifically, refer to Figure 2 , the third pin IOB3 of the watchdog chip 110 can receive the control signal C1, and the watchdog chip 110 determines whether to turn off the watchdog function according to the control signal C1. When the watchdog chip 110 receives the second level of the control signal C1, the watchdog chip 110 turns off the watchdog function and controls the second pin IOB2 to stop sending the first reset signal S1. Exemplarily, the second level is a low level. When the third pin IOB3 is a low level, the watchdog chip 110 turns off the watchdog function. Even if the first pin IOB1 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 does not send the first reset signal S1, thereby controlling the watchdog function of the watchdog chip 110, so that when the main control unit 210 is debugged or in other working states, the watchdog function of the watchdog chip 110 can be turned off to prevent the main control unit 210 from being reset by the watchdog chip 110 when debugging.

[0070] S120: When the watchdog function is enabled, when the first pin does not receive a dog feeding signal within a first preset time, the second pin is controlled to send a first reset signal to a reset terminal of the main control unit to reset the main control unit.

[0071] Specifically, refer to Figure 2 When the watchdog function of the watchdog chip 110 is turned on, the watchdog chip 110 can receive the dog feeding signal W1 sent by the main control unit 210 and send a first reset signal S1 to the main control unit 210. The first pin IOB1 of the watchdog chip 110 receives the dog feeding signal W1 sent by the main control unit 210. When the watchdog chip 110 does not receive the dog feeding signal W1 within the first preset time, the second pin IOB2 is controlled to send the first reset signal S1 to the reset terminal RESET of the main control unit 210, so as to reset the main control unit 210 and prevent the program of the main control unit 210 from running away.

[0072] The technical solution of the embodiment of the present invention provides a watchdog circuit control method, including judging whether to turn off the watchdog function of the watchdog circuit according to a control signal, so that the watchdog circuit controls the turning off and on of the watchdog function according to the control signal; when the watchdog function is turned on, when the first pin does not receive a dog feeding signal within a first preset time, the second pin is controlled to send a first reset signal to the reset end of the main control unit to reset the main control unit, thereby realizing the reset function of the watchdog circuit. The watchdog circuit control method of the present invention is simple and easy to use, has simple function implementation, and greatly reduces occupied resources.

[0073] Optionally, in another embodiment of the present invention, reference Figure 3 , the watchdog chip 110 also includes a fourth pin IOB4; the watchdog circuit control method also includes: when the watchdog function is turned on, after the second pin IOB2 sends the first reset signal S1 to the main control unit 210 at least twice, when it is detected that the first pin IOB1 still does not receive the dog feeding signal W1 within the second preset time, a restart control signal PW1 is sent to the power control unit 220 through the fourth pin IOB4, so that the power control unit 220 controls the main control unit 210 to power off and restart according to the restart control signal PW1; wherein the second preset time is greater than the first preset time.

[0074] Specifically, when the watchdog function is turned on, after the second pin IOB2 sends the first reset signal S1 to the main control unit 210 at least twice, when it detects that the first pin IOB1 has not received the dog feeding signal within the second preset time, it indicates that the main control unit 210 has not been successfully reset after receiving the first reset signal S1 at least twice, and the main control unit 210 has a program runaway or crashed, resulting in the main control unit 210 still not sending the dog feeding signal to the first pin IOB1 within the second preset time. At this time, the main control unit 210 can be forcibly powered off and restarted to reset the main control unit 210.

[0075] Optional, Figure 7 The flowchart of sending the restart control signal to the power control unit provided by the embodiment of the present invention is as follows: Figure 3 and Figure 7 , sending a restart control signal to the power control unit 220 through the fourth pin IOB4, including:

[0076] S210, controlling the output voltage of the fourth pin IOB4 to be the first voltage and then changing to the second voltage after lasting for a fourth preset time, so that the power control unit 220 controls the main control unit 210 to power off and shut down.

[0077] The first voltage is a low level, and the second voltage is a high level.

[0078] S220, after the fifth preset time, control the output voltage of the fourth pin IOB4 to be the first voltage and then change to the second voltage after the sixth preset time, so that the power control unit 220 controls the main control unit 210 to power on; wherein the sixth preset time is less than the fourth preset time.

[0079] Specifically, when the watchdog chip 110 detects that the first pin IOB1 has not received the dog feeding signal W1 within the second preset time, it controls the fourth pin IOB4 to send a low level to the power control unit 220, pulls down the level of the control terminal PWRON of the power control unit 220 for four preset times, and makes the power control unit 220 control the main control unit 210 to power off and shut down, which is equivalent to the effect of long pressing to shut down; after the fifth preset time, the level of the control terminal PWRON of the power control unit 220 is pulled down for the sixth preset time, so that the power control unit 220 is turned on, and the control terminal PWRON of the power control unit 220 returns to a high level, so that the power control unit 220 controls the main control unit 210 to power on and start up, which is equivalent to the effect of short pressing to start up. Based on this, the process of powering off and restarting the main control unit 210 can be realized, and the forced reset of the main control unit 210 can be realized.

[0080] It should be noted that the fourth preset time, the fifth preset time and the sixth preset time are set according to the power on / off program of the power control unit 220. To meet the power on / off process of the power control unit 220, the sixth preset time can be set to be less than the fourth preset time. Exemplarily, when the power control unit 220 is turned off, it needs to be pressed for 8 seconds to turn off, and when it is turned on, it needs to be pressed for 600ms, and the interval between turning off and turning on is greater than 500ms. Then, the fourth preset time is set to 8 seconds, the fifth preset time is set to 500ms, and the sixth preset time is set to 600ms, so as to meet the shutdown program of the power control unit 220 and restart the power control unit 220.

[0081] The watchdog circuit control method provided by the technical solution of the embodiment of the present invention can realize the reset control function of the watchdog circuit, can actively control the watchdog function of shutting down the watchdog circuit, has the function of detecting whether the incoming material burning program of the watchdog circuit is good, and has the function of forcibly resetting the main control unit. The control method is simple and easy to use, the function is simple to implement, and the circuit resources and costs can be greatly reduced.

[0082] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A watchdog circuit, characterized in that: It includes a watchdog chip and a voltage control unit; the watchdog chip includes a first pin, a second pin and a third pin; The first pin is connected to the dog feeding signal output terminal of the main control unit, and the first pin is used to receive the dog feeding signal sent by the main control unit; The second pin is connected to the reset end of the main control unit; the watchdog chip is used to control the second pin to send a first reset signal to the reset end of the main control unit when the first pin does not receive the dog feeding signal within a first preset time when the watchdog function is turned on, so as to reset the main control unit; and the watchdog chip is used to control the second pin to stop outputting the first reset signal when the watchdog function is turned off; The third pin is connected to a control signal, and the watchdog chip is also used to determine whether to turn off the watchdog function according to the control signal; the first input end of the voltage control unit is connected to a first power signal, the second input end of the voltage control unit is connected to a second power signal, and the output end of the voltage control unit is connected to the third pin; the voltage control unit is used to output the first power signal or the second power signal as the control signal; the voltage of the first power signal is different from that of the second power signal; the voltage control unit is also used to output the second power signal to the third pin before the watchdog chip is powered on; Wherein, the watchdog chip is used to enable the watchdog function when the third pin receives the first power signal, and disable the watchdog function when the third pin receives the second power signal; The third pin is also connected to the signal receiving end of the main control unit; The watchdog chip is also used to control the third pin to send a square wave signal to the signal receiving end of the main control unit when it is detected that the control signal received by the third pin continues to be the second power signal for a third preset time after power-on; wherein the watchdog chip only determines once whether the square wave signal is output through the third pin when power is turned on; the main control unit is used to determine that the watchdog program in the watchdog chip is normal when receiving the square wave signal, that is, the watchdog program has been burned into the watchdog chip, and the watchdog chip can perform the watchdog function; the main control unit is also used to determine that the watchdog program in the watchdog chip is abnormal or the watchdog program has not been burned into the watchdog chip if the square wave signal is not received; The voltage control unit comprises: a jumper cap and a first resistor; The first end of the first resistor is connected to the first input end of the voltage control unit, the first end of the jump cap is connected to the second input end of the voltage control unit, and the second end of the jump cap is connected to the second end of the first resistor and the output end of the voltage control unit respectively; When the jumper cap is short-circuited, the first end and the second end of the jumper cap are connected, so that the third pin receives the second power signal and the watchdog function of the watchdog chip is turned off; when the first end and the second end of the jumper cap are disconnected, the third pin receives the first power signal, and the watchdog function of the watchdog chip is turned on; The watchdog chip also includes a fourth pin; The fourth pin is connected to the control end of the power control unit, and the power control unit is used to supply power to the main control unit; the watchdog chip is also used to send a restart control signal to the power control unit through the fourth pin when the watchdog function is turned on, after the second pin sends the first reset signal to the main control unit at least twice, and when it is detected that the first pin still does not receive the dog feeding signal within a second preset time, so that the power control unit controls the main control unit to power off and restart according to the restart control signal; wherein the second preset time is greater than the first preset time; The sending of the restart control signal to the power control unit via the fourth pin includes: controlling the output voltage of the fourth pin to be a first voltage and then changing to a second voltage after a fourth preset time, so that the power control unit controls the main control unit to power off and shut down; after a fifth preset time, controlling the output voltage of the fourth pin to be the first voltage and then changing to the second voltage after a sixth preset time, so that the power control unit controls the main control unit to power on and start up; wherein the sixth preset time is less than the fourth preset time.

2. The watchdog circuit according to claim 1, characterized in that: It also includes a third resistor, a first end of the third resistor is connected to the reset end of the main control unit, and a second end of the third resistor is connected to the first power supply signal.

3. The watchdog circuit according to claim 1, characterized in that: Also includes a reset chip; The power supply end of the reset chip is connected to the first power supply signal, the ground end of the reset chip is grounded, and the output end of the reset chip is connected to the reset end of the main control unit; the reset chip is used to send a second reset signal to the reset end of the main control unit when the reset chip is powered on, so as to reset the main control unit.

4. The watchdog circuit according to claim 2 or 3, characterized in that: Also includes: A watchdog circuit power supply, wherein the watchdog circuit power supply is used to provide the first power supply signal; The watchdog chip further includes a fifth pin and a sixth pin, wherein the fifth pin is connected to the first power supply signal and the sixth pin is grounded.

5. A watchdog circuit control method, characterized in that: The watchdog circuit applied to any one of claims 1 to 4 is executed by the watchdog chip, and the watchdog circuit control method comprises: Determining whether to turn off the watchdog function of the watchdog circuit according to the control signal; When the watchdog function is turned on, when the first pin does not receive a dog feeding signal within a first preset time, the second pin is controlled to send a first reset signal to a reset end of the main control unit to reset the main control unit.