JP2000243093A - Data storing method for flash memory and data reading out method from flash memory - Google Patents

Data storing method for flash memory and data reading out method from flash memory

Info

Publication number
JP2000243093A
JP2000243093A JP1428999A JP1428999A JP2000243093A JP 2000243093 A JP2000243093 A JP 2000243093A JP 1428999 A JP1428999 A JP 1428999A JP 1428999 A JP1428999 A JP 1428999A JP 2000243093 A JP2000243093 A JP 2000243093A
Authority
JP
Japan
Prior art keywords
data
stored
flash memory
record
address
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.)
Pending
Application number
JP1428999A
Other languages
Japanese (ja)
Inventor
Hiroshi Itabashi
宏 板橋
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.)
Sanyo Electric Co Ltd
Original Assignee
Sanyo Electric 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 Sanyo Electric Co Ltd filed Critical Sanyo Electric Co Ltd
Priority to JP1428999A priority Critical patent/JP2000243093A/en
Publication of JP2000243093A publication Critical patent/JP2000243093A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a data storing method for a flash memory by which the efficiency of processing of writing data in a flash memory can be improved and a long life can be achieved. SOLUTION: When new data (record) is stored in a sector in a state in which data is stored halfway in a sector to be processed in a flash memory 4, data is stored at a position of which a flag 1 is in a state being not yet stored. Also, when new data (record) is stored in a sector in a state in which data is stored all in a sector to be processed, record in which a flag 2 is effective data is stored temporarily in a RAM 3, a sector to be processed is all erased, effective record stored temporarily in the RAM 3 is stored again from the leading of the sector to be processed, and new data (record) is stored at a position of which the successive flag 1 is in a state being not yet stored.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、半導体等からなる
メモリへのデータ記憶方法に関し、特に、データ書き込
みの前に消去を必要とし、その消去回数について限度が
あるような、フラッシュメモリ等のメモリへのデータ記
憶方法及びデータ読出方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of storing data in a memory made of a semiconductor or the like, and more particularly, to a memory such as a flash memory which requires erasing before writing data and has a limit on the number of erasing. And a data reading method.

【0002】[0002]

【従来の技術】データの書き込み及び読み出しが自由に
でき、しかも電気的に内容の消去が可能で、電源を切っ
てもデータが保存されるメモリとして、フラッシュメモ
リ等がある。
2. Description of the Related Art A flash memory or the like is a memory capable of freely writing and reading data, electrically erasing contents, and storing data even when the power is turned off.

【0003】このフラッシュメモリへのデータの書き込
みは、通常、書き込まれるデータの最小単位毎に、当該
最小単位のデータと同一の大きさの領域を確保し、確保
された記憶領域の消去を行った後、その新たな最小単位
のデータを書き込み、以下、同様にして最小単位のデー
タ毎に消去、書き込みを繰り返し、所望の全データの書
き込みを行うというような手順であった。
In writing data to the flash memory, usually, for each minimum unit of data to be written, an area having the same size as the data of the minimum unit is secured, and the secured storage area is erased. Thereafter, the new minimum unit of data is written, and thereafter, erasure and writing are repeated for each minimum unit of data in the same manner to write all desired data.

【0004】[0004]

【発明が解決しようとする課題】前述の従来の技術で
は、データの最小単位毎に書き込みの直前に消去を行う
ので、消去に要する時間の分だけ、書き込み処理の効率
が低く、書き込み対象であるデータ数の増加に伴い全体
の処理効率が低下を招くという問題点があった。
In the above-mentioned prior art, erasing is performed immediately before writing for each minimum unit of data. Therefore, the efficiency of the writing process is low by the time required for erasing, and data is to be written. There has been a problem that the overall processing efficiency is reduced with an increase in the number of data.

【0005】さらに、フラッシュメモリの場合、その消
去回数は限りがあるため、データ数の増加に伴い書き込
み回数が増え、短寿命化を招くという問題点もあった。
Further, in the case of a flash memory, the number of times of erasing is limited, so that the number of times of writing increases with an increase in the number of data, which causes a problem of shortening the life.

【0006】本発明は上記問題点に鑑みて為されたもの
であり、データ書き込み前の消去処理の回数が少なくて
済むフラッシュメモリへのデータ記憶方法を提供するも
のである。また、本発明の他の目的は、書き込み処理の
効率向上と共に、長寿命化を図ることのできるフラッシ
ュメモリへのデータ記憶方法を提供することにある。
The present invention has been made in view of the above problems, and provides a method of storing data in a flash memory, which requires a small number of erasing processes before data writing. It is another object of the present invention to provide a method of storing data in a flash memory, which can improve the efficiency of a write process and extend the life of the flash memory.

【0007】[0007]

【課題を解決するための手段】本発明では、請求項1
は、所望のデータを書き込む際に、メモリへの記憶の有
無を確認するための記憶済確認フラグと、前記データの
有効又は無効を示す有効データ確認フラグと、前記デー
タの種別情報を示す種別データと、を前記データに付加
したレコードデータを書き込むことを特徴とする。
According to the present invention, claim 1 is provided.
When writing desired data, a stored confirmation flag for confirming the presence or absence of storage in a memory, a valid data confirmation flag indicating validity or invalidity of the data, and type data indicating type information of the data And record data in which the data is added to the data.

【0008】又、請求項2は、メモリへの書込にあた
り、メモリ領域の先頭より前記記憶済確認フラグに基づ
き、順次未記憶データのアドレスを検出し、未記憶デー
タのアドレスを検出した場合、検出した前記未記憶のア
ドレスに前記レコードデータを書き込むことを特徴とす
る。
According to a second aspect of the present invention, when writing to the memory, the address of the unstored data is sequentially detected from the top of the memory area based on the stored confirmation flag, and the address of the unstored data is detected. The record data is written to the detected unstored address.

【0009】又、請求項3は、メモリへの書込にあた
り、メモリ領域の先頭より前記記憶済確認フラグに基づ
き、順次未記憶データのアドレスを検出し、未記憶デー
タのアドレスが検出できなかった場合、前記有効データ
確認フラグに基づき、有効レコードデータを一時保存
し、データをセクタ単位で消去した後、前記一時保存し
た有効レコードデータをメモリ領域の先頭より順次再書
き込むことを特徴とする。
According to a third aspect of the present invention, upon writing to the memory, the address of the unstored data is sequentially detected from the head of the memory area based on the stored confirmation flag, and the address of the unstored data cannot be detected. In this case, the valid record data is temporarily stored based on the valid data confirmation flag, the data is erased in sector units, and then the temporarily stored valid record data is sequentially rewritten from the beginning of the memory area.

【0010】又、請求項4は、メモリへの書込にあた
り、メモリ領域の先頭より前記記憶済確認フラグに基づ
き、順次未記憶データのアドレスを検出し、未記憶デー
タのアドレスが検出できなかった場合、前記有効データ
確認フラグ及び前記種別情報に基づき、有効レコードデ
ータを一時保存し、データをセクタ単位で消去した後、
前記一時保存した有効レコードデータをメモリ領域の先
頭より順次再書き込むことを特徴とする。
According to a fourth aspect of the present invention, upon writing to the memory, the address of the unstored data is sequentially detected from the beginning of the memory area based on the stored confirmation flag, and the address of the unstored data cannot be detected. In the case, based on the valid data confirmation flag and the type information, the valid record data is temporarily stored, and after erasing the data in sector units,
The temporarily stored valid record data is sequentially rewritten from the beginning of the memory area.

【0011】又、請求項5は、前記一時保存した有効レ
コードデータをメモリ領域の先頭より順次再書き込みを
行った後、その直後のアドレスに所望のデータを有する
レコードデータを書き込むことを特徴とする。
According to a fifth aspect of the present invention, the temporarily stored valid record data is sequentially rewritten from the beginning of a memory area, and then record data having desired data is written to an address immediately after the rewrite. .

【0012】又、請求項6は、請求項2乃至請求項5の
いずれかに記載のフラッシュメモリへのデータ記憶方法
により書き込まれたデータを読み出す方法であって、メ
モリ領域の先頭より順次記憶済確認フラグと有効データ
確認フラグと種別情報とを検出し、所望の種別情報を検
出した場合にデータを読み出すことを特徴とする。
According to a sixth aspect of the present invention, there is provided a method of reading data written by the method of storing data in a flash memory according to any one of the second to fifth aspects, wherein the data is sequentially stored from the beginning of the memory area. It is characterized by detecting a confirmation flag, a valid data confirmation flag, and type information, and reading out data when desired type information is detected.

【0013】[0013]

【発明の実施の形態】本発明の一実施の形態を図1乃至
図5に従って説明する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS One embodiment of the present invention will be described with reference to FIGS.

【0014】まず、図1は、本発明の実施の形態におけ
るフラッシュメモリへのデータ記憶方法が用いられる装
置の構成例であり、フラッシュメモリに記憶されたデー
タ等を用いて何らかの制御等のために構成されたもので
ある。尚、図1では、フラッシュメモリへのデータ記憶
方法の実行に直接関係する主要部分のみが示されてい
る。図2は、全メモリ領域の中に於いて、フラッシュメ
モリ領域が割当られている様子を示す模式図である。図
3は、本発明のフラッシュメモリへのデータ記憶方法及
びデータ消去方法を説明するフローチャートである。図
4は、本発明のフラッシュメモリからデータを読み出す
読出方法を説明するフローチャートである。図5は本発
明を用いた場合の様子を表した模式図である。
First, FIG. 1 shows an example of the configuration of an apparatus using a method of storing data in a flash memory according to an embodiment of the present invention. The data is stored in the flash memory for some control or the like. It is composed. It should be noted that FIG. 1 shows only the main parts directly related to the execution of the data storage method in the flash memory. FIG. 2 is a schematic diagram showing a state in which a flash memory area is allocated in all the memory areas. FIG. 3 is a flowchart illustrating a method of storing data in a flash memory and a method of erasing data according to the present invention. FIG. 4 is a flowchart illustrating a reading method for reading data from a flash memory according to the present invention. FIG. 5 is a schematic diagram showing a state when the present invention is used.

