Method for writing data into flash memory module for preventing influence of power interruption

文档序号:1719603 发布日期:2019-12-17 浏览:16次 中文

阅读说明:本技术 一种防止电源中断影响的将数据写入闪存模块的方法 (Method for writing data into flash memory module for preventing influence of power interruption ) 是由 张为 赵创 于 2019-08-21 设计创作,主要内容包括:本发明涉及一种防止电源中断影响的将数据写入闪存模块的方法,包括:构建页状态表:在写过程中,页状态表与写入页每一位相对应,如果正常写入数据时,页状态表中对应位的值为0;当出现写入异常时,页状态表中对应位的值为1,在存储模块的缓冲器中将分配空间来备份写入损坏的页的数据,通过页状态表确定数据要写入的特定页面是否已损坏;将数据写入存储模块;若在写入过程中断电,则重启存储模块;重启之后,存储模块从已写入数据的页中读取数据来重新建立页状态表;根据页状态表将数据写入页,通过页状态表中的值确定数据要写入的页是否已损坏:当页没有损坏时,直接将数据写入该页;当页已损坏时,将备份在缓冲器中的数据写入该页。(The invention relates to a method for writing data into a flash memory module, which can prevent the influence of power interruption, and comprises the following steps: constructing a page state table: in the writing process, the page state table corresponds to each bit of the writing page, and if data is normally written, the value of the corresponding bit in the page state table is 0; when the write-in is abnormal, the value of a corresponding bit in the page state table is 1, space is allocated in a buffer of the storage module to backup data written in a damaged page, and whether a specific page to which the data is written is damaged or not is determined through the page state table; writing data into the storage module; if the power is off in the writing process, restarting the storage module; after restarting, the storage module reads data from the page written with data to reestablish the page state table; writing data to the page according to the page status table, determining whether the page to which the data is to be written is corrupted by a value in the page status table: when the page is not damaged, directly writing the data into the page; when a page has been corrupted, the data backed up in the buffer is written to the page.)

1. A method of writing data to a flash memory module to prevent the effects of a power interruption, comprising the steps of:

1) starting a storage module;

2) constructing a page state table: in the writing process, the page state table corresponds to each bit of the writing page, if data is written normally, the value of the corresponding bit in the page state table is 0, namely the storage module does not back up the data; when the write-in is abnormal, the value of a corresponding bit in the page state table is 1, space is allocated in a buffer of the storage module to backup data written in a damaged page, and whether a specific page to which the data is written is damaged or not is determined through the page state table;

3) writing data into the storage module; the memory module comprises a plurality of flash memory chips, each flash memory chip comprises a plurality of blocks, each block comprises a plurality of pages, and the writing operation is performed by taking the page as a unit;

4) Restarting the memory module if the power is off during the write operation, if the LSB page on the wordline is suddenly powered off during the write operation, the CSB page and MSB page on the wordline will also be damaged;

5) After restarting, the storage module reads data from the page written with data to reestablish the page state table;

6) Writing data to the page according to the page status table, determining whether the page to which the data is to be written has been corrupted by whether the value in the page status table is 0 or 1: when the page is not damaged, directly writing the data into the page; writing the data backed up in the buffer to the page when the page is damaged;

7) Judging whether the write operation of all the writable pages in the storage module is completed or not; if the write operation of all the writable pages is completed, deleting the page state table; if not, repeating the step 6 until the writing operation is completed, and then executing the step 7 to delete the page state table;

8) If the write operation of all the writable pages of the storage module is finished, deleting the page state table; the process of writing data to the memory module ends.

Technical Field

The present invention relates to flash memory, and more particularly, to a method for writing data into a memory module.

Background

