Method and system for quickly acquiring effective data in power-on process, vehicle and medium

By dividing the DFlash space of the embedded chip into two sectors S0 and S1, and performing state judgment, CRC checksum data readback verification, the problem of data acquisition difficulties in the power-up process in the prior art is solved, and the data acquisition problem is realized. Fast and reliable data acquisition and storage efficiency.

CN119105699APending Publication Date: 2024-12-10辰致汽车科技集团有限公司

Patent Information

Application Number
CN202411108765.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The prior art is difficult to quickly obtain effective data during power-on, especially when facing large data volumes, storage reliability and independence are poor, and the initialization time is long.

Method used

The DFlash space of the embedded chip is equally divided into two sectors S0 and S1. Each sector contains a status page, a data page and a cache block page. By traversing the sector, CRC checksum data readback verification is performed. Update the content of the cache block, optimize the data recovery and verification mechanism, and ensure the integrity and reliability of the data.

Benefits of technology

It realizes rapid acquisition of effective data, improves system startup speed and data recovery capabilities, enhances data reliability and storage efficiency, and shortens the power-on process time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105699A_ABST
    Figure CN119105699A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a system for quickly acquiring effective data in a power-on process, a vehicle and a medium. The method comprises the following steps of: equally dividing a DFlash space in an embedded chip into two sectors S0 and S1; after power-on, the states of the two sectors are judged firstly, WL traversal is conducted on the two sectors according to the sequence of addresses from back to front, when data are not all zero, a state page is searched and recognized, and the validity of the sectors is determined according to the state page; if all the data are 0, an effective state page is constructed, and the sector state is initialized; if S0 or S1 is valid, traversing sectors from back to front, and detecting and processing valid data; if the sectors S0 and S1 are valid at the same time, judging a new sector and an old sector according to the size of the state page number, and erasing the old sector; in the running process of the system, updating the serial number and the physical address of correctly written data into a cache block variable; and when the system is powered off, updating and writing of the cache block are carried out. According to the invention, effective data can be rapidly obtained in the power-on process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automotive electronic control of embedded systems, and in particular to a method, system, vehicle and medium for quickly acquiring valid data during a power-on process. Background Art

[0002] With the widespread application of embedded chips in the automotive industry, the simulated EEPROM (electrically erasable programmable read-only memory) inside the chip has received more attention. On the one hand, it is because of its large storage capacity and simple operation, and it can also achieve the purpose of reducing project costs. For example, the patent document CN 116954499 A discloses a data processing method and device for simulating EEPROM. Although it adopts the solution of simulating EEPROM, it fails to describe in detail how to quickly obtain valid data during the power-on process, and does not describe in detail the capacity and utilization of the stored data. Another example is the method of using FLASH to simulate EEPROM in an embedded product disclosed in patent document CN117149077 A. The method realizes the reading and writing of data through the Flash+Ram solution, but the solution is relatively complex and occupies a large amount of RAM when facing a large amount of data. The reliability and independence of data storage are poor. Another example is the patent document CN

[0003] The data storage method and system using Flash to simulate EEPROM disclosed in 117742588A is based on relative logical addresses rather than absolute physical addresses. Therefore, the entire storage space needs to be traversed during the power-on process. When faced with a large number of storage objects, the power-on initialization time is increased.

[0004] Therefore, it is necessary to develop a new method, system, vehicle and medium for quickly acquiring valid data during the power-on process. Summary of the invention

[0005] The object of the present invention is to provide a method, system, vehicle and medium for quickly acquiring valid data during a power-on process, which can quickly acquire valid data during a power-on process.

[0006] In a first aspect, a method for quickly acquiring valid data during a power-on process according to the present invention comprises the following steps:

