CN117930960A - MCU low-power mode detection method and device - Google Patents

MCU low-power mode detection method and device Download PDF

Info

Publication number
CN117930960A
CN117930960A CN202410016062.5A CN202410016062A CN117930960A CN 117930960 A CN117930960 A CN 117930960A CN 202410016062 A CN202410016062 A CN 202410016062A CN 117930960 A CN117930960 A CN 117930960A
Authority
CN
China
Prior art keywords
mcu
low power
power consumption
mode
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410016062.5A
Other languages
Chinese (zh)
Inventor
张吉红
刘夏聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Geehy Semiconductor Co Ltd
Original Assignee
Zhuhai Geehy Semiconductor 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 Zhuhai Geehy Semiconductor Co Ltd filed Critical Zhuhai Geehy Semiconductor Co Ltd
Priority to CN202410016062.5A priority Critical patent/CN117930960A/en
Publication of CN117930960A publication Critical patent/CN117930960A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/3293Power saving characterised by the action undertaken by switching to a less power-consuming processor, e.g. sub-CPU
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/324Power saving characterised by the action undertaken by lowering clock frequency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/325Power saving in peripheral device
    • G06F1/3275Power saving in memory, e.g. RAM, cache

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)

Abstract

The invention discloses a detection method and a detection device for a low power consumption mode of an MCU (micro control Unit), wherein the detection method comprises the steps of setting a memory based on a predefined initial value, calculating a second numerical value different from the predefined initial value for a storage device with a data volatilization characteristic in a low power consumption state, storing the second numerical value in a backup domain in a backup mode, judging the difference between the second numerical value and the third numerical value after the change of the switching in response to the switching of the MCU from a normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, obtaining a difference result, and obtaining the detection result of the low power consumption mode of the MCU based on at least the difference result and the peripheral register value of the MCU. The MCU low-power consumption detection method can simply, conveniently and accurately verify whether each internal module of the MCU is normally closed, judge which low-power consumption mode the MCU enters, and realize the accurate detection of the corresponding low-power consumption mode.

Description