【0015】図1に於いて、1はCPU、2はCPU1
で実行されるプログラム等が記憶されているROM、3
はプログラムやデータが一時記憶されるRAM、4は各
種データが記憶されるフラッシュメモリであり、CPU
1、ROM2、RAM3、フラッシュメモリ4の夫々は
バス5により接続されている。
In FIG. 1, 1 is a CPU, 2 is a CPU 1
ROM storing a program to be executed by
Is a RAM for temporarily storing programs and data, 4 is a flash memory for storing various data,
1, the ROM 2, the RAM 3, and the flash memory 4 are connected by a bus 5.

【0016】この構成に於いて、フラッシュメモリへの
データ記憶方法について説明する。フラッシュメモリ4
とRAM3とを合わせた全メモリ領域の中で、例えば図
2(a)に示す様な位置にフラッシュメモリ領域が割り
当てられているものとする。
In this configuration, a method for storing data in the flash memory will be described. Flash memory 4
It is assumed that a flash memory area is allocated to a position as shown in FIG.

【0017】フラッシュメモリ領域は、図2(a)に示
す様に複数の領域(セクタと称す)により構成されてお
り、本発明では、このセクタを最小単位としてデータの
消去が行われる。また、各セクタは、図2(b)に示す
様に複数のレコードから構成されている。更に、各レコ
ードは、図2(c)に示す様に、記憶済確認フラグ(フ
ラグ1)、有効データ確認フラグ(フラグ2)、データ
種別、データサイズ、データ、CRCチェックデータに
より構成されている。
The flash memory area is composed of a plurality of areas (referred to as sectors) as shown in FIG. 2A, and in the present invention, data is erased using this sector as a minimum unit. Each sector is composed of a plurality of records as shown in FIG. Further, as shown in FIG. 2C, each record is composed of a stored confirmation flag (flag 1), a valid data confirmation flag (flag 2), a data type, a data size, data, and CRC check data. .

【0018】レコードの記憶済確認フラグは、レコード
がフラッシュメモリに書き込まれた際(記憶済状態)に
「0」とされ、それ以外の書き込まれていない状態(未
記憶状態)では「1」とされる。また、レコードの有効
データ確認フラグには、レコードのデータが有効である
場合には「1」とされ、無効である場合には「0」とさ
れる。尚、フラッシュメモリが初期状態の場合には、各
レコードの記憶済確認フラグ及び有効データ確認フラグ
は「1」及び「1」となるものとする。レコードのデー
タ種別は、記憶するデータの種別を示す情報であり、例
えば、データ部に記憶されている情報が、ファイル名や
課金データ、時刻データ等である旨の種別情報が格納さ
れている。また、CRCチェックデータは、公知のCR
Cチェックの方法を用いているものとする。尚、CRC
チェック以外にも、チェックサムデータでも良い。この
データ記憶方法に於いては、フラッシュメモリ領域の先
頭側から順にレコード単位で書き込んでゆく。
The stored confirmation flag of a record is set to “0” when the record is written to the flash memory (stored state), and is set to “1” when the record is not written (unstored state). Is done. The valid data confirmation flag of the record is set to “1” when the data of the record is valid, and is set to “0” when the data of the record is invalid. When the flash memory is in the initial state, the stored confirmation flag and the valid data confirmation flag of each record are “1” and “1”. The data type of the record is information indicating the type of data to be stored. For example, type information indicating that the information stored in the data portion is a file name, billing data, time data, or the like is stored. The CRC check data is a known CR
It is assumed that the C check method is used. In addition, CRC
In addition to checking, checksum data may be used. In this data storage method, data is written in record units sequentially from the head of the flash memory area.

【0019】次に図3のフローチャートに基づき、CP
U1の制御に基づくフラッシュメモリへの記憶処理方法
について説明する。
Next, based on the flowchart of FIG.
A storage processing method for the flash memory based on the control of U1 will be described.

【0020】CPU1からフラッシュメモリ4への書き
込み処理が発生すると、ステップS301に於いて、C
PU1内部に有するアドレス変数(ADD)にフラッシ
ュメモリ領域の先頭アドレスが記憶され、ステップS3
02に進む。初期時は、アドレス変数(ADD)にはセ
クタ0のレコード0の先頭位置アドレスが記憶されるこ
ととなる。
When a write process from the CPU 1 to the flash memory 4 occurs, at step S301, C
The start address of the flash memory area is stored in an address variable (ADD) included in PU1, and step S3 is executed.
Go to 02. Initially, the start position address of record 0 of sector 0 is stored in the address variable (ADD).

【0021】ステップS302に於いて、アドレス変数
(ADD)が示すレコードのフラグ1に記憶済情報
「0」が記憶されているか否かを判断し、未記憶状態
「1」の場合には、ステップS312に進み、書込を行
おうとする所望のデータの書込処理が行われる。ステッ
プS312に於ける書込処理では、アドレス変数(AD
D)が示すアドレス位置のレコードのフラグ1に記憶済
情報「0」を記憶し、フラグ2に有効データである旨の
「1」を記憶し、データ種別に書き込みを行おうとする
所望のデータの種別情報を記憶し、書き込みを行うデー
タのサイズ及び実データを記憶し、CRCチェックデー
タを記憶、つまり1レコード分のデータを記憶する。
又、ステップS302に於いて、フラグ1に記憶済情報
「0」が記憶されている場合には、ステップS303に
進む。
In step S302, it is determined whether or not the stored information "0" is stored in the flag 1 of the record indicated by the address variable (ADD). Proceeding to S312, a process of writing desired data to be written is performed. In the writing process in step S312, the address variable (AD
D) stores the stored information “0” in the flag 1 of the record at the address position indicated by D), stores “1” indicating that the data is valid data in the flag 2, and stores the desired data to be written in the data type. The type information is stored, the size of the data to be written and the actual data are stored, and the CRC check data is stored, that is, the data for one record is stored.
If the stored information “0” is stored in the flag 1 in step S302, the process proceeds to step S303.

【0022】ステップS303に於いて、フラグ2に有
効データである旨の「1」が記憶されているか否かを判
断し、有効データ「1」でない場合、つまり、データは
記憶されているが無効データ「0」が記憶されている場
合は、ステップS307に進み、有効データが記憶され
ている場合は、ステップS304に進む。
In step S303, it is determined whether or not "1" indicating valid data is stored in the flag 2, and if it is not valid data "1", that is, the data is stored but invalid. If data “0” is stored, the process proceeds to step S307, and if valid data is stored, the process proceeds to step S304.

【0023】ステップS304に於いて、書き込みを行
おうとする所望のデータと、記憶されているデータ種別
が一致するか否かを判断し、不一致の場合はステップS
306に進み、一致する場合は、ステップS305に進
む。
In step S304, it is determined whether or not the desired data to be written matches the stored data type.
The process proceeds to step 306, and if they match, the process proceeds to step S305.

【0024】ステップS305に於いて、書き込みを行
おうとする所望のデータと記憶されているデータとが同
一種類のデータであるため、現在記憶されているデータ
は古い情報であるものと判断され、記憶されているレコ
ードのフラグ2の有効データ「1」を、無効データであ
るとして、無効データ「0」に書き換え、ステップS3
07に進む。尚、通常フラッシュメモリは、既書込状態
にある情報を書き換える為には、一旦既書込データを消
去して再度書き換えたデータを書き込む必要があるが、
「1」から「0」に書き換える場合には、消去する必要
がなく、そのまま「1」から「0」に書き換えることが
できる。
In step S305, since the desired data to be written and the stored data are the same type of data, the currently stored data is determined to be old information, and The valid data “1” of the flag 2 of the record that has been set is rewritten to invalid data “0” as invalid data, and step S3
Proceed to 07. Normally, in order to rewrite the information in the already written state, it is necessary to erase the already written data and write the rewritten data again.
When rewriting from “1” to “0”, there is no need to erase, and it is possible to rewrite from “1” to “0” as it is.

【0025】ステップS306に於いて、ステップS3
04にて書き込みを行おうとする所望のデータと記憶さ
れているデータの種類とが不一致であると判断された場
合、この有効データが記憶されているレコード、つまり
アドレス変数(ADD)が示すレコードの全データをバ
ス5を介してRAM3に一時記憶し、ステップS307
に進む。
In step S306, step S3
If it is determined in step 04 that the desired data to be written does not match the type of the stored data, the record in which the valid data is stored, that is, the record indicated by the address variable (ADD) is stored. All the data is temporarily stored in the RAM 3 via the bus 5, and step S307
Proceed to.

【0026】ステップS307に於いて、書き込みを行
うデータ(1レコード分のデータ)がフラッシュメモリ
に書き込めるか否か、つまりフラッシュメモリ領域内の
書込処理対象としているセクタの領域が終わりか否かを
判断し、終わりの場合、ステップS309に進み、終わ
りではない場合、ステップS308に進み、CPU1内
部に有するアドレス変数(ADD)に次のレコードが位
置するアドレスが記憶され、ステップS302に進み、
次のレコードに対してステップS302以降の処理が順
次繰り返される。
In step S307, it is determined whether or not data to be written (data for one record) can be written to the flash memory, that is, whether or not the area of the sector to be written in the flash memory area has ended. If the end is determined, the process proceeds to step S309. If not, the process proceeds to step S308. The address at which the next record is located is stored in an address variable (ADD) in the CPU 1, and the process proceeds to step S302.
The processing of step S302 and subsequent steps are sequentially repeated for the next record.

【0027】ステップS309に於いては、フラッシュ
メモリ領域全てに対してデータが記憶されている為、現
在書込処理の対象としているセクタ内を全て消去し、ス
テップS310に進む。尚、消去した場合、セクタ内全
てが「1」となるものとする。
In step S309, since data is stored in the entire flash memory area, all data in the current sector to be written is erased, and the flow advances to step S310. It should be noted that when erasing, all of the sectors are set to "1".

【0028】ステップS310に於いて、CPU1内部
に有するアドレス変数(ADD)にステップS309に
て消去したセクタの先頭アドレスが記憶され、アドレス
変数(ADD)に記憶しているアドレス位置から順次、
ステップS306にてRAM3に一時記憶されたレコー
ドデータを、アドレス変数(ADD)を更新しながらバ
ス5を介して再度書き込み、RAM3に一時記憶されて
いるレコードデータが全てフラッシュメモリ4に書き込
まれるとステップS311に進む。つまり、ステップS
309乃至S310では、無効データを消去し、有効デ
ータのみを再書込することにより書き込み可能な領域を
確保することができる。
In step S310, the head address of the sector erased in step S309 is stored in an address variable (ADD) provided in the CPU 1, and the address position stored in the address variable (ADD) is sequentially determined.
In step S306, the record data temporarily stored in the RAM 3 is re-written via the bus 5 while updating the address variable (ADD). When all the record data temporarily stored in the RAM 3 is written to the flash memory 4, the process proceeds to step S306. Proceed to S311. That is, step S
In steps 309 to S310, a writable area can be secured by erasing invalid data and rewriting only valid data.

【0029】ステップS311に於いて、CPU1内部
に有するアドレス変数(ADD)に次のレコードが位置
するアドレスが記憶され、ステップS312に進む。つ
まり、ステップS311では、ステップS310にて再
書込した有効データの後の未記憶状態レコード位置のア
ドレスが記憶されることとなる。
In step S311, the address at which the next record is located is stored in the address variable (ADD) of the CPU 1, and the flow advances to step S312. That is, in step S311, the address of the unstored state record position after the valid data rewritten in step S310 is stored.

【0030】ステップS312に於いて、CPU1内部
に有するアドレス変数(ADD)が示すアドレス位置の
レコードのフラグ1に記憶済情報「0」を記憶し、フラ
グ2に有効データである旨の「1」を記憶し、データ種
別に書き込みを行うデータの種別情報を記憶し、書き込
みを行おうとする所望のデータのサイズ及び実データを
記憶し、CRCチェックデータを記憶、つまり1レコー
ド分のデータを記憶する。
In step S312, the stored information "0" is stored in the flag 1 of the record at the address position indicated by the address variable (ADD) in the CPU 1, and the flag 2 is set to "1" indicating valid data. Is stored, the type information of the data to be written is stored in the data type, the size and actual data of the desired data to be written are stored, and the CRC check data is stored, that is, the data for one record is stored. .

【0031】次に図4のフローチャートに基づき、CP
U1の制御に基づくフラッシュメモリからの読出処理方
法について説明する。
Next, based on the flowchart of FIG.
A method for processing reading from the flash memory based on the control of U1 will be described.

【0032】CPU1からフラッシュメモリ4からの読
み出し処理が発生すると、ステップS401に於いて、
CPU1内部に有するアドレス変数(ADD)にフラッ
シュメモリ領域内の読出処理対象となるセクタの先頭位
置アドレスが記憶され、ステップS402に進む。
When a read process from the flash memory 4 occurs from the CPU 1, in step S401,
The start position address of the sector to be read in the flash memory area is stored in the address variable (ADD) of the CPU 1, and the process proceeds to step S402.

【0033】ステップS402に於いて、アドレス変数
(ADD)が示すレコードのフラグ1に記憶済情報
「0」が記憶されているか否かを判断し、未記憶状態
「1」の場合には、ステップS406に進み、フラグ1
に記憶済情報「0」が記憶されている場合には、ステッ
プS403に進む。
In step S402, it is determined whether or not the stored information "0" is stored in the flag 1 of the record indicated by the address variable (ADD). Proceeds to S406 and proceeds to flag 1
If the stored information “0” is stored in step S403, the process proceeds to step S403.

【0034】ステップS403に於いて、フラグ2に有
効データである旨の「1」が記憶されているか否かを判
断し、有効データ「1」でない場合、つまり、データは
記憶されているが無効データ「0」が記憶されている場
合は、ステップS407に進み、有効データが記憶され
ている場合は、ステップS404に進む。
In step S403, it is determined whether or not "1" indicating valid data is stored in the flag 2. If not, the valid data is not "1", that is, the data is stored but invalid. If data "0" is stored, the process proceeds to step S407, and if valid data is stored, the process proceeds to step S404.

【0035】ステップS404に於いて、所望の読み出
しデータと、記憶されているデータ種別が一致するか否
かを判断し、不一致の場合はステップS407に進み、
一致する場合は、ステップS405に進み、アドレス変
数(ADD)が示す1レコード分のデータをバス5を介
して読み出す。
In step S404, it is determined whether the desired read data matches the stored data type. If not, the flow advances to step S407.
If they match, the flow advances to step S405 to read one record of data indicated by the address variable (ADD) via the bus 5.

【0036】ステップS406に於いて、アドレス変数
(ADD)に現在読出処理の対象としているセクタの先
頭位置アドレスが記憶されているか否かを判断し、セク
タの先頭アドレスが記憶されていない場合はステップS
407に進み、セクタの先頭アドレスが記憶されている
場合はステップS409へ進み、該当データ無しとして
処理を終了する。
In step S406, it is determined whether or not the start position address of the sector to be currently read is stored in the address variable (ADD). S
Proceeding to 407, if the start address of the sector is stored, proceeding to step S409, the process ends as there is no corresponding data.

【0037】ステップS407に於いて、アドレス変数
(ADD)がフラッシュメモリ内の読出処理対象として
いるセクタの領域が終わりか否かを判断し、終わりの場
合、ステップS409に進み、終わりではない場合、ス
テップS408に進み、CPU1内部に有するアドレス
変数(ADD)に次のレコードが位置するアドレスを記
憶し、ステップS402に進み、次のレコードに対して
ステップS402以降の処理が順次繰り返される。
In step S407, it is determined whether or not the address variable (ADD) is the end of the area of the sector to be read in the flash memory. If it is, the process proceeds to step S409. Proceeding to step S408, the address at which the next record is located is stored in the address variable (ADD) of the CPU 1, and the process proceeds to step S402, where the processing of step S402 and subsequent steps is sequentially repeated for the next record.

【0038】以上の様なデータ記憶方法及びデータ読出
方法の様子を模式的に表すと、図5の様になり、フラッ
シュメモリ4内の処理対象となるセクタの途中まで記憶
されている状態で、新しいデータ(レコード)をセクタ
内に記憶しようとする場合には、フラグ1が未記憶状態
の位置に記憶する(図5(a)参照)。又、処理対象と
なるセクタの全てに記憶されている状態で、新しいデー
タ(レコード)をセクタ内に記憶する場合(図5(b)
参照)、フラグ2が有効データとなっているレコードを
RAM3に一時記憶し、処理対象となるセクタを全消去
し、RAM3から一時記憶した有効なレコードを処理対
象となるセクタの先頭から記憶しなおし、その続きのフ
ラグ1が未記憶状態の位置に、記憶しようとする新しい
データ(レコード)を記憶する(図5(c)参照)。
FIG. 5 schematically shows the state of the data storage method and the data read method as described above. FIG. 5 shows a state in which a sector to be processed in the flash memory 4 is partially stored. When new data (record) is to be stored in the sector, the flag 1 is stored at a position where the data is not stored (see FIG. 5A). In the case where new data (record) is stored in a sector while being stored in all the sectors to be processed (FIG. 5B)
Record), the record in which the flag 2 is valid data is temporarily stored in the RAM 3, all the sectors to be processed are erased, and the valid record temporarily stored from the RAM 3 is stored again from the beginning of the sector to be processed. The new data (record) to be stored is stored at a position where the flag 1 following the flag is not stored (see FIG. 5C).

【0039】以上、従来n個のレコードを書き込むに
は、n回の消去を必要としていたが、本発明の方法を用
いると、消去回数を大幅に削減する事が可能となり、書
込処理の効率が向上し、消去回数の減少に伴う長寿命化
を図ることが可能となる。
As described above, writing n records conventionally required n erasures. However, the use of the method of the present invention makes it possible to greatly reduce the number of erasures. And the life can be prolonged as the number of erases decreases.

【0040】更には、消去前の有効なデータも継続的に
記憶されるので、度重なる書込処理を削減でき、更なる
効率化が可能となる。
Furthermore, since valid data before erasure is also stored continuously, repeated writing processing can be reduced, and further efficiency can be achieved.

【0041】また、複数の有効なデータを有していて
も、記憶済確認フラグと有効データ確認フラグと種別情
報とに基づいて、所望のデータを効率的に読み出すこと
が可能となる。
Further, even if there are a plurality of valid data, desired data can be efficiently read out based on the stored confirmation flag, the valid data confirmation flag, and the type information.

【0042】[0042]

【発明の効果】本発明を用いると、消去回数を大幅に削
減する事が可能となり、書込処理の効率が向上し、消去
回数の減少に伴う長寿命化を図ることが可能となる。更
には、消去前の有効なデータも継続的に記憶されるの
で、度重なる書込処理を削減でき、更なる効率化が可能
となる。また、複数の有効なデータを有していても、記
憶済確認フラグと有効データ確認フラグと種別情報とに
基づいて、所望のデータを効率的に読み出すことが可能
となる。
According to the present invention, the number of erasures can be greatly reduced, the efficiency of the writing process can be improved, and the life can be prolonged with the decrease in the number of erasures. Furthermore, since valid data before erasure is also stored continuously, repeated writing processing can be reduced, and further efficiency can be achieved. In addition, even if there are a plurality of valid data, desired data can be efficiently read based on the stored confirmation flag, the valid data confirmation flag, and the type information.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明のフラッシュメモリへのデータ記憶方法
が用いられる装置の一実施の形態を示すブロック図であ
る。
FIG. 1 is a block diagram showing an embodiment of an apparatus using a method of storing data in a flash memory according to the present invention.

【図2】全メモリ領域の中のフラッシュメモリ領域が割
当られている様子の一実施の形態を示す模式図である。
FIG. 2 is a schematic diagram showing an embodiment in which a flash memory area in all memory areas is allocated.

【図3】本発明のフラッシュメモリへのデータ記憶方法
及びデータ消去方法の一実施の形態を説明するフローチ
ャートである。
FIG. 3 is a flowchart illustrating an embodiment of a method of storing data in a flash memory and a method of erasing data according to the present invention.

【図4】本発明のフラッシュメモリからデータを読み出
す読出方法の一実施の形態を説明するフローチャートで
ある。
FIG. 4 is a flowchart illustrating an embodiment of a reading method for reading data from a flash memory according to the present invention.

【図5】本発明を用いた場合のフラッシュメモリ内の様
子の一実施の形態を示す模式図である。
FIG. 5 is a schematic diagram showing an embodiment of a state in a flash memory when the present invention is used.

【符号の説明】[Explanation of symbols]

1 CPU 2 ROM 3 RAM 4 フラッシュメモリ 5 バス 1 CPU 2 ROM 3 RAM 4 Flash memory 5 Bus

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 所望のデータを書き込む際に、 メモリへの記憶の有無を確認するための記憶済確認フラ
グと、前記データの有効又は無効を示す有効データ確認
フラグと、前記データの種別情報を示す種別データと、
を前記データに付加したレコードデータを書き込むこと
を特徴とするフラッシュメモリへのデータ記憶方法。
When writing desired data, a stored confirmation flag for confirming whether or not data is stored in a memory, a valid data confirmation flag indicating validity or invalidity of the data, and type information of the data, Type data shown,
And writing record data in which the data is added to the data.
【請求項2】 メモリへの書込にあたり、メモリ領域の
先頭より前記記憶済確認フラグに基づき、順次未記憶デ
ータのアドレスを検出し、未記憶データのアドレスを検
出した場合、検出した前記未記憶のアドレスに前記レコ
ードデータを書き込むことを特徴とする請求項1に記載
のフラッシュメモリへのデータ記憶方法。
2. When writing to a memory, an address of unstored data is sequentially detected from the beginning of a memory area based on the stored confirmation flag, and when an address of unstored data is detected, the detected unstored data is detected. 2. The method of storing data in a flash memory according to claim 1, wherein the record data is written to an address of the flash memory.
【請求項3】 メモリへの書込にあたり、メモリ領域の
先頭より前記記憶済確認フラグに基づき、順次未記憶デ
ータのアドレスを検出し、未記憶データのアドレスが検
出できなかった場合、前記有効データ確認フラグに基づ
き、有効レコードデータを一時保存し、データをセクタ
単位で消去した後、前記一時保存した有効レコードデー
タをメモリ領域の先頭より順次再書き込むことを特徴と
する請求項1に記載のフラッシュメモリへのデータ記憶
方法。
3. When writing to a memory, an address of unstored data is sequentially detected from the beginning of the memory area based on the stored confirmation flag. 2. The flash according to claim 1, wherein the valid record data is temporarily stored based on the confirmation flag, the data is erased in sector units, and then the temporarily stored valid record data is sequentially rewritten from the beginning of a memory area. A method of storing data in memory.
【請求項4】 メモリへの書込にあたり、メモリ領域の
先頭より前記記憶済確認フラグに基づき、順次未記憶デ
ータのアドレスを検出し、未記憶データのアドレスが検
出できなかった場合、前記有効データ確認フラグ及び前
記種別情報に基づき、有効レコードデータを一時保存
し、データをセクタ単位で消去した後、前記一時保存し
た有効レコードデータをメモリ領域の先頭より順次再書
き込むことを特徴とする請求項1に記載のフラッシュメ
モリへのデータ記憶方法。
4. When writing to a memory, an address of unstored data is sequentially detected from the beginning of a memory area based on the stored confirmation flag. 2. The method according to claim 1, wherein the effective record data is temporarily stored based on a confirmation flag and the type information, the data is erased in sector units, and then the temporarily stored effective record data is sequentially rewritten from a head of a memory area. 3. A method for storing data in a flash memory according to item 1.
【請求項5】 前記一時保存した有効レコードデータを
メモリ領域の先頭より順次再書き込みを行った後、その
直後のアドレスに所望のデータを有するレコードデータ
を書き込むことを特徴とする請求項3又は請求項4に記
載のフラッシュメモリへのデータ記憶方法。
5. The method according to claim 3, wherein the temporarily stored valid record data is rewritten sequentially from the beginning of a memory area, and then record data having desired data is written to an address immediately after the rewrite. Item 5. The method for storing data in a flash memory according to Item 4.
【請求項6】 請求項2乃至請求項5のいずれかに記載
のフラッシュメモリへのデータ記憶方法により書き込ま
れたデータを読み出す方法であって、 メモリ領域の先頭より順次記憶済確認フラグと有効デー
タ確認フラグと種別情報とを検出し、所望の種別情報を
検出した場合にデータを読み出すことを特徴とするフラ
ッシュメモリからのデータ読出方法。
6. A method for reading data written by the method for storing data in a flash memory according to claim 2, wherein the storage confirmation flag and the valid data are sequentially stored from the top of the memory area. A method for reading data from a flash memory, comprising detecting a confirmation flag and type information, and reading data when desired type information is detected.
JP1428999A 1998-12-25 1999-01-22 Data storing method for flash memory and data reading out method from flash memory Pending JP2000243093A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1428999A JP2000243093A (en) 1998-12-25 1999-01-22 Data storing method for flash memory and data reading out method from flash memory

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP10-369702 1998-12-25
JP36970298 1998-12-25
JP1428999A JP2000243093A (en) 1998-12-25 1999-01-22 Data storing method for flash memory and data reading out method from flash memory

Publications (1)

Publication Number Publication Date
JP2000243093A true JP2000243093A (en) 2000-09-08

Family

ID=26350210

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1428999A Pending JP2000243093A (en) 1998-12-25 1999-01-22 Data storing method for flash memory and data reading out method from flash memory

Country Status (1)

Country Link
JP (1) JP2000243093A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002052416A1 (en) * 2000-12-27 2002-07-04 Tdk Corporation Flash memory system
KR100652625B1 (en) 2004-03-03 2006-12-06 엘지전자 주식회사 Record store method for mobile communication terminal
KR100735341B1 (en) 2006-02-27 2007-07-04 삼성전자주식회사 Apparatus and method for improving speed of data reading from subscriber identity module
JP2014075036A (en) * 2012-10-04 2014-04-24 Denso Corp Data processing method for flash memory and program for data processing
US9058883B2 (en) 2011-02-23 2015-06-16 Denso Corporation Control apparatus for controlling data reading and writing to flash memory
JP2016224937A (en) * 2015-05-26 2016-12-28 華邦電子股▲ふん▼有限公司 Methods and systems for nonvolatile memory data management

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002052416A1 (en) * 2000-12-27 2002-07-04 Tdk Corporation Flash memory system
KR100652625B1 (en) 2004-03-03 2006-12-06 엘지전자 주식회사 Record store method for mobile communication terminal
KR100735341B1 (en) 2006-02-27 2007-07-04 삼성전자주식회사 Apparatus and method for improving speed of data reading from subscriber identity module
US8060140B2 (en) * 2006-02-27 2011-11-15 Samsung Electronics Co., Ltd. Method and apparatus for increasing data read speed from subscriber identity module
US9058883B2 (en) 2011-02-23 2015-06-16 Denso Corporation Control apparatus for controlling data reading and writing to flash memory
JP2014075036A (en) * 2012-10-04 2014-04-24 Denso Corp Data processing method for flash memory and program for data processing
JP2016224937A (en) * 2015-05-26 2016-12-28 華邦電子股▲ふん▼有限公司 Methods and systems for nonvolatile memory data management

Similar Documents

Publication Publication Date Title
JP3692313B2 (en) Nonvolatile memory control method
US7363421B2 (en) Optimizing write/erase operations in memory devices
EP1739683B1 (en) Space management for managing high capacity nonvolatile memory
EP1228510B1 (en) Space management for managing high capacity nonvolatile memory
JP2990181B1 (en) Flash memory, microcomputer having flash memory, and method of storing program in flash memory
US6839798B1 (en) Flash memory capable of storing frequently rewritten data
US7610436B2 (en) Semiconductor device having flash memory with a data length table
JP3875139B2 (en) Nonvolatile semiconductor memory device, data write control method thereof, and program
JP2007034581A (en) Memory controller, flash memory system and method for controlling flash memory
JP2003058417A (en) Storage device
JP2000243093A (en) Data storing method for flash memory and data reading out method from flash memory
JPH07153284A (en) Non-volatile semiconductor memory and its control method
JPH10124403A (en) Writing method for block deletion type flash memory
JPH09259046A (en) Method for storing data in flash memory and method for reading data out of flash memory
JP4031693B2 (en) Nonvolatile memory and data storage device having the same
US6898680B2 (en) Minimization of overhead of non-volatile memory operation
JP2004078907A (en) Storage device, memory management method, and program thereof
JP2008084288A (en) Memory controller
JP2001092713A (en) Device and method for writing data
JPH07296591A (en) Electronic equipment
JPH11259357A (en) Semiconductor integrated device and nonvolatile memory writing system
JP2000276461A (en) Microcomputer
JP3166659B2 (en) Storage device
JP2007199846A (en) Memory control device and memory control method
JPS62289999A (en) Data writing method

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20040406