Data storage method and device of EEPROM (Electrically Erasable Programmable Read-Only Memory)

By setting up a backup area in the EEPROM and adopting cyclic backup storage and data verification technology, the problem of the limited number of EEPROM erase/write cycles is solved, extending its service life and ensuring data integrity, thus meeting the long-term operation requirements of the BMS system.

CN122064529APending Publication Date: 2026-05-19SHANGHAI PAINENG NEW ENERGY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI PAINENG NEW ENERGY TECH CO LTD
Filing Date
2024-11-13
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

EEPROM has a limited number of erase/write cycles, making it difficult to meet the long-term operation requirements of BMS systems. Furthermore, traditional storage methods cannot guarantee data integrity and accuracy, easily leading to premature aging and data corruption.

Method used

By setting up backup areas in the EEPROM with a number corresponding to the difference between the erase/write lifespan and the preset lifespan, and by employing a cyclic backup storage mechanism and data verification technology, the erase/write load is optimized, the lifespan of the EEPROM is extended, and data integrity is ensured.

Benefits of technology

It significantly extends the lifespan of EEPROM, meets the reliability requirements of BMS system for long-term operation, and ensures data integrity and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122064529A_ABST
    Figure CN122064529A_ABST
Patent Text Reader

Abstract

The invention provides an EEPROM (Electrically Erasable Programmable Read-Only Memory) data storage method, an EEPROM data storage device and electronic equipment, and is characterized in that by determining the difference multiple between the erasing service life of the EEPROM and the preset service life, backup areas of which the number is a preset multiple corresponding to the difference multiple are arranged in the EEPROM; initializing a backup area index number, and determining a target backup area corresponding to the backup area index number; acquiring real-time data to be stored, setting a data completion identifier corresponding to a data head in the target backup area as an uncompleted state, and writing the real-time data into the target backup area; and setting the data completion identifier as a completion state, adding a preset step length to the backup area index number, and repeating the step of determining the target backup area according to a preset data storage frequency until the data storage task is completed. And by utilizing a cyclic backup storage mechanism and a data verification technology, the erasing load of the EEPROM is optimized, the service life of the EEPROM is prolonged, and the reliability requirement of long-time operation of the BMS is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and more specifically, to an EEPROM memory data storage method, apparatus, and electronic device. Background Technology

[0002] With the rapid development of new energy technologies, Battery Management Systems (BMS) play a crucial role in energy storage and power battery applications. BMS ensures that batteries operate safely and efficiently by monitoring and managing them. Its core functions include battery status detection, capacity estimation, charge / discharge management, and fault protection, among which accurate storage of real-time data is essential for the long-term reliable operation of the system.

[0003] In a Battery Management System (BMS), real-time data such as battery percentage, voltage, current, and watt-hour integral values ​​need to be frequently stored to ensure the continuity of critical parameters during power outages or fault recovery. Traditionally, Electrically Erasable Programmable Read-Only Memory (EEPROM), as a non-volatile memory, has been widely used for critical data storage in BMS. However, the physical characteristics of EEPROM limit its write cycles, typically ranging from 1 million to 4 million. Assuming data storage occurs every 2 minutes, some EEPROMs with fewer write cycles reach the end of their lifespan in less than 4 years, making it difficult to meet the 15+ year usage requirements of a BMS system.

[0004] Therefore, how to maintain data storage frequency while reducing the number of erase / write cycles on a single EEPROM storage cell, thereby extending its lifespan, has become a pressing issue in the technical field. Furthermore, the system needs to have mechanisms to ensure data integrity and accuracy, preventing data loss or damage due to unexpected power outages or write failures during storage. Traditional single-block storage methods often cannot cope with frequent erase / write operations and data reliability requirements, easily leading to premature aging and data corruption of the EEPROM. Summary of the Invention

