CN102567129A - Watchdog starting method and corresponding device - Google Patents

Watchdog starting method and corresponding device Download PDF

Info

Publication number
CN102567129A
CN102567129A CN2011104563806A CN201110456380A CN102567129A CN 102567129 A CN102567129 A CN 102567129A CN 2011104563806 A CN2011104563806 A CN 2011104563806A CN 201110456380 A CN201110456380 A CN 201110456380A CN 102567129 A CN102567129 A CN 102567129A
Authority
CN
China
Prior art keywords
house dog
preset
counting variable
judge
main circulating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011104563806A
Other languages
Chinese (zh)
Inventor
张�林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Tatfook Technology Co Ltd
Original Assignee
Shenzhen Tatfook Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Tatfook Technology Co Ltd filed Critical Shenzhen Tatfook Technology Co Ltd
Priority to CN2011104563806A priority Critical patent/CN102567129A/en
Publication of CN102567129A publication Critical patent/CN102567129A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention discloses a watchdog starting method, and further discloses a corresponding device. In the method, a counting variable is predesigned locally for counting, and whether a main loop program is abnormal in a main loop stage is judged according to the result of comparison between the counting variable and a first starting constant corresponding to the main loop stage; only when the judged result is that the main loop program is abnormal in the main loop state, can the watch dog be started, thus, the watchdog can be used regularly, and the flexibility of the watchdog can be improved; when being in a sleeping mode, a microprogrammed control unit (MCU) is not woken by the watchdog, so that the MCU can meet the requirement of low power consumption while keeping electrified.

Description