[0007] The DFlash space (i.e., data flash memory) inside the embedded chip is equally divided into two sectors, S0 and S1, each sector contains a status page, a data page, and a cache block page; wherein the status page is used to characterize the status of the current sector, including three states: unused, erased, and used; the data page is used to store data, including a data header, data, and data tail, for judging data integrity; the cache block page is used to record the corresponding number and physical address of each data;

[0008] After power-on, first determine the status of the two sectors according to the base address, and perform WL (word line) traversal on the two sectors in the order of addresses from back to front. When the data is not all 0, find and identify the status page, and determine the validity of the sector based on the status page; if the data is all 0, construct a valid status page and initialize the sector status;

[0009] If the S0 or S1 sector is valid, the sector is traversed from back to front to detect and process valid data, including CRC check (cyclic redundancy check) of the cache block, data readback check and update of the cache block content;

[0010] If the S0 and S1 sectors are both valid, the new and old sectors are determined based on the status page number size, and the old sector is erased;

[0011] During system operation, the number and physical address of the correctly written data are updated in the cache block variable;

[0012] When the system is powered off, the required data objects are stored in sequence and the cache blocks are updated and written.

[0013] Preferably, in the process of judging the sector status after power-on, if all data are 0, the sector with a smaller base address is initialized as a valid sector, and the sector with a larger base address is initialized as an erased sector. In the case where all data are 0, the sector status is directly determined according to the base address size, which simplifies the complexity of the initialization process. No additional data verification or status detection is required, and the sector status is directly set according to the rules, which improves the speed of system startup and response.

[0014] Preferably, if the S0 or S1 sector is valid, the sectors are traversed from back to front to detect and process valid data, including CRC check of the cache block, data readback check and update of the cache block content, specifically:

[0015] If the S0 or S1 sector is valid, the sector is traversed from back to front until the first valid data is detected, and then the data is judged whether it is a cache block according to the number in the data header and the data tail. If it is a cache block, its CRC is first checked. If it is correct, the physical address recorded by the non-zero data in the cache block is read back and checked in turn. If all are correct, the cache block content is retained, and the cache block record content is updated accordingly for incorrect data; then the cache block content is updated to the Cache variable for use by the storage module read-write interface; if the CRC is invalid or the first valid data is not a cache block, it means that the system is in the first operation or abnormal power-off, then the entire sector is traversed again until all valid data is found, and then the corresponding number and physical address are updated to the cache block variable for rebuilding the cache block when power is off. This processing flow ensures the integrity and validity of the cache block data, and enhances data reliability through CRC verification and physical address readback verification. At the same time, it flexibly handles the first operation or abnormal power-off, and ensures stable operation of the system by re-traversing and updating the cache block. This process optimizes the data recovery and verification mechanism, reduces the impact of erroneous data, and improves the robustness of the system and data recovery capabilities.

[0016] Preferably, if the S0 and S1 sectors are both valid, the new and old sectors are determined according to the size of the status page number, and the old sector is erased, specifically:

[0017] If both S0 and S1 sectors are valid at the same time, it means that an exception occurred during the recycling process, causing the recycling process to be interrupted. At this time, the status page number size of the valid sector is used for judgment. The status page with a larger number is determined as a new sector, and the status page with a smaller number is determined as an old sector. The old sector is erased and the erase status flag is set. By judging by the number, the abnormal interruption in the recycling process can be quickly identified to identify the new and old sectors. Only the old sectors are erased to avoid unnecessary waste of resources and improve storage efficiency. The new sector data is retained to ensure that the latest data is not deleted by mistake. At the same time, the erase status flag is set to enhance the reliability of data management.

[0018] Preferably, during the operation of the system, the serial number and physical address of the correctly written data are updated to the cache block variable, specifically:

[0019] During system operation, the corresponding number and physical address of the correctly written data are updated to the cache block Cache variable, and the data that failed to be written is not updated. By only updating the number and physical address of the correctly written data and excluding the data that failed to be written, the system can ensure that the information in the cache block Cache variable is accurate and reduce the impact of erroneous data on system performance. At the same time, this selective update method also avoids unnecessary write operations, improves the efficiency of data storage and access, and reduces the consumption of system resources.

