MCU device with power-down data protection function and power-down data protection method

By designing the ADC module, variable reference voltage module, voltage comparison module and data transfer module in the MCU device, it is possible to automatically write data to the non-volatile memory when power is lost, solving the problems of data loss and high development costs in the prior art, and improving the reliability and continuity of data.

CN119883962APending Publication Date: 2025-04-25HANGZHOU FANCHUANG INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411991527.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing MCUs have difficulty in quickly completing data writing when powered down, resulting in data loss. The existing technology relies on complex programming, increasing development and testing costs.

Method used

A MCU device is designed, including an ADC module, a variable reference voltage module, a voltage comparison module and a data transfer module. The data in the volatile memory is automatically transferred to the non-volatile memory through hardware without software intervention.

Benefits of technology

It realizes the rapid and automatic writing of data to nonvolatile memory when power is out, reducing the risk of data loss, simplifying the data protection process, reducing development costs, and improving data reliability and continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883962A_ABST
    Figure CN119883962A_ABST
Patent Text Reader

Abstract

The invention discloses an MCU (Microprogrammed Control Unit) device with a power-down data protection function, which comprises an ADC (Analog to Digital Converter) module for acquiring reference voltage values of modules in an MCU, a variable reference voltage module for outputting reference output voltages with variable values, a voltage comparison module for comparing the reference voltage values with the corresponding reference voltage values, and a power-down data protection module for outputting power-down data. When the reference voltage value is lower than the variable reference voltage, a power-down signal is generated, and the data transfer module receives the power-down signal and transfers data in one or more addresses in the volatile memory into the nonvolatile memory; the data moving module automatically stores an initial address of a set area in the volatile memory and to-be-backed-up data with a fixed length to a specified address in the nonvolatile memory through a control bus; the data migration module is preset in the chip design stage, and after the power failure signal is received, the data in the volatile memory can be automatically migrated to the nonvolatile memory through the internal bus control of the chip without a processor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power-off protection, and in particular to an MCU device with a power-off data protection function and a power-off data protection method. Background Art

[0002] Microcontrollers (MCUs) play a vital role in modern electronic systems, and they are responsible for controlling, processing, and storing a variety of data. In many applications, especially those that need to memorize user operation data or system status, data protection after MCU power failure is particularly important. When the power is suddenly interrupted, the data stored in volatile memory (such as RAM) will be lost, while the data stored in non-volatile memory (such as Flash memory) can be retained for a long time. Since the power-off process is very rapid, the time window from the normal operating voltage VCC to the minimum voltage that can be written is very short, which may be only a few milliseconds to one or two hundred milliseconds. This time pressure makes it very difficult to complete data writing during the power-off process.

[0003] In the prior art, MCU users mostly control the data movement process by writing programs. This not only increases the complexity of the program, but also increases the cost of development and testing. Programmers need to carefully consider various situations during the power-off process and write corresponding codes to handle these situations. In addition, in order to ensure the correctness and reliability of the data, a large amount of data testing is required, which further increases the development cycle and cost. Summary of the invention

[0004] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide an MCU device with a power-off data protection function and a power-off data protection method.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] An MCU device with a power-off data protection function, comprising:

[0007] ADC module, used to collect the reference voltage values ​​of each module inside the MCU;

[0008] A variable reference voltage module, used for outputting a reference output voltage with a variable value;

[0009] A voltage comparison module, used for comparing a reference voltage value with a corresponding reference voltage value, and generating a power-off signal when the reference voltage value is lower than a variable reference voltage;

[0010] A data migration module, used for receiving a power-off signal and migrating data in one or more addresses in the volatile memory to the non-volatile memory;

[0011] The data moving module is configured to automatically store the starting address of the set area in the volatile memory and the fixed-length data to be backed up to the specified address in the non-volatile memory through the control bus.

[0012] Furthermore, an input terminal of the voltage comparison module is connected to an input voltage VIN.

[0013] Furthermore, the input voltage VIN is introduced into the MCU through an IO interface.

[0014] Furthermore, an input terminal of the voltage comparison module is connected to a power supply voltage VCC.

[0015] Furthermore, the input terminal of the voltage comparison module can be selectively connected to the input voltage VIN or the power supply voltage VCC through an internal switch.

[0016] Furthermore, the input voltage VIN is configured to obtain a power-off signal before the power supply voltage VCC.

[0017] Furthermore, the power-off signal is directly generated by a voltage comparison module.

[0018] Furthermore, the power-off signal is introduced into the voltage comparison module through the IO interface;

[0019] The MCU device further includes an external detection module, which is used to generate an interrupt signal when a power failure is detected, and introduce the interrupt signal to the voltage comparison module through an IO interface to generate a power failure signal.

