Watchdog circuit and control method of watchdog circuit

By introducing a micro control unit into the watchdog circuit, detecting the auxiliary level value and setting the auxiliary dog ​​feeding signal, the problem of the watchdog circuit in the existing technology being unable to flexibly configure the dog feeding time and erroneous reset is solved, and the system is realized Stability and quick recovery capabilities.

CN119356927APending Publication Date: 2025-01-24ZKTECO CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411689263.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The existing watchdog circuit cannot flexibly configure the feeding time, and when the operation control unit is powered on and initialized, it may lead to an error reset or an error restart, affecting the stability of the system.

Method used

Design a door dog circuit that includes the operation control unit, the door -to -door dog unit, the power unit and the micro -control unit, and set the auxiliary dog ​​-fed signal through the micro -control unit to detect the auxiliary electricity value To prevent mistakes and dual repeats when necessary to ensure system recovery.

Benefits of technology

A flexible configuration of the time to look at the goal dog timeout, prevent mistakes and restart, ensure that the system can quickly restore normal operation under abnormal conditions, and save the resources of the computing control unit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356927A_ABST
    Figure CN119356927A_ABST
Patent Text Reader

Abstract

The invention provides a watchdog circuit and a control method of the watchdog circuit. The watchdog circuit comprises an operation control unit; a watchdog unit; the operation control unit is electrically connected with the power supply unit, and the power supply unit is connected with the watchdog unit in a controlled manner; the micro-control unit is in communication connection and control connection with the operation control unit, and the micro-control unit is in communication connection and control connection with the watchdog unit. The watchdog circuit has a dual reset function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of electronic circuits, and in particular to a watchdog circuit and a control method for the watchdog circuit. Background Art

[0002] In electronic products, for smart devices with software systems, there is usually a need for a watchdog function. The watchdog is usually a timer circuit that is responsible for resetting the system when the program runs away or the hardware stagnates, so that the program can be executed from the beginning. When the system is running normally, the main control unit such as the CPU usually sends a dog feeding signal continuously to prevent the watchdog from acting. Once the system fails, the watchdog monitoring times out and sends a reset signal to allow the system to automatically restart and return to normal.

[0003] For more relevant background technologies, please refer to patent documents CN110750374A (a watchdog circuit and its control method), CN116126575A (control circuit, watchdog circuit control method and device), CN117953619A) and CN219497115U (an access control device) and other related contents. Summary of the invention

[0004] Based on the shortcomings of the existing circuits and control methods, the present invention proposes a new watchdog circuit and a control method for the watchdog circuit The watchdog circuit of the present invention comprises: an operation control unit; a watchdog unit; a power supply unit, wherein the operation control unit is electrically connected to the power supply unit, and the power supply unit is controllably connected to the watchdog unit; a micro control unit, wherein the micro control unit is respectively communicatively connected and controllably connected to the operation control unit, and the micro control unit is communicatively connected and controllably connected to the watchdog unit.

[0005] Furthermore, the watchdog circuit further comprises a burning interface unit, wherein the burning interface unit is connected to the SWLCK pin and the SWDIO pin of the micro control unit, and the burning interface comprises a ground pin.

[0006] Furthermore, the watchdog circuit also includes a first resistance unit for setting an auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit is connected to the first resistance unit; the first resistance unit includes a power supply and a resistor.

[0007] Furthermore, the watchdog circuit also includes a second resistance unit for confirming the communication mode between the micro control unit and the operation control unit; the second analog-to-digital pin of the micro control unit is connected to the second resistance unit; and the second resistance unit includes a power supply and a resistor.

[0008] The control method of the watchdog circuit of the present invention is applied to the watchdog circuit as described above, and the control method includes: in the power-on initialization stage: if the operation control unit sends the original dog feeding signal to the micro control unit, the micro control unit sends the dog feeding signal to the watchdog unit according to the original dog feeding signal to perform the dog feeding operation; if the operation control unit does not send the original dog feeding signal to the micro control unit, the micro control unit detects a first auxiliary level value, and sends an auxiliary dog ​​feeding signal to the watchdog unit according to the first auxiliary level value to perform the dog feeding operation, and after the operation control unit is initialized and sends the original dog feeding signal to the micro control unit, the micro control unit re-sends the dog feeding signal to the watchdog unit according to the original dog feeding signal to perform the dog feeding operation.

[0009] Furthermore, the control method of the watchdog circuit, in the running stage: if the operation control unit sends the original dog feeding signal to the micro control unit within the timeout period, the micro control unit sends the dog feeding signal to the watchdog unit to perform a dog feeding operation; if the operation control unit fails to send the original dog feeding signal to the micro control unit within the timeout period for the first time, the micro control unit sends a first reset signal to the operation control unit to reset the operation control unit for the first time, and the micro control unit still sends the dog feeding signal to the watchdog unit to perform a dog feeding operation; if the first reset fails, after the operation control unit fails to send the original dog feeding signal to the micro control unit within the timeout period for the second time, the micro control unit stops sending the dog feeding signal to the watchdog unit, and the watchdog unit sends a second reset signal to the power supply unit to restart the operation control unit, and the watchdog unit sends a reset signal to reset the micro control unit.