[0020] Preferably, when the system is powered off, the required data objects are stored in sequence, and the cache blocks are updated and written, wherein:

[0021] Before writing to a cache block, the remaining space of the current write sector is judged. If the remaining space is larger than the required space size of the cache block, the cache block variable is directly written; otherwise, the recycling action is triggered in advance. The recycling is triggered in advance by configuring an object with the same size as the cache block but without actual content. The purpose of this operation is to avoid triggering recycling when writing to a cache block. At this time, the content of the cache block has been given as input in advance and cannot be updated. When the cache block is written after recycling, the physical address recorded in the cache block and the actual data address cannot correspond. When the cache block is judged in the next power-on cycle, invalid data will be read, which increases the initialization time caused by re-traversal. When writing to a non-cache block, if the number of bytes written is larger than the remaining space, there is no need to trigger the recycling mechanism in advance, and normal recycling is sufficient.

[0022] Preferably, the object having the same size as the cache block but without actual content is configured as follows:

[0023] If the current sector is S0 sector, first copy the valid data of S0 sector to S1 sector, then write it into the configuration block, then update the data number and physical address after recycling to the cache block variable, write the cache block into S1 sector, and finally erase S0 sector and set the erase status bit;

[0024] If the current sector is S1 sector, first copy the valid data of S1 sector to S0 sector, then write it into the configuration block, then update the data number and physical address after recovery to the cache block variable, write the cache block into S0 sector, finally erase S1 sector and set the erase status bit. By copying data between sectors, it is ensured that data will not be lost during the recovery process, thus ensuring the continuity of data. By updating the cache block variables and writing new sectors while erasing old sectors, not only the utilization of storage space is optimized and fragmentation is reduced, but also the data acquisition time during the power-on process is greatly shortened. The clear data recovery process reduces the loss of storage media and improves the long-term stable operation capability of the system.

[0025] In a second aspect, a system for quickly acquiring valid data during a power-on process described in the present invention comprises a memory and a controller, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, it can execute the steps of the method for quickly acquiring valid data during a power-on process described in the present invention.

[0026] In a third aspect, a vehicle described in the present invention adopts a system for rapidly acquiring valid data during a power-on process as described in the present invention.

[0027] In a fourth aspect, a medium described in the present invention stores a computer-readable program therein, and when the computer-readable program is called by a controller, the steps of the method for quickly acquiring valid data during the power-on process described in the present invention can be executed.

[0028] Beneficial effects of the present invention:

[0029] (1) Based on dual-partition storage, the present invention ensures data reliability by constructing a cache block to mark the corresponding number and physical address of each storage object, and reading back the address marked in the cache block. At the same time, the cache block itself has a CRC check, and data is only allowed to be read if the cache block is correct.

[0030] (2) When the cache block content is last updated during the power-off process, the present invention compares it with the remaining space threshold and samples the early recovery mechanism to ensure that the cache block content is updated in time and written correctly, making prerequisite preparations for reading the cache block in the next power-on cycle.

[0031] (3) In view of the possibility that the cache block is not completely written during the abnormal power-off process, the present invention re-traverses the storage space and rebuilds the cache block to ensure that data can be quickly obtained in the next cycle.

[0032] In summary, the present invention is suitable for large-capacity storage, and the more data objects there are, the more obvious the power-on time can be saved. The present invention can achieve the purpose of quickly acquiring valid data and provide better support for the fast power-on response of the vehicle system. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 This is a schematic diagram of the overall working principle of the simulated EEPROM in the embodiment of the present application;

[0034] Figure 2 This is a flowchart of simulating EEPROM initialization in an embodiment of the present application;

[0035] Figure 3 It is a flow chart of the recycling process in the embodiment of the present application;