[0005] This disclosure provides at least one EEPROM memory data storage method, apparatus, and electronic device. By utilizing a cyclic backup storage mechanism and data verification technology, the erase and write load of the EEPROM is optimized, significantly extending its service life and meeting the reliability requirements of long-term operation of the BMS system.

[0006] This disclosure provides an EEPROM memory data storage method, including:

[0007] Determine the multiple by which the erase / write lifespan of the EEPROM memory differs from the preset lifespan, and set up a number of backup areas in the EEPROM memory that correspond to the preset multiple of the difference multiple;

[0008] Initialize the backup area index number and determine the target backup area corresponding to the backup area index number;

[0009] Acquire the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area;

[0010] The data completion flag is set to a completed state, and the backup area index number is increased by a preset step size. The steps of determining the target backup area are repeated according to the preset data storage frequency until the data storage task is completed.

[0011] In one optional implementation, after initializing the backup area index number, the method further includes:

[0012] Iterate through all the data completion identifiers and timestamps corresponding to the backup areas;

[0013] The backup area with the largest timestamp and the data completion status is selected.

[0014] When it is determined that the cyclic redundancy check code corresponding to the data header in the backup area is correct, the backup area index number is updated to the backup area index number corresponding to the backup area, and the preset step size is increased.

[0015] In one optional implementation, the storage format of the real-time data includes: a real-time data storage header, a backup area data header corresponding to each backup area, and the real-time data stored in each backup area;

[0016] The real-time data storage header is used to identify the storage method of the real-time data;

[0017] The backup area data header includes a data completion identifier, a cyclic redundancy check code, and a timestamp.

[0018] In an optional implementation, after increasing the backup area index number by a preset step size, the method further includes:

[0019] Determine whether the backup zone index number is greater than the number of backup zones corresponding to the backup zone;

[0020] If so, initialize the backup area index number to 1.

[0021] In one optional implementation, the preset multiple is the number of times the data completion identifier needs to be written within the preset data storage frequency.

[0022] This disclosure also provides an EEPROM memory data storage device, including:

[0023] The backup area setting module is used to determine the difference multiple between the erase / write life of the EEPROM memory and the preset life, and to set the number of backup areas in the EEPROM memory that is the preset multiple corresponding to the difference multiple.

[0024] The index number initialization module is used to initialize the backup area index number and determine the target backup area corresponding to the backup area index number.

[0025] The real-time data writing module is used to acquire the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area;

[0026] The loop writing module is used to set the data completion flag to the completion status, and after increasing the backup area index number by a preset step size, repeat the step of determining the target backup area according to the preset data storage frequency until the data storage task is completed.

[0027] In an optional implementation, the device is further configured to:

[0028] Iterate through all the data completion identifiers and timestamps corresponding to the backup areas;

[0029] The backup area with the largest timestamp and the data completion status is selected.

[0030] When it is determined that the cyclic redundancy check code corresponding to the data header in the backup area is correct, the backup area index number is updated to the backup area index number corresponding to the backup area, and the preset step size is increased.

[0031] In an optional implementation, the device is further configured to:

[0032] Determine whether the backup zone index number is greater than the number of backup zones corresponding to the backup zone;

[0033] If so, initialize the backup area index number to 1.

[0034] This disclosure also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they execute the data storage method of the EEPROM memory described above, or the steps in any possible implementation of the data storage method of the EEPROM memory described above.

[0035] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described EEPROM memory data storage method or any possible implementation of the above-described EEPROM memory data storage method.

[0036] This disclosure also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the above-described EEPROM memory data storage method, or the steps in any possible implementation of the above-described EEPROM memory data storage method.