[0010] Furthermore, the watchdog circuit also includes a burning interface unit, which is connected to the SWLCK pin and SWDIO pin of the micro control unit, and the burning interface includes a ground pin; during the burning stage of the operation control unit, the SWLCK pin of the micro control unit is manually connected to a low level through the burning interface unit to turn off the reset function of the micro control unit and the watchdog unit.

[0011] Furthermore, the watchdog circuit also includes a first resistance unit for setting the auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit is connected to the first resistance unit; the auxiliary dog ​​feeding signal corresponding to different timeout times is set according to different first auxiliary level values ​​detected by the first analog-to-digital pin.

[0012] Furthermore, the watchdog circuit also includes a second resistance unit for confirming the communication mode between the microcontroller unit and the operation control unit; the second analog-to-digital pin of the microcontroller unit is connected to the second resistance unit; and different communication modes between the microcontroller unit and the operation control unit are confirmed according to different second auxiliary level values ​​detected by the second analog-to-digital pin.

[0013] Furthermore, in the power-on initialization stage, by detecting whether the SWDIO pin outputs the level of the first cycle, it is determined whether the micro control unit has completed burning; in the operation stage, by detecting the cycle of the output level of the SWDIO pin, the working state of the watchdog unit is determined.

[0014] According to the above content, in the technical solution of the present invention: A watchdog circuit is designed with an operation control unit, a watchdog unit, a power supply unit and a micro control unit, wherein the operation control unit is electrically connected to the power supply unit, and the power supply unit is controlled to be connected to the watchdog unit; the micro control unit is respectively connected to the operation control unit for communication and control, and the micro control unit is connected to the watchdog unit for communication and control. The corresponding circuit can realize both a fast reset function and a double reset function through the connection between the units.

[0015] At the same time, the corresponding control method makes full use of the corresponding circuit structure. In the power-on initialization stage, through the control coordination between the units, the corresponding first auxiliary level value can be detected through the first analog-to-digital pin, the auxiliary timeout time can be set according to the first auxiliary level value, and the auxiliary dog ​​feeding signal can be sent to prevent the operation control unit from being reset or restarted by mistake due to failure to initialize in time; and when the operation control unit completes the initialization, the original dog feeding signal will be sent to the microcontroller unit. The microcontroller unit of the embodiment of the present invention can re-update the corresponding dog feeding signal according to the original dog feeding signal (replace the auxiliary dog ​​feeding signal with the dog feeding signal generated according to the original dog feeding signal), thereby ensuring the normal progress of subsequent dog feeding operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a principle block diagram of a watchdog circuit provided by an embodiment of the present invention; Figure 2 is a circuit diagram of a watchdog unit in a watchdog circuit provided in an embodiment of the present invention; Figure 3 is a circuit diagram of a power supply unit in a watchdog circuit provided by an embodiment of the present invention; Figure 4 It is a circuit diagram of a micro control unit in a watchdog circuit provided by an embodiment of the present invention; Figure 5It is a circuit diagram of a burning interface unit in a watchdog circuit provided by an embodiment of the present invention; Figure 6 It is a circuit diagram of a first resistance unit and a second resistance unit in a watchdog circuit provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0018] At present, many watchdog circuit systems cannot flexibly configure the feeding time of the watchdog; some require the feeding time to be configured after power-on before the watchdog takes effect. This poses the risk that the operation control unit will be abnormal once it is powered on and cannot be reset. In addition, the operation control unit usually uses a CPU, which takes a relatively long time to burn programs. It may be reset by the watchdog during the burning process.

[0019] An embodiment of the present invention provides a watchdog circuit.

[0020] Please refer to Figure 1 , shows a principle block diagram of a watchdog circuit. The watchdog circuit comprises: an operation control unit 10; a watchdog unit 20; a power supply unit 30, the operation control unit 10 is electrically connected to the power supply unit 30, and the power supply unit 30 is controlled to be connected to the watchdog unit 20; a micro control unit 40, the micro control unit 40 is respectively connected to the operation control unit 10 for communication and control, and the micro control unit 40 is connected to the watchdog unit 20 for communication and control.

[0021] The operation control unit 10 may include various CPU chips ( Figure 1 The CPU is also used to represent the display operation control unit 10). The watchdog unit 20 may include: Figure 2 The watchdog chip U2 shown Figure 1 The “hardware watchdog” represents the circuit formed by the watchdog unit 20 and the corresponding structure and connection relationship, and the power supply unit 30 may include the following: Figure 3 The circuit formed by the structure and connection relationship shown in the figure (at the same time Figure 1 The “power supply” in the figure represents the power supply unit 30). The micro control unit 40 may include: Figure 4 The MCU chip U4 shown ( Figure 1 “MCU” is also used to represent the circuit formed by the display micro control unit 40) and the corresponding structures and connection relationships.

[0022] It should be noted that in this specification, the specific circuit of the operation control unit 10 is not shown, but the operation control unit 10 is electrically connected to the power supply unit 30. Figure 3 The node PWR_EN included in the power supply unit 30 is electrically connected to a corresponding power pin of a corresponding CPU chip (not shown) in the operation control unit 10 .