Startup method and the device of a kind of house dog
Technical field
The present invention relates to computer realm, particularly relate to the startup method of a kind of house dog.
Background technology
Micro-control unit (Micro Control Unit; MCU); Be one chip microcomputer or single-chip microcomputer, be meant appearance and development thereof, CPU, random access memory district, ROM (read-only memory), timer conter and the multiple I/O interface of computing machine is integrated on a slice chip along with large scale integrated circuit; Form the computing machine of chip-scale, for doing various combination control in different application scenarios.
(watchdog timer WDT), is a timer circuit to house dog, and an input is generally arranged; Cry and feed dog (kicking the dog/service the dog), a reset terminal that outputs to MCU in the time of the MCU operate as normal, is exported a signal to feeding the dog end at set intervals; Give the WDT zero clearing, do not feed dog if surpass official hour, when the program that generally appears at is run fast; WDT regularly surpasses, and will provide a reset signal to MCU, and MCU is resetted; Prevent that MCU from crashing, the effect of house dog is exactly to prevent program generation endless loop, program fleet in other words.
The house dog of a lot of MCU systems is in case its house dog enable bit and the set of watchdog reset enable bit just can't be used the software zero clearing.In actual conditions; For the assurance program can be recovered; Prevent that MCU is absorbed in a certain program segment behind the program fleet and gets into the endless loop state owing to disturbing to cause, after system's operation, also just started the counter of house dog, enabled its house dog enable bit and watchdog reset enable bit.Need keep the dog that feeds during the program run to house dog always.After getting into dormancy, feed the dog program and will stop to carry out, but can't clear up house dog enable bit and watchdog reset enable bit this moment, house dog can cause chip reset, makes dormant state to keep.Keep requiring low-power consumption in the device of "on" position in some requirement always, must let MCU sleep like this, if waken up after the MCU sleep, that can cause total system can't satisfy the requirement of low-power consumption.
Summary of the invention
The technical matters that the present invention mainly solves provides the startup method of a kind of house dog; Can use house dog normally; Can improve the dirigibility of house dog again, when MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is:
The startup method of a kind of house dog is characterized in that, comprising:
When the timer that is provided with in advance triggers interruption; Preset counting variable is added 1; The initial value of said counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation said counting variable be changed to said initial value;
Judge said main circulating program current be in the major cycle stage or the unloading phase;
Be in the major cycle stage if said main circulating program is current, judge again that then whether said counting variable starts constant greater than preset first;
If said counting variable then starts house dog greater than the first preset startup constant.
The starter gear of a kind of house dog is characterized in that, comprising:
Be arranged on local timer in advance;
The counting variable control module; Be used for when said timer triggers interruption; Preset counting variable is added 1; The initial value of said counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation said counting variable be changed to said initial value;
First judge module, be used to judge said main circulating program current be in the major cycle stage or the unloading phase;
Second judge module is used for that main circulating program is current to be in the major cycle stage when said first judge module is judged, and judges that more whether said counting variable starts constant greater than preset first;
House dog starts module, is used for when said second judge module is judged counting variable and started constant greater than preset first the startup house dog.
The invention has the beneficial effects as follows: be different from the situation of prior art, the present invention had only when the execution time to surpass preset startup constant through the execution time of the different phase of monitoring main circulating program; Just can start house dog; Thereby, can use house dog normally, can improve the dirigibility of house dog again; When MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
Description of drawings
Fig. 1 is the data flowchart of startup method first embodiment of house dog of the present invention;
Fig. 2 is the data flowchart of startup method second embodiment of house dog of the present invention;
Fig. 3 is the logical organization synoptic diagram of starter gear first embodiment of house dog of the present invention;
Fig. 4 is the logical organization synoptic diagram of starter gear second embodiment of house dog of the present invention.
Embodiment
Consult Fig. 1, startup method first embodiment of house dog of the present invention comprises:
101, when the timer that is provided with in advance triggers interruption, preset counting variable is added 1;
A timer is set in this locality in advance, and this timer continues timing then just triggering interruption through the preset time section, successively circulation;
When timer triggers interruption; Preset counting variable is added 1; The initial value of this counting variable when the timer initialization is a preset value; For example be preset as 0, and before end loop gets into circulation next time in the time that main circulating program is being preset each time, this counting variable be changed to initial value; So, as long as main circulating program end loop in the preset time, and get into circulation next time smoothly, so, counting variable is an initial value just, and can be not increasing;
102, judge main circulating program current be in the major cycle stage or the unloading phase;
Main circulating program has two stages in the process of implementation, the unloading phase and the major cycle stage, execution time in each stage is different, so it is also different to judge whether the execution in each stage unusual judgement time occurs;
103, judge that whether counting variable is greater than the first preset startup constant;
Be provided with first in advance in this locality and start constant; This first startup constant is to judge whether main circulating program unusual time constant occurs in the major cycle stage; If the value of counting variable starts constant greater than first; Explain that main circulating program surpasses expection in the execution time in major cycle stage, race flies in the major cycle stage to judge main circulating program, needs to start house dog; If the value of counting variable does not start constant greater than first, explain that main circulating program is normal in the execution time in major cycle stage, need not start house dog;
104, start house dog;
If judge counting variable in the step 103 greater than the first preset startup constant, then main circulating program surpasses expection in the execution time in major cycle stage, and the judgement main circulating program runs in the major cycle stage and flies, the startup house dog;
In the present embodiment, count through preset counting variable in this locality, and according to the comparative result of this counting variable with the first startup constant of presetting corresponding with the major cycle stage; Judge whether main circulating program occurred unusually in the major cycle stage; Having only judged result is that main circulating program occurred just starting house dog under the unusual situation in the major cycle stage, thereby; Can use house dog normally; Can improve the dirigibility of house dog again, when MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
Consult Fig. 2, startup method second embodiment of house dog of the present invention comprises:
201, when the timer that is provided with in advance triggers interruption, preset counting variable is added 1;
A timer is set in this locality in advance, and this timer continues timing then just triggering interruption through the preset time section, successively circulation;
When timer triggers interruption; Preset counting variable is added 1; The initial value of this counting variable when the timer initialization is a preset value; For example be preset as 0, and before end loop gets into circulation next time in the time that main circulating program is being preset each time, this counting variable be changed to initial value; So, as long as main circulating program end loop in the preset time, and get into circulation next time smoothly, so, counting variable is an initial value just, and can be not increasing;
202, obtain the house dog zone bit;
Be provided with the house dog zone bit in this locality, the user can be provided with through this house dog zone bit and whether directly start house dog;
203, judge whether that according to the house dog zone bit needs start house dog;
Judge whether that according to the house dog zone bit needs start house dog, if the house dog zone bit is set to need to start house dog, then execution in step 207, if the house dog zone bit is set to need not start house dog, then execution in step 204;
204, judge main circulating program current be in the major cycle stage or the unloading phase;
Main circulating program has two stages in the process of implementation, the unloading phase and the major cycle stage, execution time in each stage is different, so it is also different to judge whether the execution in each stage unusual judgement time occurs; Main circulating program is current to be in the major cycle stage if judge, and then execution in step 206, if judge the unloading phase that main circulating program is current being in, then execution in step 205;
205, judge that whether counting variable is greater than the second preset startup constant;
Be provided with second in advance in this locality and start constant; This second start constant be judge main circulating program the unloading phase whether unusual time constant appear; If the value of counting variable starts constant greater than second; Explain main circulating program the unloading phase execution time surpass expection, judge main circulating program the unloading phase run and fly, need to start house dog; If the value of counting variable does not start constant greater than second, explain main circulating program the unloading phase execution time normal, need not start house dog;
206, judge that whether counting variable is greater than the first preset startup constant;
Be provided with first in advance in this locality and start constant; This first startup constant is to judge whether main circulating program unusual time constant occurs in the major cycle stage; If the value of counting variable starts constant greater than first; Explain that main circulating program surpasses expection in the execution time in major cycle stage, race flies in the major cycle stage to judge main circulating program, needs to start house dog; If the value of counting variable does not start constant greater than first, explain that main circulating program is normal in the execution time in major cycle stage, need not start house dog;
207, start house dog;
Below, specifically bright for instance:
For example, counting variable is initialized as 0, and timer is every at a distance from interruption in 5 seconds once, every terminal once, counting variable adds 1;
First of the major cycle stage is set in advance, and to start constant be 5, the unloading phase second to start constant be 2, the house dog zone bit is set for not starting house dog;
Such as main circulating program the unloading phase normal time of carrying out be 1 second; Be 10 seconds the normal time of carrying out in the major cycle stage, and so, the time that the main circulating program circulation primary needs altogether is 11 seconds; If normal the execution; Every circulation primary, before getting into circulation next time, counting variable puts 0;
If main circulating program runs in the major cycle stage and flies; Counting variable is increased to 6; Counting variable starts constant greater than first, and promptly main circulating program has been spent 30 seconds in the major cycle stage and also do not had end loop, judges then that main circulating program ran in the major cycle stage to fly; Need this moment to start house dog, MCU is resetted;
If main circulating program is normally carried out, do not occur unusually, house dog can not be activated; Thereby, can use house dog normally, can improve the dirigibility of house dog again; When MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
In the present embodiment, through main circulating program is provided with the expection of different execution time in the different execute phases, surpass time of this expection when the execution time, it is unusual to judge that then main circulating program occurred in this stage, then starts house dog MCU is resetted; If main circulating program is normally carried out, do not occur unusually, house dog can not be activated; Thereby, can use house dog normally, can improve the dirigibility of house dog again; When MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
Consult Fig. 3, starter gear first embodiment of house dog of the present invention comprises:
Be arranged on local timer 301 in advance;
Counting variable control module 302; Be used for when timer 301 triggers interruption; Preset counting variable is added 1; Wherein, the initial value of counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation this counting variable put initial value;
First judge module 303, be used to judge main circulating program current be in the major cycle stage or the unloading phase;
Second judge module 304 is used for that main circulating program is current to be in the major cycle stage when first judge module 303 is judged, and judges that more whether counting variable starts constant greater than preset first;
House dog starts module 305, is used for when second judge module 304 is judged counting variable and started constant greater than preset first the startup house dog;
In the present embodiment, count through preset counting variable in this locality, and according to the comparative result of this counting variable with the first startup constant of presetting corresponding with the major cycle stage; Judge whether main circulating program occurred unusually in the major cycle stage; Having only judged result is that main circulating program occurred just starting house dog under the unusual situation in the major cycle stage, thereby; Can use house dog normally; Can improve the dirigibility of house dog again, when MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
Consult Fig. 4, starter gear second embodiment of house dog of the present invention comprises:
Be arranged on local timer 301 in advance;
Counting variable control module 302; Be used for when timer 301 triggers interruption; Preset counting variable is added 1; Wherein, the initial value of counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation this counting variable be changed to initial value;
Acquisition module 307 is used to obtain the house dog zone bit;
The 4th judge module 308 is used for judging whether that according to the zone bit that acquisition module 307 obtains needs start house dog;
First judge module 303 is used for judging need not start house dog the time when the 4th judge module 308, judge again main circulating program current be in the major cycle stage or the unloading phase;
Second judge module 304 is used for that main circulating program is current to be in the major cycle stage when first judge module 303 is judged, and judges that more whether counting variable starts constant greater than preset first;
The 3rd judge module 306 is used for judging the unloading phase that main circulating program is current being in when first judge module 303, judges that more whether counting variable is greater than the second preset startup constant;
House dog starts module 305; Be used for when second judge module 304 is judged counting variable and started constant greater than preset first; Perhaps when the 3rd judge module 306 is judged counting variable and is started constant greater than preset second; Perhaps the 4th judge module 308 is judged when needing to start house dog, starts house dog;
In the present embodiment, through main circulating program is provided with the expection of different execution time in the different execute phases, surpass time of this expection when the execution time, it is unusual to judge that then main circulating program occurred in this stage, then starts house dog MCU is resetted; If main circulating program is normally carried out, do not occur unusually, house dog can not be activated; Thereby, can use house dog normally, can improve the dirigibility of house dog again; When MCU gets into dormancy, do not waken up, make MCU can reach the low-power consumption requirement that keeps energising by house dog.
The above is merely embodiments of the invention; Be not so limit claim of the present invention; Every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to be done; Or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.