[0020] A power-off data protection method suitable for the above-mentioned MCU device comprises:

[0021] Configure the reference output voltage Vc of the variable reference voltage module according to the reference voltage values ​​of each module inside the MCU collected by the ADC module;

[0022] The voltage comparison module monitors the power supply voltage VCC or the external input voltage VIN, and generates a power-off signal when it is lower than Vc;

[0023] After receiving the power-off signal, the data migration module automatically migrates the data in the volatile memory to the non-volatile memory through the control bus.

[0024] Furthermore, the power-off data protection method also includes: when power is on, the data migration module automatically reads data from the non-volatile memory through the control bus and stores it in the volatile memory, and after the action is executed, the data migration module sends a completion signal to the processor.

[0025] Due to the adoption of the above technical solution, the present invention has the following beneficial effects:

[0026] 1. The present invention pre-arranges a data migration module during the chip design stage. After receiving a power-off signal, the data migration module can automatically move data in a designated area in a volatile memory to a non-volatile memory through the chip internal bus control without passing through a processor. There is no need for software to repeatedly perform write operations, which greatly simplifies the data protection process. By directly writing the volatile memory to the non-volatile memory through hardware, the writing time can be shortened during a power-off. Since the writing time is shortened, more data can be stored at a higher voltage point during a power-off process, thereby improving reliability. In addition, by implementing data writing and recovery during a power-off through hardware, the amount of code can be reduced and the size of the program storage area can be reduced.

[0027] 2. The present invention can provide additional warning time for the MCU by configuring the input voltage VIN to obtain a power-off signal before the power supply voltage VCC, so that the MCU can take necessary protection measures before the power supply voltage drops completely. At the same time, the introduction of the external detection module and the interrupt signal mechanism further enhances the reliability and response speed of power-off data protection.

[0028] 3. After the power is restored, the data migration module of the present invention can automatically read the data at the specified address from the non-volatile memory and store it back to the volatile memory, ensuring the continuity and integrity of the data. At the same time, the sending of the completion signal enables the processor to timely understand the status of data recovery, facilitating the execution of subsequent operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present invention, but are not intended to limit the present invention.

[0030] Figure 1 is a structural diagram of the first embodiment of the present invention.

[0031] Figure 2 It is a structural diagram of another power-off signal transmission method of the first embodiment of the present invention.

[0032] Figure 3 is a structural diagram of a second embodiment of the present invention.

[0033] Figure 4 yes Figure 3 FIG. 4 is a structural diagram of the third embodiment of the present invention.

[0034] Figure 5 It is a structural diagram of a fourth embodiment of the present invention.

[0035] Reference numerals:

[0036] In the figure, 100. ADC module; 200. variable reference voltage module; 300. voltage comparison module; 400. data transfer module; 500. non-volatile memory; 600. volatile memory; 700. IO interface; 800 external detection module. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. The components of the embodiments of the present invention described and shown in the accompanying drawings can be arranged and designed in various configurations. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0039] Unless otherwise defined, the technical terms or scientific terms used in this patent document shall have the usual meanings understood by people with ordinary skills in the field to which the invention belongs. The words "first", "second" and similar words used in the patent specification and claims of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "one" or "the" do not indicate a quantity limitation, but indicate the existence of at least one. Words such as "include" or "comprise" mean that the elements or objects appearing before "include" or "comprise" include the elements or objects listed after "include" or "comprise" and their equivalents, and do not exclude other elements or objects. "Center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention.

[0040] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0041] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments can be combined with each other.

[0042] Embodiment 1:

[0043] See also Figure 1 The present invention discloses an MCU device with a power-off data protection function, the MCU device includes an ADC module 100, a variable reference voltage module 200, a voltage comparison module 300 and a data transfer module 400. Specifically, the ADC module 100 is used to collect the reference voltage values ​​of each module inside the MCU. The variable reference voltage module 200 is used to output a reference output voltage with a variable value. The voltage comparison module 300 is used to compare the reference voltage value with its corresponding reference voltage value, and generate a power-off signal when the reference voltage value is lower than the variable reference voltage. The data transfer module 400 is used to receive the power-off signal and move the data in one or more addresses in the volatile memory 600 to the non-volatile memory 500. The data transfer module 400 is configured to automatically store the starting address of the set area in the volatile memory 600 and the fixed length of the backup data to the specified address in the non-volatile memory 500 through the control bus.