[0023] As mentioned above, the power supply unit 30 is controlled to be connected to the watchdog unit 20, and the micro control unit 40 is also controlled to be connected to the watchdog unit 20. Figure 1 In the figure, the corresponding controlled connection relationship is shown by the corresponding arrow. It should be noted that in the specific circuit, the power supply unit 30 and the micro control unit 40 can be directly connected to the same hardware pin in the specific circuit of the watchdog unit 20, so as to realize the corresponding controlled connection at the same time. Figure 2 As shown, the watchdog unit 20 has a corresponding watchdog chip U2, and the first pin RESET of the watchdog chip U2 outputs a corresponding MRST1 signal, which is also used to connect Figure 3 The source and Figure 4 The fourth pin NRST of the MCU chip U4 in the micro control unit 40 circuit is shown. In other words, the source of the MOS tube Q1 and the fourth pin NRST of the MCU chip U4 are simultaneously connected to the first pin RESET of the watchdog chip U2.

[0024] The micro control unit 40 is respectively connected to the operation control unit 10 for communication and control, and the communication connection part is embodied as follows: Figure 4 The eighteenth pin PA8 (SER1, communicating in a single bus mode), the nineteenth pin PA9 (TXD, communicating in a serial port mode), the twentieth pin PA10 (RXD, communicating in a serial port mode), the twenty-first pin PA11 (SCK, communicating in an I2C mode) and the twenty-second pin PA12 (SDA, communicating in an I2C mode) of the MCU chip U4 in the micro control unit 40 circuit shown are respectively connected to the pins of the corresponding CPU chip not shown in the operation control unit 10 to achieve corresponding communication connections, and the subsequent control method mentions that in the embodiment of the present invention, only one of the three communication modes (communication principles) needs to be controlled to perform specific communication operations, thereby saving resources of the corresponding CPU chip not shown in the operation control unit 10.

[0025] The microcontroller unit 40 can be constructed and implemented using various types of MCU chips. Figure 4The MCU chip U4 shown is just one example, and according to the technical solution of the invention, when the corresponding circuit is adopted, the corresponding MCU chip can be an MCU chip that is added separately for the corresponding watchdog circuit, or the MCU chip in the original circuit can be reused in the watchdog circuit (as long as the pins and functions of the MCU meet the corresponding multiplexing requirements at this time), thereby further increasing the flexibility of the circuit and the overall embeddability of the system.

[0026] The micro control unit 40 controls the connection to the operation control unit 10, that is, the operation control unit 10 is controlled to connect to the micro control unit 40, so that Figure 1 In , controlled connections are also shown with corresponding arrows. Figure 4 In the circuit of the micro control unit 40 shown in FIG. 1 , the seventh pin PA1 of the MCU chip U4 is connected to the Figure 4 The corresponding RET_CPU pin of the CPU chip is not shown in the above to achieve controlled connection, that is, Figure 4 The “RET_CPU” of the MCU chip U4 indicates that the seventh pin PA1 is connected to the reset pin of the corresponding CPU chip.

[0027] In summary, in Figure 4 In the figure, the "MRST1" on the left side of the MCU chip U4 (used to input its fourth pin N RST) indicates: the signal used by the watchdog chip U2 in the watchdog unit 20 to reset the watchdog chip U2 in the micro control unit 40; and Figure 3 The "PWR_EN" signal (node) in the figure indicates: a signal in the power supply unit 30 circuit for controlling the power supply of the operation control unit 10 (corresponding CPU); this also means that the watchdog circuit provided in the embodiment of the present invention is a secondary reset circuit, please continue to refer to the subsequent contents of this specification.

[0028] like Figure 2 and Figure 4 As shown, the aforementioned micro control unit 40 is connected to the watchdog unit 20 for communication. Figure 4 The sixth pin PA0 of the MCU chip U4 is shown as connected to Figure 2 The fourth pin WDI of the watchdog chip U2 is shown, and they communicate with each other through the signal "WDIO1". The micro control unit 40 is communicatively connected to the watchdog unit 20, and the micro control unit 40 can control the watchdog unit 20, especially turn off the watchdog unit 20 (the watchdog function).

[0029] like Figure 5 As shown, in the embodiment of the present invention, the watchdog circuit also includes a programming interface unit (not marked and not shown in FIG. Figure 1 In the principle block diagram, a specific circuit structure such as Figure 5As shown in FIG. 1 ), the programming interface unit is connected to the SWLCK pin (the twenty-fourth pin PA14) and the SWDIO pin ( Figure 4 The 23rd pin PA13 of the MCU chip U4 is shown as follows). Figure 5 As shown, the second pin of the burning interface J1 is connected Figure 4 The 23rd pin (PA13, SWDIO pin) of the MCU chip U4 is connected to the third pin of the burning interface J1 Figure 4 The twenty-fourth pin (PA14, i.e., SWLCK pin) of the MCU chip U4 is connected to the power supply, and the first pin of the burning interface J1 is connected to the ground. Under this circuit structure, the SWLCK pin of the MCU chip U4 can be manually set to a low level directly through the burning interface J1, so that the SWLCK is connected to a low level before power-on. The specific manual method is to use tweezers or other conductors to manually short-circuit the third pin and the fourth pin of the burning interface J1. After short-circuiting, the reset function of the MCU chip U4 is manually turned off, and the watchdog function of the watchdog chip U2 can also be turned off at the same time (the watchdog function is also a reset function). Please refer to the subsequent content of this manual.