Claims (10)

1. the startup method of a house dog is characterized in that, comprising:
When the timer that is provided with in advance triggers interruption; Preset counting variable is added 1; The initial value of said counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation said counting variable be changed to said initial value;
Judge said main circulating program current be in the major cycle stage or the unloading phase;
Be in the major cycle stage if said main circulating program is current, judge again that then whether said counting variable starts constant greater than preset first;
If said counting variable then starts house dog greater than the first preset startup constant.
2. method according to claim 1 is characterized in that, saidly also comprises after judging the current step that whether is in the major cycle stage of main circulating program:
If said main circulating program is current be in the unloading phase, judge that more whether said counting variable starts constant greater than preset second;
If said counting variable then starts house dog greater than the second preset startup constant.
3. method according to claim 1 is characterized in that, saidly also comprises before judging the current step that whether is in the major cycle stage of main circulating program:
Obtain the house dog zone bit, and judge whether that according to said zone bit needs start said house dog;
Start said house dog if judge needs, then carry out the step that starts house dog according to said zone bit;
Needs start said house dog if judge not according to said zone bit, then carry out and judge the current step that whether is in the major cycle stage of said main circulating program.
4. method according to claim 1 is characterized in that, saidly judges that counting variable also comprises after whether starting the step of constant greater than preset first:
If said counting variable is not more than the first preset startup constant, then return when the timer that is provided with in advance triggers interruption, preset counting variable is added 1 step, circulation successively finishes until unlatching house dog or main circulating program.
5. method according to claim 2 is characterized in that, saidly judges that counting variable also comprises after whether starting the step of constant greater than preset second:
If said counting variable is not more than the second preset startup constant, then return when the timer that is provided with in advance triggers interruption, preset counting variable is added 1 step, circulation successively finishes until unlatching house dog or main circulating program.
6. the starter gear of a house dog is characterized in that, comprising:
Be arranged on local timer in advance;
The counting variable control module; Be used for when said timer triggers interruption; Preset counting variable is added 1; The initial value of said counting variable is a preset value, and when main circulating program each time in the preset time end loop get into next time and before the circulation said counting variable be changed to said initial value;
First judge module, be used to judge said main circulating program current be in the major cycle stage or the unloading phase;
Second judge module is used for that main circulating program is current to be in the major cycle stage when said first judge module is judged, and judges that more whether said counting variable starts constant greater than preset first;
House dog starts module, is used for when said second judge module is judged counting variable and started constant greater than preset first the startup house dog.
7. device according to claim 6 is characterized in that, said device also comprises:
The 3rd judge module is used for judging the unloading phase that main circulating program is current being in when said first judge module, judges that more whether said counting variable is greater than the second preset startup constant.
8. device according to claim 7 is characterized in that, said house dog starts module and also is used for when said the 3rd judge module is judged counting variable and started constant greater than preset second the startup house dog.
9. device according to claim 6 is characterized in that, said device also comprises:
Acquisition module is used to obtain the house dog zone bit;
The 4th judge module is used for judging whether that according to the zone bit that said acquisition module obtains needs start said house dog.
10. device according to claim 9 is characterized in that, said house dog starts module and also is used for when the 4th judge module is judged the said house dog of needs startup, starting house dog.
CN2011104563806A 2011-12-30 2011-12-30 Watchdog starting method and corresponding device Pending CN102567129A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011104563806A CN102567129A (en) 2011-12-30 2011-12-30 Watchdog starting method and corresponding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011104563806A CN102567129A (en) 2011-12-30 2011-12-30 Watchdog starting method and corresponding device

