Power failure protection method for real-time data storage of embedded system
By backing up data to internal flash memory in embedded systems and rolling back update operations, the problems of data inconsistency and storage media damage caused by sudden power outages in embedded systems are solved, achieving data consistency and storage media integrity, and extending the lifespan of storage media.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BENGBU POWER SUPPLY COMPANY STATE GRID ANHUI ELECTRIC POWER
- Filing Date
- 2024-10-15
- Publication Date
- 2026-04-21
AI Technical Summary
Embedded systems face issues such as data inconsistency and storage media damage when encountering sudden power outages, especially the risk of shortened storage media lifespan and data loss due to frequent erase and write operations.
By backing up data to internal flash memory in embedded systems and rolling back update operations in the event of power failure, data consistency and integrity are ensured. Embedded internal flash memory is used to record task processing logs to ensure the execution of complete write and erase steps for data blocks.
In the event of a sudden power outage in an embedded system, ensuring data consistency and the integrity of the storage medium reduces the risk of data loss and extends the lifespan of the storage medium.
Abstract
Description
Technical Field
[0001] This invention relates to embedded system design and data storage technology. Background Technology
[0002] Embedded systems face multiple challenges in real-time data storage, including issues related to power stability, storage media lifespan, and capacitor characteristics. Power outages cause significant signal fluctuations, potentially damaging the storage media being written to. Power failures can also corrupt the file system, leading to data inconsistencies. Embedded systems typically have a lifespan of several thousand to hundreds of thousands of cycles; frequent write / erase operations shorten the storage media's lifespan and increase the risk of data loss. Furthermore, using supercapacitors or tantalum capacitors for data protection presents challenges due to their charging and discharging characteristics. For example, charging time, discharging rate, and performance changes at high or low temperatures can all affect the effectiveness of power-down protection.
[0003] This invention proposes a power-loss protection method for real-time data storage in embedded systems. If an embedded system experiences a sudden power outage while the latest data is being modified or added to the storage medium, this method, proposed from a software engineering perspective, fully guarantees data consistency. Summary of the Invention
[0004] (a) Technical problems to be solved
[0005] In view of this, the purpose of this invention is to study a power failure protection method for real-time data storage in embedded systems, and to solve the problem of data inconsistency caused by system power failure in embedded systems.
[0006] (II) Technical Solution
[0007] 1. To modify data in a specific block on an SD card, follow these steps:
[0008] Step 1: Back up the data on the SD card to the embedded internal flash memory. If a power outage occurs during this step, the update operation will be rolled back after power is restored.
[0009] Step 2: Save the data to be updated to the embedded internal flash memory. If power is lost during this step, the update operation will be rolled back after power is restored.
[0010] Step 3: Create a task processing record and save it to the embedded internal flash memory. If a power failure occurs during this step, after power is restored, retrieve the task processing record. If the record is incomplete, roll back the update operation; if the record is complete, retrieve the task processing record and continue to Step 4.
[0011] Step 4: Erase the data blocks on the SD card and update the current status of the task processing record to "erased". If a power outage occurs during this step, continue with steps 4 to 6 after power is restored.
[0012] Step 5: Data was saved in the flash memory in Steps 1 and 2. The new data block content is then assembled from the flash memory. If a power outage occurs during this step, steps 5 and 6 will continue after power is restored.
[0013] Step 6: Write the new data block to the SD card. If a power failure occurs during this step, continue with steps 5 and 6 after power is restored.
[0014] 2. To add data to a specific data block on the SD card, follow these steps:
[0015] Step 1: Save the data to be added to the embedded internal flash memory. If power is lost during this step, the update operation will be rolled back after power is restored.
[0016] Step 2: Create a task processing record and save it to the embedded internal flash memory. If a power failure occurs during this step, after power is restored, retrieve the task processing record. If the record is incomplete, roll back the update operation; if the record is complete, retrieve the task processing record and continue to Step 3.
[0017] Step 3: Erase the data blocks on the SD card and update the current status of the task processing record to "erased". If a power outage occurs during this step, continue with steps 3 and 4 after power is restored.
[0018] Step 4: Write the new data block to the SD card. If a power failure occurs during this step, continue with Step 4 after power is restored.
Claims
1. A power-loss protection method for real-time data storage in embedded systems, characterized in that... To modify data in a specific block on an SD card, follow these steps: Step 1: Back up the data on the SD card to the embedded internal flash memory. If a power outage occurs during this step, the update operation will be rolled back after power is restored. Step 2: Save the data to be updated to the embedded internal flash memory. If power is lost during this step, the update operation will be rolled back after power is restored. Step 3: Create a task processing record and save it to the embedded internal flash memory. If a power failure occurs during this step, after power is restored, retrieve the task processing record. If the record is incomplete, roll back the update operation; if the record is complete, retrieve the task processing record and continue to Step 4. Step 4: Erase the data blocks on the SD card and update the current status of the task processing record to "erased". If a power outage occurs during this step, continue with steps 4 to 6 after power is restored. Step 5: Data was saved in the flash memory in Steps 1 and 2. The new data block content is then assembled from the flash memory. If a power outage occurs during this step, steps 5 and 6 will continue after power is restored. Step 6: Write the new data block to the SD card. If a power failure occurs during this step, continue with steps 5 and 6 after power is restored.
2. A power-loss protection method for real-time data storage in embedded systems, characterized in that... To add data to a specific data block on an SD card, follow these steps: Step 1: Save the data to be added to the embedded internal flash memory. If power is lost during this step, the update operation will be rolled back after power is restored. Step 2: Create a task processing record and save it to the embedded internal flash memory. If a power failure occurs during this step, after power is restored, retrieve the task processing record. If the record is incomplete, roll back the update operation; if the record is complete, retrieve the task processing record and continue to Step 3. Step 3: Erase the data blocks on the SD card and update the current status of the task processing record to "erased". If a power outage occurs during this step, continue with steps 3 and 4 after power is restored. Step 4: Write the new data block to the SD card. If a power failure occurs during this step, continue with Step 4 after power is restored.