[0030] In an embodiment of the present invention, the watchdog circuit also includes a first resistance unit (not marked and not shown in the principle block diagram) for setting an auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit 40 (the ninth pin PA3 of the MCU chip U4) is connected to the first resistance unit; the first resistance unit includes a power supply and a resistor.

[0031] In an embodiment of the present invention, the watchdog circuit also includes a second resistance unit (not marked and not shown in the principle block diagram) for confirming the communication mode between the micro control unit 40 and the operation control unit 10; the second analog-to-digital pin of the micro control unit 40 (the tenth pin PA4 of the MCU chip U4) is connected to the second resistance unit; the second resistance unit includes a power supply and a resistor.

[0032] like Figure 6 As shown, in the embodiment of the present invention, the power supply connection of the first resistance unit and the second resistance unit is the same power supply VD1 to simplify the circuit. At this time, the first resistance unit and the second resistance unit are combined and simplified. The first resistance unit includes the power supply VD1, resistor R6 and resistor R7, and the second resistance unit includes the power supply VD1, resistor R4 and resistor R5.

[0033] It should be noted that, based on the watchdog circuit provided by the present invention, the following control method can be provided. Therefore, the technical effects and advantages brought about by the following control method can also be used as the effects and advantages of the corresponding watchdog circuit.

[0034] The embodiment of the present invention also provides a control method for a watchdog circuit.

[0035] The control method of the watchdog circuit provided in the embodiment of the present invention is applied to the watchdog circuit as described above. Therefore, the watchdog circuit may refer to the above content.

[0036] The control method includes: in the power-on initialization stage: the micro control unit 40 detects whether the operation control unit 10 sends the original dog feeding signal to the micro control unit 40; if the operation control unit 10 sends the original dog feeding signal to the micro control unit 40, the micro control unit 40 sends the dog feeding signal to the watchdog unit 20 according to the original dog feeding signal to perform the dog feeding operation; if the operation control unit 10 does not send the original dog feeding signal to the micro control unit 40, the micro control unit 40 detects the first auxiliary level value, and sends the auxiliary dog ​​feeding signal to the watchdog unit 20 according to the first auxiliary level value to perform the dog feeding operation, and after the operation control unit 10 is initialized and sends the original dog feeding signal to the micro control unit 40, the micro control unit 40 sends the dog feeding signal to the watchdog unit 20 according to the original dog feeding signal to perform the dog feeding operation again.

[0037] The above control method is specific to Figures 2 to 4 The circuit is: If the operation control unit 10 passes Figure 4 In the circuit of the microcontroller unit 40 shown, the MCU chip U4 sends a dog feeding original signal to the microcontroller unit 40 through any one of the eighteenth pin PA8 (the pin of the "SER1" signal, communicating on the principle of single bus correspondence), the nineteenth pin PA9 (the TXD pin, communicating on the principle of serial port correspondence), the twentieth pin PA10 (the RXD pin, communicating on the principle of serial port correspondence), the twenty-first pin PA11 (the SCK pin, communicating on the principle of I2C correspondence) and the twenty-second pin (the SDA pin, communicating on the principle of I2C correspondence), and the microcontroller unit 40 receives the dog feeding original signal. Then, the microcontroller unit 40 sends a dog feeding signal (WDIO1 related signal) from the sixth pin PA0 of the MCU chip U4 to the fourth pin WDI of the watchdog chip U2 of the watchdog unit 20 according to the dog feeding original signal, and performs a dog feeding operation; If the operation control unit 10 does not send the original dog feeding signal to the micro control unit 40, the micro control unit 40 detects the first auxiliary level value, that is, detects Figure 4The first auxiliary level value (AD1 value) of the ninth pin PA3 (that is, the corresponding first analog-to-digital pin) of the MCU chip U4 is measured, and according to the first auxiliary level value, the auxiliary dog ​​feeding signal is sent to the fourth pin WDI of the watchdog chip U2 of the watchdog unit 20 through the sixth pin PA0 of the MCU chip U4 again to perform the dog feeding operation. After the operation control unit 10 is initialized, the original dog feeding signal is sent to the eighteenth pin PA8 (or the nineteenth pin PA9 and the twentieth pin PA10, or the twenty-first pin PA11 and the twenty-second pin PA12) of the MCU chip U4 of the microcontroller unit 40, so that the microcontroller unit 40 sends the dog feeding signal to the fourth pin WDI of the watchdog chip U2 of the watchdog unit 20 through the sixth pin PA0 of the MCU chip U4 according to the original dog feeding signal to perform the dog feeding operation.

[0038] The principle of the above control process is: in the power-on initialization stage of the operation control unit 10, if the operation control unit 10 has been burned normally, when the operation control unit 10 is powered on, the watchdog timeout time will be configured, and a corresponding signal will be sent to the micro control unit 40, and the micro control unit 40 will normally send a dog feeding signal to the watchdog unit 20 to feed the dog; however, when the operation control unit 10 fails to send (fail to configure) the corresponding signal of the timeout time (in a timely manner) due to reasons such as slow initialization (slow startup or slow buffering), the micro control unit 40 of the embodiment of the present invention will send the watchdog timeout time through the first analog-to-digital pin (the ninth pin) The first auxiliary level value (AD1 value) is detected by the pin PA3, and the auxiliary timeout time is set according to the first auxiliary level value (AD1 value), and the auxiliary dog ​​feeding signal is sent to prevent the operation control unit 10 from being reset or restarted by mistake due to failure to initialize in time; and when the operation control unit 10 completes the initialization, the original dog feeding signal is sent to the micro control unit 40. Therefore, the micro control unit 40 of the embodiment of the present invention can re-update the corresponding dog feeding signal according to the original dog feeding signal (replace the auxiliary dog ​​feeding signal with the dog feeding signal generated according to the original dog feeding signal), thereby ensuring the normal progress of the subsequent dog feeding operation.

[0039] It can be seen from the above content that in this embodiment, the timeout period corresponding to the auxiliary dog ​​feeding signal should be roughly the time required for the operation control unit 10 to be initialized. Please refer to the corresponding content of adjusting the timeout period corresponding to the auxiliary dog ​​feeding signal according to the first auxiliary level value (AD1 value) later in this manual.

[0040] In summary, in the watchdog circuit provided by the embodiment of the present invention, the dog feeding signal is controlled by the micro control unit 40, so that the timeout time of the dog feeding signal can be flexibly configured (the micro control unit 40 can either set the dog feeding signal according to the operation control unit 10, or detect the first auxiliary level value of the first analog-to-digital pin by itself to assist in the setting of the dog feeding signal, so that the watchdog timeout time can be flexibly configured) and the circuit reset function can be flexibly configured.

[0041] In the embodiment of the present invention, during the operation stage: if the operation control unit 10 sends the original dog feeding signal to the micro control unit 40 within the timeout period, the micro control unit 40 (after receiving the original dog feeding signal, according to the original dog feeding signal) sends the dog feeding signal to the watchdog unit 20 to perform the dog feeding operation; if the operation control unit 10 fails to send the original dog feeding signal to the micro control unit 40 within the timeout period for the first time, the micro control unit 40 sends the first reset signal to the operation control unit 10 (the reset pin, not shown) to reset the operation control unit 10 for the first time, and the micro control unit 40 still sends the dog feeding signal to the watchdog unit 20 to perform the dog feeding operation; if the first reset fails, after the operation control unit 10 fails to send the original dog feeding signal to the micro control unit 40 within the timeout period for the second time, the micro control unit 40 stops sending the dog feeding signal to the watchdog unit 20, and the watchdog unit 20 sends the second reset signal to the power supply unit 30 to restart the operation control unit 10, and the watchdog unit 20 sends the reset signal to reset the micro control unit 40.

[0042] The control method of the above operation stage is specific to Figures 2 to 4 The circuit is: If the operation control unit 10 sends a dog feeding original signal to one of the three groups of pins of the micro control unit 40 MCU chip U4 within the timeout period, the micro control unit 40 (after receiving the dog feeding original signal, according to the dog feeding original signal) sends a dog feeding signal to the fourth pin WDI of the watchdog chip U2 of the watchdog unit 20 through the sixth pin PA0 to perform the dog feeding operation; If the operation control unit 10 fails to send the original dog feeding signal to the micro control unit 40 within the timeout period for the first time, Figure 4 The seventh pin PA1 of the MCU chip U4 in the micro control unit 40 sends the first reset signal (RET_CPU) to the reset pin of the operation control unit 10 (not shown) to reset the operation control unit 10 for the first time. At the same time, the micro control unit 40 still sends the dog feeding signal (WDIO1) to the fourth pin WDI of the watchdog chip U2 of the watchdog unit 20 through the sixth pin PA0 of the MCU chip U4 to perform the dog feeding operation; If the first reset fails, after the operation control unit 10 fails to send the original dog feeding signal to the micro control unit 40 within the timeout period for the second time, the micro control unit 40 stops sending the dog feeding signal to the watchdog unit 20 through the MCU chip U4. After not receiving the dog feeding signal within the timeout period, Figure 2 The first pin RESET of the watchdog chip U2 in the watchdog unit 20 sends a second reset signal (MRST1) to Figure 3 The source of the MOS tube Q1 in the power supply unit 30 circuit is turned on (forming a PWR_EN signal) to restart the operation control unit 10 , and at the same time, the first pin RESET of the watchdog unit 20 sends a reset signal (MRST1) to the fourth pin NRST of the MCU chip U4 to reset the micro control unit 40 .

[0043] In the control method of the above-mentioned operation stage, during the first reset, only the microcontroller unit 40 resets the operation control unit 10, instead of directly restarting the power supply of the operation control unit 10 at the first reset; if the power supply of the operation control unit 10 is restarted at the first reset, it may cause accelerated loss of various circuit structures (loss of the operation control unit 10, etc., specifically, it may be the loss of the corresponding CPU forcing the power supply to restart), and it may also cause each reset time to be too long, and the reset effect is not ideal; the embodiment of the present invention first uses the microcontroller unit 40 to reset the operation control unit 10 for the first time, and such a first reset operation is usually faster and more efficient; if the operation control unit 10 still cannot return to normal after the microcontroller unit 40 attempts to reset the operation control unit 10, the embodiment of the present invention performs a secondary reset (second reset), and the power supply of the operation control unit 10 is forced to restart during the second reset. The coordination of the two resets not only ensures the prevention of circuit loss and the possibility of efficient reset, but also ensures the effect of ensuring successful reset.