Publications (1)

Publication Number Publication Date
CN102567129A true CN102567129A (en) 2012-07-11

Family

ID=46412612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011104563806A Pending CN102567129A (en) 2011-12-30 2011-12-30 Watchdog starting method and corresponding device

Country Status (1)

Country Link
CN (1) CN102567129A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103389644A (en) * 2013-06-19 2013-11-13 杭州士兰微电子股份有限公司 Timing system and timing method
CN107851050A (en) * 2015-07-08 2018-03-27 微软技术许可有限责任公司 The WatchDog Timer of high availability and energy efficient

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5903767A (en) * 1988-12-09 1999-05-11 Dallas Semiconductor Corporation Integrated circuit for providing supervisory functions to a microprocessor
CN1501621A (en) * 2002-11-18 2004-06-02 华为技术有限公司 A safe system starting method
CN1917446A (en) * 2006-09-04 2007-02-21 华为技术有限公司 Method and system for eliminating faults of server
CN101271414A (en) * 2008-05-06 2008-09-24 江苏东大金智建筑智能化系统工程有限公司 Full-range dog-feeding method of embedded system
CN101281414A (en) * 2007-04-07 2008-10-08 深圳迈瑞生物医疗电子股份有限公司 Controllable watchdog replacement system
CN101710296A (en) * 2009-11-27 2010-05-19 广州从兴电子开发有限公司 Watchdog circuit
CN101901168A (en) * 2010-06-29 2010-12-01 深圳市景阳科技股份有限公司 Watchdog resetting system and resetting method thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5903767A (en) * 1988-12-09 1999-05-11 Dallas Semiconductor Corporation Integrated circuit for providing supervisory functions to a microprocessor
CN1501621A (en) * 2002-11-18 2004-06-02 华为技术有限公司 A safe system starting method
CN1917446A (en) * 2006-09-04 2007-02-21 华为技术有限公司 Method and system for eliminating faults of server
CN101281414A (en) * 2007-04-07 2008-10-08 深圳迈瑞生物医疗电子股份有限公司 Controllable watchdog replacement system
CN101271414A (en) * 2008-05-06 2008-09-24 江苏东大金智建筑智能化系统工程有限公司 Full-range dog-feeding method of embedded system
CN101710296A (en) * 2009-11-27 2010-05-19 广州从兴电子开发有限公司 Watchdog circuit
CN101901168A (en) * 2010-06-29 2010-12-01 深圳市景阳科技股份有限公司 Watchdog resetting system and resetting method thereof

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103389644A (en) * 2013-06-19 2013-11-13 杭州士兰微电子股份有限公司 Timing system and timing method
CN103389644B (en) * 2013-06-19 2017-02-08 杭州士兰微电子股份有限公司 Timing system and timing method
CN107851050A (en) * 2015-07-08 2018-03-27 微软技术许可有限责任公司 The WatchDog Timer of high availability and energy efficient
CN107851050B (en) * 2015-07-08 2021-04-09 微软技术许可有限责任公司 Device with watchdog timer and method for operating watchdog timer

