Search

CN-115686893-B - Watchdog monitoring method and device, electronic equipment and storage medium

CN115686893BCN 115686893 BCN115686893 BCN 115686893BCN-115686893-B

Abstract

The embodiment of the invention provides a watchdog monitoring method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining a first operating frequency of an operating clock of a processor and a second operating frequency of an independent counting clock, calculating a proportion relation between the first operating frequency and the second operating frequency, receiving pulse signals sent by the independent counting clock, carrying out frequency division processing on the pulse signals according to the proportion relation, counting the number of the processed pulse signals, and monitoring the processor according to the counted number of the processed pulse signals. By applying the embodiment of the invention, the pulse signals sent to the watchdog module of the independent counting clock are subjected to frequency division processing according to the running clock of the processor and the running frequency of the independent counting clock, so that the time length when the number of the counted pulse signals of the watchdog module reaches the maximum number is adjusted, and the synchronization of the clock cycle of the watchdog and the feeding cycle of the running program of the processor is ensured under the condition that the running frequency of the processor is changed.

Inventors

  • ZHOU BO
  • LI QIFENG

Assignees

  • 比亚迪半导体股份有限公司

Dates

Publication Date
20260505
Application Date
20210728

Claims (8)

  1. 1. A watchdog monitoring method, applied to a watchdog module, the watchdog module being respectively connected to a processor and an independent count clock, the method comprising: Acquiring a first operating frequency of an operating clock of the processor and a second operating frequency of the independent counting clock; calculating the proportional relation between the first operating frequency and the second operating frequency; receiving pulse signals sent by the independent counting clocks, and carrying out frequency division processing on the pulse signals according to the proportional relation; Counting the number of the processed pulse signals, and monitoring the processor according to the counted number of the processed pulse signals; the calculating the proportional relation between the first operating frequency and the second operating frequency comprises the following steps: acquiring a first frequency configuration table and a second frequency configuration table; searching a first frequency configuration value corresponding to the first operating frequency from the first frequency configuration table, and searching a second frequency configuration value corresponding to the second operating frequency from the second frequency configuration table; calculating a ratio of the first frequency configuration value to the second frequency configuration value; the step of performing frequency division processing on the pulse signal according to the proportion relation comprises the following steps: determining a dynamic configuration value of a counter of the watchdog module according to the proportion value; And controlling the counting frequency of the counter input to the watchdog module by the independent counting clock according to the dynamic configuration value.
  2. 2. The method of claim 1, wherein the watchdog module includes a counter, and wherein counting the number of processed pulse signals includes: inputting the processed pulse signals into a counter of the watchdog module; and counting the number of the processed pulse signals through a counter of the watchdog module.
  3. 3. The method according to claim 1 or 2, wherein said monitoring of the processor according to the counted number of processed pulse signals comprises: judging whether the counted number of the pulse signals after processing reaches a preset threshold value or not; and when the counted number of the processed pulse signals reaches the preset threshold value, determining that the processor is abnormal.
  4. 4. A method according to claim 3, further comprising, after said counted number of processed pulse signals reaches said preset threshold value: and sending a reset signal to the processor, and carrying out reset processing on the processor through the reset signal.
  5. 5. A method according to claim 3, further comprising: And before the number of the pulse signals counted by the watchdog module reaches the preset threshold, receiving an interrupt signal sent by the processor, resetting the counted number of the pulse signals after processing, and starting to count the number of the pulse signals after processing again.
  6. 6. A watchdog monitoring device, characterized by being applied to a watchdog module, the watchdog module being connected to a processor and an independent counting clock, respectively, the device comprising: the frequency acquisition module is used for acquiring a first operating frequency of an operating clock of the processor and a second operating frequency of the independent counting clock; The relation calculation module is used for calculating the proportional relation between the first operating frequency and the second operating frequency; the frequency processing module is used for receiving the pulse signals sent by the independent counting clocks and carrying out frequency division processing on the pulse signals according to the proportional relation; The abnormality monitoring module is used for counting the number of the processed pulse signals and monitoring the processor according to the counted number of the processed pulse signals; the relation calculation module comprises: the configuration table acquisition sub-module is used for acquiring a first frequency configuration table and a second frequency configuration table; A configuration value searching sub-module, configured to search a first frequency configuration value corresponding to the first operating frequency from the first frequency configuration table, and search a second frequency configuration value corresponding to the second operating frequency from the second frequency configuration table; A ratio value calculating sub-module for calculating a ratio value of the first frequency configuration value and the second frequency configuration value; The frequency processing module is specifically configured to determine a dynamic configuration value of a counter of the watchdog module according to the proportion value, and control the counting frequency of the counter of the watchdog module input by the independent counting clock according to the dynamic configuration value.
  7. 7. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the watchdog monitoring method of any of claims 1 to 5 when executed by the processor.
  8. 8. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the watchdog monitoring method according to any of the claims 1 to 5.

