CN104866051B - A kind of prediction dog resets method, microcontroller and the embedded system of generation - Google Patents
A kind of prediction dog resets method, microcontroller and the embedded system of generation Download PDFInfo
- Publication number
- CN104866051B CN104866051B CN201410063269.4A CN201410063269A CN104866051B CN 104866051 B CN104866051 B CN 104866051B CN 201410063269 A CN201410063269 A CN 201410063269A CN 104866051 B CN104866051 B CN 104866051B
- Authority
- CN
- China
- Prior art keywords
- dog
- value
- time
- unclear
- reset
- 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.)
- Active
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of method, microcontroller and embedded system that the reset of prediction dog occurs, MCU enters interrupt handling routine determination according to the program of operation will occur dog reset, then DDR is switched to self-refresh mode, and it waits for and dog reset occurs, can predict in this way will occur dog reset, then DDR is switched to self-refresh mode before dog occurs and resets, it can ensure that DDR data are not in saltus step during dog resets, and then reduce the abnormal behaviour that program occurs by data variation at runtime.
Description
Technical field
The present embodiments relate to fields of communication technology more particularly to a kind of prediction dog to reset the method occurred, microcontroller
Device and embedded system.
Background technology
With the fast development of embedded device, the complexity of embedded software is also constantly rising, house dog and great Rong
The data storage device of amount is widely used.House dog is for monitoring and managing microcontroller, digital signal processor(DSP,
Digital Signal Processor)Equal microcontrollers(MCU, Micro Control Unit)Reset circuit, MCU is normal
It when operation, gives house dog one pulse signal every certain time by system software, is commonly called as " feeding dog ".If more than when regulation
Between house dog do not receive " feed dog " signal, house dog exports a pulse to the reset pin of MCU, MCU is made to reset.
Double Data Rate synchronous DRAM(DDR, Double Data Rate)When storing data, MCU pairs is needed
DDR provides clock and carries out Refresh Data in real time.But in dog reseting procedure, MCU will not provide clock to DDR, DDR storages
There are the risks of loss of data during dog resets for data, and saltus step may be occurred by causing dog to reset front and back DDR data, be caused
The abnormal behaviour of the program of MCU operations.
Invention content
In view of the disadvantages described above of the prior art, the present invention provide it is a kind of prediction dog reset occur method, microcontroller and
Embedded system solves in the prior art, and MCU will not provide clock to DDR, before caused dog resets during being resetted due to dog
The problem of saltus step, may occur for DDR data afterwards.
The first aspect of the embodiment of the present invention provides a kind of method that the reset of prediction dog occurs, including:
When microcontroller runs program, MCU enters interrupt handling routine determination according to the described program of operation will
Dog occurs to reset;
Double Data Rate synchronous DRAM DDR is switched to self-refresh mode by the MCU, and is waited for described in generation
Dog resets.
In conjunction with the embodiment of the present invention in a first aspect, the first embodiment of the first aspect in the embodiment of the present invention
In, the interrupt handling routine is timer interruption processing routine, and the MCU enters interrupt processing according to the described program of operation
Dog reset will occur for program determination:
The MCU periodically enters timer interruption processing routine according to the period 1, and the period 1 is timer
The time cycle of interruption;
Judge that the value identified in the timer interruption processing routine, the mark are used to indicate whether that dog to be occurred is answered
The value of position, the mark includes the first numerical value, and first numerical value, which is used to indicate, will occur dog reset;
If the value of the mark is first numerical value, dog reset will occur for the MCU determinations.
In conjunction with the first embodiment of the first aspect of the embodiment of the present invention, in the first aspect of the embodiment of the present invention
In second of embodiment, the value of the mark further includes second value, when the second value is used to indicate calculating unclear dog
Between;
Judge that the value of the mark in the timer interruption processing routine further includes later:
If the value of the mark is the second value, the MCU calculates the unclear dog time;
Judge whether the unclear dog time is more than or equal to preset value;Wherein, the unclear dog time is from nearest
To at the time of executing the calculating unclear dog time at the time of primary clear dog, the preset value is second round to subtract the period 1
The sum of with threshold value, the second round is the time cycle that dog occurs and resets;
If the unclear dog time is more than or equal to the preset value, the value that the mark is arranged is first number
Value, and determine that dog reset will occur for the when of again going into the timer interruption processing routine;
If the unclear dog time is less than the preset value, it is determined that be not dog reset to be occurred, and will be described unclear
The dog time is added up.
The second aspect of the embodiment of the present invention provides a kind of microcontroller, and the MCU includes:
Running unit, for running program;
For entering interrupt handling routine determination according to the described program of operation dog reset will occur for determination unit;
Switch unit for Double Data Rate synchronous DRAM DDR to be switched to self-refresh mode, and waits pending
The raw dog resets.
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
In, including:The interrupt handling routine is timer interruption processing routine, and the running unit was additionally operable to according to the period 1
Periodically enter timer interruption processing routine, wherein the period 1 is the time cycle of timer interruption;
The determination unit includes:
First judgment sub-unit, the value for judging to identify in the timer interruption processing routine, the mark are used for
Indicate whether that dog to be occurred resets, the value of the mark includes the first numerical value, and first numerical value is used to indicate and will occur
Dog resets;
First determination subelement, for when the value of the mark is the first numerical value, dog reset will to occur for determination.
In conjunction with the first embodiment of the second aspect of the embodiment of the present invention, in the second aspect of the embodiment of the present invention
In second of embodiment, including:The value of the mark further includes second value, and it is unclear that the second value is used to indicate calculating
The dog time;
The determination unit further includes:
Computation subunit, for when the value of the mark is the second value, calculating the unclear dog time;
Second judgment sub-unit, for judging whether the unclear dog time is more than or equal to preset value;Wherein, described
The unclear dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of, the preset value is second week
Phase subtracts the sum of the period 1 and threshold value, and the second round is the time cycle that dog occurs and resets;
Determination subelement is set, is used for when the unclear dog time being more than or equal to the preset value, described in setting
The value of mark is first numerical value, and it is multiple to determine that dog will occur for the when of again going into the timer interruption processing routine
Position;
Accumulative determination subelement, for when the unclear dog time being less than the preset value, determination not to be to occur
Dog resets, and the unclear dog time is added up.
The third aspect of the embodiment of the present invention provides a kind of embedded system, the system comprises:
Microcontroller, Double Data Rate synchronous DRAM DDR and house dog;
The MCU is connected with the house dog and the DDR respectively;
The MCU includes:Running unit, determination unit and switch unit;
The running unit, for running program;
The determination unit, for entering interrupt handling routine determination according to the described program of operation, that dog will occur will be multiple
Position;
The switch unit for Double Data Rate synchronous DRAM DDR to be switched to self-refresh mode, and waits
Wait that the dog, which 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
In, including:The interrupt handling routine is timer interruption processing routine, and the running unit was additionally operable to according to the period 1
Periodically enter timer interruption processing routine, wherein the period 1 is the time cycle of timer interruption;
Determination unit includes described in the MCU:First judgment sub-unit and the first determination subelement;
First judgment sub-unit, the value for judging to identify in the timer interruption processing routine, the mark
It is used to indicate whether that dog to be occurred resets, the value of the mark includes the first numerical value, and first numerical value is used to indicate will
Dog occurs to reset;
First determination subelement, for when the value of the mark is the first numerical value, dog reset will to occur for determination.
In conjunction with the first embodiment of the third aspect of the embodiment of the present invention, in the third aspect of the embodiment of the present invention
In second of embodiment, including:The value of the mark further includes second value, and it is unclear that the second value is used to indicate calculating
The dog time;
Determination unit further includes described in the MCU:Computation subunit, the second judgment sub-unit, setting determination subelement
With accumulative determination subelement;
The computation subunit, for when the value of the mark is the second value, calculating the unclear dog time;
Second judgment sub-unit, for judging whether the unclear dog time is more than or equal to preset value;Wherein,
The unclear dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of, the preset value is the
Two cycles subtract the sum of the period 1 and threshold value, and the second round is the time cycle that dog occurs and resets;
The setting determination subelement, for when the unclear dog time being more than or equal to the preset value, being arranged
The value of the mark is first numerical value, and determines that dog will occur for the when of again going into the timer interruption processing routine
It resets;
The accumulative determination subelement, for when the unclear dog time being less than the preset value, determination not to be that will want
Dog occurs to reset, and the unclear dog time is added up.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages:
The present invention provides a kind of method, microcontroller and embedded system that the reset of prediction dog occurs, and MCU is according to operation
Program, which enters interrupt handling routine determination, will occur dog reset, and DDR is then switched to self-refresh mode, and wait for and dog occurs
It resets, can predict will occur dog reset in this way, and DDR is then switched to self-refresh mode before dog occurs and resets,
It can ensure that DDR data are not in saltus step during dog resets, and then reduce program and occur at runtime because of data variation
Abnormal behaviour.
Description of the drawings
Fig. 1 is that prediction dog resets the method one embodiment schematic diagram occurred in the embodiment of the present invention;
Fig. 2 is that prediction dog resets another embodiment schematic diagram of method occurred in the embodiment of the present invention;
Fig. 3 is that prediction dog resets another embodiment schematic diagram of method occurred in the embodiment of the present invention;
Fig. 4 is MCU one embodiment schematic diagrames in the embodiment of the present invention;
Fig. 5 is another embodiment schematic diagrams of MCU in the embodiment of the present invention;
Fig. 6 is embedded system one embodiment schematic diagram in the embodiment of the present invention.
Specific implementation mode
An embodiment of the present invention provides a kind of prediction dogs to reset method, microcontroller and the embedded system occurred, can
Ensure that DDR data are not in saltus step during dog reset, and then reduces the exception that program occurs by data variation at runtime
Behavior.
In order to make the invention's purpose, features and advantages of the invention more obvious and easy to understand, below in conjunction with the present invention
Attached drawing in embodiment, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that disclosed below
Embodiment be only a part of the embodiment of the present invention, and not all embodiments.Based on the embodiments of the present invention, this field
The every other embodiment that technical staff is obtained, shall fall within the protection scope of the present invention.
Fig. 1 is that prediction dog resets the method one embodiment occurred in the embodiment of the present invention, which includes:
101, when MCU runs program, MCU enters interrupt handling routine determination according to the program of operation will occur dog
It resets;
In the present embodiment, interrupt handling routine includes:Abnormal interrupt processing routine and timer interruption processing routine, MCU
Interrupt handling routine determination can be entered according to the program of operation will occur dog reset(watchdog reset), actually answering
In, after MCU receives abnormal interrupt request, the program of MCU operations enters abnormal interrupt processing routine, when MCU is received
Timer interruption is asked, and the program of MCU operations enters timer interruption processing routine.
102, DDR is switched to self-refresh mode by MCU, and waits for and dog reset occurs.
In the present embodiment, after step 101, i.e., after dog reset will occur for determination, DDR is switched to from brush by MCU
New model, and wait for and dog reset occurs, when DDR is in self-refresh mode, DDR supplies itself clock, to keep itself storing
Data do not lose, MCU cannot access the data stored in DDR at this time, in practical applications, MCU jump directly in MCU with
Machine accesses memory(RAM, Random-Access Memory)On program, DDR is switched to self-refresh mode, wherein MCU use
In operations such as control, communication, command analysis and the execution for completing embedded system, RAM is that the operation of embedded system program is empty
Between, it is located in MCU.
Further, the method for the present embodiment can also include:When dog, which resets, completes, DDR is switched back into normal work by MCU
Operation mode.
In the present embodiment, MCU enters interrupt handling routine determination according to the program of operation will occur dog reset, then will
DDR is switched to self-refresh mode, and waits for and dog reset occurs, and can predict will occur dog reset in this way, then occur
DDR is switched to self-refresh mode before dog reset, can ensure that DDR data are not in saltus step during dog resets, in turn
Reduce the abnormal behaviour that program occurs by data variation at runtime.
In order to make it easy to understand, below with a specific example in the embodiment of the present invention prediction dog reset occur method into
Row description, referring to Fig. 2, when interrupt handling routine is timer interruption processing routine, prediction dog resets hair in the embodiment
Raw method includes:
201, when MCU runs program, MCU periodically enters timer interruption processing routine according to the period 1;
202, judge the value identified in the timer interruption processing routine;
In the present embodiment, which is the time cycle of timer interruption, and when MCU runs program, MCU can root
Periodically enter timer interruption processing routine according to the period 1, the numerical value of the period 1 do not limit, and the period 1 can be with
It it is several seconds, or several milliseconds, can also be several microseconds, in practical applications, the system function where not influencing MCU
Under the premise of, the numerical value of period 1 is the smaller the better, reaches as unit of millisecond or microsecond, the mark be used to indicate whether by
Occur dog reset, the value of the mark includes the first numerical value and second value, which is used to indicate that dog will occur will be multiple
Position, in practical applications, the value of the mark does not limit, and can be number, letter or character string, the present embodiment is with first
Numerical value be TURE and second value be FLASE for illustrate.
203, if it is determined that mark value be the first numerical value when, it is determined that will occur dog reset;
204, DDR is switched to self-refresh mode by MCU, and waits for and dog reset occurs;
205, when dog, which resets, completes, DDR is switched back into normal mode of operation by MCU.
In the present embodiment, if the value of the mark be the first numerical value, the MCU can determination will occur dog reset,
In practical application, when the value of the mark is TURE, which will occur dog reset.
If 206, the value identified is second value, the unclear dog time is calculated;
In the present embodiment, which, which is used to indicate, calculates the unclear dog time, which is a time model
Enclose, the unclear dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of, in practical applications, when
When MCU enters timer interruption processing routine and meets condition of the value of mark for second value, MCU passes through timer interruption
At the time of processing routine can determine the last clear dog and determine it is current execute at the time of calculate the unclear dog time, then MCU
The unclear dog time is calculated by timer interruption processing routine, for example, setting second value as FALSE, when determining mark
When value is FALSE, MCU calculates the unclear dog time.
House dog itself has the function of timer conter, clear dog be the timer conter of house dog is reset into 0, MCU can
To carry out clear dog according to preset clear dog operation, if for example, it is 3 minutes that the period that dog resets, which occurs, when MCU executes clear dog,
The timer conter of house dog is reset to 0, the timer conter needs of house dog are accumulated to since 03 minutes again at this time
Dog reset can just occur.
207, judge whether the unclear dog time is more than or equal to preset value, if more than or equal to preset value, then execute
Step 208, if being less than preset value, 209 are thened follow the steps;
208, the value of setting mark is the first numerical value, and determines that the when of again going into timer interruption processing routine will be sent out
Raw dog resets;
209, determination is not that dog to be occurred resets, and the unclear dog time is added up.
In the present embodiment, after step 206, judge whether the unclear dog time calculated is more than or equal to preset value,
If the unclear dog time is more than or equal to preset value, the value that mark is arranged is the first numerical value, and determines to again go into and determine
When device interrupt handling routine when will occur dog reset, if the unclear dog time be less than preset value, MCU determination be not to occur
Dog resets, and the unclear dog time is added up, wherein the preset value be subtract the second round period 1 and threshold value it
It it is the time cycle that dog occurs and resets with, second round, the value of the mark further includes the first numerical value, and first numerical value is for referring to
Dog reset will be occurred by showing, with the first numerical value be TRUE in the present embodiment and second value be FLASE be illustrate, for example,
The unclear dog time calculated is Y, second round X, period 1 T0, and threshold value is Δ T, if Y>=X-T0- Δ T, then will mark
Value be set as TURE, if Y<X-T0- Δ T then add up the unclear dog time, until Y>=X-T0-ΔT.
By being provided that Y in this present embodiment>=X-T0- Δ T will not be incited somebody to action so after setting the value of mark to TURE
DDR is switched to self-refresh mode, and MCU exits timer interruption processing routine, and after it's the T0 times has past the time again, MCU is again
It is secondary to enter timer interruption processing routine, judge that the value of mark is TURE at this time, DDR could be switched to self-refresh mode by MCU.
Further, it is the first numerical value when the value identified is arranged in MCU, and determines and again go into timer interruption processing journey
After dog reset will occur when sequence, MCU can repeat step 201-205 in above-described embodiment.It should be noted that this
Threshold value Δ T in embodiment is that reserved time window is resetted for dog, and the value of threshold value depends on MCU execution and is switched to DDR certainly
The time of refresh mode needs to transport in timer interruption processing routine since MCU by DDR when being switched to self-refresh mode
The program that DDR is in self-refresh mode is exercised, the purpose for window of setting aside some time is to ensure that DDR is in before the program of self-refresh mode
Dog reset will not occur.
In the present embodiment, if the program of MCU operations enters timer interruption processing routine, MCU judges at timer interruption
The value of the mark in program is managed, if the value of mark is the first numerical value, it is determined that dog reset will occur, if the value of mark is second
Numerical value then calculates the unclear dog time, and is determined whether to mark according to the comparison of the unclear dog time of calculating and preset value
Value is set as the first numerical value, and determines that dog reset will occur for the when of again going into timer interruption processing routine, in this way can be with
Dog reset will be occurred by predicting when being again introduced into timer interruption processing routine, then cut DDR before dog occurs and resets
Change to self-refresh mode, can ensure dog reset during DDR data be not in saltus step, and then reduce program at runtime because
Data variation and the abnormal behaviour occurred.
Interrupt handling routine includes:Abnormal interrupt processing routine and timer interruption processing routine, Fig. 3 describe MCU fortune
Prediction dog resets the flow chart occurred when capable program enters abnormal interrupt processing routine and timer interruption processing routine, specifically
, which includes:
301, MCU runs program;
302, the program of MCU judgements operation enters abnormal interrupt processing routine;
303, dog reset will occur for MCU determinations;
304, MCU periodically enters timer interruption processing routine according to the period 1;
305, judge the value identified in timer interruption processing routine, if the value of mark is the first numerical value, then follow the steps
303, if the value of mark is second value, then follow the steps 306;
306, the unclear dog time is calculated;
307, judge whether the unclear dog time is more than or equal to preset value, preset if the unclear dog time is more than or equal to
Value, thens follow the steps 308, if the unclear dog time is less than preset value, thens follow the steps 309;
308, the value of setting mark is the first numerical value, and determines that the when of again going into timer interruption processing routine will be sent out
Raw dog resets;
309, determination is not that dog to be occurred resets, and the unclear dog time is added up;
310, after step 303, DDR is switched to self-refresh mode by MCU, and waits for and dog reset occurs.
It should be noted that MCU after completing step 308, can repeat step 304-305.
In the present embodiment, which is second round to subtract the sum of period 1 and threshold value, and the period 1 is timer
The time cycle of interruption, second round are the time cycle that dog occurs and resets, and threshold value is that reserved time window, the mark are resetted for dog
Knowledge is used to indicate whether that dog to be occurred resets, and the value of mark includes the first numerical value and second value, and first numerical value is for referring to
Dog reset will be occurred by showing, which, which is used to indicate, calculates the unclear dog time.
Abnormal interrupt processing routine is set as program A, timer interruption processing routine is program B, and DDR is switched to by MCU
The program of self-refresh mode is program C, period 1 T0, second round X, and threshold value is Δ T, and the accumulative unclear dog time is
Y, the first numerical value for identifying CFLAG is TURE, and the second value for identifying CFLAG is FLASE, and original state CFLAG is FLASE.
First step, MCU run program;
Second step jumps to program C, i.e., runs journey in program A if the program of MCU judgement operations enters program A
Sequence C is waited for and dog reset is occurred so that DDR is switched to self-refresh mode;
Third step, if the program of MCU operations enters program B, the value of CFLAG in decision procedure B;
Four steps jumps to program C if CFLAG is TURE, i.e., program C is run in program B to switch DDR
To self-refresh mode, waits for and dog reset occurs;
5th step, after the completion of dog resets, DDR is switched back into normal mode of operation by MCU;
6th step calculates Y, and whether judge Y if CFLAG is FLASE>=X-T0-ΔT;
7th step, if Y>=X-T0- Δ T, then set CFLAG to TURE;If Y<X-T0- Δ T then continue accumulative Y.
After setting CFLAG to TURE in the 7th step, third step is repeated to the 5th step.
In the present embodiment, MCU is still entered in timer by determining that the program of operation enters abnormal interrupt processing routine
Disconnected processing routine executes different operations to determine that dog, which will occur, to be resetted, and is then switched to self-refresh mode, and wait for by DDR
Dog occurs to reset, can predict will occur dog reset in this way, and DDR is then switched to self-refresh before dog occurs and resets
Pattern can ensure that DDR data are not in saltus step during dog resets, and then reduce program at runtime due to data variation
The abnormal behaviour of generation.
The MCU for executing the embodiment of the present invention that above-mentioned prediction dog resets the method occurred is illustrated below,
With reference to figure 4, the MCU in the embodiment includes basic logical structure:
Running unit 401, determination unit 402 and switch unit 403;
Running unit 401, for running program;
For entering interrupt handling routine determination according to the program of operation dog reset will occur for determination unit 402;
Switch unit 403 for DDR to be switched to self-refresh mode, and waits for and dog reset occurs.
In the present embodiment, determination unit 402 according to the program of operation enters interrupt handling routine determination, and that dog will occur will be multiple
Position, then DDR is switched to self-refresh mode by switch unit 403, and waits for and dog reset occurs, and can predict will send out in this way
Raw dog resets, and DDR is then switched to self-refresh mode before dog occurs and resets, can ensure the DDR numbers during dog resets
According to being not in saltus step, and then reduce the abnormal behaviour that program occurs by data variation at runtime.
Below with a specific embodiment to the interaction of MCU each units for including and element to the data interaction in MCU
Mode illustrates, referring to Fig. 5, when interrupt handling routine is timer interruption processing routine, MCU packets in the embodiment
It includes:Running unit 501, determination unit 502 and switch unit 503;
Determination unit 502 includes:First judgment sub-unit 5021, the first determination subelement 5022,
Computation subunit 5023, the second judgment sub-unit 5024, setting determination subelement 5025, accumulative determination subelement
5026。
Running unit 501 periodically enters timer interruption processing routine according to the period 1, and the wherein period 1 is
Then the time cycle of timer interruption informs that the first judgment sub-unit 5021 has been enter into timer interruption processing routine.
First judgment sub-unit 5021 judges the value identified in the timer interruption processing routine, which, which is used to indicate, is
No that dog reset will occur, the value of the mark includes the first numerical value, which, which is used to indicate, will occur dog reset, if mark
The value of knowledge is the first numerical value, then informs the first determination subelement 5022, if the value of mark is second value, informs that calculating is single
Member 5023.
First determination subelement 5022 is determined when it is the first numerical value to receive 5021 judging result of the first judgment sub-unit
Dog reset will occur, then inform that dog reset will occur for switch unit 503.
DDR is switched to self-refresh mode by switch unit 503, and waits for and dog reset occurs, and in practical applications, works as dog
After the completion of reset, DDR can also be switched back into normal mode of operation by switch unit 503.
Computation subunit 5023 calculates the unclear dog time, and the result of calculating is then sent to the second judgment sub-unit
5024, which is a time range, the unclear dog time be from the last clear dog at the time of calculate not to executing
At the time of the clear dog time, in practical applications, when running unit 501 enters timer interruption processing routine and meets mark
When value is the condition of second value, running unit 501 can determine the last clear dog by timer interruption processing routine
At the time of moment and determining current execution calculate the unclear dog time, in the present embodiment be TURE with the first numerical value and second value is
It is illustrated for FALSE, for example, set second value as FALSE, when the value of mark is FALSE, computation subunit 5023
Calculate the unclear dog time.
Second judgment sub-unit 5024 judges whether the unclear dog time is more than or equal to preset value, if the unclear dog time is big
In or equal to preset value, then it will determine that result informs setting determination subelement 5025, if the unclear dog time is less than preset value,
It will determine that result informs accumulative determination subelement 5026, which is second round to subtract the sum of period 1 and threshold value, should
Second round is the time cycle that dog occurs and resets.
If the unclear dog time is more than or equal to preset value, the value that mark is arranged in setting determination subelement 5025 is the first number
Value, and determine that dog reset will occur for the when of again going into the timer interruption processing routine.
If the unclear dog time is less than preset value, the accumulative determination of determination subelement 5026 is not dog reset to be occurred, and will
The unclear dog time is added up.
In practical applications, the unclear dog time of calculating is Y, second round X, period 1 T0, and threshold value is Δ T,
If Y>=X-T0- Δ T, then set the value of mark to the first numerical value, if Y<X-T0- Δ T carry out adding up the unclear dog time at this time,
Until Y>=X-T0-ΔT.
By being provided that Y in this present embodiment>=X-T0- Δ T will not be incited somebody to action so after setting the value of mark to TURE
DDR is switched to self-refresh mode, and running unit 501 exits timer interruption processing routine, when the time crossed again the T0 times it
Afterwards, running unit 501 is again introduced into timer interruption processing routine, if the value of mark is TURE, DDR could be switched to by MCU
Self-refresh mode.
It should be noted that the threshold value Δ T in the present embodiment is to reset reserved time window for dog, the value of threshold value depends on
It is executed in MCU and DDR is switched to time of self-refresh mode needed since MCU by DDR when being switched to self-refresh mode
The program for making DDR be in self-refresh mode is run in timer interruption processing routine, the purpose for window of setting aside some time is to ensure that at DDR
Dog will not occur before the program of self-refresh mode to reset.
In the present embodiment, running unit 501 periodically enters timer interruption processing routine according to the period 1, and first sentences
Disconnected subelement 5021 judges the value identified in timer interruption processing routine, if the value of mark is the first numerical value, first determines
Dog reset will occur for 5022 determination of subelement, if the value of mark is second value, computation subunit 5023 calculates unclear dog
Time, and the comparison of the unclear dog time of calculating and preset value is determined that setting determines son by the second judgment sub-unit 5024
Whether unit 5025 is set as the first numerical value to the value of mark, and when determining and again going into timer interruption processing routine will
Dog occurs to reset, can predict will occur dog reset in this way, and DDR is then switched to self-refresh before dog occurs and resets
Pattern can ensure that DDR data are not in saltus step during dog resets, and then reduce program at runtime due to data variation
The abnormal behaviour of generation.
It should be noted that in embodiments of the present invention, running unit, determination unit, determination unit neutron cells and cut
Changing the repertoire of unit can be realized by hardware completely, i.e., completely by the algorithm performed by logical integrated circuit come real
It is existing.Optionally, the repertoire of running unit, determination unit, determination unit neutron cells and switch unit can also pass through software
It is realized with the mode of combination of hardware, i.e., the described logical integrated circuit can execute operation to complete under the driving of drive software
State function.
The embedded system for executing the embodiment of the present invention that above-mentioned prediction dog resets the method occurred is carried out below
Illustrate, basic logical structure is with reference to figure 6, embedded system one embodiment in the embodiment of the present invention, which includes:
MCU601, DDR602 and house dog 603;
MCU601 is connected with house dog 603 and DDR602 respectively;
MCU601 includes:Running unit 6011, determination unit 6012 and switch unit 6013;
Running unit 6011, for running program;
For entering interrupt handling routine determination according to the program of operation dog reset will occur for determination unit 6012;
Switch unit 6013 for DDR to be switched to self-refresh mode, and waits for and dog reset occurs.
Optionally, when interrupt handling routine is timer interruption processing routine, running unit 6011 is additionally operable to according to the
One cycle enters timer interruption processing routine;
Determination unit 6012 includes in MCU601:First judgment sub-unit 60121 and the first determination subelement 60122;
First judgment sub-unit 60121, the value for judging to identify in the timer interruption processing routine, the mark are used for
Indicate whether that dog to be occurred resets, the value of the mark includes the first numerical value, which is used to indicate that dog will occur will be multiple
Position;
First determination subelement 60122, for when the value of the mark is the first numerical value, dog reset will to occur for determination.
Optionally, determination unit 6012 further includes in MCU601:Computation subunit 60123, the second judgment sub-unit
60124, determination subelement 60125 and accumulative determination subelement 60126 are set;
Computation subunit 60123, for when the value of the mark is the second value, calculating the unclear dog time;
Second judgment sub-unit 60124, for judging whether the unclear dog time is more than or equal to preset value;
Determination subelement 60125 is set, for when the unclear dog time being more than or equal to the preset value, the mark to be arranged
The value of knowledge is first numerical value, and determines that dog reset will occur for the when of again going into the timer interruption processing routine;
Accumulative determination subelement 60126, for when the unclear dog time being less than the preset value, determination not to be dog to be occurred
It resets, and the unclear dog time is added up.
Further, the period 1 is the time cycle of timer interruption, and second round is week time that dog occurs and resets
Phase;The unclear dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of;Preset value be this second
Period subtracts the sum of the period 1 and threshold value;Mark is used to indicate whether that dog to be occurred resets, which includes:First number
Value and second value, which, which is used to indicate, will occur dog reset, which is used to indicate that dog will occur will be multiple
Position.
In the present embodiment, MCU601 enters interrupt handling routine determination according to the program of operation will occur dog reset,
Then DDR602 is switched to self-refresh mode, and waits for house dog 603 that dog occurs and resets, can predict will occur in this way
Dog resets, and DDR is then switched to self-refresh mode before dog occurs and resets, can ensure the DDR data during dog resets
Be not in saltus step, and then reduce the abnormal behaviour that program occurs by data variation at runtime.
Those of ordinary skill in the art may realize that lists described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, depends on the specific application and design constraint of technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be the indirect coupling by some interfaces, device or unit
It closes or communicates to connect, can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in a computer read/write memory medium.Based on this understanding, technical scheme of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be expressed in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment(Can be
People's computer, server or network equipment etc.)It performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory(ROM, Read-Only Memory), arbitrary access deposits
Reservoir(RAM, Random Access Memory), the various media that can store program code such as magnetic disc or CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (6)
1. a kind of prediction dog resets the method occurred, which is characterized in that including:
When microcontroller runs program, MCU will enter interrupt handling routine determination according to the described program of operation to be occurred
Dog resets;
Double Data Rate synchronous DRAM DDR is switched to self-refresh mode by the MCU, and waits for the generation dog multiple
Position;
Wherein, the interrupt handling routine is timer interruption processing routine, during the MCU enters according to the described program of operation
Dog reset will occur for disconnected processing routine determination:
The MCU periodically enters timer interruption processing routine according to the period 1, and the period 1 is timer interruption
Time cycle;
Judge that the value identified in the timer interruption processing routine, the mark are used to indicate whether that dog to be occurred resets;
If the value of the mark is the first numerical value, dog reset will occur for the MCU determinations, and first numerical value is used to indicate
Dog reset will occur.
2. according to the method described in claim 1, it is characterized in that, the value of the mark further includes second value, described second
Numerical value, which is used to indicate, calculates the unclear dog time;
Judge that the value identified in the timer interruption processing routine further includes later:
If the value of the mark is the second value, the MCU calculates the unclear dog time;
Judge whether the unclear dog time is more than or equal to preset value;Wherein, the unclear dog time is from the last time
To at the time of executing the calculating unclear dog time at the time of clear dog, the preset value is second round to subtract the period 1 and threshold
The sum of value, the second round are the time cycle that dog occurs and resets;
If the unclear dog time is more than or equal to the preset value, the value that the mark is arranged is first numerical value,
And determine that dog reset will occur for the when of again going into the timer interruption processing routine;
If the unclear dog time is less than the preset value, it is determined that be not that dog to be occurred resets, and when by the unclear dog
Between added up.
3. a kind of microcontroller, which is characterized in that the MCU includes:
Running unit, for running program;
For entering interrupt handling routine determination according to the described program of operation dog reset will occur for determination unit;
Switch unit for Double Data Rate synchronous DRAM DDR to be switched to self-refresh mode, and waits for and institute occurs
State dog reset;
Wherein, the interrupt handling routine is timer interruption processing routine, and the running unit was additionally operable to according to the period 1
Periodically enter timer interruption processing routine, wherein the period 1 is the time cycle of timer interruption;
The determination unit includes:
First judgment sub-unit, the value for judging to identify in the timer interruption processing routine, the mark are used to indicate
Whether dog reset will be occurred;
First determination subelement is used for when the value of the mark is the first numerical value, and determination will occur dog and reset, and described first
Numerical value, which is used to indicate, will occur dog reset.
4. MCU according to claim 3, which is characterized in that the value of the mark further includes second value, second number
Value, which is used to indicate, calculates the unclear dog time;
The determination unit further includes:
Computation subunit, for when the value of the mark is the second value, calculating the unclear dog time;
Second judgment sub-unit, for judging whether the unclear dog time is more than or equal to preset value;Wherein, described unclear
The dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of, the preset value subtracts for second round
It is the time cycle that dog occurs and resets to go the sum of the period 1 and threshold value, the second round;
Determination subelement is set, for when the unclear dog time being more than or equal to the preset value, the mark to be arranged
Value be first numerical value, and determine dog reset will occur when again going into the timer interruption processing routine;
Accumulative determination subelement, for when the unclear dog time being less than the preset value, determination not to be that dog to be occurred is answered
Position, and the unclear dog time is added up.
5. a kind of embedded system, which is characterized in that the system comprises:
Microcontroller, Double Data Rate synchronous DRAM DDR and house dog;
The MCU is connected with the house dog and the DDR respectively;
The MCU includes:Running unit, determination unit and switch unit;
The running unit, for running program;
For entering interrupt handling routine determination according to the described program of operation dog reset will occur for the determination unit;
The switch unit for Double Data Rate synchronous DRAM DDR to be switched to self-refresh mode, and waits pending
The raw dog resets;
Wherein, the interrupt handling routine is timer interruption processing routine, and the running unit was additionally operable to according to the period 1
Periodically enter timer interruption processing routine, wherein the period 1 is the time cycle of timer interruption;
Determination unit includes described in the MCU:First judgment sub-unit and the first determination subelement;
First judgment sub-unit, the value for judging to identify in the timer interruption processing routine, the mark are used for
Indicate whether that dog to be occurred resets;
First determination subelement, for when the value of the mark is the first numerical value, dog reset will to occur for determination, described
First numerical value, which is used to indicate, will occur dog reset.
6. system according to claim 5, which is characterized in that the value of the mark further includes second value, and described second
Numerical value, which is used to indicate, calculates the unclear dog time;
Determination unit further includes described in the MCU:Computation subunit, the second judgment sub-unit are arranged determination subelement and tire out
Count determination subelement;
The computation subunit, for when the value of the mark is the second value, calculating the unclear dog time;
Second judgment sub-unit, for judging whether the unclear dog time is more than or equal to preset value;Wherein, described
The unclear dog time be from the last clear dog at the time of to execute calculate the unclear dog time at the time of, the preset value is second week
Phase subtracts the sum of the period 1 and threshold value, and the second round is the time cycle that dog occurs and resets;
The setting determination subelement is used for when the unclear dog time being more than or equal to the preset value, described in setting
The value of mark is first numerical value, and it is multiple to determine that dog will occur for the when of again going into the timer interruption processing routine
Position;
The accumulative determination subelement, for when the unclear dog time being less than the preset value, determination not to be to occur
Dog resets, and the unclear dog time is added up.
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 CN104866051A (en) | 2015-08-26 |
CN104866051B true 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) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107463459B (en) * | 2017-08-14 | 2021-02-26 | 海信视像科技股份有限公司 | Method, device and system for storing system abnormal memory data and terminal equipment |
Citations (5)
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 |
-
2014
- 2014-02-24 CN CN201410063269.4A patent/CN104866051B/en active Active
Patent Citations (5)
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 |
Also Published As
Publication number | Publication date |
---|---|
CN104866051A (en) | 2015-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106339058B (en) | Dynamic manages the method and system of power supply | |
CN103676722B (en) | Use interrogation and the response of the security system of the watchdog timer of amendment | |
CN104700886B (en) | Memory circuit with power supply status sensor | |
CN103902364B (en) | A kind of physical resource management method, apparatus and intelligent terminal | |
CN107273231A (en) | Distributed memory system hard disk tangles fault detect, processing method and processing device | |
CN107527648A (en) | The method for refreshing and system of memory | |
CN105260267B (en) | A kind of method for refreshing data and solid state hard disk | |
CN108491311A (en) | A kind of the house dog monitoring method and terminal of real time operating system | |
CN109272728A (en) | A kind of electric quantity managing method and device | |
CN109992366A (en) | Method for scheduling task and dispatching device | |
CN107038137A (en) | A kind of device and method of hot plug | |
CN110465333A (en) | Resin regeneration method, controller, water softening device and computer readable storage medium | |
CN105955101A (en) | Control method, scheduling processor and controller | |
CN106844055A (en) | A kind of execution method and apparatus of task | |
CN110021792A (en) | Charge control method, device, terminal device and computer storage medium | |
CN109766248A (en) | System failure signal acquiring method, device, server and readable storage medium storing program for executing | |
CN104866051B (en) | A kind of prediction dog resets method, microcontroller and the embedded system of generation | |
CN107908271A (en) | Prophylactic applications influence the method, apparatus and intelligent terminal of intelligent terminal power consumption | |
CN109075993A (en) | For managing the device and correlation technique of WI-FI network performance | |
CN106649042B (en) | A kind of processing method and processing unit of cpu load information | |
CN108897646A (en) | A kind of switching method and baseboard management controller of BIOS chip | |
CN111949494A (en) | Task regulation and control method, device and related equipment | |
CN109302445A (en) | Host node state determines method, apparatus, host node and storage medium | |
TWI609268B (en) | Pcie device power state control | |
CN107704317A (en) | Smart machine and its application management method and the device with store function |
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 |