Similar Documents

Publication Publication Date Title
KR101529018B1 (en) Dynamic sleep for multicore computing devices
US9092218B2 (en) Methods and apparatus to improve turbo performance for events handling
US9152205B2 (en) Mechanism for facilitating faster suspend/resume operations in computing systems
CN100568191C (en) The full-range dog-feeding method of embedded system
CN105183128A (en) Forcing a processor into a low power state
TWI454905B (en) Constrained boot techniques in multi-core platforms
CN101526845B (en) Power management method and related chipset thereof
CN103885847A (en) Dog feeding method and device based on embedded system
US20160335149A1 (en) Peripheral Watchdog Timer
Pan et al. A lightweight progress maximization scheduler for non-volatile processor under unstable energy harvesting
US9110723B2 (en) Multi-core binary translation task processing
CN104049702A (en) Single chip microcomputer-based CPU (Central Processing Unit) reset control system, method and device
CN115826728A (en) Chip power management method and device
CN102567129A (en) Watchdog starting method and corresponding device
EP2818974A1 (en) Protected power management mode in a processor
CN210348469U (en) Nested watchdog device
CN102169451B (en) The method and apparatus that a kind of monitoring CPU is run
US20040210785A1 (en) Method of and apparatus for achieving "watch dog" functions in microcontrollers and microcomputers and the like, required to shut down for extended periods of time for energy-conservation purposes
CN101630277A (en) Over-frequency module, computer system and over-frequency method thereof
CN116010143A (en) Method for automatically feeding dogs under dormancy and energy storage system
CN108804150A (en) Terminal standby procedure processing method and terminal
CN202887096U (en) Central processing unit (CPU) reset circuit
CN101872233B (en) Automatic on-off schedule control method and system thereof
US9170862B2 (en) Converting apparatus, conversion method, and information processing system
JP2010140319A (en) Semiconductor device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120711