[0044] Since the watchdog circuit provided in the embodiment of the present invention has a dual reset mechanism (when the operation control unit 10 receives the first reset signal and still fails to reset, the power supply will be forcibly cut off to restart the power supply of the operation control unit 10, thereby ensuring the success of the reset), the watchdog circuit structure of the present invention is an embedded dual watchdog system solution, which is a two-level reset control solution.

[0045] Please continue to refer to Figures 1 to 5 The watchdog circuit of the embodiment of the present invention further includes a programming interface unit, which is connected to the SWLCK pin and the SWDIO pin of the micro control unit 40. The programming interface J1 includes a ground pin, ie, the fourth pin thereof.

[0046] During the burning stage of the operation control unit 10, the SWLCK pin of the micro control unit 40 can be manually connected to a low level through the burning interface unit to turn off the reset function of the micro control unit 40 and the watchdog unit 20. Specifically, when the system is powered on and initialized, the micro control unit 40 will first detect the SWLCK pin (the 24th pin PA14) of its MCU chip U4. When it is detected to be a low level, the watchdog chip U2 (hardware watchdog) will be turned off. If it is detected to be a high level, the hardware watchdog will be turned on. However, when the corresponding equipment (such as access control equipment) with a watchdog circuit is produced, the corresponding operation control unit 10 often needs to wait until a later stage to burn the program (that is, the original operation control unit 10 is not burned), and the burning time of the operation control unit 10 (usually the burning time of the corresponding CPU) often exceeds 1 minute. Therefore, it may occur that the micro control unit 40 will reset the operation control unit 10 during the burning process of the operation control unit 10, resulting in a situation where the burning fails. Therefore, this embodiment uses the structural design and control method of the watchdog circuit, for example, manually connects the SWLCK pin (the 24th pin PA14) of the microcontrol unit 40, specifically through the third pin of the burning interface J1 (the pin connected to the SWLCK pin of the microcontrol unit 40) and the fourth pin (ground pin) of the burning interface J1, which is equivalent to grounding the 24th pin (PA14, i.e., the SWLCK pin) of the MCU chip U4 (the operation can be achieved by short-circuiting with tweezers or other conductors), that is, setting the pin to a low level, thereby realizing the function of preventing false reset during the burning stage (i.e., when burning the program of the operation control unit 10, by turning off the reset function of the microcontrol unit 40 and the watchdog unit 20, the burning failure is prevented). That is to say, when the SWLCK pin is just powered on, it will be set as an input for detecting the level value. When the level (value) at this time is detected to be a low level, the hardware watchdog function and the MCU reset function will be turned off. This structural design and control method is implemented by forced manual operation, which manually turns off the reset function corresponding to the microcontrol unit 40 and the watchdog unit 20, and has a strong control effect and controllability.

[0047] As mentioned above, the watchdog circuit also includes a first resistor unit for setting an auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit 40 (the ninth pin PA3 of the MCU chip U4) is connected to the first resistor unit (as mentioned above, not marked); the auxiliary dog ​​feeding signal corresponding to different timeout times is set according to different first auxiliary level values ​​(AD1 values) detected by the first analog-to-digital pin. Figure 6 As shown, the first resistor unit includes a power supply VD1, a resistor R6 and a resistor R7. By controlling the resistance selection of the resistor R6 and the resistor R7, the first auxiliary level value (AD1 value) detected by the first analog-to-digital pin can have different sizes.

[0048] The existing watchdog circuit will usually directly cause the watchdog function to fail if an abnormality occurs as soon as the operation control unit 10 is powered on (because the operation control unit 10 does not have a corresponding dog feeding signal output at this time). It can be seen that the existing watchdog circuit cannot flexibly configure the watchdog timeout time, does not have the function of auxiliary configuration of the watchdog timeout time, and does not have the function of flexibly configuring different auxiliary timeout times of the watchdog. However, the embodiment of the present invention increases the micro control unit 40, uses the micro control unit 40 to set the default auxiliary watchdog timeout time, and specifically sets the corresponding auxiliary watchdog timeout time (as a preliminary default timeout time) according to the first auxiliary level value (AD1 value) detected by the first analog-to-digital pin of the micro control unit 40, so that the watchdog function can be prevented from failing. Specifically, the micro control unit 40 detects the first auxiliary level value (AD1 value), and sets different timeout times according to the detected first auxiliary level value, that is, when the micro control unit 40 confirms that the operation control unit 10 has just been powered on but has not sent a dog feeding signal (may be due to, for example, a long initialization time of the operation control unit 10, etc.), the corresponding auxiliary dog ​​feeding time and dog feeding signal. In one case, when the first auxiliary level value is 1V, the auxiliary reset time (timeout time) is set to 30 seconds, when the first auxiliary level value is 2V, the auxiliary reset time is set to 60 seconds, and when the first auxiliary level value is 3V, the auxiliary reset time is set to 90 seconds. The specific values ​​of the first auxiliary level value (1V, 2V and 3V) can be set by Figure 6 The power supply VD1 and the resistance values ​​of the resistors R6 and R7 in the first resistor unit circuit are selected to realize the above. It can be seen that the control method of the embodiment of the present invention can flexibly configure the (auxiliary) timeout time of the hardware watchdog. Considering that the system loading time of each type of operation control unit 10 may be different, different (auxiliary) feeding timeout times are set according to the operation control units 10 of different products (specifically, the corresponding access control system, etc.).