[0036] Figure 4 This is a flowchart of data writing during the power-off process in an embodiment of the present application;

[0037] Figure 5 It is a principle block diagram of a system for quickly acquiring valid data during the power-on process in an embodiment of the present application. DETAILED DESCRIPTION

[0038] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.

[0039] In an embodiment of the present application, a method for quickly acquiring valid data during a power-on process includes the following steps:

[0040] The DFlash space inside the embedded chip is equally divided into two sectors, S0 and S1. Each sector content contains three parts: status page, data page and cache block page. Among them, the status page is used to characterize the status of the current sector, including three states: unused, erased and used. The status page data description and data arrangement are shown in Table 1. The data page is used to store data, including data header, data and data tail. The data header and data tail are used to judge the data integrity. The data page description and data arrangement are shown in Table 2. The cache block page is used to record the corresponding number and physical address of each data. The cache block page description and data arrangement are shown in Table 3.

[0041] like Figure 1 As shown in the figure, it is the overall working principle diagram of the simulated EEPROM. The DFlash space inside the embedded chip is equally divided into two sectors, S0 and S1. When the remaining space of the S0 sector is less than the space required for writing data, the data is copied to the S1 sector and the S1 sector is marked as valid. At this time, the S0 sector is valid and the S1 sector is valid. Then the data in the S0 sector is erased and the erased S0 sector is marked as erased. At this time, the S0 sector is erased and the S1 sector is valid. When the remaining space of the S1 sector is less than the space required for writing data, the data is copied to the S0 sector and the S0 sector is marked as valid. At this time, the S0 sector is valid and the S1 sector is valid. Then the S1 sector is erased and the S1 sector is marked as erased. At this time, the S0 sector is valid and the S1 sector is erased.

[0042] Table 1 is the data description and data arrangement table of each status page:

[0043]

[0044] Table 2 is the data page data description and data arrangement:

[0045]

[0046] Table 3 is the buffer block page data description and data arrangement:

[0047]

[0048] like Figure 2 As shown, after power-on, the status of the two sectors is first judged according to the base address, and the WL traversal data (WL size is 512 bytes) is performed from the last address of each sector in the order of the address from back to front. When the data is not all 0, its content is judged until the status page of the corresponding sector is found, and the validity of the sector is determined according to the status page. When the data is all 0, it means that the system has not been initialized. At this time, it is necessary to build a valid status page first. By default, the sector with a smaller base address is initialized as a valid sector, and the sector with a larger base address is initialized as an erased sector. If the S0 or S1 sector is valid, the sector is traversed from back to front to detect and process valid data, including the CRC check of the cache block, the data readback check, and the update of the cache block content; specifically:

[0049] If the S0 sector is valid, traverse the sectors from back to front until the first valid data is detected, and then determine whether the data is a cache block based on the numbers in the data header and data footer. If it is a cache block, first check its CRC. If it is correct, perform data readback verification on the physical addresses recorded by the non-zero data in the cache block in turn. If all are correct, retain the cache block content. If the data is incorrect, update the cache block record content accordingly. Then update the cache block content to the Cache variable (i.e., cache block variable) for use by the storage module read and write interface. If the CRC is invalid or the first valid data is not a cache block, it means that the system is in the first operation or caused by abnormal power-off. In this case, it is necessary to re-traverse the entire sector until all valid data is found, and then update their corresponding numbers and physical addresses to the Cache variable for rebuilding the cache block when power is off. For specific steps, see Figure 2 If the S1 sector is valid, it will be processed in the same way as the S0 sector. If both the S0 and S1 sectors are valid, it means that an exception occurred during the recycling process, causing the recycling process to be interrupted. At this time, the judgment is made based on the size of the valid sector status page number. The larger the number is, the newer the sector is. At this time, the smaller numbered sector will be erased and the erase status flag will be set. For specific steps, see Figure 3 .