[0044] It should be noted that in this embodiment, the data moving module 400 is used to move data at a fixed position in the volatile memory 600. The present application implements the preset of the starting address and the ending address through hardware. Specifically, the data moving module 400 can be a special function module (hardware) that can copy data from one address space to another address space, and can realize high-speed data transmission between various memories. The data transmission process is controlled by the data moving module 400 itself without the participation of the processor. To achieve specific control or data processing functions. The data moving module 400 of this embodiment can read the starting address and the ending address preset by the user, and use this information to ensure the correct movement of data during the data moving process. And the data moving module 400 can immediately copy or "move" the data with a fixed length (that is, the amount of data is known) in a pre-set area (this area has a starting address) in the volatile memory 600 to a specified position in the non-volatile memory 500 through the control bus after receiving the power-off signal when the power is off. The data migration module 400 is preset to automatically perform data backup tasks through the control bus without external intervention or manual operation; this means that when a power failure occurs, the system can automatically move the data in the specified area of ​​the volatile memory 600 to the non-volatile memory 500, thereby ensuring the immediacy and accuracy of the data backup process. The automation feature simplifies the operation process. In addition, the variable reference voltage module 200 allows the reference voltage value to be adjusted according to actual needs, which means that the MCU device can adapt to power-off protection requirements of different voltage thresholds. In addition, the data migration module 400 supports the backup of the starting address of the set area in the volatile memory 600 and the data of a fixed length. This flexibility enables the device to easily adapt to data sets and storage layouts of different sizes, providing a wide range of applicability for a variety of application scenarios.

[0045] The input end of the voltage comparison module 300 is connected to the input voltage VIN, which is introduced into the MCU through the IO interface 700, and the reference output voltage Vc of the variable reference voltage module 200 is configured according to the reference voltage values ​​of each module inside the MCU collected by the ADC module 100. When the power supply voltage detection module is lower than the reference output voltage Vc, the voltage comparison module 300 immediately generates a power-off signal. In this embodiment, the power-off signal is a hardware control signal, and there is no need to pass through the processor. The data moving module 400 is controlled through the internal bus of the chip, and the fixed-length data in one or more volatile memory 600 addresses preset by the software are automatically moved to the pre-specified non-volatile memory 500 address in a hardware manner, without the need to perform one or more data read and write operations through software. It should be noted that since the input voltage VIN is the AC voltage, it is configured at the input end of the entire MCU circuit, and VCC is the power supply voltage value (referring to the voltage required for the normal operation of the MCU); when using the AC power to power the MCU, it is necessary to use a power conversion circuit (such as a rectifier, filter, voltage regulator, etc.) to convert the AC voltage (input voltage VIN) into the DC voltage (power supply voltage VCC) required by the MCU. This conversion process usually involves multiple links and devices to ensure the stability and reliability of the voltage. Therefore, the input voltage VIN can obtain a power-off signal before the power supply voltage VCC. And when a power outage is detected, there is more time to back up data. In this embodiment, the power-off signal is directly generated by the voltage comparison module 300. In other embodiments, such as Figure 2 As shown, the power-off signal can also be introduced into the voltage comparison module 300 through the IO interface 700; wherein, the MCU device also includes an external detection module 800, which is used to generate an interrupt signal when a power-off situation is detected, and is introduced into the voltage comparison module 300 through the IO interface 700 to generate a power-off signal.

[0046] The present application also discloses a power-off data protection method for an MCU device, which is implemented by using the MCU device with power-off data protection function of the present application. Specifically, the method includes: configuring the reference output voltage Vc of the variable reference voltage module 200; the voltage comparison module 300 monitors the power supply voltage VCC or the externally introduced voltage VIN, and generates a power-off signal when the power supply voltage VCC or the externally introduced voltage VIN is lower than Vc; after receiving the power-off signal, the data transfer module 400 automatically transfers the data in the volatile memory 600 to the non-volatile memory 500 through the control bus, thereby completing the process of data transfer and backup after power failure. Further, the power-off data protection method in the present application also includes: when power is on, the data transfer module 400 automatically reads data from the non-volatile memory 500 through the control bus and stores it in the volatile memory 600, and after the action is executed, the data transfer module 400 sends a completion signal to the processor, thereby completing the process of data recovery after power on.

[0047] Embodiment 2:

[0048] like Figure 3 As shown, the difference between this embodiment and embodiment 1 is that, in this embodiment, the MCU chip contains a power supply voltage detection module and a data transfer module 400, and also a reference output voltage Vc. The reference output voltage Vc value output by the variable reference voltage module 200 in this embodiment can be configured by software, so as to output a variable and knowable voltage value. The input end of the voltage comparison module 300 is connected to the power supply voltage VCC. When the power supply voltage VCC is lower than the reference output voltage Vc, a power-off signal (hardware control signal) will be generated immediately. Without passing through the processor, the data transfer module 400 automatically moves the data in one or more volatile memory 600 addresses pre-set by the software to the non-volatile memory 500 address specified by the software through the chip internal bus control in a hardware manner, without having to perform one or more data read and write operations through software. In this embodiment, in this embodiment, the voltage value of the reference output voltage Vc can be configured by program and compared with the VCC voltage. Once the VCC voltage drops to the set value, the MCU chip can determine that a power-off situation has occurred and immediately generate a power-off signal (hardware control signal). When the chip receives a power-off signal, the data transfer module 400 automatically writes the data at the specified address of the volatile memory 600 to the specified address of the non-volatile memory 500 by means of the bus and hardware mechanism without going through the processor. Some non-volatile memories 500 need to be erased before writing data. Therefore, when power is turned on, data is first read from the non-volatile memory 500 and stored in the volatile memory 600. When power is turned off next time, regardless of whether the data in the volatile memory 600 is updated, the data will be rewritten to the non-volatile memory 500 again.

[0049] Embodiment 3:

[0050] like Figure 4 As shown, the difference between this embodiment and embodiment 1 is that, in this embodiment, the input end of the voltage comparison module 300 can be selected through an internal switch, and the software configuration can select VCC or VIN, and the reference output voltage Vc can be compared with the power supply voltage VCC or the input voltage VIN to determine the occurrence of a power-off event.

[0051] Embodiment 4:

[0052] like Figure 5 As shown, the difference between this embodiment and embodiment 1 is that, in this embodiment, the power supply voltage of the ADC module 100 can be configured by software to be VCC or Vout externally input through the IO interface 700, and at the same time, the ADC collects a known reference voltage Vb, and infers the VCC or Vout voltage through the known reference voltage Vb (this method is a prior art and will not be described in detail here). When VCC or Vout loses power, a power-off signal (hardware control signal, or a control instruction given after the software obtains it) will be generated immediately. Without going through a processor, the data moving module 400 controls the internal bus of the chip, and automatically moves the data in one or more volatile memory 600 addresses pre-set by the software to the non-volatile memory 500 address specified by the software in a hardware manner, without having to perform one or more data read and write operations through software.

[0053] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. An MCU device with power-off data protection function, characterized in that: include: ADC module, used to collect the reference voltage values ​​of each module inside the MCU; A variable reference voltage module, used for outputting a reference output voltage with a variable value; A voltage comparison module, used for comparing a reference voltage value with a corresponding reference voltage value, and generating a power-off signal when the reference voltage value is lower than a variable reference voltage; A data migration module, used for receiving a power-off signal and migrating data in one or more addresses in the volatile memory to the non-volatile memory; The data moving module is configured to automatically store the starting address of the set area in the volatile memory and the fixed-length data to be backed up to the specified address in the non-volatile memory through the control bus.

2. The MCU device according to claim 1, characterized in that: An input terminal of the voltage comparison module is connected to an input voltage VIN.

3. The MCU device according to claim 2, characterized in that: The input voltage VIN is introduced into the MCU through the IO interface.

4. The MCU device according to claim 1, characterized in that: The input terminal of the voltage comparison module is connected to the power supply voltage VCC.

5. The MCU device according to claim 1, characterized in that: The input terminal of the voltage comparison module can be selectively connected to an input voltage VIN or a power supply voltage VCC through an internal switch.

6. The MCU device according to claim 5, characterized in that: The input voltage VIN is configured to receive a power-off signal before the power supply voltage VCC.

7. The MCU device according to any one of claims 1 or 6, characterized in that: The power-off signal is directly generated by a voltage comparison module.

8. The MCU device according to any one of claims 1 or 6, characterized in that: The power-off signal is introduced into the voltage comparison module through the IO interface; The MCU device further includes an external detection module, which is used to generate an interrupt signal when a power failure is detected, and introduce the interrupt signal to the voltage comparison module through an IO interface to generate a power failure signal.

9. A power-off data protection method for an MCU device according to any one of claims 1 to 8, characterized in that: include: Configure the reference output voltage Vc of the variable reference voltage module according to the reference voltage values ​​of each module inside the MCU collected by the ADC module; The voltage comparison module monitors the power supply voltage VCC or the external input voltage VIN, and generates a power-off signal when it is lower than Vc; After receiving the power-off signal, the data migration module automatically migrates the data in the volatile memory to the non-volatile memory through the control bus.

10. The power-off data protection method according to claim 9, characterized in that: The power-off data protection method further includes: when power is on, the data migration module automatically reads data from the non-volatile memory through the control bus and stores it in the volatile memory, and after the action is executed, the data migration module sends a completion signal to the processor.

Citation Information

Cited By

  • Chip, electronic equipment and data migration method

    CN120631261A