[0049] Continue to refer Figure 6 In the embodiment of the present invention, the watchdog circuit further includes a second resistor unit (as described above, not marked) for confirming the communication mode between the micro control unit 40 and the operation control unit 10; the second analog-to-digital pin of the micro control unit 40 (the tenth pin PA4 of the MCU chip U4) is connected to the second resistor unit; and different communication modes between the micro control unit 40 and the operation control unit 10 are confirmed according to different second auxiliary level values ​​detected by the second analog-to-digital pin.

[0050] In the existing method, the circuit usually controls the watchdog hardware (watchdog chip) more, for example, it is usually necessary to directly or indirectly control the watchdog hardware through 4 IO ports, so it takes up more resources of the operation control unit 10. In the solution of the embodiment of the present invention, by using the second analog-to-digital pin ( Figure 4 The different second auxiliary level values ​​(AD2 values) detected by the tenth pin PA4 of the MCU chip U4 as shown confirm the different communication modes between the micro control unit 40 and the operation control unit 10, so that the operation control unit 10 only needs to control the micro control unit 40 through one of the three modes of I2C, UART or single IO bus. At this time, when the operation control unit 10 actually indirectly controls the watchdog hardware, it only needs to occupy the resources of 2 input and output pins (for example, two I2C pins or two UART pins), and sometimes even only needs the resources of 1 input and output pin (that is, a single IO bus pin), that is, the micro control unit 40 can be used to control the dog feeding signal and indirectly control the watchdog unit 20, thereby further saving the resources of the operation control unit 10. Specifically, one method of determining the communication mode (selecting the communication determination mode) can be: using the second analog-to-digital pin of the micro control unit 40 to detect the second auxiliary level value (AD2 value), and confirming its communication mode with the operation control unit 10 according to the detected second auxiliary level value. For example: when the second auxiliary level value is detected to be 3V, it is confirmed that the communication method used is serial communication; when the second auxiliary level value is detected to be 2V, it is confirmed that the communication method used is I2C communication; when the second auxiliary level value is detected to be 1V, it is confirmed that the communication method is single bus communication. The specific values ​​of the second auxiliary level value (1V, 2V and 3V) can be obtained through Figure 6 The power supply VD1 and the resistance values ​​of the resistors R4 and R5 in the second resistor unit circuit are selected and implemented.

[0051] In combination with the above content, it can be seen that the embodiment of the present invention configures the watchdog auxiliary timeout time and communication mode respectively through the corresponding first analog-to-digital pin (pin corresponding to the AD1 value) and the second analog-to-digital pin (pin corresponding to the AD2 value), thereby improving the watchdog circuit and its control method, having corresponding flexibility and controllability, and saving circuit resources and improving circuit efficiency.

[0052] In the embodiment of the present invention, as described above, in the power-on initialization stage, by detecting whether the SWDIO pin outputs the level of the first cycle, it is determined whether the micro control unit 40 has completed the burning; and, further, in the operation stage, by detecting the cycle of the output level of the SWDIO pin, the working state of the watchdog unit 20 is determined.

[0053] The reason for determining whether the microcontroller unit 40 has completed the burning by detecting the SWDIO pin is that: in the actual production process, the microcontroller unit 40 may forget to burn the program, and the common method of detecting whether the microcontroller unit 40 has completed the burning of the program is usually troublesome and complicated; therefore, the embodiment of the present invention sets the SWDIO pin ( Figure 4The level flip cycle of the 23rd pin PA13 of the MCU chip U4 shown in the figure (for example, the level is flipped once every 1 second) is set, which makes it convenient for production staff to directly use a multimeter to realize detection (self-test) or random inspection without the aid of other complex detection equipment, thereby facilitating production and further improving production efficiency.

[0054] It should be noted that for the program burning of the MCU chip contained in the microcontroller unit 40, the embodiment of the present invention can adopt a unified program version, so that the MCU chips can be uniformly batched and the program can be uniformly burned in the future. This method can be adapted to mass production, with high production efficiency, low cost and easy operation.

[0055] As described above, in the embodiment of the present invention, the SWDIO pin is set ( Figure 4 The level flipping time of the twenty-third pin PA13 of the MCU chip U4 shown is seconds (in seconds) to directly detect the level change. At this time, the level change cycle is one second or several seconds, so as to quickly and conveniently know whether the micro control unit 40 is normal and whether it has been burned.

[0056] Furthermore, the embodiment of the present invention is set to determine the state of the watchdog by flipping the level of a specific pin for a time period when the watchdog circuit has a state output level (i.e., after being powered on for a period of time and running normally). Specifically, it can be set, for example, to display the watchdog state 30 seconds after the SWDIO pin is powered on. When the watchdog chip U2 is in the enabled state, the corresponding SWDIO pin flips the level once every 1 second; when the watchdog chip U2 is in the disabled state, the pin SWDIO pin flips the level once every 2 seconds. In this case, the staff can directly use a multimeter to detect what state the watchdog unit 20 is processing, thereby further facilitating the detection operation and improving production efficiency.

[0057] For more information about the structure, properties and advantages of the device of this embodiment, please refer to the corresponding content of the aforementioned method embodiment, which will not be repeated here.

[0058] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A watchdog circuit, characterized in that: include: A computing control unit; Watchdog unit; A power supply unit, the operation control unit is electrically connected to the power supply unit, and the power supply unit is controllably connected to the watchdog unit; A micro control unit is respectively connected to and controlled by the operation control unit for communication, and the micro control unit is connected to and controlled by the watchdog unit for communication.

2. The watchdog circuit according to claim 1, wherein: It also includes a burning interface unit, which is connected to the SWLCK pin and the SWDIO pin of the micro control unit, and the burning interface includes a ground pin.

3. The watchdog circuit according to claim 1, wherein: It also includes a first resistance unit for setting an auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit is connected to the first resistance unit; the first resistance unit includes a power supply and a resistor.

4. The watchdog circuit as claimed in claim 3, characterized in that: It also includes a second resistance unit for confirming the communication mode between the micro control unit and the operation control unit; the second analog-to-digital pin of the micro control unit is connected to the second resistance unit; the second resistance unit includes a power supply and a resistor.

5. A control method for a watchdog circuit, characterized in that: Applied to the watchdog circuit as claimed in claim 1, the control method comprises, in a power-on initialization stage: If the operation control unit sends a dog feeding original signal to the micro control unit, the micro control unit sends a dog feeding signal to the watchdog unit to perform a dog feeding operation according to the dog feeding original signal; If the operation control unit does not send the original dog feeding signal to the micro control unit, the micro control unit detects a first auxiliary level value, and sends an auxiliary dog ​​feeding signal to the watchdog unit according to the first auxiliary level value to perform a dog feeding operation, and after the operation control unit is initialized and sends the original dog feeding signal to the micro control unit, the micro control unit re-sends the dog feeding signal to the watchdog unit according to the original dog feeding signal to perform a dog feeding operation.

6. The control method of the watchdog circuit according to claim 5, characterized in that: During the operation phase: If the operation control unit sends the original dog feeding signal to the micro control unit within the timeout period, the micro control unit sends the dog feeding signal to the watchdog unit to perform a dog feeding operation; If the operation control unit fails to send the original dog feeding signal to the micro control unit within the timeout period for the first time, the micro control unit sends a first reset signal to the operation control unit to reset the operation control unit for the first time, and at the same time, the micro control unit still sends the dog feeding signal to the watchdog unit to perform a dog feeding operation; If the first reset fails, after the operation control unit fails to send the original dog feeding signal to the micro control unit within the timeout period for the second time, the micro control unit stops sending the dog feeding signal to the watchdog unit, and the watchdog unit sends a second reset signal to the power supply unit to restart the operation control unit. At the same time, the watchdog unit sends a reset signal to reset the micro control unit.

7. The control method of the watchdog circuit according to claim 6, characterized in that: The watchdog circuit also includes a burning interface unit, which is connected to the SWLCK pin and the SWDIO pin of the micro control unit, and the burning interface includes a ground pin; during the burning stage of the operation control unit, the SWLCK pin of the micro control unit is manually connected to a low level through the burning interface unit to turn off the reset function of the micro control unit and the watchdog unit.

8. The control method of the watchdog circuit according to claim 6, characterized in that: The watchdog circuit also includes a first resistor unit for setting the auxiliary dog ​​feeding signal, and the first analog-to-digital pin of the microcontroller unit is connected to the first resistor unit; the auxiliary dog ​​feeding signal corresponding to different timeout times is set according to different first auxiliary level values ​​detected by the first analog-to-digital pin.

9. The control method of the watchdog circuit according to claim 8, characterized in that: The watchdog circuit also includes a second resistance unit for confirming the communication mode between the micro control unit and the operation control unit; the second analog-to-digital pin of the micro control unit is connected to the second resistance unit; and different communication modes between the micro control unit and the operation control unit are confirmed according to different second auxiliary level values ​​detected by the second analog-to-digital pin.

10. The control method of the watchdog circuit according to claim 7, characterized in that: In the power-on initialization stage, by detecting whether the SWDIO pin outputs the level of the first cycle, it is determined whether the micro control unit has completed the burning; In the operation stage, the working state of the watchdog unit is determined by detecting the period of the output level of the SWDIO pin.

Citation Information

Patent Citations

  • Watchdog circuit and control method thereof

    CN110750374A

  • Control circuit, watchdog circuit control method and device

    CN116126575A

  • Visual passage gate device, system and passage method

    CN117953619A

  • Access control device

    CN219497115U