[0037] This disclosure provides an EEPROM memory data storage method, apparatus, and electronic device. By determining the difference multiple between the EEPROM memory's erase / write lifespan and a preset lifespan, a number of backup areas corresponding to the preset multiple of the difference multiple are set in the EEPROM memory. The backup area index numbers are initialized, and the target backup area corresponding to the backup area index number is determined. Real-time data to be stored is acquired, and the data completion flag corresponding to the data header in the target backup area is set to an incomplete state, and the real-time data is written to the target backup area. The data completion flag is set to a completed state, and the backup area index number is increased by a preset step size. The steps of determining the target backup area are repeated according to a preset data storage frequency until the data storage task is completed. By utilizing a cyclic backup storage mechanism and data verification technology, the erase / write load of the EEPROM is optimized, significantly extending its lifespan and meeting the reliability requirements of a BMS system for long-term operation.

[0038] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0040] Figure 1 A flowchart illustrating a data storage method for an EEPROM memory provided in an embodiment of this disclosure is shown;

[0041] Figure 2 A flowchart illustrating another data storage method for an EEPROM memory provided in an embodiment of this disclosure is shown;

[0042] Figure 3 A schematic diagram of a data storage device for an EEPROM memory provided in an embodiment of the present disclosure is shown;

[0043] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present disclosure is shown. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0045] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0046] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0047] Research has revealed that the physical characteristics of EEPROM limit its erase / write cycles, typically ranging from 1 million to 4 million. Assuming data storage occurs every 2 minutes, some EEPROMs with fewer erase / write cycles reach the end of their lifespan in less than 4 years, failing to meet the 15+ year usage requirements of a BMS system. Therefore, how to maintain data storage frequency while reducing the number of erase / write cycles on a single EEPROM cell, thereby extending its lifespan, has become a pressing issue in the technical field. Furthermore, the system needs mechanisms to ensure data integrity and accuracy, preventing data loss or corruption due to unexpected power outages or write failures during storage. Traditional single-block storage methods often cannot cope with frequent erase / write operations and data reliability requirements, easily leading to premature aging and data corruption of the EEPROM.

[0048] Based on the above research, this disclosure provides a data storage method, apparatus, and electronic device for an EEPROM memory. By determining the multiple between the erase / write lifespan of the EEPROM memory and a preset lifespan, a number of backup areas corresponding to the preset multiple of the multiple are set in the EEPROM memory. The backup area index number is initialized, and the target backup area corresponding to the backup area index number is determined. Real-time data to be stored is acquired, and the data completion flag corresponding to the data header in the target backup area is set to an incomplete state, and the real-time data is written to the target backup area. The data completion flag is set to a completed state, and the backup area index number is increased by a preset step size. The steps of determining the target backup area are repeated according to a preset data storage frequency until the data storage task is completed. By utilizing a cyclic backup storage mechanism and data verification technology, the erase / write load of the EEPROM is optimized, significantly extending its lifespan and meeting the reliability requirements of a BMS system for long-term operation.

[0049] To facilitate understanding of this embodiment, a data storage method for an EEPROM memory disclosed in this disclosure will first be described in detail. The execution entity of the data storage method for an EEPROM memory provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, this data storage method for an EEPROM memory can be implemented by a processor calling computer-readable instructions stored in the memory.

[0050] See Figure 1 The diagram shows a flowchart of a data storage method for an EEPROM memory according to an embodiment of this disclosure. The method includes steps S101 to S104, wherein:

[0051] S101. Determine the difference multiple between the erase / write lifespan of the EEPROM memory and the preset lifespan, and set up a backup area in the EEPROM memory with a number corresponding to the preset multiple of the difference multiple.

[0052] In practical implementation, EEPROM is a non-volatile memory with a limited number of erase / write cycles. The erase / write lifespan of EEPROM is typically between 1 million and 4 million cycles. Each data storage or modification involves an erase / write operation; therefore, as the number of erase / write operations increases, the memory gradually ages until it can no longer write new data. The lifespan is determined based on the actual usage time set by the product design. For example, BMS systems typically require a lifespan of over 15 years. This means that the memory needs to support frequent system status recording and data writing throughout the entire product's lifespan.

[0053] Here, to ensure that the EEPROM does not prematurely age within its preset lifespan, we need to calculate the ratio between the EEPROM's erase / write lifespan and the product's lifespan. Assuming the EEPROM's erase / write lifespan is 1 million cycles, and the system writes data every 2 minutes, that's 720 writes per day, or approximately 260,000 writes per year. Then, over a 15-year product lifespan, the number of writes would be approximately 4 million (15 years × 260,000 times / year). Since the EEPROM can only support 1 million erase / write operations, the ratio between the erase / write lifespan and the product's lifespan is 4 million ÷ 1 million = 4 times.

[0054] To extend the lifespan of the EEPROM, data is not written to the same storage area each time, but rather distributed across multiple backup areas. Each backup area can be considered an independent space within the EEPROM, used to store different batches of data.

[0055] It should be noted that the preset multiplier refers to the number of times the data completion indicator needs to be written within the preset data storage frequency. For example, when the difference multiplier is 4, 4 backup areas are initially set up. However, since the data completion indicator in the data header of the backup areas needs to be written twice within the preset data storage frequency of writing data once every 2 minutes, 4 more backup areas need to be set up, for a total of 8 backup areas.

[0056] In this embodiment, the storage format of real-time data includes: a real-time data storage header, a backup area data header corresponding to each backup area, and real-time data stored in each backup area; the real-time data storage header is used to identify the storage method of the real-time data; the backup area data header includes a data completion identifier, a cyclic redundancy check code, and a timestamp.

[0057] Here, the real-time data storage header serves as the overall real-time data storage header for the EEPROM memory, distinguishing the data storage method provided in this application embodiment from existing conventional storage methods (i.e., data storage methods that use EEPROM memory with low erase / write lifespan to achieve the lifespan of EEPROM memory with high erase / write lifespan, versus data storage methods that directly use EEPROM memory with high erase / write lifespan). Furthermore, for each backup area, the data format used is a backup area data header and the real-time data stored in the backup area.

[0058] For example, the real-time data storage header can be 0xAA55 (representing storage using the data storage method provided in this application embodiment), occupying 2 bytes of storage space; for each backup area, the backup area data header can be 0x1132FFFFFFFF, occupying 6 bytes of storage space, where the high byte: this byte indicates whether the data storage of this backup area is complete (11 indicates data storage is complete, 22 indicates data storage is not completed due to power failure or other reasons); 32: this byte indicates the Cyclic Redundancy Check (CRC) code used for the overall backup area data; the low 4 bytes represent the timestamp, with an initial value of 1, which increments by 1 every two minutes when the system is running.

[0059] For example, in the real-time data stored in the backup area, the power percentage occupies 2 bytes of storage space, the power integral value_low byte occupies 2 bytes of storage space, the power integral value_high byte occupies 2 bytes of storage space, the power watt-hour percentage uWH occupies 2 bytes of storage space, the power watt-hour integral value_low byte uWH occupies 2 bytes of storage space, and the power watt-hour integral value_high byte uWH occupies 2 bytes of storage space.

[0060] S102. Initialize the backup area index number and determine the target backup area corresponding to the backup area index number.

[0061] In practical implementation, when the EEPROM memory performs data storage tasks, it first performs power-on initialization and assigns the backup area index number of the global variable to 1. Then, it needs to locate which backup block the latest data was stored in at the time of the last power-off. Once it is confirmed that the cyclic redundancy check code corresponding to the data header in that backup block is correct, the backup area index number is updated in real time, and the target backup area (i.e., the backup area where the current real-time data needs to be stored) corresponding to the updated backup area index number is determined.

[0062] For details, see Figure 2 The diagram shows a flowchart of another data storage method for an EEPROM memory provided in this embodiment of the present disclosure. The method includes steps S1021 to S1022, wherein:

[0063] S1021. Traverse all the data completion identifiers and timestamps corresponding to the backup areas.

[0064] S1022. Filter the backup areas whose data completion identifier is in a completed state and whose timestamp is the largest. When it is determined that the cyclic redundancy check code corresponding to the data header in the backup area is correct, update the backup area index number to the backup area index number corresponding to the backup area, and increase the preset step size.

[0065] In practice, each backup area's data header includes a data completion flag to indicate whether the data in that backup area has been successfully written. Only when the data writing is complete and the data flag is set to completion can the data in that backup area be considered valid. Each time data is written, the system appends a timestamp to the data, recording the specific time the data was written. The timestamp helps the system determine which backup area contains the most up-to-date data.

[0066] Here, the latest data is selected from the backup areas marked as complete, meaning the backup area with the largest timestamp. The CRC code in the data header is checked for correctness. Only when the CRC check passes can the reliability of the data in that backup area be guaranteed. CRC is a verification mechanism used to ensure data integrity. Each backup area's data header contains a CRC checksum. When the system reads data, it recalculates the CRC value of that data and compares it with the CRC value stored in the data header. If they match, it means the data has not been corrupted or erroneous.

[0067] Each backup zone has a corresponding index number to identify it. Having identified the latest and most valid data backup zone through the steps above, the index number of the current backup zone is now updated to match this latest index number. The next data storage operation is then prepared according to the set strategy. The preset step size determines which backup zone should be selected for the next data storage operation.

[0068] Preferably, the preset step size can be 1. For example, when the step size is 1, the index number will increment to the next backup area. If the current backup area is area 3, then the next backup area is area 4.

[0069] S103. Obtain the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area.

[0070] In practice, when writing data to the EEPROM memory, the data completion flag in the data header of the corresponding target backup area is first written to an incomplete state (e.g., written as 22), and then the data writing operation is performed to store the real-time data in the target backup area.

[0071] Here, before actually writing the data, the data completion flag is set to an incomplete state to prevent other modules from mistakenly reading the data in the backup area as valid data before it has been fully written. This ensures that the data in the backup area is not mistakenly considered complete and valid during the writing process. This is to guarantee data integrity and prevent errors during storage.

[0072] S104. Set the data completion flag to the completion status, and after increasing the backup area index number by a preset step size, repeat the step of determining the target backup area according to the preset data storage frequency until the data storage task is completed.

[0073] In practical implementation, the data storage operation of the EEPROM memory is set to perform data storage loop according to a preset data storage frequency (for example, by setting a 2-minute storage timer to perform data writing once every 2 minutes). In the data storage loop, the target backup area indicated by the currently updated backup area index number is first determined. The data completion flag in the data header of the corresponding backup area is first set to the incomplete state, and then the data is written. The real-time data is then stored in the target backup area. When the writing operation is completed, the data completion flag in the data header of the backup area is set to the completed state (for example, written as 11), and the backup area index number is incremented by one step (for example, incremented by 1).

[0074] Here, when it is determined that the backup area index number is greater than the number of backup areas corresponding to the backup area, the backup area index number is initialized to 1. (For example, if the number of backup areas is 4, and the backup area index number is greater than 4 after incrementing by 1, the backup area index number is initialized to 1, and then incremented by 1 again in the next data storage loop).

[0075] As one possible implementation method, the data storage method of the EEPROM memory provided in this application embodiment is mainly applied to achieving a lifespan higher than the erase and write lifespan of the EEPROM memory using an EEPROM memory with a low erase and write lifespan (hereinafter collectively referred to as the new storage method), and can be compatible with the method of directly using an EEPROM memory with a high erase and write lifespan for storage (hereinafter collectively referred to as the original storage method).

[0076] Specifically, after power-on initialization, check if the statistical data identifier (DRV_EEPROM_STATSTIC_FLAG_ADDR) of the external EEPROM memory is 0x55aa. If not, it means that the EEPROM memory has been erased or has never been loaded. In this case, 0x55aa needs to be written into the statistical data identifier of the external EEPROM memory, and the data is triggered to be stored in the original statistical data location according to the storage logic of the new storage method. The real-time data of the statistical data is stored in the corresponding new location using the data structure corresponding to the new storage method. At this time, the initialization of the EEPROM memory is completed.

[0077] Furthermore, if the statistical data identifier of the EEPROM memory is 0x55aa, then the real-time data storage header of the EEPROM memory is read to determine the data storage method indicated by the data storage header (e.g., whether the identifier is 0xAA55).

[0078] Here, if the statistical data identifier of the EEPROM memory is 0x55aa, it means that the EEPROM memory stores data in the data storage format corresponding to the new storage method. In this case, all statistical data (except real-time data) needs to be restored to the original structure, and the real-time data needs to be restored from the new location to the new structure. At this point, the initialization of the EEPROM memory is complete. If the statistical data identifier of the EEPROM memory is not 0x55aa, it means that the EEPROM memory stores data in the data storage format corresponding to the original storage method. In this case, all statistical data (except real-time data) needs to be restored to the original structure, and the real-time data needs to be retrieved from the original statistical data location and assigned to the new structure. At this point, the initialization of the EEPROM memory is complete.

[0079] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0080] This disclosure provides a data storage method for an EEPROM memory. The method involves determining the difference between the EEPROM memory's erase / write lifespan and a preset lifespan, and then setting up a number of backup zones in the EEPROM memory corresponding to the preset multiple of the difference multiple. The method initializes backup zone index numbers and determines the target backup zone corresponding to each index number. Real-time data to be stored is acquired, and the data completion flag corresponding to the data header in the target backup zone is set to an incomplete state. The real-time data is then written to the target backup zone. The data completion flag is then set to a completed state, and the backup zone index number is increased by a preset step size. The steps of determining the target backup zone are repeated according to a preset data storage frequency until the data storage task is completed. By utilizing a cyclic backup storage mechanism and data verification technology, the erase / write load of the EEPROM is optimized, significantly extending its lifespan and meeting the reliability requirements of a BMS system for long-term operation.

[0081] Based on the same inventive concept, this disclosure also provides a data storage device for an EEPROM memory corresponding to the data storage method of the EEPROM memory. Since the principle of the device in this disclosure for solving the problem is similar to the data storage method of the EEPROM memory described above in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0082] Please see Figure 3 , Figure 3 This is a schematic diagram of a data storage device for an EEPROM memory provided in an embodiment of this disclosure. Figure 3As shown in the figure, the data storage device 300 of the EEPROM memory provided in this embodiment includes:

[0083] The backup area setting module 310 is used to determine the difference multiple between the erase / write life of the EEPROM memory and the preset life, and to set a number of backup areas in the EEPROM memory that correspond to the preset multiple of the difference multiple.

[0084] The index number initialization module 320 is used to initialize the backup area index number and determine the target backup area corresponding to the backup area index number.

[0085] The real-time data writing module 330 is used to acquire the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area.

[0086] The loop writing module is used to set the data completion flag to the completion status, and after increasing the backup area index number by a preset step size, repeat the step of determining the target backup area according to the preset data storage frequency until the data storage task is completed.

[0087] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0088] This disclosure provides a data storage device for an EEPROM memory. By determining the difference between the EEPROM memory's erase / write lifespan and a preset lifespan, a number of backup areas corresponding to the preset multiple of the difference multiple are set in the EEPROM memory. Backup area index numbers are initialized, and target backup areas corresponding to the index numbers are determined. Real-time data to be stored is acquired, and the data completion flag corresponding to the data header in the target backup area is set to an incomplete state, and the real-time data is written to the target backup area. The data completion flag is then set to a completed state, and the backup area index number is increased by a preset step size. The steps of determining the target backup area are repeated according to a preset data storage frequency until the data storage task is completed. By utilizing a cyclic backup storage mechanism and data verification technology, the erase / write load of the EEPROM is optimized, significantly extending its lifespan and meeting the reliability requirements of a BMS system for long-term operation.

[0089] Corresponding to Figure 1 and Figure 2 This disclosure also provides an electronic device 400, such as a data storage method for an EEPROM memory. Figure 4 The diagram shown is a structural schematic of an electronic device 400 provided in an embodiment of this disclosure, including:

[0090] Processor 41, memory 42, and bus 43; memory 42 is used to store execution instructions, including main memory 421 and external memory 422; the main memory 421, also called internal memory, is used to temporarily store the computational data in processor 41, as well as the data exchanged with external memory 422 such as hard disk. Processor 41 exchanges data with external memory 422 through main memory 421. When the electronic device 400 is running, processor 41 and memory 42 communicate through bus 43, enabling processor 41 to execute... Figure 1 and Figure 2 The steps of the data storage method of the EEPROM memory.

[0091] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the data storage method of the EEPROM memory described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0092] This disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they can perform the steps of the data storage method of the EEPROM memory described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0093] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0096] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0098] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A data storage method for an EEPROM memory, characterized in that, include: Determine the multiple by which the erase / write lifespan of the EEPROM memory differs from the preset lifespan, and set up a number of backup areas in the EEPROM memory that correspond to the preset multiple of the difference multiple; Initialize the backup area index number and determine the target backup area corresponding to the backup area index number; Acquire the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area; The data completion flag is set to a completed state, and the backup area index number is increased by a preset step size. The steps of determining the target backup area are repeated according to the preset data storage frequency until the data storage task is completed.

2. The method according to claim 1, characterized in that, After initializing the backup area index number, the method further includes: Iterate through all the data completion identifiers and timestamps corresponding to the backup areas; The backup area with the largest timestamp and the data completion status is selected. When it is determined that the cyclic redundancy check code corresponding to the data header in the backup area is correct, the backup area index number is updated to the backup area index number corresponding to the backup area, and the preset step size is increased.

3. The method according to claim 1, characterized in that: The storage format of the real-time data includes: a real-time data storage header, a backup area data header corresponding to each backup area, and the real-time data stored in each backup area; The real-time data storage header is used to identify the storage method of the real-time data; The backup area data header includes a data completion identifier, a cyclic redundancy check code, and a timestamp.

4. The method according to claim 1, characterized in that, After increasing the backup area index number by a preset step size, the method further includes: Determine whether the backup zone index number is greater than the number of backup zones corresponding to the backup zone; If so, initialize the backup area index number to 1.

5. The method according to claim 1, characterized in that: The preset multiple is the number of times the data completion identifier needs to be written within the preset data storage frequency.

6. An EEPROM memory data storage device, characterized in that, include: The backup area setting module is used to determine the difference multiple between the erase / write life of the EEPROM memory and the preset life, and to set the number of backup areas in the EEPROM memory that is the preset multiple corresponding to the difference multiple. The index number initialization module is used to initialize the backup area index number and determine the target backup area corresponding to the backup area index number. The real-time data writing module is used to acquire the real-time data to be stored, set the data completion flag corresponding to the data header in the target backup area to an incomplete state, and write the real-time data into the target backup area; The loop writing module is used to set the data completion flag to the completion status, and after increasing the backup area index number by a preset step size, repeat the step of determining the target backup area according to the preset data storage frequency until the data storage task is completed.

7. The apparatus according to claim 6, characterized in that, The device is also used for: Iterate through all the data completion identifiers and timestamps corresponding to the backup areas; The backup area with the largest timestamp and the data completion status is selected. When it is determined that the cyclic redundancy check code corresponding to the data header in the backup area is correct, the backup area index number is updated to the backup area index number corresponding to the backup area, and the preset step size is increased.

8. The apparatus according to claim 6, characterized in that, The device is also used for: Determine whether the backup zone index number is greater than the number of backup zones corresponding to the backup zone; If so, initialize the backup area index number to 1.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the EEPROM memory data storage method as described in any one of claims 1 to 5 are performed.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the EEPROM memory data storage method as described in any one of claims 1 to 5.