Data storage method for prolonging service life of flash
By using a method of cyclically reading and writing by address and erasing all at once after the address is full, the complex area division and management problems in the existing technology are solved, the lifespan of flash memory is improved while maintaining read and write speed, and independent operation and flexible starting address selection are supported.
Patent Information
- Application Number
- CN202410934646.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-08
AI Technical Summary
Existing technical solutions are complex, requiring the division of flash memory into different areas and management of write/erase status, which affects read/write speed and is not user-friendly.
It adopts a method of cyclic reading and writing by address and erasing all at once after the address is full. Combined with the characteristics of flash writing, the current and next storage addresses are recorded through the information field, and the starting address can be flexibly selected. The chip can work independently.
It achieves simplified flash management, improves lifespan, reduces the impact on read and write speeds, and supports independent operation and flexible starting address selection.
Smart Images

Figure CN118915962A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of flash, and in particular to a data storage method for improving the service life of flash. Background Art
[0002] The life of flash is related to the number of erase and write cycles. Existing technical solutions all address this issue, balancing the number of erase and write cycles in each area and solving the bottleneck of high local erase and write rates.
[0003] For example, Chinese patent number: CN115132260A discloses a data storage and reading method that can increase the service life of flash storage units. The patent proposes to balance the number of erase and write times of each storage unit to increase the service life of flash. This design divides the flash storage into two sectors for use and management, which not only requires monitoring the use of the two areas, but also affects the read and write speed.
[0004] Another example is a real-time data cyclic reading and writing method for increasing the service life of FLASH disclosed in Chinese patent CN115390755A. The patent proposes logical processing and cross-page regulation to achieve efficient reading and writing and convenient operation. This design is not application-friendly, and the discontinuous compilation address of the software program is difficult to implement. Although there is no file system management, it is also necessary to store the usage marks of each page, to perform statistical management, and to connect to the host computer in real time. Once the host computer is disconnected and the data is lost, the system will crash.
[0005] In summary, it can be seen that the existing technical solution adopts regional division, counts the number of erase and write times for each area, and then performs regional erase and write based on the result analysis. This method is complex to design, requires storing the number of usage data, and also needs to compare to find which area has a low usage rate, and then use it, which will also affect the read and write speed. Summary of the invention
[0006] In view of the shortcomings of the prior art, the present invention provides a data storage method for improving the service life of flash, which solves the problems of the prior art such as the complexity of the solution, the need to divide the flash areas, manage the erase and write conditions, affect the read and write speed, and is not application-friendly.
[0007] The technical solution of the present invention is as follows: A data storage method for improving the service life of flash, characterized in that it comprises the following steps: Step 1. Downloading and writing a program through a host computer; Step 2. The host computer rolls back the program flow steps and Step 3. The chip workflow steps:
[0008] Step 1 includes:
[0009] 1.1 Calculate the size of the current write program;
[0010] 1.2 Read the mapping value MM1 of the number of times the information field is read, and the address AX of the last stored address information is calculated;
[0011] 1.3 Read the last stored address information AAX;
[0012] 1.4 Start burning the program from the last stored address until it is completed;
[0013] 1.5 Write the current number mapping value MM2 (MM2=MM1<<1), and write the current storage address information at address A(X+1);
[0014] Step 2 includes:
[0015] 2.1 Read the mapping value MM1 of the number of times the information field is read, and calculate the address AX of the last stored address information;
[0016] 2.2 Read the last storage address information and the last storage address information;
[0017] 2.3 Write the current number mapping value MM2 (MM2=MM1<<1), and write the last storage address information and the last storage address information combination value at the A(X+1) address;
[0018] Wherein step 3 comprises: mapping the number of times of power-on loading information domain to value MM1, and calculating the address AAX of the last storage address information;
[0019] Read the last stored address information and store it in the program load entry register;
[0020] After power-on is complete, the program is executed (starting from the value of the program loading entry register).
[0021] As a preferred method, the flash is read and written cyclically according to the address, and is erased all at once after being filled.
[0022] As a preference, there is no need to connect to a host computer in real time, and the chip can work independently.
[0023] As a preference, flexible selection of the first address of the first write program is supported, so that the chip initialization program or fixed data can be placed at a low address, and the application program skips this block area without the need to re-burn each time.
[0024] Preferably, the record management information is stored in a backup domain or a last page of the flash.
[0025] As a preferred option, it supports rolling back program versions without the need for re-burning, and the steps are simple.
[0026] As a preference, the program loading and running speed is not affected.
[0027] As a preferred method, the number of flash chip erase and write times is unified, the usage rate of each part of the flash is balanced, and the flash life is increased.
[0028] The present invention provides a data storage method for improving the service life of flash, which can realize the use of flash for cyclic reading and writing according to the address, and a one-time erasing method after the flash is full, that is, the flash is fully erased and used after being nearly fully written, and the first address of the current time and the first address of the next storage are recorded and stored in the middle. This method makes the erasure times of each area of the flash consistent, and the times do not need to be recorded. In addition, it supports flexible selection of the first address of the first write program, and the chip initialization program or fixed data can be placed on the low address, and the application program skips this block area, and does not need to be re-burned each time. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0030] like Figure 1 As shown, in the specific implementation of the present invention, there is no need to connect to the host computer in real time, and the chip can work independently. The backup domain or the last page of the flash stores the record management information, which is called the information domain. The stored information includes the current write count mapping value MM, the address of each write and the first address of the next storage, such as Figure 1 As shown. The flash storage characteristics determine that only 0 can be written. When the data is to be changed from 0 to 1, an erase operation must be performed. This design combines this feature. The flash is written once and then erased. The characteristics of the mapping value MM of the current number of writes of the stored information are that it is all 1 when the flash is empty. After writing a program once, the lowest bit of MM is written to 0. After writing the program for the second time, the second lowest bit of MM is written to 0. And so on. After writing the program N times, the Nth bit of MM from low to high is written to 0. The minimum value of N is estimated based on the actual flash capacity and the size of the program written once, that is, N>=(flash capacity) / (the size of the program written once).
[0031] The steps of downloading and writing program on the host computer are as follows:
[0032] Calculate the size of the current write program;
[0033] The number of times the information field is read is mapped to the value MM1, and the address AX of the last stored address information is calculated;
[0034] Read the last stored address information AAX;
[0035] Start burning the program from the location of the last stored address until it is completed;
[0036] Write the current number mapping value MM2 (MM2=MM1<<1), and write the current storage address information at the A(X+1) address.
[0037] The steps of the upper computer rollback program are as follows:
[0038] The number of times the information field is read is mapped to the value MM1, and the address AX of the last stored address information is calculated;
[0039] Read the last storage address information and the last storage address information;
[0040] The current number mapping value MM2 (MM2=MM1<<1) is written, and the previous storage address information and the previous storage address information combination value are written at the A(X+1) address.
[0041] Microarray workflow steps:
[0042] The number of times the information field is loaded upon power-on is mapped to the value MM1, and the address AAX of the last stored address information is calculated;
[0043] Read the last stored address information and store it in the program load entry register.
[0044] After power-on is complete, the program is executed (starting from the value of the program loading entry register).
[0045] The above generally describes the present invention in detail, but it is obvious to a person skilled in the art that some modifications or improvements can be made to the present invention. Therefore, modifications or improvements that do not depart from the spirit of the present invention are within the scope of protection of the present invention.
Claims
1. A data storage method for increasing the service life of flash, characterized in that: The process includes the following steps: Step 1. Download and write the program through the host computer; Step 2. The host computer rolls back the program flow steps and Step 3. The chip workflow steps: Step 1 includes: 1.1 Calculate the size of the current write program; 1.2 Read the mapping value MM1 of the number of times the information field is read, and the address AX of the last stored address information is calculated; 1.3 Read the last stored address information AAX; 1.4 Start burning the program from the last stored address until it is completed; 1.5 Write the current number mapping value MM2 (MM2=MM1<<1), and write the current storage address information at address A(X+1); Step 2 includes: 2.1 Read the mapping value MM1 of the number of times the information field is read, and calculate the address AX of the last stored address information; 2.2 Read the last storage address information and the last storage address information; 2.3 Write the current number mapping value MM2 (MM2=MM1<<1), and write the last storage address information and the last storage address information combination value at the A(X+1) address; Wherein step 3 comprises: mapping the number of times of power-on loading information domain to value MM1, and calculating the address AAX of the last storage address information; Read the last stored address information and store it in the program load entry register; After power-on is complete, the program is executed (starting from the value of the program loading entry register).
2. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: The method of reading and writing the flash in a loop according to the address, and erasing it all at once after it is full.
3. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: There is no need to connect to the host computer in real time, the chip can work independently.
4. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: Supports flexible selection of the first address of the first write program. The chip initialization program or fixed data can be placed at a low address, and the application program skips this area without the need to re-burn each time.
5. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: The record management information is stored in the backup area or the last page of the flash.
6. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: Supports rolling back program versions, no need to re-burn, the steps are simple.
7. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: It does not affect the program loading and running speed.
8. The data storage method for increasing the service life of flash as claimed in claim 1, characterized in that: Unify the number of flash erase and write times, balance the usage of each part of the flash, and increase the life of the flash.
Citation Information
Patent Citations
Data storage and reading method capable of prolonging service life of flash storage unit
CN115132260A
Real-time data cycle read-write method for prolonging service life of FLASH
CN115390755A
