CN115952113B - EEPROM storage protection method - Google Patents

EEPROM storage protection method Download PDF

Info

Publication number
CN115952113B
CN115952113B CN202310248926.1A CN202310248926A CN115952113B CN 115952113 B CN115952113 B CN 115952113B CN 202310248926 A CN202310248926 A CN 202310248926A CN 115952113 B CN115952113 B CN 115952113B
Authority
CN
China
Prior art keywords
eeprom
data
buffer
embedded equipment
erasing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310248926.1A
Other languages
Chinese (zh)
Other versions
CN115952113A (en
Inventor
康义
李�杰
王云
姜明军
沈永柏
孙艳
江梓贤
刘欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ligao Shandong New Energy Technology Co ltd
Original Assignee
Ligao Shandong New Energy Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ligao Shandong New Energy Technology Co ltd filed Critical Ligao Shandong New Energy Technology Co ltd
Priority to CN202310248926.1A priority Critical patent/CN115952113B/en
Publication of CN115952113A publication Critical patent/CN115952113A/en
Application granted granted Critical
Publication of CN115952113B publication Critical patent/CN115952113B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

The invention belongs to the technical field of embedded equipment of new energy automobiles, in particular to an EEPROM storage protection method which is applied to executing EEPROM erasing protection in the embedded equipment and comprises the following steps of: obtaining the maximum erasing times N of EEPROM in the embedded device e And the life span T of the embedded equipment, and obtaining the minimum time interval T of single erasure of the EEPROM based on the life span T sl, And based on T sl The number of times of single permission of erasing and writing of the EEPROM is obtained and recorded as N ae The method comprises the steps of carrying out a first treatment on the surface of the The invention dynamically distributes the number of times of erasing EEPROM which is not used in the early stage in the running process to the later stage while ensuring the service life of the storage medium in a cache way, and proposes to judge the number of times N of data change in the buffer s And the number of times data is stored in the EEPROM in the buffer N sl On the basis of guaranteeing the service life of the storage medium, when the data is frequently changed, the data changed in real time is stored to the maximum extent.

Description

EEPROM storage protection method
Technical Field
The invention belongs to the technical field of embedded equipment of new energy automobiles, and particularly relates to an EEPROM storage protection method.
Background
The automobile has many embedded control units, there are many key parameters in the running process of the automobile, in order to prevent the RAM (random access memory) from being reinitialized after dormancy to lose key data, the key parameters are required to be stored into EEPROM (electrically erasable programmable read only memory, a memory chip which does not lose data after power failure) when dormancy, and the data is read from EEPPROM and recovered after power-on.
When a lead-acid pull or watchdog reset occurs throughout the vehicle, data cannot be stored in a dormant mode, which can result in many critical data losses. Many key parameters in the existing embedded equipment need to be stored in the EEPROM in a rolling way when the key parameters change, such as SOC, SOH, fault snapshot data and the like in a battery management system, but the key data storage times of the general embedded equipment are limited by the maximum allowable erasure times of a storage medium, and the requirements of each parameter are different from the use situation, so that the storage condition of each parameter is different, if the storage condition of the real-time storage of part of parameters is unreasonable, the storage medium of the embedded equipment is frequently erased, the storage life is greatly shortened, and under the more serious condition, the storage medium is permanently damaged, the read key parameters are abnormal, the system is abnormal, and the service life requirement of an automobile cannot be met.
Disclosure of Invention
The invention provides an EEPROM storage protection method, which provides a layer of middleware between a data storage function and a bottom layer function, and can avoid the condition that EEPROM is erased frequently due to abnormality in the storage function, and avoid that the EEPROM is abnormal and does not meet the service life requirement.
The invention realizes the above purpose through the following technical scheme:
a method of EEPROM memory protection, the method being applied to performing EEPROM erase protection in an embedded device, comprising the steps of:
obtaining the maximum erasing times N of the EEPROM in the embedded equipment e And the life span T of the embedded equipment, and obtaining the shortest time interval T of single erasure of the EEPROM based on the life span T sl And based on the T sl The number of times of single permission of erasing and writing of the EEPROM is obtained to be N ae
Establishing a buffer and storing a counter number value N representing the number of data changes in the buffer during initialization of the embedded device s And a storage counter cache value N characterizing the number of times data is stored into the EEPROM in the buffer sl
The EEPROM storage protection method further comprises the following steps: when the embedded equipment is in a non-dormant state or a dormant state, judging the mode of writing dynamic data in the embedded equipment into the EEPROM by the change times of the data in the buffer and the times of the data stored in the buffer, wherein the method specifically comprises the following steps of:
s1: judging whether the embedded equipment is in a non-dormant state, if so, executing a step S2, otherwise, executing a step S3;
s2: the embedded device is in a non-dormant state and satisfies N s +1<N ae And N is s >N sl The data in the buffer is written into the EEPORM preferentially, and the N is written into the EEPORM sl Is updated to the value of N s Is a numerical value of (2); if satisfy N s +1>N ae Preferentially storing the data into the buffer;
wherein N is s +1 represents dynamic data written into the buffer once in real time;
s3: the embedded equipment is in a dormant state and meets N s >N sl Preferentially storing the data in the buffer into the EEPROM; and if not, preferentially storing the data into the buffer.
As a further optimization scheme of the invention, the maximum erasing times N of the EEPROM are obtained e The method comprises the following steps: judging whether the embedded equipment is provided with an EEPROM, if so, recording the maximum erasing times as N e Otherwise, dividing FLASH data in the embedded device into N l Sub-data rolling storage, simulating FLASH maximum erasing times of EEPROM
Figure SMS_1
Wherein the N is f And the maximum erasing times of FLASH in the embedded equipment are obtained.
As a further optimization scheme of the invention, the EEPROM is erased for the shortest time interval T once sl The calculation formula of (a) is specifically as follows:
Figure SMS_2
as a further optimization scheme of the invention, the EEPROM is used for single time every interval under the condition that the embedded device is in a non-dormant stateErase minimum time interval T sl The number of times of single permission erasing of the EEPROM is N ae +1。
As a further optimization scheme of the invention, the dynamic data is specifically the data which is changed and needs to be stored in real time and received by the embedded equipment in real time.
As a further optimization scheme of the invention, the embedded device preferentially stores the dynamic data into the buffer when receiving the dynamic data.
The invention has the beneficial effects that:
(1) The buffer is built in the EEPROM, so that the maximum erasing times of the storage medium (EEPROM) are distributed to the erasing times in each period of time in advance, and the storage medium is ensured not to be excessively erased and damaged in the service life period;
(2) The invention dynamically distributes the number of times of erasing EEPROM which is not used in the early stage in the running process to the later stage in the caching way while ensuring the service life of the storage medium, namely, proposes to judge the number of times N of data change in the buffer s And the number of times data is stored in the EEPROM in the buffer N sl On the basis of guaranteeing the service life of the storage medium, when the data is frequently changed, the data changed in real time can be stored to the maximum extent.
Drawings
Fig. 1 is a schematic diagram illustrating an execution flow of the EEPORM memory protection method according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings, wherein it is to be understood that the following detailed description is for the purpose of further illustrating the invention only and is not to be construed as limiting the scope of the invention, as various insubstantial modifications and adaptations of the invention to those skilled in the art can be made in light of the foregoing disclosure.
As shown in fig. 1, which is a schematic diagram illustrating steps of implementing the algorithm of the present invention, the present invention provides a method for protecting EEPROM storage, which is applied to executing EEPROM erasure protection in an embedded device, and includes the following steps:
acquisition ofMaximum erasing times N of EEPROM in embedded equipment e And the life span T of the embedded equipment, and obtaining the minimum time interval T of single erasure of the EEPROM based on the life span T sl And based on T sl The number of times of single permission of erasing and writing of the EEPROM is obtained and recorded as N ae The method comprises the steps of carrying out a first treatment on the surface of the The life span T of the product is obtained according to the product quality assurance required life time, for example, the quality assurance span of a battery management system in the prior art is generally 10 years.
The invention discloses two methods for storing data through EEPROM, one is that an MCU chip (micro control unit) in the embedded equipment is provided with EEPROM, and the other MCU chip is provided with no EEPROM, and the storage is realized through simulating EEPROM.
Obtaining the maximum erasing times N of the EEPROM e The method comprises the following steps: judging whether the embedded equipment is provided with an EEPROM, if so, recording the maximum erasing times as N e Otherwise, the EEPROM is simulated in a chip, and FLASH data (FLASH memory) in the embedded device is divided into N l Sub-data rolling storage, simulating FLASH maximum erasing times of EEPROM
Figure SMS_3
Wherein N is f The maximum erasing times of FLASH in the embedded device are obtained.
Wherein, the minimum time interval T of each erasure in the MCU chip is the shortest time interval T of each erasure in the MCU chip when the embedded device is stored sl The calculation formula of (a) is specifically as follows:
Figure SMS_4
the method comprises the steps of carrying out a first treatment on the surface of the In the case of an embedded device in a non-sleep state, a single erase of EEPROM occurs for a minimum time interval T sl The number of times of single permission erasing of the EEPROM is N ae +1。
The invention establishes a buffer and a storage counter N for representing the number of data change times in the buffer in the initialization process of the embedded equipment s And a storage counter cache value N characterizing the number of times data is stored into the EEPROM in the buffer sl The method comprises the steps of carrying out a first treatment on the surface of the Among them, data that changes in real time and needs to be stored in real time is hereinafter referred to as dynamic data.
The EEPROM storage protection method in the invention further comprises the following steps: when the embedded device is in a non-dormant state or a dormant state, judging a mode of writing dynamic data in the embedded device into the EEPROM by the change times of the data in the buffer and the times of the data stored in the buffer, wherein the method specifically comprises the following steps of:
s1: judging whether the embedded equipment is in a non-dormant state, if so, executing the step S2, otherwise, executing the step S3;
s2: the embedded device is in a non-dormant state, and when dynamic data is generated, the stored counter number value N is satisfied s +1 < number of times of single permission of erasing and writing N ae Storing counter number N s Buffer value N of storage counter sl In this process N s +1 represents that the dynamic data is written into the buffer once in real time, the data in the buffer is preferentially written into the EEPORM, and the buffer value N of the storage counter is stored sl The value update is to store the counter number N s Is a numerical value of (2); if satisfy N s +1>N ae Preferentially storing the data into the buffer;
step S2 of the invention firstly caches dynamic data in a buffer when the embedded equipment is in a non-dormant state, when the number of data change in a storage counter is larger than the number of data storage in an EEPROM (electrically erasable programmable read-Only memory), a large amount of dynamic data stored in real time are shown in the buffer, and the data in the buffer is quickly written into the EEPORM in the non-dormant state; if the number of data change times in the storage counter is larger than the number of single permission erasing times of the EEPROM, the number is recorded as N ae In order to avoid the loss of dynamic data or avoid damage caused by excessive EEPROM erasing times, the dynamic data is stored in the buffer preferentially.
According to the invention, through a buffer mode (a buffer is constructed), the service life of the EEPROM is prolonged, and meanwhile, a large amount of data is prevented from being directly written into the EEPROM in real time in a non-dormant state, so that damage caused by excessive erasing is avoided; meanwhile, the number of times of erasing and writing EEPROM which is not used in the earlier stage in the running process is dynamically distributed to the later stage, and the real-time changed data (dynamic data) can be stored to the maximum extent when the data are frequently changed on the basis of guaranteeing the service life of a storage medium (EEPROM).
S3: the embedded device is in a dormant state and satisfies N s >N sl (when the number of data change times in the buffer is larger than the number of data storage times in the EEPROM in the buffer), the data in the buffer is stored in the EEPROM preferentially when a large amount of stored dynamic data exist in the buffer, so that the data in the buffer is prevented from being lost in the sleep state buffer; if N s <N sl The data is stored in the buffer preferentially, and the dynamic data is cached in the buffer in order to avoid damage caused by excessive brushing times in the EEPROM.
According to the invention, the BUFFER (BUFFER) is built in the EEPROM, and the maximum erasing times of the storage medium (EEPROM) are distributed to the erasing times in each period of time in advance, so that the storage medium is prevented from being excessively erased and damaged in the life cycle; in addition, the buffer memory mode ensures the service life of the storage medium, and dynamically distributes the unused erasing EEPROM times in the previous period in the running process to the later period (providing judgment of the data change times N in the buffer) s And the number of times data is stored in the EEPROM in the buffer N sl ) On the basis of guaranteeing the service life of the storage medium, when the data is frequently changed, the data changed in real time can be stored to the maximum extent.
The above examples merely represent a few embodiments of the present invention, which are described in more detail and are not to be construed as limiting the scope of the present invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention.

Claims (6)

1. A method for protecting EEPROM storage is characterized in that: the method is applied to executing EEPROM erasing and writing protection in the embedded equipment, and comprises the following steps:
obtaining the maximum erasing times N of the EEPROM in the embedded equipment e And the life span T of the embedded equipment, and obtaining the shortest time interval T of single erasure of the EEPROM based on the life span T sl And based on the T sl The number of times of single permission of erasing and writing of the EEPROM is obtained to be N ae
Establishing a buffer and storing a counter number value N representing the number of data changes in the buffer during initialization of the embedded device s And a storage counter cache value N characterizing the number of times data is stored into the EEPROM in the buffer sl
The EEPROM storage protection method further comprises the following steps: when the embedded equipment is in a non-dormant state or a dormant state, judging the mode of writing dynamic data in the embedded equipment into the EEPROM by the change times of the data in the buffer and the times of the data stored in the buffer, wherein the method specifically comprises the following steps of:
s1: judging whether the embedded equipment is in a non-dormant state, if so, executing a step S2, otherwise, executing a step S3;
s2: the embedded device is in a non-dormant state and satisfies N s +1<N ae And N is s >N sl The data in the buffer is written into the EEPROM preferentially, and the N is written into the EEPROM sl Is updated to the value of N s Is a numerical value of (2); if satisfy N s +1>N ae Preferentially storing the data into the buffer;
wherein N is s +1 represents dynamic data to be written into the buffer once again in real time;
s3: the embedded equipment is in a dormant state and meets N s >N sl Preferentially storing the data in the buffer into the EEPROM; and if not, preferentially storing the data into the buffer.
2. A method of EEPROM memory protection as claimed in claim 1, characterized in that: obtaining the maximum erasing times N of the EEPROM e The method comprises the following steps: judging whether the embedded equipment is provided with an EEPROM, if so, recording the maximum erasing times as N e Otherwise, dividing FLASH data in the embedded device into N l Sub-data rolling storage and simulating FLASH maximum erasing times of EEPROMNumber N e =N f *N l Wherein N is f And the maximum erasing times of FLASH in the embedded equipment are obtained.
3. A method of EEPROM memory protection as claimed in claim 1, characterized in that: EEPROM single erase minimum time interval T sl The calculation formula of (a) is specifically as follows:
T sl =(T*360*24)/N e
4. a method of EEPROM memory protection as claimed in claim 1, characterized in that: the EEPROM is erased once for a minimum time interval T every interval while the embedded device is in a non-sleep state sl The number of times of single permission erasing of the EEPROM is N ae +1。
5. A method of EEPROM memory protection as claimed in claim 1, characterized in that: the dynamic data is specifically the data which is received by the embedded equipment in real time, changes and needs to be stored in real time.
6. The method of claim 5, wherein: and the embedded equipment preferentially stores the dynamic data into the buffer when receiving the dynamic data.
CN202310248926.1A 2023-03-15 2023-03-15 EEPROM storage protection method Active CN115952113B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310248926.1A CN115952113B (en) 2023-03-15 2023-03-15 EEPROM storage protection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310248926.1A CN115952113B (en) 2023-03-15 2023-03-15 EEPROM storage protection method

Publications (2)

Publication Number Publication Date
CN115952113A CN115952113A (en) 2023-04-11
CN115952113B true CN115952113B (en) 2023-06-13

Family

ID=85891446

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310248926.1A Active CN115952113B (en) 2023-03-15 2023-03-15 EEPROM storage protection method

Country Status (1)

Country Link
CN (1) CN115952113B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112083873A (en) * 2019-06-14 2020-12-15 北京忆芯科技有限公司 Method and device for intelligently identifying unreliable blocks of nonvolatile storage medium
CN112231244A (en) * 2020-12-21 2021-01-15 深圳杰睿联科技有限公司 SIM card file erasing and writing system and method applied to SoftSIM and readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050036387A1 (en) * 2002-04-24 2005-02-17 Seal Brian K. Method of using flash memory for storing metering data
KR20130112509A (en) * 2012-04-04 2013-10-14 주식회사 만도 Data write and erase method of eeprom
CN104820641B (en) * 2015-04-16 2017-10-31 上海冉能自动化科技有限公司 The method for reducing FLASH erasing times
CN109213448B (en) * 2018-08-30 2022-04-05 东信和平科技股份有限公司 Method, device, equipment and storage medium for erasing and writing data of smart card
CN111078136B (en) * 2019-10-22 2023-05-05 力高(山东)新能源技术股份有限公司 Method for preventing flash life reduction caused by BMS dynamic data storage
CN113267673A (en) * 2021-04-10 2021-08-17 煜邦电力智能装备(嘉兴)有限公司 Effective method for solving electric energy loss of electronic electric energy meter
CN113918485B (en) * 2021-10-12 2023-04-11 广东省高峰科技有限公司 Method, device, equipment and storage medium for preventing flash memory data from being lost
CN114038493A (en) * 2021-11-05 2022-02-11 东风电子科技股份有限公司 Method, device, memory and storage medium for preventing EEPROM damage caused by frequent erasing of check bits

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112083873A (en) * 2019-06-14 2020-12-15 北京忆芯科技有限公司 Method and device for intelligently identifying unreliable blocks of nonvolatile storage medium
CN112231244A (en) * 2020-12-21 2021-01-15 深圳杰睿联科技有限公司 SIM card file erasing and writing system and method applied to SoftSIM and readable storage medium

Also Published As

Publication number Publication date
CN115952113A (en) 2023-04-11

Similar Documents

Publication Publication Date Title
CN103890693B (en) Report updated threshold level based on parameter
CN103164345B (en) Solid-state storage device meets with the date storage method after power-off
US20160004468A1 (en) Data-storage device and flash memory control method
CN103942160B (en) Storage system, storage device and date storage method
CN101788948B (en) Dynamic storage system of journal information and method
CN102929794B (en) The storage means of a kind of EEPROM
US20170212687A1 (en) Demand-based provisioning of volatile memory for use as non-volatile memory
CN105589767B (en) A kind of system power failure for NAND FLASH protects implementation method
CN107220001A (en) A kind of solid state hard disc cache implementing method and solid state hard disc
CN108369488B (en) Using volatile memory as non-volatile memory
US20130179715A1 (en) Systems and methods for reducing energy consumption in sensor networks
CN115952113B (en) EEPROM storage protection method
CN102981977A (en) Data storage method capable of prolonging service life of abode flash player (FLASH)
CN101364437A (en) Method capable of loss equalization of flash memory and application thereof
CN104881249B (en) A kind of reading/writing method and device of eMMC
CN105205015B (en) A kind of date storage method and storage equipment
CN115793995B (en) Pflash-only data storage method for traditional MCU
CN113392036B (en) Solid-state memory and data writing method and device thereof
CN102880570B (en) The weighting abrasion equilibrium method of solid state hard disc and system
CN113190473B (en) Cache data management method and medium based on energy collection nonvolatile processor
CN109814804A (en) A kind of method and apparatus reducing distributed memory system energy consumption
CN109683097A (en) A kind of BBU capacity method of calibration, device and relevant device
CN110309084B (en) Power failure protection method and device for solid state disk data
CN110209346B (en) Data write control device and method
CN111026681A (en) Caching method, caching system and caching medium based on Ceph

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: No. 15 Hengyang Road, Guxian Street, Yantai Economic and Technological Development Zone, Shandong Province, China 265503

Patentee after: Ligao (Shandong) New Energy Technology Co.,Ltd.

Country or region after: China

Address before: Room 501, No.8, No.300, Changjiang Road, Yantai Economic and Technological Development Zone, Shandong Province 264000

Patentee before: Ligao (Shandong) New Energy Technology Co.,Ltd.

Country or region before: China