Description

Watchdog monitoring method and device, electronic equipment and storage medium Technical Field The present invention relates to the field of electronic technologies, and in particular, to a watchdog monitoring method, a device, an electronic device, and a storage medium. Background In order to meet the requirements of reliability design of a system, a watchdog module is generally adopted to monitor the running state of an MCU (Microcontroller Unit, a micro control unit) in real time and generate a reset signal when an abnormality is detected to reset the system to normal operation, so that the situation that the whole system is paralyzed and cannot be recovered due to the fact that a program running on the MCU runs off or falls into the abnormality of dead circulation due to the influence of some external or internal factors is avoided. At present, an independent control logic and a fixed frequency counting clock source independent of the clock of the MCU system are generally adopted to trigger the watchdog count, so that the watchdog module operates independent of the MCU system to monitor the MCU. However, since the clock frequency of the watchdog is fixed, and the running frequency of the watchdog is dynamically changed by the MCU system according to the actual application requirement of the watchdog, the situation that the clock frequency of the watchdog for counting is not matched with the running frequency of the MCU system occurs, for example, when the MCU runs at a slower clock frequency, the MCU runs a longer program for a longer period of time, the time period of feeding the watchdog is prolonged, the time period of feeding the watchdog itself for feeding the watchdog is unchanged, and the abnormal situation that the system of the MCU itself is normal but the feeding of the watchdog is not reached occurs, thereby affecting the development of the application program. Disclosure of Invention The embodiment of the invention provides a watchdog monitoring method, a watchdog monitoring device, electronic equipment and a storage medium, which solve the problem that the clock period of a watchdog is not synchronous with the feeding period of an MCU running program because an MCU system dynamically changes the running frequency according to the actual application requirement of the MCU system. In order to solve the above problems, an embodiment of the present invention discloses a watchdog monitoring method, which is applied to a watchdog module, wherein the watchdog module is respectively connected with a processor and an independent counting clock, and the method comprises: Acquiring a first operating frequency of an operating clock of the processor and a second operating frequency of the independent counting clock; calculating the proportional relation between the first operating frequency and the second operating frequency; receiving pulse signals sent by the independent counting clocks, and carrying out frequency division processing on the pulse signals according to the proportional relation; counting the number of the processed pulse signals, and monitoring the processor according to the counted number of the processed pulse signals. Optionally, calculating the proportional relationship between the first operating frequency and the second operating frequency includes: acquiring a first frequency configuration table and a second frequency configuration table; searching a first frequency configuration value corresponding to the first operating frequency from the first frequency configuration table, and searching a second frequency configuration value corresponding to the second operating frequency from the second frequency configuration table; and calculating a ratio value of the first frequency configuration value and the second frequency configuration value. Optionally, the watchdog module includes a counter, and counts the number of the processed pulse signals, and further includes: inputting the processed pulse signals into a counter of the watchdog module; and counting the number of the processed pulse signals through a counter of the watchdog module. Optionally, the monitoring the processor according to the counted number of the pulse signals after processing includes: judging whether the counted number of the pulse signals after processing reaches a preset threshold value or not; and when the counted number of the processed pulse signals reaches the preset threshold value, determining that the processor is abnormal. Optionally, after the number of the counted processed pulse signals reaches the preset threshold, the method further includes: and sending a reset signal to the processor, and carrying out reset processing on the processor through the reset signal. Optionally, the method further comprises: And before the number of the pulse signals counted by the watchdog module reaches the preset threshold, receiving an interrupt signal sent by the processor, resetting the counted number of the pul