MCU low-power mode detection method and device
Technical Field
The invention relates to the technical field of chips, in particular to a method and a device for detecting a low-power consumption mode of an MCU.
Background
The MCU design can combine different application scenarios to design low power consumption modes with different power consumption levels, and can be mainly divided into a normal operation mode, a SLEEP mode (SLEEP), a STOP mode (STOP), a STANDBY mode (STANDBY mode), and the like. In the early design stage of the MCU, the designed low-power mode switching needs to be completely verified so as to ensure the complete and error-free function of the designed low-power mode switching. The MCU enters a low power consumption mode by closing internal components such as a core clock, a peripheral clock, a clock source, a memory and the like, so that the power consumption is reduced.
In the existing scheme of low-power mode switching, an instruction is usually sent through an upper computer to enable an MCU to enter different low-power modes, current consumption and state signals of the MCU in the modes are monitored, then the MCU is awakened to return to a normal working mode, and the state signals and the current consumption are monitored again. And judging whether the switching of the MCU in the low power consumption mode is normal or not by comparing the state signals and the current consumption of the MCU in the low power consumption mode and the normal working mode. The test result is fed back to the upper computer for display. However, in the prior art, the low-power mode cannot realize accurate detection, and particularly cannot determine which low-power mode is, and whether the control of the internal module in the corresponding mode is normal or not, so that the switching and detection of the low-power mode in the prior art cannot be widely applied in practice under the condition that the accuracy cannot be completed.
Disclosure of Invention
In order to solve the accuracy of the detection of the low power consumption mode of the MCU in the prior art, according to one aspect of the present invention, there is provided a detection method of the low power consumption mode of the MCU, the detection method comprising,
Setting a memory based on a predefined initial value, the memory being a memory device having data volatilizing properties in a low power consumption state,
Calculating a second numerical value different from the predefined initial value through a calculation model, storing a second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value,
Responding to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second numerical value and the third numerical value after the switching change to obtain a difference result,
The MCU further comprises a peripheral register, the peripheral register pre-stores peripheral register values,
And obtaining an MCU low power consumption mode detection result at least based on the difference result and the MCU peripheral register value.
In some embodiments, the memory is a static random access memory and a synchronous dynamic random access memory.
In some embodiments, the setting a memory based on a predefined initial value specifically includes storing the predefined initial value in any storage space in the memory.
In some embodiments, the step of responding to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second value and the third value after the switching change to obtain a difference result specifically includes responding to the switching of the MCU from the normal operation mode to the low power consumption mode, staying for a first preset time in the low power consumption mode, and then from the low power consumption mode to the normal operation mode, judging the difference between the second value and the third value after the switching change to obtain the difference result.
In some embodiments, the calculation model performs calculations based on run time in a normal run mode prior to a low power mode switch.
In some embodiments, the calculating a second value different from the predefined initial value specifically includes, before the MCU switches from the normal operation mode to the low power consumption mode, calculating a second value associated with the normal operation state time based on a rule that an accumulation operation is performed every second preset time, and using the predefined initial value as a base value.
In some embodiments, the backup domain is an RTC backup register or backup SRAM.
In some embodiments, the obtaining the MCU low power consumption mode detection result at least based on the difference result and the MCU peripheral register value specifically includes obtaining the MCU low power consumption mode detection result based on the difference result, the MCU peripheral register value, and the system clock state from the low power consumption mode to the normal operation mode.
In some embodiments, based on the difference result, the MCU peripheral register value, and the internal clock state from the low power mode to the normal operation mode, the detection result of the MCU low power mode is obtained, which specifically includes that the difference result is the same, the MCU peripheral register value is a reset value, and it is determined that the sleep mode of the MCU is switched normally.
In some embodiments, based on the difference result, the MCU peripheral register value, and the internal clock state from the low power mode to the normal running mode, the detection result of the MCU low power mode is obtained, which specifically includes that the difference result is the same, the MCU peripheral register value is not a reset value, the MCU system clock is an internal high-speed clock, and it is determined that the MCU stop mode is switched normally.
In some embodiments, the method further includes obtaining a detection result of the MCU low power consumption mode based on the difference result, the MCU peripheral register value, and the internal clock state from the low power consumption mode to the normal operation mode, where the difference structure is different, the MCU peripheral register value is not a reset value, and the MCU system clock is an internal high-speed clock, and determining that the MCU on-off mode is switched normally.
A second aspect of the present invention provides an MCU low power consumption mode detection apparatus, the detection apparatus comprising,
A setting unit that sets a memory, which is a memory device having a data volatilization characteristic in a low power consumption state, based on a predefined initial value,
A calculation unit calculating a second value different from the predefined initial value,
A backup unit for storing the second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value,
A judging unit for responding to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second value and the third value after the switching change to obtain a difference result,
And the detection unit is used for obtaining an MCU low-power-consumption mode detection result at least based on the difference result and the MCU peripheral register value.
A third aspect of the present invention provides an MCU chip comprising a processor and a memory, the memory storing a computer program executable by the processor, the processor being operable to execute the computer program to implement a low power mode detection method according to any one of the first aspects of the present invention.
The invention has the beneficial effects that:
According to the MCU low power consumption mode detection method, a predefined initial value is set and stored in a memory, a second numerical value different from the predefined initial value is calculated, a second numerical value backup is stored in a backup domain, the numerical value backed up in the backup domain is a third numerical value, the difference between the second numerical value and the third numerical value after switching is judged in response to switching of the MCU from a normal operation mode to a low power consumption mode and then from the low power consumption mode to the normal operation mode, a difference result is obtained, and an MCU low power consumption mode detection result is obtained at least based on the difference result and the MCU peripheral register numerical value. By skillfully comparing the second numerical value stored in different low-power modes with the third numerical value of the backup domain, and matching with the change of the peripheral register in different low-power modes, the accurate detection of the low-power mode switching is realized, different low-power modes can be detected and distinguished, the verification of whether the internal module is closed in the low-power mode switching is realized, and the judgment of which low-power mode is also realized.
Drawings
FIG. 1 is a flow chart of a method for detecting MCU low power mode according to an embodiment of the invention;
FIG. 2 is a flowchart of a method for detecting a MCU low power mode according to a second embodiment of the present invention;
Fig. 3 is a schematic diagram of an MCU low power consumption mode detection device according to a third embodiment of the present invention;
Detailed Description
The present invention will now be described in further detail with reference to the accompanying drawings, wherein the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implying a number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly and include, for example, either fixedly attached, detachably attached, or integrally formed; may be mechanically connected, may be electrically connected or may be in communication with each other; either directly or indirectly, through intermediaries, or both, may be in communication with each other or in interaction with each other, unless expressly defined otherwise. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
In the present invention, unless expressly stated or limited otherwise, a first feature "up" or "down" a second feature may be the first and second features in direct contact, or the first and second features in indirect contact via an intervening medium. Moreover, a first feature being "above," "over" and "on" a second feature may be a first feature being directly above or obliquely above the second feature, or simply indicating that the first feature is level higher than the second feature. The first feature being "under", "below" and "beneath" the second feature may be the first feature being directly under or obliquely below the second feature, or simply indicating that the first feature is less level than the second feature.
In the above description, descriptions of the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Embodiment one:
Fig. 1 is a schematic flow chart of a method for detecting a low power consumption mode of an MCU according to a first embodiment of the present invention. The MCU low power consumption mode detection method in the embodiment of the invention is applied to an MCU chip, the MCU chip is short for a micro control unit (Microcontroller Unit), the frequency and the specification of a central processing unit (Central Process Unit; CPU) are properly reduced, and functional modules such as a memory (memory), a counter (Timer), USB, A/D conversion, UART, PLC, DMA and the like are integrated on a single chip to form a chip-level micro control computer.
The current MCU design combines the functional characteristics under different use scenes, designs different job number modes, is arranged from high to low according to power consumption, and has four working modes of running a normal running mode, a sleep mode, a stop mode and a standby mode. The MCU is in an operation state after power-on reset, when the kernel does not need to continue to operate, the kernel can select to enter the following three low-power-consumption modes to reduce power consumption, and in the three modes, the power consumption is different, the wake-up time is different, the wake-up source is different, and a user needs to select the optimal low-power-consumption mode according to application requirements. In the prior art, the low power consumption mode is generally switched by sending an instruction through an upper computer to enable the MCU to enter different low power consumption modes, monitoring the current consumption and state signals of the MCU in the modes, waking up the MCU to return to a normal working mode, and monitoring the state signals and the current consumption again. And judging whether the switching of the MCU in the low power consumption mode is normal or not by comparing the state signals and the current consumption of the MCU in the low power consumption mode and the normal working mode. The detection method in the prior art cannot realize accurate detection on the low power consumption mode, particularly in the prior art, whether the low power consumption of the MCU is normal or not is verified by detecting the current change of the MCU entering the low power consumption mode, whether the internal module is closed or not is verified in a detailed and accurate mode, and the specific IP circuits which enter the low power consumption cannot be confirmed through the current change and the IP circuits which do not enter the low power consumption, and meanwhile, the prior art cannot judge which low power consumption mode is entered through the 'whether the internal module is closed or not is verified'.
In order to solve the above-mentioned problems in the existing detection of the low power consumption mode of the MCU, the first embodiment of the present invention provides a detection method of the low power consumption mode of the MCU, which is applied to the MCU chip, and the detection method is that the MCU chip responds to an external detection instruction to perform the completed detection and judgment steps by itself.
The method of detection may include the steps of,
Step S100, setting a memory based on a predefined initial value, wherein the memory is a memory device with data volatilization characteristics in a low power consumption state;
The predefined initial value in the embodiment of the invention can be any preset non-zero value, and the preset mode can be that the MCU automatically generates and stores the initial value in a memory based on a calculation rule in a program of factory pre-firing of the MCU chip, or that a preset non-zero value is set and stored in the memory through the pre-firing program. Because the variables stored in the awakened storage component can be powered down and reset to zero in different low-power consumption modes, the subsequent detection and judgment can be conveniently realized by setting the defined initial value of non-0.
Wherein the memory is a memory device having a data-generating characteristic in a low power consumption state, such as a Static Random Access Memory (SRAM) and a Synchronous Dynamic Random Access Memory (SDRAM), in which data loss occurs because data in a memory cell cannot be maintained due to power interruption or significant reduction. The setting the memory based on the predefined initial value specifically includes storing the predefined initial value in any storage space in the memory. It should be noted that, the predefined initial value sets up the memory, one implementation way is to select a certain address of the memory to store the predefined initial value, and record the storage address of the memory for addressing in the subsequent method flow.
Step S101, calculating a second numerical value different from the predefined initial value through a calculation model, and storing a second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value. The MCU normal operation mode is a normal operation mode of the MCU.
In the embodiment of the invention, any program capable of carrying out a predefined initial value stored in a memory is carried out in a normal working mode of the chip to obtain a second numerical value, wherein the second numerical value is a numerical value obtained after the predefined initial value is subjected to a calculation model processing; the calculation model processing may be any calculation method or calculation model that obtains a second value different from the predefined initial value, as long as the second value different from the defined initial value can be obtained, a preferred and convenient embodiment may select a calculation manner that increases based on the predefined initial value and the elapsed time, and the calculated second value may be stored in the same memory as the defined initial value. In different low power consumption modes, the variable stored in the awakened storage component is powered down to be zeroed, for detection and judgment, the second numerical value backup is stored in the backup domain, the backup numerical value in the backup domain is recorded as a third numerical value, and the third numerical value can provide reference data for subsequent detection and judgment.
In the embodiment of the present invention, the backup domain is a backup storage area capable of receiving protection, so as to prevent write access caused by unexpected power failure or mode switching, and certain special operation steps must be strictly executed to enable access, so that normal storage of data can be maintained in a low power consumption mode.
Step S102, in response to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second numerical value and the third numerical value after the switching change, and obtaining a difference result.
After the predefined initial value storage, the calculation storage of the second numerical value, and the third numerical value obtained after the backup storage of the backup domain are completed, in order to detect the switching of the low power consumption mode of the MCU, the MCU chip responds to the switching instruction, switches from the normal operation mode to the low power consumption mode, and switches from the low power consumption mode to the normal operation mode after the low power consumption mode is operated, so as to obtain the second numerical value after the switching change.
In the embodiment of the invention, the MCU further comprises a peripheral register, and the peripheral register pre-stores peripheral register values.
And step S103, obtaining an MCU low power consumption mode detection result at least based on the difference result and the MCU peripheral register value.
Considering that the difference judgment is carried out on the third value of the second value range after the switching change, only basic detection of the two conditions can be obtained, and the sleep mode and the stop mode cannot be distinguished and detected. Since in sleep mode only the core clock is turned off and the core stops running, the peripheral on the chip peripheral and the core also normally runs, the peripheral registers are reset values, whereas in both the off mode and standby mode the peripheral stops working due to all clocks being turned off, the peripheral registers are not reset values, wherein the reset value refers to the default value stored by the register if this register is not operated, in one embodiment the reset value of the peripheral registers may be 0x4444 4444.
According to the effective effect of the MCU low-power mode detection method in the first embodiment of the invention, a predefined initial value is set and stored in a memory, a second numerical value different from the predefined initial value is calculated, a second numerical value backup is stored in a backup domain, the numerical value backed up in the backup domain is a third numerical value, the difference between the second numerical value and the third numerical value after switching is judged in response to the switching of the MCU from the normal operation mode to the low-power mode and then from the low-power mode to the normal operation mode, a difference result is obtained, and the MCU low-power mode detection result is obtained at least based on the difference result and the MCU peripheral register value. By skillfully comparing the second numerical value stored in different low-power modes with the third numerical value of the backup domain, and matching with the change of the peripheral register in different low-power modes, the accurate detection of the low-power mode switching is realized, different low-power modes can be detected and distinguished, the verification of whether the internal module is closed in the low-power mode switching is realized, and the judgment of which low-power mode is also realized.
Embodiment two:
In the second MCU low power consumption mode detection method of the present invention, in addition to the difference result and the MCU peripheral register value, the MCU low power consumption mode detection result is obtained based on the system clock state after the MCU is switched from the low power consumption mode to the normal operation mode, specifically, in the second MCU low power consumption mode detection method of the present invention,
Step S200: setting a memory based on a predefined initial value, wherein the memory is a memory device with data volatilization characteristics in a low power consumption state; the memory may optionally be configured as static random access memory or synchronous dynamic random access memory.
Step S201: calculating a second numerical value different from the predefined initial value, and storing a second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value;
Step S202: responding to the switching of the MCU from the normal operation mode to the low power consumption mode, after the MCU stays for the preset time of the low power consumption mode, from the low power consumption mode to the normal operation mode, judging the difference between the second numerical value and the third numerical value after the switching change, and obtaining a difference result;
In the second embodiment of the present invention, the difference between the second value and the third value after the switching is determined in response to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, so as to obtain a difference result. In combination with step S201, after the first preset time for staying in the low power consumption mode is set, the operation is switched to the normal operation mode, wherein the first preset time can be set by machine reaction and recognition of selection of a person skilled in the art according to the actual working state of the MCU without affecting the normal operation and the functions of the low power consumption mode.
In the second embodiment, S201 may be configured to complete the calculation based on the operation time in the normal operation mode before the low power mode is switched, or may be configured to calculate, based on a rule that the accumulation operation is performed every second preset time, a second value associated with the normal operation state time based on the predefined initial value before the MCU is switched from the normal operation mode to the low power mode.
As a preferred embodiment, S201 is specifically configured to include, before the MCU switches from the normal operation mode to the low power consumption mode, calculating a second value associated with the normal operation state time based on the rule that the 1-adding operation is performed every 1S, with the predefined initial value as a base value. By setting a second numerical rule which is different from the predefined initial value and a calculation rule which is associated with the stay time in the low power consumption mode in the step, the stay process in the low power consumption mode can be associated, the detection independence of each MCU is increased, the detection failure caused by the loophole of an external control algorithm is prevented, and the method is simple and feasible.
Step S203: and obtaining a detection result of the MCU low-power mode based on the difference result, the MCU peripheral register value and the system clock state from the low-power mode to the normal running mode.
Specifically, in the second embodiment of the present invention, for the sleep mode in the low power consumption mode, based on the difference result, the MCU peripheral register value, and the internal clock state from the low power consumption mode to the normal operation mode, the detection result of the MCU low power consumption mode is obtained.
In the second embodiment of the present invention, for the stop mode in the low power consumption mode, based on the difference result, the value of the external registers of the MCU, and the internal clock state from the low power consumption mode to the normal operation mode, the detection result of the low power consumption mode of the MCU is obtained. In the second embodiment of the present invention, for the on/off mode in the low power consumption mode, based on the difference result, the MCU peripheral register value, and the internal clock state from the low power consumption mode to the normal operation mode, the detection result of the MCU low power consumption mode is obtained. In this embodiment, preferably, the MCU system clock is an internal high-speed clock N times.
In the embodiment of the invention, the MCU is combined with the characteristics that the data in the core clock, most of the peripheral clocks, the PLL, the internal high-speed oscillator, the external high-speed oscillator and the SRAM are lost in the stop mode and the standby mode, the difference between the second numerical value and the third numerical value after the switching change and the detection results of the peripheral register numerical value of the MCU and the system clock of the MCU are selected to comprehensively judge the switching result of the stop mode in the low-power mode, so that the defect that the three modes in the low-power mode particularly enter the prior art can not be detected is realized while the detection accuracy is improved.
The MCU low power consumption mode detection method of the second embodiment of the invention has the advantages that on the basis of the beneficial effects of the first embodiment, when the low power consumption mode detection result is judged, the system clock state after the MCU is switched from the low power consumption mode to the normal operation mode is added except for the difference between the second numerical value and the third numerical value after the switching change and the numerical value of the peripheral register, so that the sleep mode and the stop mode can be judged more accurately, and finer and more accurate detection is realized.
The method for detecting the low power consumption mode of the second MCU of the embodiment of the present invention is different from that of the embodiment 1 of the present invention in that the steps, functions and effects of the same implementation manner exist, and since any implementation manner of each specific step in the above embodiment 1 is described in detail, the description is not repeated here,
Embodiment III:
the MCU low-power mode detection method can be also applied to the completion of the whole detection process by the cooperative control of multiple main bodies, namely the execution process of the multiple main bodies. In the third embodiment of the present invention, the MCU low power consumption mode detection method is applied to a cooperative control process of the MCU unit and an external detection device, and specifically includes:
step S301: the MCU unit sets a memory based on a predefined initial value, wherein the memory is a memory device with data volatilization characteristics in a low power consumption state;
Step S302: the MCU unit calculates a second numerical value different from the predefined initial value, and stores the second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value;
It should be noted that, in the third embodiment of the present invention, step S302 may also be optionally performed by an external detection device, that is, in the normal operation mode of the MCU, the external detection device calculates a second value different from the predefined initial value based on a preset calculation rule, and stores the second value in the memory of the MCU, and at the same time, the MCU stores the second value backup in the backup domain, where the value backed up in the backup domain is a third value;
Step S303: and the MCU unit responds to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judges the difference between the second numerical value and the third numerical value after the switching change, and obtains a difference result.
In the third embodiment of the present invention, step S303 may also be optionally performed by an external detection device, where the external detection device determines the difference between the third values of the second range of values after the switching change to obtain a difference result. In the embodiment where the external detection device completes step S303, the MCU needs to respond to the mutual instruction with the external detection device to complete the corresponding data transmission and operation steps.
Step S304: and the MCU unit obtains an MCU low-power mode detection result at least based on the difference result and the MCU peripheral register value.
In the third embodiment of the present invention, step S303 may also be optionally performed by an external detection device, where the external detection device determines the difference between the third values of the second range of values after the switching change to obtain a difference result. In the embodiment where the external detection device completes step S303, the MCU needs to respond to the mutual instruction with the external detection device to complete the corresponding data transmission and operation steps.
The method for detecting the low-power-consumption mode of the third MCU in the embodiment of the invention has the advantages that on the basis of the advantages of the first and second embodiments, the steps of the method can be applied to the cooperation of the external detection equipment and the MCU, so that more practical application scenes and greater configuration flexibility are realized.
The third MCU low power consumption mode detection method of the embodiment of the present invention has the same steps, functions and effects as those of the embodiment 1 except for the different descriptions of the execution main body, and since any implementation of each specific step in the embodiment 1 is described in detail, the description is not repeated here,
Embodiment four:
Fig. 3 is a schematic diagram of a detection device for a low power consumption mode of a fourth MCU according to an embodiment of the present invention, and as shown in fig. 3, a detection device 400 for a low power consumption mode of a fourth MCU according to an embodiment of the present invention includes:
a setting unit 401 that sets a memory, which is a memory device having a data volatilization characteristic in a low power consumption state,
A calculation unit 402 for calculating a second value different from the predefined initial value,
The backup unit 403 stores the second value backup in the backup domain, the value of the backup in the backup domain being the third value,
A judging unit 404, responsive to the MCU switching from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second value and the third value after the switching change, obtaining a difference result,
And the detection unit 405 obtains a detection result of the MCU low power consumption mode at least based on the difference result and the MCU peripheral register value.
In the embodiment of the present invention, each functional unit in the MCU low power consumption mode detection device processes the above-mentioned function implementation, and can simultaneously complete steps, functions and effects of any implementation manner of the MCU low power consumption mode detection method in the first embodiment to the third embodiment of the present invention.
The embodiment of the invention also discloses an MCU chip, which comprises a processor and a memory, wherein the memory stores a computer program which can be executed by the processor, and the processor can execute the computer program to realize the MCU low-power consumption mode detection method according to any one of the first to third embodiments of the invention.
In addition to the above steps, the method for executing instructions by the processor in the electronic device of the present invention can simultaneously complete the steps, functions and effects of any implementation manner of the MCU low power consumption mode detection method in any one of the first to third embodiments of the present invention, since any implementation manner of each specific step in any one of the first to third embodiments is described in detail, and also not repeated herein,
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A MCU low power consumption mode detection method is characterized in that the detection method comprises,
Setting a memory based on a predefined initial value, the memory being a memory device having data volatilizing properties in a low power consumption state,
Calculating a second numerical value different from the predefined initial value by a calculation model, storing the second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value,
Responding to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second numerical value and the third numerical value after the switching change to obtain a difference result,
The MCU also comprises a peripheral register, wherein the peripheral register pre-stores peripheral register values;
and obtaining an MCU low power consumption mode detection result at least based on the difference result and the peripheral register value.
2. The method for detecting a low power consumption mode according to claim 1, wherein the step of judging the difference between the second value and the third value after the change of the switching in response to the switching of the MCU from the normal operation mode to the low power consumption mode and from the low power consumption mode to the normal operation mode to obtain the difference result comprises the steps of judging the difference between the second value and the third value after the change of the switching in response to the switching of the MCU from the normal operation mode to the low power consumption mode for a first preset time and from the low power consumption mode to the normal operation mode to obtain the difference result.
3. The low power mode detection method of claim 1, wherein the calculation model performs calculation based on a run time in a normal operation mode before the low power mode is switched.
4. The low power mode detection method of claim 3, wherein the calculating a second value different from the predefined initial value includes, in particular, calculating a second value associated with the normal operation state time based on a rule that an accumulation operation is performed every second preset time, based on the predefined initial value, before the MCU switches from the normal operation mode to the low power mode.
5. The low power mode detection method of claim 1, wherein the backup domain is an RTC backup register or a backup SRAM.
6. The method for detecting a low power consumption mode according to claim 1, wherein the obtaining the MCU low power consumption mode detection result based on at least the difference result and the MCU peripheral register value specifically includes obtaining the MCU low power consumption mode detection result based on the difference result, the MCU peripheral register value, and the system clock state from the low power consumption mode to the normal operation mode.
7. The method for detecting a low power consumption mode according to claim 1 or 6, wherein the detection result of the low power consumption mode of the MCU is obtained based on the difference result, the value of the peripheral registers of the MCU, and the internal clock state after the low power consumption mode is changed to the normal operation mode, specifically including that the difference result is the same, the value of the peripheral registers of the MCU is a reset value, and the normal sleep mode switching of the MCU is determined.
8. The method for detecting a low power consumption mode according to claim 7, wherein the detection result of the low power consumption mode of the MCU is obtained based on the difference result, the value of the external registers of the MCU, and the state of the internal clock after the low power consumption mode is changed to the normal operation mode.
9. The method for detecting a low power consumption mode according to claim 7, wherein the detection result of the low power consumption mode of the MCU is obtained based on the difference result, the value of the external registers of the MCU and the state of the internal clock after the low power consumption mode is changed to the normal operation mode.
10. A MCU low power consumption mode detection device is characterized by comprising,
A setting unit that sets a memory, which is a memory device having a data volatilization characteristic in a low power consumption state, based on a predefined initial value,
A calculation unit calculating a second numerical value different from the predefined initial value by a calculation model,
A backup unit for storing the second numerical value backup in a backup domain, wherein the numerical value backed up in the backup domain is a third numerical value,
A judging unit for responding to the switching of the MCU from the normal operation mode to the low power consumption mode and then from the low power consumption mode to the normal operation mode, judging the difference between the second value and the third value after the switching change to obtain a difference result,
And the detection unit is used for obtaining an MCU low-power-consumption mode detection result at least based on the difference result and the peripheral register value.
CN202410016062.5A 2024-01-03 2024-01-03 MCU low-power mode detection method and device Pending CN117930960A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410016062.5A CN117930960A (en) 2024-01-03 2024-01-03 MCU low-power mode detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410016062.5A CN117930960A (en) 2024-01-03 2024-01-03 MCU low-power mode detection method and device

Publications (1)

Publication Number Publication Date
CN117930960A true CN117930960A (en) 2024-04-26

Family

ID=90760683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410016062.5A Pending CN117930960A (en) 2024-01-03 2024-01-03 MCU low-power mode detection method and device

Country Status (1)

Country Link
CN (1) CN117930960A (en)

Similar Documents

Publication Publication Date Title
US7983870B2 (en) Integrated circuit and method for determining the operating range of an integrated circuit
US7596705B2 (en) Automatically controlling processor mode of multi-core processor
US6052793A (en) Wakeup event restoration after power loss
US20190050048A1 (en) Memory controller and operating method thereof
KR101492953B1 (en) Leakage variation aware power management for multicore processors
TW201205322A (en) Computer component power-consumption database
CN110806794A (en) Power-down protection method, system, computer device and medium for storage system
US8949638B2 (en) Embedded controller with an internal timer
WO2012075223A1 (en) Maximum current limiting method and apparatus
EP3036598B1 (en) Power signal interface
KR101720202B1 (en) Adaptively disabling and enabling sleep states for power and performance
KR20090026895A (en) Apparatus and method for reducing power consumption in system on chip
US20210141438A1 (en) Systems, apparatus, and methods for transitioning between multiple operating states
US8886974B2 (en) Controller
US20180129180A1 (en) Pch thermal sensor dynamic shutdown
CN117930960A (en) MCU low-power mode detection method and device
CN112783354A (en) Control method, device and equipment of touch device and storage medium
TW201322685A (en) System and method for restoring network configuration parameters
CN103970253B (en) Power-saving operation method and electronic device
JP2001034370A (en) Power-saving controller, power-saving control method, and computer system
US20080201605A1 (en) Dead man timer detecting method, multiprocessor switching method and processor hot plug support method
US8990594B2 (en) Apparatus for measuring a remaining power of a battery includes a first memory for storing a routine code and a second memory for storing an exception code
CN105138479B (en) A kind of information processing method and electronic equipment
TW200807245A (en) Method of restarting a peripheral device
CN116662092A (en) Memory data testing method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination