CN109240622A - A kind of method and system of EEPROM data write-in - Google Patents

A kind of method and system of EEPROM data write-in Download PDF

Info

Publication number
CN109240622A
CN109240622A CN201811122642.3A CN201811122642A CN109240622A CN 109240622 A CN109240622 A CN 109240622A CN 201811122642 A CN201811122642 A CN 201811122642A CN 109240622 A CN109240622 A CN 109240622A
Authority
CN
China
Prior art keywords
data
backup area
block
written
eeprom
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.)
Granted
Application number
CN201811122642.3A
Other languages
Chinese (zh)
Other versions
CN109240622B (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.)
Weichai Power Co Ltd
Original Assignee
Weichai Power 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 Weichai Power Co Ltd filed Critical Weichai Power Co Ltd
Priority to CN201811122642.3A priority Critical patent/CN109240622B/en
Publication of CN109240622A publication Critical patent/CN109240622A/en
Application granted granted Critical
Publication of CN109240622B publication Critical patent/CN109240622B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks

Abstract

The invention discloses a kind of method and system of EEPROM data write-in, this method comprises: EEPROM memory space is divided into several memory blocks;In the memory block, backup area and memory block are determined;The EEPROM data are divided into the data block to match with the memory block quantity;First data block is written to the backup area, if first data block is written successfully, the backup area is determined as to the effective district of first data block;The first memory block corresponding with first data block is redefined as backup area, the second data block is written to the backup area, and rejudge whether the second data block is written success, until the EEPROM data are all written.The purpose for improving the space EEPROM utilization rate and guaranteeing the write-in of EEPROM data safety is realized through the invention.

Description

A kind of method and system of EEPROM data write-in
Technical field
The present invention relates to technical field of data processing, more particularly to a kind of method and system of EEPROM data write-in.
Background technique
Along with the fast development of industrial equipment, intelligence instrument device requirement increases sharply, few based on internal control resource, advanced Safety low cost external non-volatile memory demand it is increasing.Based on cost, using it is simple, can be general by being higher than The effect for the pressure that is powered generallys use EEPROM many factors, the intelligence instrument such as to wipe and reprogram (ElectricallyErasable Programmable Read-Only Memory, band Electrically Erasable Programmable Read-Only Memory) To store the important parameter that all are operated normally about instrument.
ECU (Electronic Control Unit, electronic control unit) can be by runing time, traveling when electric at T15 The data such as mileage are stored into EEPROM, are powered on next time and are read from EEPROM again.If during storage is to EEPROM Power-off suddenly, then the data in EEPROM can store failure, so that data corruption or loss, the data of mistake can also when serious Cause the reset of ECU.
To solve the above problems, will usually be stored in data full backup in EEPROM in the prior art, deposited in EEPROM Data are starved in new and old two versions.In this way when accessing the power-off of new edition notebook data, legacy data is then read when next time powers on.By In using data all one's duties in the prior art, so that the space utilization rate of EEPROM is low, it is only capable of storage EEPROM available space Half size, and single memory block is larger, and the probability that power-off damage occurs is bigger.
Summary of the invention
It is directed to the above problem, the present invention provides a kind of method and device of EEPROM data write-in, realizes raising The space EEPROM utilization rate and the purpose for guaranteeing the write-in of EEPROM data safety.
To achieve the goals above, the present invention provides the following technical scheme that
A kind of method of EEPROM data write-in, comprising:
EEPROM memory space is divided into several memory blocks;
In the memory block, backup area and memory block are determined;
The EEPROM data are divided into the data block to match with the memory block quantity;
First data block is written to the backup area, if first data block is written successfully, by the backup area It is determined as the effective district of first data block;
The first memory block corresponding with first data block is redefined as backup area, the second data block is written to The backup area, and rejudge whether the second data block is written success, until the EEPROM data are all written.
Optionally, if first data are written to backup area failure, this method further include:
The data of the backup failure are obtained by the first memory block.
Optionally, this method further include:
When detecting two effective identical blocks, the write time of described two identical data blocks is compared, it will The data block that write time meets preset requirement is determined as latest data block.
Optionally, if failure when memory block is redefined as backup area, this method further include:
When electronic control unit is when carrying out reading data, the memory block is re-flagged as backup area.
A kind of system of EEPROM data write-in, comprising:
Space division unit, for EEPROM memory space to be divided into several memory blocks;
Determination unit, for determining backup area and memory block in the memory block;
Data block division unit, for the EEPROM data to be divided into the data to match with the memory block quantity Block;
Writing unit, for the first data block to be written to the backup area, if first data block is written successfully, The backup area is determined as to the effective district of first data block;
Backup area determination unit, for the first memory block corresponding with first data block to be redefined as backup Second data block is written to the backup area, and rejudges whether the second data block is written success by area, until will be described EEPROM data are all written.
Optionally, the system further include:
Data capture unit, if when for first data to be written to backup area failure, passing through the first storage Area obtains the data of the backup failure.
Optionally, the system further include:
Data block determination unit, for comparing described two identical when detecting two effective identical blocks The data block that write time meets preset requirement is determined as latest data block by the write time of data block.
Optionally, the system further include:
Marking unit, if failure when for memory block to be redefined as backup area, when electronic control unit is being counted When according to reading, the memory block is re-flagged as backup area.
Compared to the prior art, the present invention provides a kind of method and system of EEPROM data write-in, EEPROM is deposited Storage space, which divide, has obtained several memory blocks, and backup area and memory block have been determined in memory block, reduces in this way The space size of backup area so that the available space EEPROM is larger improves EEPROM space utilization rate, and the backup Area is dynamic change, after data block is written successfully, sets effective district for backup area, corresponding is deposited the data block is original Storage area is redefined as backup area, and data are first written to backup area, guarantees that powering off data suddenly when data storage will not lose It loses, ensure that the write-in safety of EEPROM data.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow diagram of EEPROM method for writing data provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of EEPROM data subregion provided in an embodiment of the present invention;
Fig. 3 is a kind of process schematic for writing data into first memory block provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of the system of EEPROM data write-in provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Term " first " and " second " in description and claims of this specification and above-mentioned attached drawing etc. are for area Not different objects, rather than for describing specific sequence.Furthermore term " includes " and " having " and their any deformations, It is intended to cover and non-exclusive includes.Such as it contains the process, method of a series of steps or units, system, product or sets It is standby not to be set in listed step or unit, but may include the step of not listing or unit.
Provide a kind of EEPROM method for writing data in embodiments of the present invention, referring to Fig. 1, this method may include with Lower step:
S101, EEPROM memory space is divided into several memory blocks;
S102, in the memory block, determine backup area and memory block.
The memory block of same size is divided into according to the size of EEPROM memory space, it is one of to be used to the area that backups, It is remaining to be used as memory block.It referring to fig. 2, is a kind of schematic diagram of EEPROM data subregion provided in an embodiment of the present invention. By taking memory space is the eeprom chip of 16K size as an example, EEPROM memory space is divided into 16 pieces, every block size is 1Kbyte.Wherein, user is supplied to using 15K memory space, and remaining 1K is backup area.The corresponding storage of 15K memory space It is index1 to index15 that block works out serial number as shown in Figure 2.
S103, the EEPROM data are divided into the data block to match with the memory block quantity;
For the ease of the write-in of data, the data for needing to be written into are divided into several data blocks, wherein data block Quantity is consistent with the quantity of memory block.
S104, the first data block is written to the backup area, it, will be described standby if first data block is written successfully Part area is determined as the effective district of first data block;
S105, it will be redefined as backup area with original corresponding first memory block of first data block, by the second number It is written to the backup area according to block, and rejudges whether the second data block is written success, until the EEPROM data are complete Portion's write-in.
Still by taking Fig. 2 as an example, 1Kbyte is written in each data, writes data into backup area, backup area success to be written first Afterwards, effective district is set by backup area, original memory block is then labeled as backup area, which is a dynamic mistake Journey.I.e. by after the write-in backup area success of the first data block, backup area is set by the first memory block, then by the second database write After entering backup area success, backup area is set by the second memory block, until all 15 data blocks are written successfully.
The present invention provides a kind of methods of EEPROM data write-in, and EEPROM memory space has been carried out division and has been obtained Several memory blocks, and backup area and memory block have been determined in memory block, the space size of backup area is reduced in this way, so that The available space EEPROM is larger, improves EEPROM space utilization rate, and the backup area is dynamic change, works as data block After being written successfully, effective district is set by backup area, the corresponding memory block of the database is redefined as backup area, by data It is first written to backup area, guarantees that powering off data suddenly when data storage will not lose, ensure that the write-in peace of EEPROM data Entirely.
It is a kind of process schematic for writing data into first memory block provided in an embodiment of the present invention referring to Fig. 3.
First step: the data that will be written are written to the 16th Area-Specific Archive area, and mark the zone state to be index1-pre;
Second step: if first step success, the 16th subregion state is labeled as index1;
Third step: if second step success, the 1st subregion state is labeled as backup area.
After above three step, backup zone position becomes first piece.It is empty storing remaining index2-index15 Between when, backup zone position is always in dynamic change.
Method that is corresponding, further comprising abnormality processing in embodiments of the present invention, specific:
Optionally, if first data are written to backup area failure, this method further include:
The data of the backup failure are obtained by the first memory block.
Optionally, this method further include:
When detecting two effective identical blocks, the write time of described two identical data blocks is compared, it will The data block that write time meets preset requirement is determined as latest data block.
Optionally, if failure when memory block is redefined as backup area, this method further include:
When electronic control unit is when carrying out reading data, the memory block is re-flagged as backup area.
Pass through complete exception handling procedure, it is ensured that ECU any time when data store powers off, and ECU is powered on again When can read believable data.Illustrate by taking the description process in Fig. 3 as an example, if power-off occurs in the first step when storage When rapid, then when ECU is powered on again, it still is able to read the index1 data completed.In this state, preceding 15 pieces of memory blocks are Valid data are saved, the 16th piece of region is as backup area.
If power-off occurs when ECU is powered on again, to detect two believable index1 in second step when storage Data.ECU determines newest data by the write time of two index1 blocks of comparison at this time.
If power-off occurs to fail when the 1st bulk state being labeled as backup area, then ECU exists in third step when storage When reading, the bulk state is only needed to re-flag as backup area.
Through the embodiment of the present invention, backup area is write data into first before storing EEPROM data, guarantees data storage When ECU power off data suddenly and will not lose;The space EEPROM is divided into multiple fritters, stores several times, improves EEPROM sky Between utilization rate;Backup zone position dynamic change improves EEPROM service life.
A kind of system of EEPROM data write-in is additionally provided in embodiments of the present invention, and referring to fig. 4, which includes:
Space division unit 401, for EEPROM memory space to be divided into several memory blocks;
Determination unit 402, for determining backup area and memory block in the memory block;
Data block division unit 403 matches for being divided into the EEPROM data with the memory block quantity Data block;
Writing unit 404, for the first data block to be written to the backup area, if first data block is written to The backup area is then determined as the effective district of first data block by function;
Backup area determination unit 405, for will the first memory block corresponding with first data block be redefined as it is standby Part area, is written to the backup area for the second data block, and rejudge whether the second data block is written success, until will be described EEPROM data are all written.
The present invention provides a kind of systems of EEPROM data write-in, by EEPROM memory space in the division unit of space Divide and obtained several memory blocks, and backup area and memory block have been determined in memory block by determination unit, this Sample reduces the space size of backup area, so that the available space EEPROM is larger, improves EEPROM space utilization rate, passes through Data block division unit, writing unit and backup area determination unit can be found that the backup area is dynamic change, work as data block After being written successfully, effective district is set by backup area, the corresponding memory block of the data block is redefined as backup area, by data It is first written to backup area, guarantees that powering off data suddenly when data storage will not lose, ensure that the write-in peace of EEPROM data Entirely.
Optionally, the system on the basis of the above embodiments further include:
Data capture unit, if when for first data to be written to backup area failure, passing through the first storage Area obtains the data of the backup failure.
Optionally, the system further include:
Data block determination unit, for comparing described two identical when detecting two effective identical blocks The data block that write time meets preset requirement is determined as latest data block by the write time of data block.
Optionally, the system further include:
Marking unit, if failure when for memory block to be redefined as backup area, when electronic control unit is being counted When according to reading, the memory block is re-flagged as backup area.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is said referring to method part It is bright.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (8)

1. a kind of method of EEPROM data write-in characterized by comprising
EEPROM memory space is divided into several memory blocks;
In the memory block, backup area and memory block are determined;
The EEPROM data are divided into the data block to match with the memory block quantity;
First data block is written to the backup area, if first data block is written successfully, the backup area is determined For the effective district of first data block;
The first memory block corresponding with first data block is redefined as backup area, the second data block is written to described Backup area, and rejudge whether the second data block is written success, until the EEPROM data are all written.
2. the method according to claim 1, wherein failing if first data are written to the backup area When, this method further include:
The data of the backup failure are obtained by the first memory block.
3. according to the method described in claim 2, it is characterized in that, this method further include:
When detecting two effective identical blocks, the write time of described two identical data blocks is compared, will be written The data block that time meets preset requirement is determined as latest data block.
4. according to the method described in claim 3, it is characterized in that, being somebody's turn to do if failure when memory block is redefined as backup area Method further include:
When electronic control unit is when carrying out reading data, the memory block is re-flagged as backup area.
5. a kind of system of EEPROM data write-in characterized by comprising
Space division unit, for EEPROM memory space to be divided into several memory blocks;
Determination unit, for determining backup area and memory block in the memory block;
Data block division unit, for the EEPROM data to be divided into the data block to match with the memory block quantity;
Writing unit, for the first data block to be written to the backup area, if first data block is written successfully, by institute State the effective district that backup area is determined as first data block;
Backup area determination unit will for the first memory block corresponding with first data block to be redefined as backup area Second data block is written to the backup area, and rejudges whether the second data block is written success, until by the EEPROM Data are all written.
6. system according to claim 5, which is characterized in that the system further include:
Data capture unit, if being obtained when for first data to be written to backup area failure by the first memory block Take the data of the backup failure.
7. system according to claim 6, which is characterized in that the system further include:
Data block determination unit, for comparing described two identical data when detecting two effective identical blocks The data block that write time meets preset requirement is determined as latest data block by the write time of block.
8. system according to claim 7, which is characterized in that the system further include:
Marking unit, if failure when for memory block to be redefined as backup area, when electronic control unit is carrying out data reading When taking, the memory block is re-flagged as backup area.
CN201811122642.3A 2018-09-26 2018-09-26 Method and system for writing EEPROM data Active CN109240622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811122642.3A CN109240622B (en) 2018-09-26 2018-09-26 Method and system for writing EEPROM data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811122642.3A CN109240622B (en) 2018-09-26 2018-09-26 Method and system for writing EEPROM data

Publications (2)

Publication Number Publication Date
CN109240622A true CN109240622A (en) 2019-01-18
CN109240622B CN109240622B (en) 2021-10-08

Family

ID=65056209

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811122642.3A Active CN109240622B (en) 2018-09-26 2018-09-26 Method and system for writing EEPROM data

Country Status (1)

Country Link
CN (1) CN109240622B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134645A (en) * 2019-04-15 2019-08-16 深圳市战音科技有限公司 File system memory management method, read method, managing device and reading device
CN110281865A (en) * 2019-06-29 2019-09-27 潍柴动力股份有限公司 A kind of vehicle control device and date storage method
CN110888605A (en) * 2019-12-11 2020-03-17 重庆超力高科技股份有限公司 EEPROM data writing method and device and electronic equipment
CN111142502A (en) * 2019-12-30 2020-05-12 潍柴动力股份有限公司 Processing method, device and equipment for ECU detection and storage medium
CN114563995A (en) * 2022-01-17 2022-05-31 潍柴动力股份有限公司 Reset detection method, device and equipment of electronic control unit and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101656106A (en) * 2009-08-27 2010-02-24 北京握奇数据系统有限公司 Method for writing data into EEPROM and device thereof
CN102063379A (en) * 2010-12-28 2011-05-18 天津市亚安科技电子有限公司 Data storage method of FLASH memory
CN102455973A (en) * 2010-10-19 2012-05-16 厦门华侨电子股份有限公司 Method for setting data field to erase data by using residual space of Flash chip
JP2016192009A (en) * 2015-03-31 2016-11-10 日立オートモティブシステムズ株式会社 Control device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101656106A (en) * 2009-08-27 2010-02-24 北京握奇数据系统有限公司 Method for writing data into EEPROM and device thereof
CN102455973A (en) * 2010-10-19 2012-05-16 厦门华侨电子股份有限公司 Method for setting data field to erase data by using residual space of Flash chip
CN102063379A (en) * 2010-12-28 2011-05-18 天津市亚安科技电子有限公司 Data storage method of FLASH memory
JP2016192009A (en) * 2015-03-31 2016-11-10 日立オートモティブシステムズ株式会社 Control device

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134645A (en) * 2019-04-15 2019-08-16 深圳市战音科技有限公司 File system memory management method, read method, managing device and reading device
CN110134645B (en) * 2019-04-15 2023-07-11 深圳市战音科技有限公司 File system storage management method, file system storage reading method, file system storage management device and file system storage reading device
CN110281865A (en) * 2019-06-29 2019-09-27 潍柴动力股份有限公司 A kind of vehicle control device and date storage method
CN110281865B (en) * 2019-06-29 2021-01-19 潍柴动力股份有限公司 Vehicle controller and data storage method
CN110888605A (en) * 2019-12-11 2020-03-17 重庆超力高科技股份有限公司 EEPROM data writing method and device and electronic equipment
CN110888605B (en) * 2019-12-11 2023-10-20 重庆超力高科技股份有限公司 EEPROM data writing method and device and electronic equipment
CN111142502A (en) * 2019-12-30 2020-05-12 潍柴动力股份有限公司 Processing method, device and equipment for ECU detection and storage medium
CN114563995A (en) * 2022-01-17 2022-05-31 潍柴动力股份有限公司 Reset detection method, device and equipment of electronic control unit and storage medium
CN114563995B (en) * 2022-01-17 2024-03-19 潍柴动力股份有限公司 Reset detection method, device, equipment and storage medium of electronic control unit

Also Published As

Publication number Publication date
CN109240622B (en) 2021-10-08

Similar Documents

Publication Publication Date Title
CN109240622A (en) A kind of method and system of EEPROM data write-in
CN102890657B (en) The method that the reading and writing data of a kind of EEPROM of minimizing is made mistakes
CN101903866B (en) Method and system for storage of data in non-volatile media
CN103299276B (en) The software upgrading process of embedded equipment
CN105260270B (en) A kind of Dynamic- Recovery method and device of Flash memory space
US20140379965A1 (en) Adaptive cache memory controller
GB2330672A (en) Storing and retrieving data in a control system eg in a motor vehicle
US8402204B2 (en) Methods for measuring usable lifespan and replacing an in-system programming code of a memory device, and data storage system using the same
US8516213B2 (en) Method and apparatus for EEPROM emulation for preventing data loss in the event of a flash block failure
CN102270144A (en) Embedded network equipment and method for upgrading firmware by using same
CN107678420B (en) engine data online storage method
EP0990989A2 (en) Microcomputer provided with flash memory and method of storing program into flash memory
CN102024502A (en) Flash device testing method and device as well as board and network equipment
CN104021089A (en) Flash memory control chip, storage device and flash memory control method
CN109376031A (en) A kind of method and device for preventing the verification erroneous judgement of the memory block EEPROM from occurring
JP2010086009A (en) Storage device and memory control method
EP1540660B1 (en) Method of and apparatus for detecting an error in writing to persistent memory
CN111124294B (en) Sector mapping information management method and device, storage medium and equipment
CN110781031B (en) Controller data recovery method and device, controller and automobile
US20140244895A1 (en) Robust Sector ID Scheme for Tracking Dead Sectors to Automate Search and Copydown
CN101366009B (en) Data processing system and a method for the operation thereof
CN108694131B (en) Method and device for operating a storage device
CN115048256B (en) Test method, test system, and computer-readable storage medium
CN101403986A (en) Disaster tolerance technology for storing and leading out flash memory data
CN101593153A (en) A kind of method, device and computing machine that data is write non-volatile memory medium

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