[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN104866051A - Method for predicting watchdog resetting, microcontroller and embedded system - Google Patents

Method for predicting watchdog resetting, microcontroller and embedded system Download PDF

Info

Publication number
CN104866051A
CN104866051A CN201410063269.4A CN201410063269A CN104866051A CN 104866051 A CN104866051 A CN 104866051A CN 201410063269 A CN201410063269 A CN 201410063269A CN 104866051 A CN104866051 A CN 104866051A
Authority
CN
China
Prior art keywords
dog
value
unclear
time
occur
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.)
Granted
Application number
CN201410063269.4A
Other languages
Chinese (zh)
Other versions
CN104866051B (en
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410063269.4A priority Critical patent/CN104866051B/en
Publication of CN104866051A publication Critical patent/CN104866051A/en
Application granted granted Critical
Publication of CN104866051B publication Critical patent/CN104866051B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method for predicting watchdog resetting, a microcontroller and an embedded system. An MCU (micro control unit) enters an interrupt handling program according a running program to determine that watchdog resetting is to occur, and then a DDR (double data rate) is switched to a self-refreshing mode to wait for watchdog resetting, so that watchdog resetting can be predicted, then the DDR is switched to the self-refreshing mode before watchdog resetting occurs, data of the DDR cannot jump during watchdog resetting, and accordingly, abnormal behavior caused by data changes when the program runs can be reduced.

Description

A kind of predict dog reset occur method, microcontroller and embedded system
Technical field
The embodiment of the present invention relates to communication technical field, particularly relates to a kind of predict method, microcontroller and embedded system that dog reset occurs.
Background technology
Along with the fast development of embedded device, the complexity of embedded software is also in continuous rising, and house dog and jumbo data storage device are widely used.House dog is for monitoring and management single-chip microcomputer, digital signal processor (DSP, Digital Signal Processor) etc. microcontroller (MCU, MicroControl Unit) reset circuit, when MCU normally runs, by system software every certain hour to house dog pulse signal, be commonly called as " feed dog ".If exceeded stipulated time house dog do not receive " feed dog " signal, house dog has exported a pulse to the reset pin of MCU, and MCU is resetted.
When Double Data Rate synchronous DRAM (DDR, Double Data Rate) stores data, MCU is needed to provide clock to carry out Refresh Data in real time to DDR.But in dog reseting procedure, there is the risk of loss of data in the data that MCU can not provide clock to store to DDR, DDR at dog reseting period, cause dog reset before and after DDR data may there is saltus step, the abnormal behaviour of the program causing MCU to run.
Summary of the invention
In view of the above defect of prior art, the invention provides a kind of predict method, microcontroller and embedded system that dog reset occurs, solve in prior art, because dog reseting period MCU can not provide clock to DDR, before and after the dog caused resets may there is the problem of saltus step in DDR data.
The first aspect of the embodiment of the present invention provides a kind of method that dog reset occurs of predicting, comprising:
When microcontroller working procedure, MCU enters interrupt handling routine according to the described program run and determines that dog will occur to be resetted;
Double Data Rate synchronous DRAM DDR is switched to self-refresh mode by described MCU, and waits for that described dog occurs to be resetted.
In conjunction with the first aspect of the embodiment of the present invention, in the first embodiment of the first aspect of the embodiment of the present invention, described interrupt handling routine is timer interruption handling procedure, and described MCU enters interrupt handling routine according to the described program run and determines that dog reset will occur to be comprised:
Described MCU periodically enters timer interruption handling procedure according to the period 1, and the described period 1 is the time cycle of timer interruption;
Judge the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
If the value of described mark is described first numerical value, then described MCU determines that dog will occur to be resetted.
In conjunction with the first embodiment of the first aspect of the embodiment of the present invention, in the second embodiment of the first aspect of the embodiment of the present invention, the value of described mark also comprises second value, and described second value is used to indicate and calculates the unclear dog time;
Also comprise after judging the value of the mark in described timer interruption handling procedure:
If the value of described mark is described second value, then described MCU calculates the unclear dog time;
Judge whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
If the described unclear dog time is greater than or equal to described preset value, then the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
If the described unclear dog time is less than described preset value, then determines it is not dog will occur reset, and the described unclear dog time is added up.
The second aspect of the embodiment of the present invention provides a kind of microcontroller, and described MCU comprises:
Running unit, for working procedure;
For entering interrupt handling routine according to the described program run, determining unit, determines that dog will occur to be resetted;
Switch unit, for Double Data Rate synchronous DRAM DDR is switched to self-refresh mode, and waits for that described dog occurs to be resetted.
In conjunction with the second aspect of the embodiment of the present invention, in the first embodiment of the second aspect of the embodiment of the present invention, comprise: described interrupt handling routine is timer interruption handling procedure, described running unit, also for periodically entering timer interruption handling procedure according to the period 1, wherein, the described period 1 is the time cycle of timer interruption;
Described determining unit comprises:
First judgment sub-unit, for judging the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
First determines subelement, for when the value of described mark is the first numerical value, determines that dog will occur to be resetted.
In conjunction with the first embodiment of the second aspect of the embodiment of the present invention, in the second embodiment of the second aspect of the embodiment of the present invention, comprising: the value of described mark also comprises second value, described second value is used to indicate and calculates the unclear dog time;
Described determining unit also comprises:
Computation subunit, for when the value of described mark is described second value, calculates the unclear dog time;
Second judgment sub-unit, for judging whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
Arrange and determine subelement, for when the described unclear dog time is greater than or equal to described preset value, the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
Add up to determine subelement, for when the described unclear dog time is less than described preset value, determines it is not dog will occur reset, and the described unclear dog time is added up.
The third aspect of the embodiment of the present invention provides a kind of embedded system, and described system comprises:
Microcontroller, Double Data Rate synchronous DRAM DDR and house dog;
Described MCU is connected with described DDR with described house dog respectively;
Described MCU comprises: running unit, determining unit and switch unit;
Described running unit, for working procedure;
For entering interrupt handling routine according to the described program run, described determining unit, determines that dog will occur to be resetted;
Described switch unit, for Double Data Rate synchronous DRAM DDR is switched to self-refresh mode, and waits for that described dog occurs to be resetted.
In conjunction with the third aspect of the embodiment of the present invention, in the first embodiment of the third aspect of the embodiment of the present invention, comprise: described interrupt handling routine is timer interruption handling procedure, described running unit, also for periodically entering timer interruption handling procedure according to the period 1, wherein, the described period 1 is the time cycle of timer interruption;
Described in described MCU, determining unit comprises: the first judgment sub-unit and first determines subelement;
Described first judgment sub-unit, for judging the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
Described first determines subelement, for when the value of described mark is the first numerical value, determines that dog will occur to be resetted.
In conjunction with the first embodiment of the third aspect of the embodiment of the present invention, in the second embodiment of the third aspect of the embodiment of the present invention, comprising: the value of described mark also comprises second value, described second value is used to indicate and calculates the unclear dog time;
Described in described MCU, determining unit also comprises: computation subunit, the second judgment sub-unit, arrange and determine subelement and accumulative determine subelement;
Described computation subunit, for when the value of described mark is described second value, calculates the unclear dog time;
Described second judgment sub-unit, for judging whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
Described setting determines subelement, and for when the described unclear dog time is greater than or equal to described preset value, the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
Described adding up determines subelement, for when the described unclear dog time is less than described preset value, determines it is not dog will occur reset, and is added up the described unclear dog time.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages:
The invention provides a kind of predict method, microcontroller and embedded system that dog reset occurs, MCU enters interrupt handling routine according to the program run and determines that dog will occur to be resetted, then DDR is switched to self-refresh mode, and wait for that dog occurs to be resetted, can predict like this and dog reset will occur, then before generation dog resets, DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, so reduce program operationally factor data change and occur abnormal behaviour.
Accompanying drawing explanation
Fig. 1 is the method embodiment schematic diagram predicting in the embodiment of the present invention that dog reset occurs;
Fig. 2 is another embodiment schematic diagram of method predicting in the embodiment of the present invention that dog reset occurs;
Fig. 3 is another embodiment schematic diagram of method predicting in the embodiment of the present invention that dog reset occurs;
Fig. 4 is MCU embodiment schematic diagram in the embodiment of the present invention;
Fig. 5 is another embodiment schematic diagram of MCU in the embodiment of the present invention;
Fig. 6 is embedded system embodiment schematic diagram in the embodiment of the present invention.
Embodiment
Embodiments provide a kind of predict dog reset occur method, microcontroller and embedded system, can ensure that dog reseting period DDR data there will not be saltus step, and then reduce program operationally factor data change and the abnormal behaviour that occurs.
For making goal of the invention of the present invention, feature, advantage can be more obvious and understandable, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, the embodiments described below are only the present invention's part embodiments, and not all embodiments.Based on the embodiment in the present invention, the every other embodiment that those skilled in the art obtains, all belongs to the scope of protection of the invention.
Fig. 1 is the method embodiment predicting in the embodiment of the present invention that dog reset occurs, and this embodiment comprises:
101, when MCU working procedure, MCU enters interrupt handling routine according to this program run and determines that dog will occur to be resetted;
In the present embodiment, interrupt handling routine comprises: abnormal interrupt handling routine and timer interruption handling procedure, MCU can enter interrupt handling routine and determine that dog will occur resets (watchdog reset) according to the program run, in actual applications, after MCU receives abnormal interrupt request, the program that MCU runs enters abnormal interrupt handling routine, and when MCU receives timer interruption request, the program that MCU runs enters timer interruption handling procedure.
102, DDR is switched to self-refresh mode by MCU, and waits for that dog occurs to be resetted.
In the present embodiment, after step 101, namely after determining that dog will occur to be resetted, DDR is switched to self-refresh mode by MCU, and wait for that dog occurs to be resetted, when DDR is in self-refresh mode, DDR supplies self clock, the data stored to keep self are not lost, now MCU can not access the data stored in DDR, in actual applications, MCU directly jumps to random-access memory (RAM in MCU, Random-Access Memory) on program, DDR is switched to self-refresh mode, wherein, MCU is for completing the control of embedded system, communication, the operation such as command analysis and execution, RAM is the running space of embedded system program, be arranged in MCU.
Further, the method for the present embodiment can also comprise: when dog has resetted, DDR is switched back normal mode of operation by MCU.
In the present embodiment, MCU enters interrupt handling routine according to the program run and determines that dog will occur to be resetted, then DDR is switched to self-refresh mode, and wait for that dog occurs to be resetted, can predict like this and dog reset will occur, then generation dog reset before DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, so reduce program operationally factor data change and occur abnormal behaviour.
For the ease of understanding, with an instantiation, the method that the prediction dog reset in the embodiment of the present invention occurs being described below, referring to Fig. 2, when interrupt handling routine is timer interruption handling procedure, in this embodiment, predict that the method that dog reset occurs comprises:
201, when MCU working procedure, MCU periodically enters timer interruption handling procedure according to the period 1;
202, the value identified in this timer interruption handling procedure is judged;
In the present embodiment, this period 1 is time cycle of timer interruption, when MCU working procedure, MCU periodically can enter timer interruption handling procedure according to the period 1, the numerical value of this period 1 does not limit, period 1 can be a few second, also can be several milliseconds, it can also be a few microsecond, in actual applications, under the prerequisite of systemic-function not affecting MCU place, the numerical value of period 1 is the smaller the better, reach in units of millisecond or microsecond, whether this mark is used to indicate will there is dog reset, the value of this mark comprises the first numerical value and second value, this first numerical value is used to indicate and dog reset will occur, in actual applications, the value of this mark does not limit, it can be numeral, letter, or character string, the present embodiment for the first numerical value for TURE and second value for FLASE is described.
If when the value of 203 marks judged is as the first numerical value, then determine that dog will occur to be resetted;
204, DDR is switched to self-refresh mode by MCU, and waits for that dog occurs to be resetted;
205, when dog has resetted, DDR is switched back normal mode of operation by MCU.
In the present embodiment, if when the value of this mark is the first numerical value, then this MCU can determine that dog will occur to be resetted, and in actual applications, when the value of this mark is TURE, this MCU determines that dog will occur to be resetted.
If the value of 206 marks is second value, then calculate the unclear dog time;
In the present embodiment, this second value is used to indicate and calculates the unclear dog time, this unclear dog time is a time range, the unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, in actual applications, when MCU enters into timer interruption handling procedure and the value of satisfied mark is the condition of second value, MCU can determine the moment of the last clear dog by timer interruption handling procedure and determine the current moment performing the calculating unclear dog time, then MCU calculates the unclear dog time by timer interruption handling procedure, such as, setting second value is FALSE, when the value of the mark determined is FALSE, MCU calculates the unclear dog time.
House dog itself has timer conter function, clear dog is that the timer conter of house dog is reset to 0, MCU can carry out dog clearly according to the clear dog operation preset, such as, if the cycle that dog reset occurs is 3 minutes, when MCU performs clear dog, the timer conter of house dog is reset to 0, now the timer conter of house dog needs from 0, to be again accumulated to 3 minutes just can to occur dog and resets.
207, judge whether the unclear dog time is greater than or equal to preset value, if be greater than or equal to preset value, then perform step 208, if be less than preset value, then perform step 209;
208, the value arranging mark is the first numerical value, and dog reset will occur when determining to enter timer interruption handling procedure again;
209, determine it is not dog will occur reset, the unclear dog time is added up.
In the present embodiment, after step 206, judge whether the unclear dog time calculated is greater than or equal to preset value, if this unclear dog time is greater than or equal to preset value, the value then arranging mark is the first numerical value, and dog reset when determining to enter timer interruption handling procedure again, will be there is, if the unclear dog time is less than preset value, then MCU determines it is not dog will occur reset, and the unclear dog time is added up, wherein, this preset value is for deducting this period 1 and threshold value sum this second round, this second round is the time cycle that dog reset occurs, the value of this mark also comprises the first numerical value, this first numerical value is used to indicate and dog reset will occur, in the present embodiment with the first numerical value for TRUE and second value are for FLASE is for being described, such as, the unclear dog time calculated is Y, second round is X, period 1 is T0, threshold value is Δ T, if Y>=X-T0-Δ T, then the value of mark is set to TURE, if Y<X-T0-Δ T, the then accumulative unclear dog time, until Y>=X-T0-Δ T.
Y>=X-T0-Δ T due to what arrange in the present embodiment, so after the value of mark is set to TURE, DDR can not be switched to self-refresh mode, and MCU exits timer interruption handling procedure, after it's the T0 time has past again the time, MCU enters timer interruption handling procedure again, now judges that DDR could be switched to self-refresh mode as TURE, MCU by the value identified.
Further, the value arranging mark as MCU is the first numerical value, and after will there is dog reset when determining to enter timer interruption handling procedure again, MCU can repeat step 201-205 in above-described embodiment.It should be noted that, threshold value Δ T in the present embodiment is the reserved time window of dog reset, the value of threshold value depends on that MCU performs time DDR being switched to self-refresh mode, because MCU is when being switched to self-refresh mode by DDR, need to run in timer interruption handling procedure to make DDR be in the program of self-refresh mode, the object of window of setting aside some time guarantees that DDR, before being in the program of self-refresh mode, dog reset can not occur.
In the present embodiment, if the program that MCU runs enters timer interruption handling procedure, MCU judges the value of the mark in timer interruption handling procedure, if the value of mark is the first numerical value, then determine that dog will occur to be resetted, if the value of mark is second value, then calculate the unclear dog time, and determine whether to be set to the first numerical value to the value identified with comparing of preset value according to the unclear dog time calculated, and dog reset when determining to enter timer interruption handling procedure again, will be there is, can predict like this when again entering timer interruption handling procedure and dog reset will occur, then before generation dog resets, DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, and then reduce program operationally factor data change and occur abnormal behaviour.
Interrupt handling routine comprises: abnormal interrupt handling routine and timer interruption handling procedure, Fig. 3 describes prediction dog when program that MCU runs enters abnormal interrupt handling routine and timer interruption handling procedure and to reset the process flow diagram occurred, concrete, this embodiment comprises:
301, MCU working procedure;
302, MCU judges that the program run enters abnormal interrupt handling routine;
303, MCU determines that dog will occur to be resetted;
304, MCU periodically enters timer interruption handling procedure according to the period 1;
305, judge the value identified in timer interruption handling procedure, if the value of mark is the first numerical value, then perform step 303, if the value of mark is second value, then perform step 306;
306, the unclear dog time is calculated;
307, judge whether the unclear dog time is greater than or equal to preset value, if the unclear dog time is greater than or equal to preset value, then perform step 308, if the unclear dog time is less than preset value, then perform step 309;
308, the value arranging mark is the first numerical value, and dog reset will occur when determining to enter timer interruption handling procedure again;
309, determine it is not dog will occur reset, and the unclear dog time is added up;
310, after step 303, DDR is switched to self-refresh mode by MCU, and waits for that dog occurs to be resetted.
It should be noted that, MCU, can repeated execution of steps 304-305 after completing steps 308.
In the present embodiment, this preset value is deduct period 1 and threshold value sum second round, period 1 is time cycle of timer interruption, second round is the time cycle that dog reset occurs, threshold value is the time window that dog reset is reserved, and whether this mark is used to indicate dog reset will occur, and the value of mark comprises the first numerical value and second value, this first numerical value is used to indicate and dog reset will occur, and this second value is used to indicate and calculates the unclear dog time.
Setting abnormal interrupt handling routine is program A, timer interruption handling procedure is program B, the program that DDR is switched to self-refresh mode by MCU is program C, period 1 is T0, and second round is X, and threshold value is Δ T, the accumulative unclear dog time is Y, first numerical value of mark CFLAG is TURE, and the second value of mark CFLAG is FLASE, original state CFLAG is FLASE.
First step, MCU working procedure;
Second step, if MCU judges that the program run enters program A, then jumps to program C, and namely in program A, working procedure C, so that DDR is switched to self-refresh mode, waits for that dog occurs to be resetted;
Third step, if the program that MCU runs enters program B, the value of CFLAG in decision procedure B;
4th step, if CFLAG is TURE, then jumps to program C, and namely in program B, working procedure C, so that DDR is switched to self-refresh mode, waits for that dog occurs to be resetted;
5th step, after dog has resetted, DDR has been switched back normal mode of operation by MCU;
6th step, if CFLAG is FLASE, then calculates Y, and judges Y whether >=X-T0-Δ T;
7th step, if Y>=X-T0-Δ T, is then set to TURE by CFLAG; If Y<X-T0-Δ T, then continue accumulative Y.
After CFLAG being set to TURE in the 7th step, repeat third step to the 5th step.
In the present embodiment, MCU by determine run program enter abnormal interrupt handling routine still enter timer interruption handling procedure perform different operations to determine will occur dog reset, then DDR is switched to self-refresh mode, and wait for that dog occurs to be resetted, can predict like this and dog reset will occur, then before generation dog resets, DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, so reduce program operationally factor data change and occur abnormal behaviour.
Be described the MCU of the embodiment of the present invention for performing the method that the reset of above-mentioned prediction dog occurs below, its basic logical structure is with reference to figure 4, and the MCU in this embodiment comprises:
Running unit 401, determining unit 402 and switch unit 403;
Running unit 401, for working procedure;
For entering interrupt handling routine according to the program run, determining unit 402, determines that dog will occur to be resetted;
Switch unit 403, for DDR is switched to self-refresh mode, and waits for that dog occurs to be resetted.
In the present embodiment, determining unit 402 enters interrupt handling routine according to the program run and determines that dog will occur to be resetted, then DDR is switched to self-refresh mode by switch unit 403, and wait for that dog occurs to be resetted, can predict like this and dog reset will occur, then generation dog reset before DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, so reduce program operationally factor data change and occur abnormal behaviour.
The unit comprised MCU with a specific embodiment below and the mutual of element are described the data interactive mode in MCU, refer to Fig. 5, when interrupt handling routine is timer interruption handling procedure, in this embodiment, MCU comprises: running unit 501, determining unit 502 and switch unit 503;
Determining unit 502 comprises: the first judgment sub-unit 5021, first determine subelement 5022,
Computation subunit 5023, second judgment sub-unit 5024, arrange and determine subelement 5025, accumulative determine subelement 5026.
Running unit 501 periodically enters timer interruption handling procedure according to the period 1, and wherein this period 1 is the time cycle of timer interruption, then informs that the first judgment sub-unit 5021 has entered timer interruption handling procedure.
First judgment sub-unit 5021 judges the value identified in this timer interruption handling procedure, whether this mark is used to indicate will there is dog reset, the value of this mark comprises the first numerical value, this first numerical value is used to indicate and dog reset will occur, if the value of mark is the first numerical value, then inform that first determines subelement 5022, if the value of mark is second value, then inform computation subunit 5023.
First determines that subelement 5022 is when to receive the first judgment sub-unit 5021 judged result be the first numerical value, determines that dog will occur to be resetted, and then informs that switch unit 503 dog will occur and resets.
DDR is switched to self-refresh mode by switch unit 503, and waits for that this dog occurs to be resetted, and in actual applications, after dog has resetted, DDR can also be switched back normal mode of operation by switch unit 503.
Computation subunit 5023 calculates the unclear dog time, then the result calculated is sent to the second judgment sub-unit 5024, this unclear dog time is a time range, the unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, in actual applications, when running unit 501 enters into timer interruption handling procedure and the value of satisfied mark is the condition of second value, running unit 501 can be determined the moment of the last clear dog by timer interruption handling procedure and determine the current moment performing the calculating unclear dog time, in the present embodiment for the first numerical value for TURE and second value for FALSE is described, such as, setting second value is FALSE, when the value identified is FALSE, computation subunit 5023 calculates the unclear dog time.
Second judgment sub-unit 5024 judges whether the unclear dog time is greater than or equal to preset value, if the unclear dog time is greater than or equal to preset value, then judged result is informed arrange and determine subelement 5025, if the unclear dog time is less than preset value, then judged result is informed and add up to determine subelement 5026, this preset value is deduct period 1 and threshold value sum second round, and this second round is the time cycle that dog reset occurs.
If the unclear dog time is greater than or equal to preset value, arranges and determine that the value that subelement 5025 arranges mark is the first numerical value, and determine that dog will occur when entering this timer interruption handling procedure again to be resetted.
If the unclear dog time is less than preset value, adding up to determine that subelement 5026 is determined is not dog will occur reset, and is added up this unclear dog time.
In actual applications, the unclear dog time calculated is Y, second round is X, period 1 is T0, and threshold value is Δ T, if Y>=X-T0-Δ T, then the value of mark is set to the first numerical value, if Y<X-T0-Δ T, now carry out the accumulative unclear dog time, until Y>=X-T0-Δ T.
Y>=X-T0-Δ T due to what arrange in the present embodiment, so after the value of mark is set to TURE, DDR can not be switched to self-refresh mode, and running unit 501 exits timer interruption handling procedure, after it's the T0 time has past again the time, running unit 501 enters timer interruption handling procedure again, if the value of mark is that DDR could be switched to self-refresh mode by TURE, MCU.
It should be noted that, threshold value Δ T in the present embodiment is the reserved time window of dog reset, the value of threshold value depends on that MCU performs time DDR being switched to self-refresh mode, because MCU is when being switched to self-refresh mode by DDR, need to run in timer interruption handling procedure to make DDR be in the program of self-refresh mode, the object of window of setting aside some time guarantees that DDR, before being in the program of self-refresh mode, dog reset can not occur.
In the present embodiment, running unit 501 periodically enters timer interruption handling procedure according to the period 1, first judgment sub-unit 5021 judges the value identified in timer interruption handling procedure, if the value of mark is the first numerical value, then first determines that subelement 5022 determines that dog will occur to be resetted, if the value of mark is second value, then computation subunit 5023 calculates the unclear dog time, and by the second judgment sub-unit 5024 comparing the unclear dog time calculated and preset value to determine to arrange and determine whether subelement 5025 is set to the first numerical value to the value identified, and dog reset when determining to enter timer interruption handling procedure again, will be there is, can predict like this and dog reset will occur, then before generation dog resets, DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, and then reduce program operationally factor data change and occur abnormal behaviour.
It should be noted that, in embodiments of the present invention, the repertoire of running unit, determining unit, determining unit neutron cells and switch unit can be realized by hardware completely, is namely realized by the algorithm performed by logical integrated circuit completely.Alternatively, the mode that the repertoire of running unit, determining unit, determining unit neutron cells and switch unit also combines by software and hardware realizes, and namely described logical integrated circuit can perform computing to complete described function under the driving of drive software.
Below the embedded system of the embodiment of the present invention for performing the method that the reset of above-mentioned prediction dog occurs is described, its basic logical structure is with reference to figure 6, embedded system embodiment in the embodiment of the present invention, this system comprises: MCU601, DDR602 and house dog 603;
MCU601 is connected with DDR602 with house dog 603 respectively;
MCU601 comprises: running unit 6011, determining unit 6012 and switch unit 6013;
Running unit 6011, for working procedure;
For entering interrupt handling routine according to this program run, determining unit 6012, determines that dog will occur to be resetted;
Switch unit 6013, for DDR is switched to self-refresh mode, and waits for that this dog occurs to be resetted.
Alternatively, when interrupt handling routine is timer interruption handling procedure, running unit 6011 is also for periodically entering timer interruption handling procedure according to the period 1;
In MCU601, determining unit 6012 comprises: the first judgment sub-unit 60121 and first determines subelement 60122;
First judgment sub-unit 60121, for judging the value identified in this timer interruption handling procedure, whether this mark is used to indicate will there is dog reset, and the value of this mark comprises the first numerical value, and this first numerical value is used to indicate and dog reset will occur;
First determines subelement 60122, for when the value of this mark is the first numerical value, determines that dog will occur to be resetted.
Alternatively, in MCU601, determining unit 6012 also comprises: computation subunit 60123, second judgment sub-unit 60124, arrange and determine subelement 60125 and accumulative determine subelement 60126;
Computation subunit 60123, for when the value of this mark is this second value, calculates the unclear dog time;
Second judgment sub-unit 60124, for judging whether this unclear dog time is greater than or equal to preset value;
Arrange and determine subelement 60125, for when this unclear dog time is greater than or equal to this preset value, the value of this mark is set for this first numerical value, and determine that dog will occur when entering this timer interruption handling procedure again to be resetted;
Add up to determine subelement 60126, for when the unclear dog time is less than this preset value, determines it is not dog will occur reset, and this unclear dog time is added up.
Further, the period 1 is the time cycle of timer interruption, and second round is the time cycle that dog reset occurs; The unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing; Preset value is for deducting this period 1 and threshold value sum this second round; Whether mark is used to indicate will there is dog reset, and this mark comprises: the first numerical value and second value, and this first numerical value is used to indicate and dog reset will occur, and this second value is used to indicate and dog reset will occur.
In the present embodiment, MCU601 enters interrupt handling routine according to this program run and determines that dog will occur to be resetted, then DDR602 is switched to self-refresh mode, and wait for that house dog 603 dog occurs and resets, can predict like this and dog reset will occur, then generation dog reset before DDR is switched to self-refresh mode, can ensure to there will not be saltus step in dog reseting period DDR data, so reduce program operationally factor data change and occur abnormal behaviour.
Those of ordinary skill in the art can recognize, in conjunction with unit and the algorithm steps of each example of embodiment disclosed herein description, can realize with the combination of electronic hardware or computer software and electronic hardware.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel can use distinct methods to realize described function to each specifically should being used for, but this realization should not thought and exceeds scope of the present invention.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the specific works process of the system of foregoing description, device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiments that the application provides, should be understood that disclosed system, apparatus and method can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.
If described function using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part of the part that technical scheme of the present invention contributes to prior art in essence in other words or this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. various can be program code stored medium.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; change can be expected easily or replace, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should described be as the criterion with the protection domain of claim.

Claims (9)

1. predict and it is characterized in that the method that dog reset occurs, comprising:
When microcontroller working procedure, MCU enters interrupt handling routine according to the described program run and determines that dog will occur to be resetted;
Double Data Rate synchronous DRAM DDR is switched to self-refresh mode by described MCU, and waits for that described dog occurs to be resetted.
2. method according to claim 1, is characterized in that, described interrupt handling routine is timer interruption handling procedure, and described MCU enters interrupt handling routine according to the described program run and determines that dog reset will occur to be comprised:
Described MCU periodically enters timer interruption handling procedure according to the period 1, and the described period 1 is the time cycle of timer interruption;
Judge the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
If the value of described mark is described first numerical value, then described MCU determines that dog will occur to be resetted.
3. method according to claim 2, is characterized in that, the value of described mark also comprises second value, and described second value is used to indicate and calculates the unclear dog time;
Also comprise after judging the value identified in described timer interruption handling procedure:
If the value of described mark is described second value, then described MCU calculates the unclear dog time;
Judge whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
If the described unclear dog time is greater than or equal to described preset value, then the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
If the described unclear dog time is less than described preset value, then determines it is not dog will occur reset, and the described unclear dog time is added up.
4. a microcontroller, is characterized in that, described MCU comprises:
Running unit, for working procedure;
For entering interrupt handling routine according to the described program run, determining unit, determines that dog will occur to be resetted;
Switch unit, for Double Data Rate synchronous DRAM DDR is switched to self-refresh mode, and waits for that described dog occurs to be resetted.
5. MCU according to claim 4, is characterized in that, described interrupt handling routine is timer interruption handling procedure, described running unit, also for periodically entering timer interruption handling procedure according to the period 1, wherein, the described period 1 is the time cycle of timer interruption;
Described determining unit comprises:
First judgment sub-unit, for judging the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
First determines subelement, for when the value of described mark is the first numerical value, determines that dog will occur to be resetted.
6. MCU according to claim 5, is characterized in that, the value of described mark also comprises second value, and described second value is used to indicate and calculates the unclear dog time;
Described determining unit also comprises:
Computation subunit, for when the value of described mark is described second value, calculates the unclear dog time;
Second judgment sub-unit, for judging whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
Arrange and determine subelement, for when the described unclear dog time is greater than or equal to described preset value, the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
Add up to determine subelement, for when the described unclear dog time is less than described preset value, determines it is not dog will occur reset, and the described unclear dog time is added up.
7. an embedded system, is characterized in that, described system comprises:
Microcontroller, Double Data Rate synchronous DRAM DDR and house dog;
Described MCU is connected with described DDR with described house dog respectively;
Described MCU comprises: running unit, determining unit and switch unit;
Described running unit, for working procedure;
For entering interrupt handling routine according to the described program run, described determining unit, determines that dog will occur to be resetted;
Described switch unit, for Double Data Rate synchronous DRAM DDR is switched to self-refresh mode, and waits for that described dog occurs to be resetted.
8. system according to claim 7, is characterized in that, described interrupt handling routine is timer interruption handling procedure, described running unit, also for periodically entering timer interruption handling procedure according to the period 1, wherein, the described period 1 is the time cycle of timer interruption;
Described in described MCU, determining unit comprises: the first judgment sub-unit and first determines subelement;
Described first judgment sub-unit, for judging the value identified in described timer interruption handling procedure, whether described mark is used to indicate will there is dog reset, and the value of described mark comprises the first numerical value, and described first numerical value is used to indicate and dog reset will occur;
Described first determines subelement, for when the value of described mark is the first numerical value, determines that dog will occur to be resetted.
9. system according to claim 8, is characterized in that, the value of described mark also comprises second value, and described second value is used to indicate and calculates the unclear dog time;
Described in described MCU, determining unit also comprises: computation subunit, the second judgment sub-unit, arrange and determine subelement and accumulative determine subelement;
Described computation subunit, for when the value of described mark is described second value, calculates the unclear dog time;
Described second judgment sub-unit, for judging whether the described unclear dog time is greater than or equal to preset value; Wherein, the described unclear dog time be from the last time clear dog moment calculate moment of unclear dog time to performing, described preset value is deduct described period 1 and threshold value sum second round, and described second round is that the time cycle that dog resets occurs;
Described setting determines subelement, and for when the described unclear dog time is greater than or equal to described preset value, the value arranging described mark is described first numerical value, and dog reset will occur when determining to enter described timer interruption handling procedure again;
Described adding up determines subelement, for when the described unclear dog time is less than described preset value, determines it is not dog will occur reset, and is added up the described unclear dog time.
CN201410063269.4A 2014-02-24 2014-02-24 A kind of prediction dog resets method, microcontroller and the embedded system of generation Active CN104866051B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410063269.4A CN104866051B (en) 2014-02-24 2014-02-24 A kind of prediction dog resets method, microcontroller and the embedded system of generation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410063269.4A CN104866051B (en) 2014-02-24 2014-02-24 A kind of prediction dog resets method, microcontroller and the embedded system of generation

Publications (2)

Publication Number Publication Date
CN104866051A true CN104866051A (en) 2015-08-26
CN104866051B CN104866051B (en) 2018-09-07

Family

ID=53911941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410063269.4A Active CN104866051B (en) 2014-02-24 2014-02-24 A kind of prediction dog resets method, microcontroller and the embedded system of generation

Country Status (1)

Country Link
CN (1) CN104866051B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463459A (en) * 2017-08-14 2017-12-12 青岛海信电器股份有限公司 Store method, device, system and the terminal device of system exception internal storage data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5537564A (en) * 1993-03-08 1996-07-16 Zilog, Inc. Technique for accessing and refreshing memory locations within electronic storage devices which need to be refreshed with minimum power consumption
CN1215865A (en) * 1997-10-27 1999-05-05 摩托罗拉公司 Circuit and method for retaining data in DRAM in portable electronic device
CN1436333A (en) * 2000-06-09 2003-08-13 摩托罗拉公司 Integrated processor platform supporting wireless handheld multimedia devices
CN1945555A (en) * 2006-11-01 2007-04-11 华为技术有限公司 Method and device for preventing internal storage data from losing
CN101311910A (en) * 2008-06-27 2008-11-26 北京星网锐捷网络技术有限公司 Hardware reset control method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5537564A (en) * 1993-03-08 1996-07-16 Zilog, Inc. Technique for accessing and refreshing memory locations within electronic storage devices which need to be refreshed with minimum power consumption
CN1215865A (en) * 1997-10-27 1999-05-05 摩托罗拉公司 Circuit and method for retaining data in DRAM in portable electronic device
CN1436333A (en) * 2000-06-09 2003-08-13 摩托罗拉公司 Integrated processor platform supporting wireless handheld multimedia devices
CN1945555A (en) * 2006-11-01 2007-04-11 华为技术有限公司 Method and device for preventing internal storage data from losing
CN101311910A (en) * 2008-06-27 2008-11-26 北京星网锐捷网络技术有限公司 Hardware reset control method and apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463459A (en) * 2017-08-14 2017-12-12 青岛海信电器股份有限公司 Store method, device, system and the terminal device of system exception internal storage data

Also Published As

Publication number Publication date
CN104866051B (en) 2018-09-07

Similar Documents

Publication Publication Date Title
US9733844B2 (en) Data migration method, data migration apparatus, and storage device
CN104700886B (en) Memory circuit with power supply status sensor
US8402232B2 (en) Memory utilization tracking
JP5425887B2 (en) System and method for extending the useful life of a portable device
US20230297243A1 (en) Method and apparatus for predicting service life of solid-state disk, and computer-readable storage medium
KR20070039176A (en) Method and apparatus to establish, report and adjust system memory usage
US20120143577A1 (en) Prioritizing well drilling propositions
EP3200085A1 (en) Data saving method and device and terminal
CN104115091A (en) Multi-level cpu high current protection
CN105260267B (en) A kind of method for refreshing data and solid state hard disk
US10642342B2 (en) Predicting voltage guardband and operating at a safe limit
CN111142644A (en) Hard disk operation control method and device and related components
CN105786552A (en) Memory clearing method and electronic equipment
CN104749943A (en) Screen light-up method and device and intelligent watch
CN103890713A (en) Apparatus and method for managing register information in a processing system
CN104866051A (en) Method for predicting watchdog resetting, microcontroller and embedded system
CN103823711A (en) Method and device for providing relative timing in Java virtual machine
CN107885626A (en) The system of on-chip system programming device starts the device and method of Autonomous test
CN103493023A (en) System and detection method
CN110633169B (en) Backup computer storage system
CN106502929B (en) A kind of target device, a kind of processing method and processing device of internal storage data
CN109298992A (en) Electronic device and starting time calculation method
CN106326599B (en) System state monitoring method and device for multiprocessor system simulation
WO2017014731A1 (en) Operating frequency determination
CN111400151B (en) Method, device and equipment for monitoring residual life of hard disk

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant