Method, device, equipment and medium for adjusting power consumption of microcontroller unit
Through multi-voltage domain design and automatic repair mechanism, combined with clock source and module priority adjustment, the problem of extensive power consumption management of microcontroller units is solved, and the system is stable and low-power operation is achieved.
Patent Information
- Application Number
- CN202510349153.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-18
AI Technical Summary
The power consumption management of existing microcontroller units is relatively extensive and cannot be accurately controlled based on the real-time operating status of the system, resulting in waste of power consumption and degradation of performance.
The multi-voltage domain design is adopted, and the status data is obtained through the detection module, the working status of the power supply voltage monitoring module is judged, and the power supply voltage and driving current are adjusted in abnormal situations. The power supply voltage and driving current are adjusted in combination with the clock source and module priority, and the low power consumption mode is entered to reduce unnecessary power consumption.
Effectively prevent system crashes caused by abnormal power supply voltage, reduce additional power consumption during troubleshooting and repair, improve system stability and fault tolerance, and optimize power consumption and reliability balance.
Smart Images

Figure CN120335593A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microcontroller units, and in particular to a method, device, equipment and medium for power consumption adjustment of microcontroller units. Background Art
[0002] In modern electronic devices, microcontroller units (MCUs) are widely used in various scenarios. In some MCU designs, developers often pay more attention to the implementation of MCU performance and functions, while ignoring the importance of power consumption management. For example, simple clock gating or power gating, etc. Although these technologies can reduce power consumption to a certain extent, the effect is limited, and they may bring additional design complexity and cost.
[0003] With the continuous increase of device functions and the improvement of requirements for portability and battery life, reducing the power consumption of microcontroller units has become a key problem to be solved urgently. Summary of the Invention
[0004] In view of this, the present invention provides a method, device, equipment and medium for power consumption adjustment of microcontroller units to solve the problem of relatively rough power consumption management of microcontroller units in related technologies.
[0005] In a first aspect, the present invention provides a method for power consumption adjustment of a microcontroller unit. The method includes: obtaining status data of modules in the microcontroller unit based on a detection module arranged in a first voltage domain; judging whether a power supply voltage monitoring module operates according to a preset working mode based on the status data, the power supply voltage monitoring module being arranged in a second voltage domain; if the power supply voltage monitoring module does not operate according to the preset working mode, performing abnormal repair based on a preset repair logic, and if the repair fails, giving an alarm, wherein the microcontroller unit includes the first voltage domain and the second voltage domain, and the voltage in the first voltage domain is lower than the voltage in the second voltage domain.
[0006] In an optional implementation manner, the method further includes: obtaining workload information of the microcontroller unit; evaluating power consumption information of each clock source under different workload conditions based on the workload information and historical workload information to obtain an evaluation result; judging whether there is an external clock source with a clock frequency lower than that in the evaluation result. If so, detecting a fluctuation value of the frequency of the external clock source within a preset time period. If the fluctuation value is less than a preset threshold, switching the original clock to the external clock source. If the fluctuation value is greater than or equal to the preset threshold, switching the original clock to the crystal oscillator clock in the microcontroller unit.
[0007] In an alternative embodiment, the method further includes: obtaining the priorities of the modules in the first voltage domain; for a first module whose priority is higher than a priority threshold, adjusting the power supply voltage and drive current of the first module based on the workload of the first module; for a second module whose priority is lower than or equal to the priority threshold, gradually reducing the power supply voltage and drive current of the second module based on a smooth transition algorithm.
[0008] In an alternative embodiment, the method further includes, if the microcontroller unit enters a low-power mode, executing at least one of the following instructions: turning off the internal bus in the microcontroller unit that has not been used for more than a preset duration; saving the status information of the second module, powering off the second module; stopping the output of the clock signal.
[0009] In an alternative embodiment, the method further includes: if a wake-up signal for waking up the microcontroller unit is obtained, preprocessing the wake-up signal to screen out valid wake-up signals; if the valid wake-up signal comes from an external interrupt, determining a target module related to the external interrupt, starting the target module, and restoring the power supply voltage and drive current of the target module; if the valid wake-up signal comes from a timer, restoring the power supply and clock of the module related to the preset task based on the preset task of the timer.
[0010] In an alternative embodiment, the step of, if a wake-up signal for waking up the microcontroller unit is obtained, preprocessing the wake-up signal to screen out valid wake-up signals includes: screening the wake-up signal to remove interference signals in the wake-up signal to obtain a screened interference signal; determining whether the screened interference signal is a valid wake-up signal, including detecting the source and format of the screened interference signal, and if the source and format of the screened interference signal meet a preset standard, the screened interference signal is a valid wake-up signal.
[0011] In a second aspect, the present invention provides a device for power consumption adjustment of a microcontroller unit, the device includes: an acquisition module, configured to obtain status data of modules in the microcontroller unit based on a detection module arranged in a first voltage domain; a judgment module, configured to judge whether a power supply voltage monitoring module operates according to a preset working mode based on the status data, the power supply voltage monitoring module being arranged in a second voltage domain; an adjustment module, configured to, if the power supply voltage monitoring module does not operate according to the preset working mode, perform abnormal repair based on a preset repair logic, and give an alarm if the repair fails, wherein the microcontroller unit includes the first voltage domain and the second voltage domain, and the voltage in the first voltage domain is lower than the voltage in the second voltage domain.
[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the method for power consumption adjustment of a microcontroller unit according to the first aspect or any corresponding embodiment thereof.
[0013] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored. The computer instructions are used to cause a computer to execute the method for power consumption adjustment of a microcontroller unit according to the first aspect or any corresponding embodiment thereof.
[0014] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to cause a computer to execute the method for power consumption adjustment of a microcontroller unit according to the first aspect or any corresponding embodiment thereof.
[0015] By means of status data, the working state of the power supply voltage monitoring module is monitored, and in case of any abnormality, it is repaired in a timely manner, which can effectively prevent system crashes or instability caused by abnormal power supply voltage. For the automatic repair mechanism in case of abnormalities, it can ensure the stable operation of the system and reduce the additional power consumption that may be generated during the process of fault detection and repair. At the same time, with the multi-voltage domain design, the detection module is set in the first voltage domain with low voltage characteristics, which can reduce the power consumption of the detection module itself, avoid interference with other modules, balance power consumption and reliability, and avoid the impact of a single voltage domain failure on the whole. In addition, by presetting the repair logic, the need for manual intervention is reduced, and part of the abnormalities are processed through an automated process, enhancing the fault tolerance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the related art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It shows a schematic flow chart of the method for power consumption adjustment of a microcontroller unit according to an embodiment of the present invention;
[0018] Figure 2 It shows a schematic flow chart of another method for power consumption adjustment of a microcontroller unit according to an embodiment of the present invention;
[0019] Figure 3 It shows a schematic structural diagram of the device for power consumption adjustment of a microcontroller unit according to an embodiment of the present invention;
[0020] Figure 4 It is a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention. Specific embodiments
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0022] The power consumption management methods in the related art are often relatively crude and cannot perform precise power consumption control according to the real-time operating state of the system. For example, in clock management, usually a certain clock source is fixedly used without considering the energy-saving advantages that other clock sources may bring under different workloads; in voltage and current regulation, there is also a lack of dynamic tracking of the working states of each module and targeted adjustment. This leads to a large amount of unnecessary power consumption waste during the operation of the MCU, affecting the overall performance and user experience of the device. Therefore, a method for reducing the power consumption of the MCU is needed to solve the above problems.
[0023] According to an embodiment of the present invention, there is provided an embodiment of a method for power consumption adjustment of a microcontroller unit. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0024] In this embodiment, a method for power consumption adjustment of a microcontroller unit is provided, which can be used for a microcontroller unit. Figure 1 The flowchart of the method for power consumption adjustment of the microcontroller unit according to the embodiment of the present invention is shown, as Figure 1 shown, and the process includes the following steps:
[0025] Step S101, based on the detection module disposed in the first voltage domain, obtain the status data of the modules in the microcontroller unit.
[0026] In this step, a microcontroller unit (MCU for short) is an integrated circuit that integrates a central processor, memory, input / output interfaces, and various peripheral devices. In the automotive field, the MCU is responsible for controlling and monitoring various electronic systems to ensure the reliability and safety of the vehicle.
[0027] The status data includes: the type of the system clock source, the frequency of the system clock source, the working voltage values of each module within the MCU, and the real-time current conditions of each module within the MCU, etc.
[0028] In the embodiment of the present invention, the MCU adopts a multi-voltage domain design. The first voltage domain is an area within the MCU, and its voltage level is lower than that of the second voltage domain. The low-voltage characteristics of the first voltage domain can reduce the power consumption of the detection module itself and avoid interference with other modules at the same time. This design structure helps to protect the modules in the low-voltage area from possible damage caused by high voltage.
[0029] The detection module can also obtain the MCU task queue information, including: the type of tasks to be processed in the queue or the estimated processing time, etc., so as to provide more comprehensive data support for subsequent power consumption management.
[0030] Step S102: Based on the status data, determine whether the power supply voltage monitoring module operates according to a preset working mode. The power supply voltage monitoring module is arranged within the second voltage domain.
[0031] In this step, based on the status data, it can be determined whether the power supply voltage monitoring module or the power supply voltage regulation module located in the second voltage domain operates according to the preset mode. The power supply voltage monitoring module can work at a higher voltage to ensure the monitoring reliability. The preset working mode, including parameters such as voltage thresholds and monitoring frequencies, can be dynamically compared by the logic control unit. It can also be determined based on the status data whether the configuration of the relevant registers is correct.
[0032] Based on the status data, it can also be determined the communication status between the power supply voltage monitoring module or the power supply voltage regulation module and other modules, which can ensure the accuracy and timeliness of data interaction and avoid system anomalies and increased power consumption caused by module failures.
[0033] Step S103: If the power supply voltage monitoring module does not operate according to the preset working mode, perform abnormal repair based on the preset repair logic. If the repair fails, give an alarm. Among them, the microcontroller unit includes a first voltage domain and a second voltage domain, and the voltage within the first voltage domain is lower than the voltage within the second voltage domain.
[0034] In this step, if the power supply voltage monitoring module is abnormal, for example, the power supply voltage monitoring module has a threshold offset or response delay, etc., the system triggers the preset repair logic, for example, reconfiguring the module parameters or restarting the module. If the repair fails, an abnormal alarm is given through an alarm mechanism, for example, log recording or a hardware signal. This process relies on the coordinated control of the multi-voltage domain to ensure that the repair operation does not affect the stability of the modules in the first voltage domain.
[0035] Among them, the alarm signal sent for alarming includes abnormal information. The abnormal information includes the specific abnormal module name, abnormal parameter value, and speculation on the possible cause of the abnormality, which can facilitate users or administrators to quickly locate and handle problems.
[0036] Specifically, the voltage can be reduced in the idle state to reduce the leakage current, or in the case of a sudden increase in load, the high-voltage domain power supply can be quickly restored.
[0037] The method for power consumption adjustment of the microcontroller unit provided in this embodiment monitors the working state of the power supply voltage monitoring module through status data and repairs it in a timely manner when an abnormality is found, which can effectively prevent system crashes or instabilities caused by abnormal power supply voltages; for the automatic repair mechanism in case of abnormalities, it can ensure the stable operation of the system and reduce the additional power consumption that may occur during the process of troubleshooting and repair; at the same time, adopting a multi-voltage domain design and setting the detection module in the first voltage domain with low voltage characteristics can reduce the power consumption of the detection module itself, avoid interference with other modules, balance power consumption and reliability, and avoid the impact of a single voltage domain failure on the whole; in addition, presetting the repair logic reduces the need for manual intervention, and automating the process to handle some abnormalities enhances the fault tolerance of the system.
[0038] In some alternative embodiments, the aforementioned method for power consumption adjustment of the microcontroller unit further includes: obtaining the workload information of the microcontroller unit; evaluating the power consumption information of each clock source under different workload conditions based on the workload information and historical workload information to obtain an evaluation result; determining whether there is an external clock source with a clock frequency lower than the evaluation result, if so, detecting the fluctuation value of the frequency of the external clock source within a preset time period, if the fluctuation value is less than the preset threshold, switching the original clock to the external clock source, and if the fluctuation value is greater than or equal to the preset threshold, switching the original clock to the crystal oscillator clock within the microcontroller unit.
[0039] In this embodiment, parameters such as the active state and instruction execution frequency of the real-time acquisition module can be collected through the flag bit design of the microcontroller unit (MCU) core; or the number of tasks being run or the task complexity, etc. can be obtained. The current workload intensity is characterized based on the aforementioned parameters. Historical workload data can be recorded through a storage unit, such as Flash with ECC check, and a time series database can be established for dynamically analyzing the load change trend.
[0040] Based on current and historical workload data, a dynamic energy efficiency model can be adopted to calculate the power consumption of different clock sources. For example, a high-frequency external clock source can respond quickly when the load surges, but its power consumption is relatively high; a low-frequency clock source can reduce dynamic power consumption when idle. The evaluation results are quantified for the energy efficiency ratio of each clock source through a preset algorithm, such as a cost estimation module based on the XGBoost model.
[0041] If there is an external clock source with a power consumption lower than the current evaluated value, the system detects its frequency stability. The fluctuation value of the frequency (such as ±50ppm) within a preset time period can be measured through a transient pulse filtering module and a temperature compensation circuit. If the fluctuation value is less than the preset threshold (such as ±100ppm), switch to the external clock source to reduce power consumption; if it exceeds the threshold, automatically switch back to the internal crystal oscillator clock of the MCU (such as a 16MHz main clock) to ensure timing accuracy.
[0042] The compatibility of the external clock source can also be evaluated, which can be achieved by detecting whether the interface protocol between the external clock source and each module inside the MCU matches.
[0043] If the fluctuation value of the external clock source is less than the preset threshold, the original clock frequency can be gradually reduced through the intelligent clock module, and at the same time, the frequency of the selected external clock source can be gradually increased to complete the clock source switching. If the fluctuation value of the external clock source is greater than or equal to the preset threshold, switch to the internal crystal oscillator clock and adjust its frequency to the lowest frequency just meeting the requirements of the current task through a specific algorithm. The specific algorithm can be based on the real-time analysis of the current task, including the data processing volume and processing speed requirements of the task, to accurately adjust the frequency of the internal crystal oscillator clock. During the entire clock source switching and frequency adjustment process, the intelligent clock module monitors the operating state of the system in real time to ensure the stability of the system and avoid data loss or system failures caused by clock changes.
[0044] In this way, by combining the workload characteristics and historical data, the on-demand switching of the clock source can be realized, which can reduce dynamic power consumption; through frequency fluctuation detection and redundant switching mechanisms, system failures caused by abnormal external clocks can be avoided, meeting the stringent requirements of industrial-grade MCUs for timing accuracy. Select the most suitable clock source according to different working scenarios. At the same time, the availability, stability, compatibility, and energy-saving potential of the external clock source can be preferentially evaluated, providing more possibilities for reducing power consumption, avoiding system failures caused by clock changes, and minimizing clock-related power consumption to the greatest extent.
[0045] In some alternative embodiments, the aforementioned method for power consumption adjustment of a microcontroller unit further includes: obtaining the priorities of the modules within the first voltage domain; for a first module whose priority is higher than a priority threshold, adjusting the supply voltage and drive current of the first module based on the workload of the first module; for a second module whose priority is lower than or equal to the priority threshold, gradually reducing the supply voltage and drive current of the second module based on a smooth transition algorithm.
[0046] In this embodiment, by real-time monitoring the active states of the modules within the first voltage domain, such as the interrupt frequency, memory occupancy rate, etc., and combining with a task scheduling strategy to dynamically allocate priorities, and setting a threshold to distinguish critical modules, i.e., the first module, from non-critical modules, i.e., the second module. The priority determination logic can be implemented based on hardware flag bits or a software task manager. For the first module with a priority higher than the threshold, such as a real-time communication module, the supply voltage and drive current are dynamically adjusted according to its current workload, such as the data transfer rate. For example, when the load suddenly increases, the supply voltage is increased to the optimal value through dynamic voltage and frequency scaling (DVFS) technology to ensure performance stability.
[0047] For the second module with a priority lower than or equal to the threshold, such as a non-real-time sensor interface, a smooth transition algorithm is adopted to gradually reduce the supply voltage and drive current. For example, the PWM duty cycle is adjusted in stages through a timer interrupt, causing the voltage and current to decrease in an exponential curve to avoid interference to the power network caused by instantaneous current mutations.
[0048] Specifically, if there is a first module, the number of first modules can be at least one. Similarly, if there is a second module, the number of second modules can be at least one. For the first module, the supply voltage and drive current can be dynamically adjusted according to the real-time change of its workload. For the second module, its supply voltage can be gradually reduced to a very low maintenance voltage. At the same time, the drive current can be reduced to almost zero, only retaining a very small current to maintain the basic state of the second module to prevent data loss or state anomalies.
[0049] During the process of reducing the supply voltage and drive current, a smooth transition algorithm can be adopted, such as linear gradient or gradient based on feedback control, to make the change process of the voltage and current stable and avoid impacting the system. The voltage and current can be correspondingly reduced when the module load decreases; and appropriately increased when the load increases to ensure that the module can meet the working requirements without causing power consumption waste.
[0050] The power supply voltage and drive current of each module can be precisely adjusted under different working conditions. For the unused module, i.e., the second module, the voltage is reduced to a very low maintenance voltage and the drive current is nearly zero, effectively reducing the static power consumption. For the module in use, i.e., the first module, it is dynamically adjusted according to the real-time change of the load, which not only meets the working requirements but also avoids power consumption waste. The smooth transition algorithm further ensures the stability of the system during the voltage and current adjustment process, preventing performance degradation or faults caused by sudden changes.
[0051] In this way, based on the priority-based acquisition, it can be determined which modules are critical for the current task and which can temporarily reduce power consumption. At the same time, combined with the real-time requirements of the current task, the required working performance levels of each module are clarified. The power supply requirements of the first module with high priority are preferentially guaranteed to ensure that tasks with high real-time requirements are not affected by the power consumption adjustment of low-priority modules, improving the overall reliability of the system. Dynamically adjusting the power supply parameters can reduce the idle power consumption of the first module. For example, when idle, the voltage is reduced to the maintenance state. At the same time, the smooth voltage reduction strategy avoids power supply noise caused by the sudden shutdown of low-priority modules, which can reduce the overall power consumption.
[0052] In some alternative embodiments, the foregoing method for power consumption adjustment of the microcontroller unit further includes: if the microcontroller unit enters the low-power mode, at least one of the following instructions is executed: closing the internal bus that has not been used for more than a preset duration in the microcontroller unit; saving the state information of the second module and powering off the second module; stopping the output of the clock signal.
[0053] In this embodiment, the low-power mode is an operating state in which the MCU selectively turns off or reduces the power supply and clock frequency of non-critical modules through software and hardware co-design on the premise of ensuring the basic functions, so as to reduce the overall energy consumption of the system. Its core goal is to extend the battery life and reduce the energy consumption without sacrificing functional reliability.
[0054] If the microcontroller unit enters the low-power mode, the internal bus that has not been used for more than a preset duration can be closed through the sleep control module arranged in the first voltage domain, cutting off the relevant data transmission channels and reducing the power consumption caused by data transmission. At the same time, part of the cache is closed, releasing the resources occupied by the cache and reducing the static power consumption. The sleep control module can close the internal bus that has not been used for more than a preset duration according to the usage frequency of the internal bus. The sleep control module can also close the cache corresponding to the expired cache data according to the timeliness of the cache data.
[0055] After the sleep control module saves the status information of the second module, it powers off the second module. Saving the status information of the second module facilitates subsequent recovery. The clock source selected by the intelligent clock module is turned off, and the output of the clock signal is stopped, causing most modules of the MCU to enter a static state. The sleep control module causes the MCU to enter the deep sleep mode. In this mode, some key registers and memory cells switch to the lowest power consumption state, and the power management unit can also be set to the ultra-low power consumption mode to minimize the system power consumption.
[0056] In this way, when the microcontroller unit enters the low power mode, by turning off unnecessary internal buses and caches, resources are released, and static power consumption is reduced. The functional modules that are not temporarily required in the second voltage domain are completely powered off and their key status information is saved, and the power management unit is set to the ultra-low power consumption mode, minimizing the power consumption of the MCU in the sleep state.
[0057] In some optional embodiments, the foregoing method for adjusting the power consumption of the microcontroller unit further includes: if a wake-up signal for waking up the microcontroller unit is obtained, preprocessing the wake-up signal to screen out valid wake-up signals; if the valid wake-up signal comes from an external interrupt, determining the target module related to the external interrupt, starting the target module, and restoring the power supply voltage and drive current of the target module; if the valid wake-up signal comes from a timer, based on the preset task of the timer, restoring the power supply and clock of the module related to the preset task.
[0058] In this embodiment, the wake-up signal can be preprocessed through a hardware filtering circuit (such as an RC low-pass filter) and a software debouncing algorithm (such as multiple sampling decisions) to exclude false triggers caused by noise or transient interference. For example, when the external interrupt signal lasts for more than a preset duration (such as 10 ms), it is determined as a valid wake-up. The wake-up type is marked according to the signal source (external interrupt or timer) and associated with the preset task list. For example, an external interrupt wake-up may correspond to a sensor data acquisition task, and a timer wake-up corresponds to a periodic communication task. Through the interrupt vector table or event mapping table, the functional module corresponding to the external interrupt that triggers the wake-up is determined. It is possible to only restore the power supply voltage and drive current of the target module and its dependent peripherals (such as ADC, DMA), rather than waking up the MCU globally. For example, the power domain is locally activated through the Power Gating technology.
[0059] Based on the timer preset task, such as the data upload task triggered by the RTC alarm, only the power supply and clock of the relevant module can be restored. For example, after waking up, only the SPI bus and the wireless communication module are enabled, and other peripherals remain in the sleep state. The clock source is dynamically switched according to the task priority, such as switching from the low-power 32 kHz internal oscillator to the high-speed external crystal oscillator, and immediately restoring the low-frequency mode after the task is completed.
[0060] It can be restored to an appropriate clock frequency at the fastest speed according to the priority of the wake-up source and the urgency of the task; during this process, a fast recovery algorithm can be adopted, for example, predicting the required clock frequency based on historical data and preheating the clock source in advance to effectively reduce the wake-up time.
[0061] In this way, the number of invalid wake-ups can be reduced through signal preprocessing, avoiding frequent power supply switching caused by noise, and reducing dynamic power consumption; power supply and clock of the target module are restored on demand. Compared with the global wake-up scheme, the wake-up delay can be shortened, such as from millisecond level to microsecond level, and at the same time, the repeated initialization overhead of memory and bus resources can be reduced.
[0062] In some alternative embodiments, if a wake-up signal of the wake-up microcontroller unit is obtained, the wake-up signal is preprocessed to screen out valid wake-up signals, including: screening the wake-up signal to remove interference signals in the wake-up signal to obtain the screened interference signal; determining whether the screened interference signal is a valid wake-up signal, including detecting the source and format of the screened interference signal. If the source and format of the screened interference signal meet the preset criteria, the screened interference signal is a valid wake-up signal.
[0063] In this embodiment, detecting the source and format of the screened interference signal includes: checking the signal format, specifically including verifying whether the encoding method, data bit length, parity bit, etc. of the signal meet the system setting criteria. The check of the signal source can be achieved by comparing with a preset list of legal wake-up sources.
[0064] High-frequency noise, such as electromagnetic interference pulses, can be filtered out by an RC low-pass filter circuit, and low-frequency valid wake-up signals are retained. The waveform is shaped by a Schmitt trigger to eliminate signal jitter. The wake-up signal is sampled multiple times, such as detecting a high level continuously for 3 times, and combined with a time window decision, such as the signal lasting for more than 10 ms, to exclude transient interference.
[0065] In this way, the number of invalid wake-ups can be reduced through hardware filtering and software de-jittering, the dynamic power consumption can be reduced, and the battery life of battery-powered devices can be extended. Processing valid signals that meet the source and format criteria shortens the wake-up delay, such as from millisecond level to microsecond level, and reduces redundant peripheral initialization operations, improving resource utilization.
[0066] In some alternative embodiments, after waking up, the state recovery module disposed in the first voltage domain can gradually restore the power supply voltage, drive current, and clock frequency of each module in a certain order according to the previously saved state information. Specifically, it can first restore the parameters of the critical modules to ensure that the system can basically operate, and then restore the other modules in sequence. During the parameter recovery process, the performance of the system can be monitored in real time, such as monitoring key indicators such as the system's response time or data processing speed. In addition to monitoring the system's response time and data processing speed, the resource utilization rate of the system can also be monitored, including but not limited to key indicators such as CPU usage rate and memory occupancy rate, so as to comprehensively evaluate the system performance.
[0067] If it is found that the performance is lower than expected, the state recovery module can optimize and adjust the restored parameters, such as appropriately increasing the voltage or frequency, to ensure that the system can operate normally; during the adjustment process, the performance indicators can be continuously monitored until a satisfactory performance level is achieved. The entire low-power process can be recorded in detail, including the time of entering and exiting the low-power mode, the power consumption data of each module at different stages, etc.; based on these records, the historical usage data can be updated to provide a more optimized basis for the next power management operation.
[0068] In the embodiments of the present invention, another method for power consumption adjustment of a microcontroller unit is also provided. Figure 2 The flowchart of another method for power consumption adjustment of a microcontroller unit according to the embodiments of the present invention is shown.
[0069] As Figure 2 shown, in the embodiments of the present invention, another method for power consumption adjustment of a microcontroller unit includes:
[0070] Step S201, initialization check. Specifically, it includes:
[0071] Step S2011, state data collection. Based on the detection module disposed in the first voltage domain, the state data of the modules in the microcontroller unit is obtained.
[0072] Step S2012, detection of the module state data in the second voltage domain.
[0073] Step S2013, exception handling of the power supply voltage monitoring module.
[0074] Step S202, clock selection and adjustment. Specifically, it includes:
[0075] Step S2021, evaluation of the workload information and the historical workload information.
[0076] Step S2022, evaluation of the external clock source.
[0077] Step S2023, Clock Source Switching and Frequency Adjustment.
[0078] Step S2024, System Stability Assurance.
[0079] Step S203, Dynamic Adjustment of Voltage and Current. Specifically, it includes:
[0080] Step S2031, Obtaining the Priorities of Each Module within the First Voltage Domain.
[0081] Step S2032, Adjustment of the Power Supply Voltage and Driving Current of the First Module.
[0082] Step S2033, Adjustment of the Power Supply Voltage and Driving Current of the Second Module.
[0083] Step S2034, Smooth Transition Control of the Adjustment Process.
[0084] Step S204, Entering the Low-Power Mode. Specifically, it includes:
[0085] Step S2041, Closing the Internal Bus and Cache.
[0086] Step S2042, Powering Off the Second Module.
[0087] Step S2043, Closing the Clock Source.
[0088] Step S2044, Entering the Deep Sleep Mode.
[0089] Step S205, Waking Up the Microcontroller Unit. Specifically, it includes:
[0090] Step S2051, Wake-up Signal Screening and Verification.
[0091] Step S2052, Wake-up Source Classification Processing.
[0092] Step S2053, Rapid Recovery of the Clock Frequency.
[0093] Step S206, State Recovery and Optimization. Specifically, it includes:
[0094] Step S2061, State Recovery Module for State Recovery.
[0095] Step S2062, Real-time Monitoring of System Performance.
[0096] Step S2063, Parameter Optimization Adjustment.
[0097] Step S2064, Recording and Optimization.
[0098] For the specific implementation manners, reference can be made to the foregoing part.
[0099] In this embodiment, a device for power consumption adjustment of a microcontroller unit is further provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated here. As used hereinafter, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0100] This embodiment provides a device for power consumption adjustment of a microcontroller unit. Figure 3 The structural schematic diagram of the device for power consumption adjustment of a microcontroller unit according to an embodiment of the present invention is shown. As Figure 3 shown, it includes:
[0101] An acquisition module 301, configured to acquire status data of modules in the microcontroller unit based on a detection module disposed in the first voltage domain.
[0102] A judgment module 302, configured to judge whether a power supply voltage monitoring module operates according to a preset working mode based on the status data. The power supply voltage monitoring module is disposed in the second voltage domain.
[0103] An adjustment module 303, configured to perform abnormal repair based on a preset repair logic if the power supply voltage monitoring module does not operate according to the preset working mode, and give an alarm if the repair fails. Among them, the microcontroller unit includes a first voltage domain and a second voltage domain, and the voltage in the first voltage domain is lower than the voltage in the second voltage domain.
[0104] In some alternative implementation manners, the foregoing device for power consumption adjustment of a microcontroller unit further includes: a clock adjustment module, configured to acquire the workload information of the microcontroller unit; evaluate the power consumption information of each clock source under different workload conditions based on the workload information and historical workload information to obtain an evaluation result; judge whether there is an external clock source with a clock frequency lower than the evaluation result. If so, detect the fluctuation value of the frequency of the external clock source within a preset time period. If the fluctuation value is less than a preset threshold, switch the original clock to the external clock source. If the fluctuation value is greater than or equal to the preset threshold, switch the original clock to the crystal oscillator clock in the microcontroller unit.
[0105] In some alternative implementation manners, the foregoing device for power consumption adjustment of a microcontroller unit further includes: a voltage and current adjustment module, configured to acquire the priorities of the modules in the first voltage domain; for a first module with a priority higher than a priority threshold, adjust the power supply voltage and drive current of the first module based on the workload of the first module; for a second module with a priority lower than or equal to the priority threshold, gradually reduce the power supply voltage and drive current of the second module based on a smooth transition algorithm.
[0106] In some alternative embodiments, the aforesaid device for power consumption adjustment of the microcontroller unit further includes: a low-power mode module, which is configured to, if the microcontroller unit enters the low-power mode, execute at least one of the following instructions: turn off the internal bus in the microcontroller unit that has not been used for more than a preset duration; save the status information of the second module, power off the second module; stop the output of the clock signal.
[0107] In some alternative embodiments, the aforesaid device for power consumption adjustment of the microcontroller unit further includes: a wake-up module, which is configured to, if a wake-up signal for waking up the microcontroller unit is acquired, preprocess the wake-up signal to screen out valid wake-up signals; if the valid wake-up signal comes from an external interrupt, determine the target module related to the external interrupt, start the target module, and restore the power supply voltage and drive current of the target module; if the valid wake-up signal comes from a timer, based on the preset task of the timer, restore the power supply and clock of the module related to the preset task.
[0108] In some alternative embodiments, the wake-up module includes:
[0109] A first wake-up unit, which is configured to screen the wake-up signal to remove the interference signals in the wake-up signal, and obtain the screened interference signal; determine whether the screened interference signal is a valid wake-up signal, including detecting the source and format of the screened interference signal, and if the source and format of the screened interference signal meet the preset criteria, the screened interference signal is a valid wake-up signal.
[0110] The further function descriptions of the above-mentioned various modules and units are the same as those in the corresponding above-mentioned embodiments, and will not be elaborated herein.
[0111] The device for power consumption adjustment of the microcontroller unit in this embodiment is presented in the form of functional units. Here, the unit refers to an Application Specific Integrated Circuit (ASIC) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0112] The embodiment of the present invention further provides a computer device having the aforesaid Figure 3 shown device for power consumption adjustment of the microcontroller unit.
[0113] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention. As shown in Figure 4As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component communicates with each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of a graphical user interface on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (such as an array of servers, a set of blade servers, or a multi-processor system). Figure 4 In the figure, a processor 10 is taken as an example.
[0114] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above-mentioned programmable logic device can be a complex programmable logic device, a field programmable gate array, a generic array logic, or any combination thereof.
[0115] Among them, the aforementioned memory 20 stores instructions executable by at least one processor 10, so that the aforementioned at least one processor 10 executes the method shown in the above embodiments.
[0116] The memory 20 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 can include high-speed random access memory and can also include non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 can optionally include a memory remotely set relative to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0117] The memory 20 can include volatile memory, such as random access memory; the memory can also include non-volatile memory, such as flash memory, a hard disk, or a solid-state drive; the memory 20 can also include a combination of the above types of memory.
[0118] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 may be connected by a bus or other means. Figure 4 Taking the connection by bus as an example.
[0119] The input device 30 can receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., a light-emitting diode), and a haptic feedback device (e.g., a vibration motor), etc. The above display device includes, but is not limited to, a liquid crystal display, a light-emitting diode, a display, and a plasma display. In some alternative embodiments, the display device may be a touch screen.
[0120] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented by downloading through a network from an original storage in a remote storage medium or a non-transitory machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiment is implemented.
[0121] A part of the present invention can be applied as a computer program product, such as computer program instructions. When executed by a computer, through the operation of the computer, the methods and / or technical solutions according to the present invention can be called or provided. Those skilled in the art should be able to understand that the forms of existence of computer program instructions in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Herein, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible by the computer.
[0122] While embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for power consumption adjustment of a microcontroller unit, characterized in that, The method includes: Based on a detection module disposed within a first voltage domain, obtaining status data of modules within a microcontroller unit; Based on the status data, determining whether a power supply voltage monitoring module operates according to a preset operating mode, where the power supply voltage monitoring module is disposed within a second voltage domain; If the power supply voltage monitoring module does not operate according to the preset operating mode, performing abnormal repair based on a preset repair logic, and if the repair fails, giving an alarm, where the microcontroller unit includes the first voltage domain and the second voltage domain, and the voltage within the first voltage domain is lower than the voltage within the second voltage domain.
2. The method according to claim 1, wherein The method further includes: Obtaining workload information of the microcontroller unit; Based on the workload information and historical workload information, evaluating the power consumption information of each clock source under different workload conditions to obtain an evaluation result; Determining whether there is an external clock source with a clock frequency lower than that in the evaluation result. If so, detecting the fluctuation value of the frequency of the external clock source within a preset time period. If the fluctuation value is less than a preset threshold, switching the original clock to the external clock source. If the fluctuation value is greater than or equal to the preset threshold, switching the original clock to the crystal oscillator clock within the microcontroller unit.
3. The method according to claim 2, wherein The method further includes: Obtaining the priorities of the modules within the first voltage domain; For a first module with a priority higher than a priority threshold, adjusting the power supply voltage and drive current of the first module based on the workload of the first module; For a second module with a priority lower than or equal to the priority threshold, gradually reducing the power supply voltage and drive current of the second module based on a smooth transition algorithm.
4. The method according to claim 3, wherein The method further includes that if the microcontroller unit enters a low-power mode, executing at least one of the following instructions: Closing an internal bus within the microcontroller unit that has not been used for more than a preset duration; Saving the status information of the second module and powering off the second module; Stopping the output of a clock signal.
5. The method according to claim 3, characterized in that The method further includes: If a wake-up signal for waking up the microcontroller unit is obtained, preprocessing the wake-up signal to screen out valid wake-up signals; If the valid wake-up signal comes from an external interrupt, determining a target module related to the external interrupt, starting the target module, and restoring the power supply voltage and drive current of the target module; If the valid wake-up signal comes from a timer, restoring the power supply and clock of a module related to the preset task based on the preset task of the timer.
6. The method according to claim 5, wherein The step of if a wake-up signal for waking up the microcontroller unit is obtained, preprocessing the wake-up signal to screen out valid wake-up signals includes: Screening the wake-up signal to remove interference signals in the wake-up signal to obtain a screened interference signal; Determining whether the screened interference signal is the valid wake-up signal, including detecting the source and format of the screened interference signal. If the source and format of the screened interference signal meet a preset standard, the screened interference signal is the valid wake-up signal.
7. A device for adjusting the power consumption of a microcontroller unit, characterized in that, The device includes: An acquisition module, configured to acquire status data of modules in a microcontroller unit based on a detection module disposed in a first voltage domain; A judgment module, configured to judge whether a power supply voltage monitoring module operates according to a preset working mode based on the status data, where the power supply voltage monitoring module is disposed in a second voltage domain; An adjustment module, configured to perform abnormal repair based on a preset repair logic if the power supply voltage monitoring module does not operate according to the preset working mode, and issue an alarm if the repair fails. The microcontroller unit includes the first voltage domain and the second voltage domain, and the voltage in the first voltage domain is lower than the voltage in the second voltage domain.
8. A computer device, characterized in that, Comprising: A memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the method for power consumption adjustment of a microcontroller unit according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to cause a computer to execute the method for power consumption adjustment of a microcontroller unit according to any one of claims 1 to 6.
10. A computer program product, characterized in that, Comprising computer instructions, which are used to cause a computer to execute the method for power consumption adjustment of a microcontroller unit according to any one of claims 1 to 6.