[0050] During the system operation, for the data that has been written correctly, its corresponding number and physical address are updated to the cache block Cache variable, and the data that failed to be written is not updated.

[0051] like Figure 4As shown in the figure, when the system is powered off, the required data objects (such as writing DTC (diagnostic trouble code) / OBD (on-board automatic diagnostic system) / operating parameters and other data) are stored in sequence, and finally the cache block is updated and written. Before writing the cache block, the remaining space of the current writing sector will be judged. If the remaining space is larger than the required space size of the cache block, the cache block variable will be written directly; otherwise, the recycling action needs to be triggered in advance. The recycling action is triggered in advance by configuring an object with the same size as the cache block but without actual content.

[0052] In a possible embodiment, an object having the same size as the cache block but without actual content is configured as follows:

[0053] If the current sector is S0, first copy the valid data of S0 to S1, then write the configuration block, then update the data number and physical address after the recovery is completed to the cache block variable, write the cache block to S1, finally erase S0, and set the erase status bit. If the current sector is S1, first copy the valid data of S1 to S0, then write the configuration block, then update the data number and physical address after the recovery is completed to the cache block variable, write the cache block to S0, finally erase S1, and set the erase status bit. The purpose of this operation is to avoid triggering recovery when writing to the cache block, while the content of the cache block has been given as input in advance and cannot be updated. When the recovery is completed and the cache block is written again, the physical address recorded in the cache block cannot correspond to the actual data address. Invalid data will be read when judging the cache block in the next power-on cycle, which increases the initialization time caused by re-traversal. When writing to a non-cache block, if the number of bytes written is greater than the remaining space, there is no need to trigger the recovery mechanism in advance, and normal recovery is sufficient.

[0054] like Figure 5 As shown, in an embodiment of the present application, a system for quickly acquiring valid data during a power-on process includes a memory and a controller, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, it can execute the steps of the method for quickly acquiring valid data during a power-on process as described in the embodiment of the present application.

[0055] In an embodiment of the present application, a vehicle adopts a system for quickly acquiring valid data during the power-on process as described in the embodiment of the present application.

[0056] A medium stores a computer-readable program, which, when called by a controller, can execute the steps of a method for quickly acquiring valid data during a power-on process as described in an embodiment of the present application.

[0057] In an embodiment of the present application, the medium may be a tangible medium that may contain or store a program for use by or in combination with an instruction execution system, device or equipment. The medium may be a machine-readable signal medium or a machine-readable storage medium. The medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. A more specific example of the medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0058] The above-mentioned embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above-mentioned embodiments. Any other changes, modifications, substitutions, combinations and simplifications made without departing from the spirit and principle of the present invention shall be equivalent replacement modes and shall be included in the protection scope of the present invention.

Claims

1. A method for quickly acquiring valid data during a power-on process, characterized in that: The following steps are involved: The DFlash space inside the embedded chip is equally divided into two sectors, S0 and S1, each sector contains a status page, a data page and a cache block page; wherein the status page is used to characterize the status of the current sector, including three states: unused, erased and used; the data page is used to store data, including a data header, data and a data tail, for judging data integrity; the cache block page is used to record the corresponding number and physical address of each data; After power-on, first determine the status of the two sectors according to the base address, and perform WL traversal on the two sectors in the order of addresses from back to front. When the data is not all 0, find and identify the status page, and determine the validity of the sector based on the status page; if the data is all 0, construct a valid status page and initialize the sector status; If the S0 or S1 sector is valid, the sector is traversed from back to front to detect and process valid data, including CRC check of cache block, data readback check and update of cache block content; If the S0 and S1 sectors are both valid, the new and old sectors are determined based on the status page number size, and the old sector is erased; During system operation, the number and physical address of the correctly written data are updated in the cache block variable; When the system is powered off, the required data objects are stored in sequence and the cache blocks are updated and written.