In recent decades, methods for storing data by human beings are changing day by day, and it is very important to pursue high reliability and permanent storage, among which, a Flash memory (Nand Flash) has a long data storage time, high reliability, high density and low price, and thus occupies a large space in the storage market. In flash architectures, the memory cells are organized in series every 32 or 64. Each memory cell string has a bit line (bitline) for connecting to other strings. The control gate is used to connect Word Lines (WLs). Page (Page) is the minimum unit of reading by the flash chip, Block (Block) is the minimum unit of writing by the flash chip, and one Block is every 64 pages.

when the power supply of the flash memory is suddenly interrupted during a write operation, not only the page currently being written may be damaged, but also other pages located on the same word line as the page will be damaged. For example, it is assumed that the above flash memory is a three-level cell (TLC) flash memory chip, and each word line in the TLC flash memory forms a Least Significant Bit (LSB) page, a Central Significant Bit (CSB) page, and a Most Significant Bit (MSB) page. If the LSB page on a wordline is suddenly powered down during a write operation, the CSB page and MSB page on the wordline will also be corrupted. Therefore, a Sudden Power Off Recovery (SPOR) procedure is critical to maintaining data reliability of the flash memory.

Disclosure of Invention

it is an object of the present invention to provide a method of writing data to a memory module, which can efficiently continue a subsequent SPOR program and data writing when a write page is corrupted. The technical scheme is as follows:

a method of writing data to a flash memory module to prevent the effects of a power interruption, comprising the steps of:

1) Starting a storage module;

2) Constructing a page state table: in the writing process, the page state table corresponds to each bit of the writing page, if data is written normally, the value of the corresponding bit in the page state table is 0, namely the storage module does not back up the data; when the write-in is abnormal, the value of a corresponding bit in the page state table is 1, space is allocated in a buffer of the storage module to backup data written in a damaged page, and whether a specific page to which the data is written is damaged or not is determined through the page state table;

3) Writing data into the storage module; the memory module comprises a plurality of flash memory chips, each flash memory chip comprises a plurality of blocks, each block comprises a plurality of pages, and the writing operation is performed by taking the page as a unit;

4) Restarting the memory module if the power is off during the write operation, if the LSB page on the wordline is suddenly powered off during the write operation, the CSB page and MSB page on the wordline will also be damaged;

5) After restarting, the storage module reads data from the page written with data to reestablish the page state table;

6) writing data to the page according to the page status table, determining whether the page to which the data is to be written has been corrupted by whether the value in the page status table is 0 or 1: when the page is not damaged, directly writing the data into the page; writing the data backed up in the buffer to the page when the page is damaged;

7) Judging whether the write operation of all the writable pages in the storage module is completed or not; if the write operation of all the writable pages is completed, deleting the page state table; if not, repeating the step 6 until the writing operation is completed, and then executing the step 7 to delete the page state table;

8) if the write operation of all the writable pages of the storage module is finished, deleting the page state table; the process of writing data to the memory module ends.

Drawings

fig. 1 is an internal structure of a memory module according to an embodiment of the present invention.

FIG. 2 is a block A having a TLC structure used in the present invention.

FIG. 3 is a flow chart of the method of the present invention (process B).

Detailed Description

FIG. 1 is a diagram of a memory device according to an embodiment of the present invention. The memory device includes a flash memory module and a flash memory controller. The flash memory controller is arranged to access the flash memory module. The flash memory controller includes a microprocessor, Read Only Memory (ROM), control logic, a buffer, and interface logic. The ROM is used for storing program codes, and the microprocessor is used for executing the program codes and controlling the access of the flash memory controller. The control logic includes an encoder and a decoder. The encoder is used to encode data written to the flash memory module to generate a corresponding check code (ECC), while the decoder is used to decode data read therefrom.

FIG. 2 Block A includes N word lines WL0-WLN, and each word line forms three pages. The LSB bits among the plurality of cells stored on the word line form a first page (LSB page) of the word line, the CSB bits among the plurality of cells stored on the word line form a second page (CSB page) of the word line, and the plurality of cells on the MSB bit word line stored therein form a third page (MSB page) of the word line. FIG. 2, Block A, the LSB bits among the cells stored on word line WL1 form page P1, the CSB bits among the cells stored on word line WL1 form page P24, and the MSB bits among the cells stored on word line WL1 form page P25. If page P1 were corrupted due to a sudden power down occurring during a write operation, page P24 and page P25 would also be corrupted. Thus, after page P1 has been corrupted, the flash controller may operate to write if it is still desired to write data to a subsequent page. This approach, which avoids data write errors, but pages P2-P23 are also wasted, by writing dummy data from page P1 to page P25 and writing valid data from page P26 so that data is not written to pages P24 and P25 on word line WL 1. Especially when the flash memory module is a 3D NAND, the distance between the LSB page, CSB page and MSB page is large (the difference between the page sequence numbers is also large). Therefore, more pages are wasted in the 3DNAND type flash memory. In order to solve the above-described problem of page waste due to sudden power-off, the pages in the block are used in a more efficient manner after the SPOR by the following method.

Taking block a of fig. 2 as fig. 3 is a flowchart of the present invention, which includes the following steps:

Step 1, the process begins, wherein the flash controller allocates the block as a target block ready for writing data.

step 2: the flash controller builds a page status table that records whether pages within a block are corrupted and temporarily stores the page status table in a buffer. The page status table can only record corrupted pages, i.e. when no data is written to the block at the beginning, the page status table does not record corrupted information about any page. Instead, the page status table records information only when a page is determined to be corrupted.

and step 3: the flash memory controller receives a write command from a host device. The flash controller starts writing data sequentially on the page according to the write command. If a sudden power down occurs while the flash memory controller is writing data to a page, the data in the page may be erroneous and the page status table stored in the buffer may also be lost.

And 4, step 4: the memory device is re-powered and the flash controller and flash module perform initialization after power up.

And 5: the flash memory controller reconstructs the page state table of the corresponding block. During reconstruction of the page status table, the flash controller first reads data from the pages and determines the data quality of the pages. For any page to which data has been written, if it is determined that the data quality of the page does not meet the criteria, the page is recorded in the page status table as being corrupted, as are other pages that are also recorded to share the same word line as the page.

step 6: the flash memory controller writes data to the block with reference to the page state table. As shown in FIG. 2, the flash controller first references the corresponding bit in the page status table, and since the value of the corresponding bit is "O", page P2 is not corrupted. Therefore, the flash controller writes the data directly to page P2. The flash controller then references the corresponding bits of P3-P23 in the page state table and writes the data directly to pages P3-P23. Thus, before the flash controller writes the data to the next page P24, the flash controller refers to the value of the corresponding bit in the page status table. When the value of the corresponding bit of the P24 state table is "1", it means that page P24 has been corrupted. The flash controller writes dummy data to page P24. The flash controller then references the corresponding bit of P25 in the page status table. Since the page state table corresponds to "1", which means that page P25 has been corrupted, the flash controller also writes dummy data to page P25. Therefore, the flash controller references the page state table with the value of the P26 corresponding bit being "O", which means that page P26 is not corrupted, so the flash controller writes the data directly to page P26.

step 7, the flash controller determines whether all writes to writable pages in the block have been completed. That is, it is determined whether data has been written to the last valid page. If not, the flow proceeds to step and continues to write data on block A. Otherwise, the flow proceeds to step 8.

in step 8, the flash controller deletes the page status table corresponding to the block from the buffer. After the writer operation on block a has completed, if the flash controller needs to write data to another block as follows, the following process may include: process B may be repeated to build a page state table corresponding to another block as a reference for the write operation.

When data needs to be written to the block again, the flash controller may read the page status table from it and write the data to the block according to the page status table. In FIG. 3, only the pages marked as corrupted in Block A will be written with valid data, and the other pages will still be available for storing data (i.e., only pages P1, P24, P25 will not be written with valid data in FIG. 2), so that the pages in Block A can be fully utilized, thereby enhancing page usage.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:打印控制方法及装置、系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类