2. The method for quickly acquiring valid data during power-on according to claim 1, characterized in that: In the process of judging the sector status after power-on, if all data are 0, the sector with a smaller base address is initialized as a valid sector, and the sector with a larger base address is initialized as an erased sector.

3. The method for quickly acquiring valid data during power-on according to claim 2, characterized in that: If the S0 or S1 sector is valid, the sectors are traversed from back to front to detect and process valid data, including CRC check of cache blocks, data readback check and update of cache block contents, specifically: If the S0 or S1 sector is valid, the sectors are traversed from back to front until the first valid data is detected, and then the data is determined to be a cache block based on the numbers in the data header and the data footer. If it is a cache block, its CRC is first checked. If it is correct, the physical addresses recorded by the non-zero data in the cache block are checked for data readback in turn. If all are correct, the cache block content is retained, and the cache block record content is updated accordingly for incorrect data; the cache block content is then updated to the Cache variable for use by the storage module read-write interface; if the CRC is invalid or the first valid data is not a cache block, it means that the system is in the first operation or caused by abnormal power-off, then the entire sector is traversed again until all valid data is found, and then the corresponding number and physical address are updated to the cache block variable for rebuilding the cache block when power is off.

4. The method for quickly acquiring valid data during power-on according to claim 2, characterized in that: If the S0 and S1 sectors are both valid, the new and old sectors are determined based on the status page number size, and the old sector is erased, specifically: If both S0 and S1 sectors are valid at the same time, it means that an exception occurred during the recycling process, causing the recycling process to be interrupted. At this time, the sector with a larger status page number is judged as a new sector, and the sector with a smaller status page number is judged as an old sector. And erase the old sector and set the erase status flag.

5. The method for quickly acquiring valid data during power-on according to claim 1, characterized in that: During system operation, the number and physical address of the correctly written data are updated to the cache block variable, specifically: During system operation, the corresponding number and physical address of the correctly written data are updated to the cache block Cache variable, and the data that fails to be written is not updated.

6. The method for quickly acquiring valid data during power-on according to claim 1, characterized in that: When the system is powered off, the required data objects are stored in sequence and the cache blocks are updated and written, where: Before writing a cache block, the remaining space of the current write sector is judged. If the remaining space is larger than the required space of the cache block, the cache block variable is directly written; otherwise, the recycling action is triggered in advance. The recycling action is triggered in advance by configuring an object with the same size as the cache block but without actual content.

7. The method for quickly acquiring valid data during power-on according to claim 6, characterized in that: The configuration is the same as the cache block size but has no actual content, specifically: If the current sector is S0 sector, first copy the valid data of S0 sector to S1 sector, then write it into the configuration block, then update the data number and physical address after recycling to the cache block variable, write the cache block into S1 sector, and finally erase S0 sector and set the erase status bit; If the current sector is the S1 sector, first copy the valid data of the S1 sector to the S0 sector, then write it into the configuration block, then update the data number and physical address after the recovery is completed to the cache block variable, write the cache block into the S0 sector, and finally erase the S1 sector and set the erase status bit.

8. A system for quickly acquiring valid data during power-on, characterized in that: It comprises a memory and a controller, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, the steps of the method for quickly acquiring valid data during the power-on process as claimed in any one of claims 1 to 7 can be executed.

9. A vehicle, characterized in that: A system for quickly acquiring valid data during the power-on process as described in claim 8.

10. A medium, characterized in that: A computer-readable program is stored therein, and when the computer-readable program is called by the controller, the steps of the method for quickly acquiring valid data during the power-on process as described in any one of claims 1 to 7 can be executed.

Citation Information

Patent Citations

  • Data processing method and device for simulating EEPROM

    CN116954499A

  • Method for simulating EEPROM (electrically erasable programmable read-only memory) by FLASH in embedded product

    CN117149077A

Cited By

  • Data storage system and method using FLASH to simulate EEPROM

    CN119759286A

  • Data storage method and device and electronic equipment

    CN120950001A