CN104166627A - NAND-FLASH writing operation method based on single-chip microcomputer - Google Patents
NAND-FLASH writing operation method based on single-chip microcomputer Download PDFInfo
- Publication number
- CN104166627A CN104166627A CN201410440206.6A CN201410440206A CN104166627A CN 104166627 A CN104166627 A CN 104166627A CN 201410440206 A CN201410440206 A CN 201410440206A CN 104166627 A CN104166627 A CN 104166627A
- Authority
- CN
- China
- Prior art keywords
- piece
- data
- nand
- write operation
- flash
- 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
Links
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
- Read Only Memory (AREA)
Abstract
The invention relates to an NAND-FLASH writing operation method based on a single-chip microcomputer. The method includes the following steps that first, an NAND-FLASH is divided into a bad block mapping information area, a block exchange area, a data using area and a bad block replacing area; second, the bad block mapping information area is traversed, usable exchange blocks are searched for in the block exchange area according to the traversal result, and an objective block with true writing operation is searched for in the data using area or the bad block replacing area; third, the exchange blocks are erased; fourth, the objective block is copied to the exchange blocks; fifth, the objective block is erased; sixth, new data are generated through combination between data of the exchange blocks and data to be written in and written into the objective block page by page. The method can be used for the single-chip microcomputer with the internal RAM space smaller than the block space of the NAND-FLASH, and not only can stable and reliable use of the NAND-FLASH on the single-chip microcomputer be guaranteed, but also the writing operation stability and reliability of the NAND-FLASH can be improved by managing the bad blocks.
Description
Technical field
The present invention relates to the technical field of data-carrier store write operation, be specifically related to a kind of SCM Based NAND-FLASH write operation method.
Background technology
Single-chip microcomputer because its volume is little, low in energy consumption, control that function is strong, expansion flexibly, the advantage such as microminiaturized and easy to use, and be widely used in instrument and meter.Single-chip microcomputer, in conjunction with dissimilar sensor, can be realized the measurement of physical quantitys such as voltage, electric current, power, frequency, humidity, temperature.Adopt Single-chip Controlling to make instrument and meter digitizing, intellectuality, microminiaturization, and function is more powerful compared with adopting electronics or digital circuit.
NAND-FLASH because its volume is little, non-volatile, repeatedly erasability, write with erasing speed and the cheaper features such as every bit price and obtained swift and violent development in electronic product market faster.NAND-FLASH Yi Yewei unit reads and writes data, Er Yikuaiwei unit's obliterated data.If only upgrade for certain page data in piece, existing method is first the residing monoblock content of page to be read in buffer, and piece is wiped; In conjunction with the data in the page data that will write and former, generate new blocks of data again; Finally write in piece.Though existing method can complete write operation, at least need to distribute the buffer memory of NAND-FLASH mono-block size, for the less single-chip microcomputer of RAM, cannot use the method operation NAND-FLASH.In addition, NAND-FLASH can do once the demarcation of bad piece when product export.In use to repeatedly wiping of NAND-FLASH, also may cause bad piece to produce with writing, cause storing the unreliable of data or lose.
Summary of the invention
The object of the present invention is to provide a kind of SCM Based NAND-FLASH write operation method, the method not only can realize on the less single-chip microcomputer of RAM and use NAND-FLASH, also by adopting bad block management to improve stability and the reliability of NAND-FLASH write operation.
For achieving the above object, the present invention has adopted following technical scheme:
A SCM Based NAND-FLASH write operation method, the method comprises the following steps:
(1) NAND-FLASH is divided into Huai Kuai map information district, piece exchange area, data use district and bad piece and replaces district.
Huai Kuai map information district, piece exchange area, data are used district and bad piece to replace the position of district in NAND-FLASH, can set according to design requirement.Described bad piece map section, for storing bad piece map information.When the piece exchange area of NAND-FLASH, data, using certain piece that district or bad piece replace district does not have when successful carrying out write operation, can be by the bad piece mapping table in the information real-time update Zhi Huaikuai map information district of this bad piece.Described piece exchange area, for when NAND-FLASH is carried out to write operation, the data in temporary storage purpose piece.Described data are used district, as the data storage cell of NAND-FLASH.Described bad piece is replaced district, for use district to carry out write operation while there is bad piece in data, according to the bad piece mapping table in Huai Kuai map information district, uses the bad piece in district to replace with bad piece data and replaces the piece in district.
(2) traversal Huai Kuai map information district, and according to traversing result, in piece exchange area, search operable swap block, in data, use district or bad piece to replace district and search the real object piece of write operation.Described operable swap block is that bad piece cannot be used because may there is bad piece in piece exchange area.And the swap block that will search in this step will be brought temporal data to use, therefore, operable swap block will be searched one by one in piece exchange area, until find.The real object piece of described write operation, if be because the object piece A providing is bad piece, just need to recall this bad piece according to bad piece mapping table and replace corresponding piece B in district at bad piece, with piece B, replaces piece A to store data.Therefore, the real object piece of write operation, just refers to the final actual execution object of write operation.
(3) wipe swap block.
(4) copy object piece to swap block.
(5) wipe object piece.
(6) in conjunction with the data of swap block and the data that will write, generate new data, be written to page by page object piece.Specifically, first the data of destination address place page are read single-chip microcomputer buffer RAM from swap block, and other data acquisitions except this page are moved to order and moved back to object piece from swap block with page.Then, with new data, cover the data of storing in RAM.Finally, the data by after upgrading in RAM, are written to the destination address place page in object piece, complete the write operation of NAND-FLASH.From this step, can find out, the present invention only need to store the data of destination address place page in the RAM of single-chip microcomputer into, so can stable use on the less single-chip microcomputer of ram space.
Further, NAND-FLASH, when product export, can do once bad piece and demarcate.But due in use, to repeatedly the wiping and writing of NAND-FLASH, also may cause the generation of new bad piece, make the data of storage unreliable or lose.Therefore, in step (4), to step (6) operating process, all can sync check whether there is bad piece, to guarantee to store the reliability of data.
Specifically, step (4) Suo Shu, copy object piece in the process of swap block, checking whether success of write operation simultaneously, if unsuccessful, recording bad piece, upgrading bad piece mapping table, returning to step (2).
In the process of wiping object piece step (5) Suo Shu, check that whether write operation is successful simultaneously, if unsuccessful, record bad piece, upgrade bad piece mapping table, return to step (2).
In the data of combination swap block step (6) Suo Shu and the data that will write, generate new data, be written to page by page in the process of object piece, check that whether write operation is successful simultaneously, if unsuccessful, record bad piece, upgrade bad piece mapping table, return to step (2).
Further, whether described inspection write operation successfully adopts the mode of ECC verification to carry out.
As shown from the above technical solution, the present invention can use on internal RAM space is less than the single-chip microcomputer of a NAND-FLASH block space, it not only can guarantee the reliable and stable use of NAND-FLASH on single-chip microcomputer, also can be by adopting bad block management to improve stability and the reliability of NAND-FLASH write operation.
Accompanying drawing explanation
Fig. 1 is the subregion schematic diagram of all of NAND-FLASH in the present invention;
Fig. 2 is the process flow diagram of write operation method in the present invention.
Wherein:
1, Huai Kuai map information district, 2, piece exchange area, 3, data are used district, 4, bad piece replaces district.
Embodiment
Below in conjunction with accompanying drawing, the present invention will be further described:
As shown in Figure 1, according to the difference of function, NAND-FLASH is divided into Huai Kuai map information district 1, piece exchange area 2, data use district 3 and bad piece successively and replaces district 4.Huai Kuai map information district 1, piece exchange area 2, data are used district 3 and bad piece to replace the position of district 4 in NAND-FLASH, can set according to design requirement.Described bad piece map section 1, for storing bad piece map information.When the piece exchange area 2 of NAND-FLASH, data, using certain piece that district 3 or bad piece replace district 4 does not have when successful carrying out write operation, can be by the bad piece mapping table in the information real-time update Zhi Huaikuai map information district 1 of this bad piece.Described piece exchange area 2, for when NAND-FLASH is carried out to write operation, the data in temporary storage purpose piece.Described data are used district 3, as the data storage cell of NAND-FLASH.Described bad piece is replaced district 4, for use district 3 to carry out write operation while there is bad piece in data, according to the bad piece mapping table in Huai Kuai map information district 1, uses the bad piece in district 3 to replace with bad piece data and replaces the piece in district 4.
As shown in Figure 2, in the time will carrying out write operation to NAND-FLASH, comprise the following steps:
(1.1) read page by page the content of bad piece map section 1, according to reading result, in piece exchange area 2, search operable swap block C, in data, use district 3 or bad piece to replace district 4 and search the real object piece of write operation D.Specifically, when searching operable swap block C in piece exchange area, if be bad piece according to first swap block of INFORMATION DISCOVERY in Huai Kuai map information district 1, just reach second swap block as C again; If second is also bad piece, just reach the 3rd swap block as C again; By that analogy, until find operable swap block.When searching the object piece D1 of write operation in data use district 3, if D1 is bad piece according to this object piece of the INFORMATION DISCOVERY in Huai Kuai map information district 1, according to the bad piece mapping table in Huai Kuai map information district 1, search this bad piece D1 again and replace corresponding piece D2 in district 4 at bad piece, damage corresponding piece D2 in piece replacement district 4 and replace this bad piece D1 use, as the real object piece of write operation D.
(2.1) wipe swap block, be about to the data erase in swap block C.
(3.1) copy object piece to swap block, adopt page to move order, the data in object piece D are copied page by page and moved in swap block C.Meanwhile, open ECC verification and check that whether write operation is successful.If verification is correct, i.e. write operation success, continues execution step (4.1).If check errors, write operation is unsuccessful, records bad piece, upgrades bad piece mapping table and Huai Kuai map information district, and is back to step (1.1).
(4.1) wipe object piece, be about to the data erase in object piece D.Meanwhile, open ECC verification and check that whether write operation is successful.If verification is correct, i.e. write operation success, continues execution step (5.1).If check errors, write operation is unsuccessful, records bad piece, upgrades bad piece mapping table and Huai Kuai map information district, and is back to step (1.1).
(5.1) in conjunction with the data of swap block C and the data that will write, generate new data, be written to page by page in object piece D.Meanwhile, open ECC verification and check that whether write operation is successful.If verification is correct, i.e. write operation success, continues execution step (6.1).If check errors, write operation is unsuccessful, records bad piece, upgrades bad piece mapping table and Huai Kuai map information district, and is back to step (1.1).
Specifically, if the destination address of write operation is x-y byte of the n page of D piece, the detailed process that " generates new data in conjunction with the data of swap block C and the data that will write, be written to page by page in object piece D " is as follows:
(5.1.1) data in swap block C are divided into two parts, first's content is the data on n page, and the second part is other data of removing outside n page.
(5.1.2) adopting page to move order moves back to the second part in object piece D page by page.
(5.1.3) first's content is read the buffer RAM of single-chip microcomputer from swap block C.
(5.1.4) with the new data that will write, x-y the byte of storing the n page of data in RAM in step (5.1.3) override, the data of RAM storage are upgraded.
(5.1.5) by the data after upgrading in RAM, be written to the n page in object piece D.
(6.1) complete NAND-FLASH write operation.
In sum because for RAM compared with for little single-chip microcomputer, its RAM can not store 1 blocks of data in NAND-FLASH.If adopt existing NAND-FLASH write operation method, be to realize the content of monoblock to read in the buffer RAM of single-chip microcomputer.And the present invention is when carrying out write operation to NAND-FLASH, only destination address place page need be kept in buffer RAM, can meet NAND-FLASH and be applied in the demand on the single-chip microcomputer that RAM is less.In addition, the present invention, also by NAND-FLASH is carried out to function division, adopts bad block management that bad piece is checked out in time, guarantees reliability and the stability of data storage.
Above-described embodiment is described the preferred embodiment of the present invention; not scope of the present invention is limited; design under the prerequisite of spirit not departing from the present invention; various distortion and improvement that those of ordinary skills make technical scheme of the present invention, all should fall in the definite protection domain of the claims in the present invention book.
Claims (3)
1. a SCM Based NAND-FLASH write operation method, is characterized in that: the method comprises the following steps:
(1) NAND-FLASH is divided into Huai Kuai map information district, piece exchange area, data use district and bad piece and replaces district;
(2) traversal Huai Kuai map information district, and according to traversing result, in piece exchange area, search operable swap block, in data, use district or bad piece to replace district and search the real object piece of write operation;
(3) wipe swap block;
(4) copy object piece to swap block;
(5) wipe object piece;
(6) in conjunction with the data of swap block and the data that will write, generate new data, be written to page by page object piece.
2. a kind of SCM Based NAND-FLASH write operation method according to claim 1, it is characterized in that: step (4) Suo Shu, copying object piece in the process of swap block, check that whether write operation is successful simultaneously, if unsuccessful, record bad piece, upgrade bad piece mapping table, return to step (2);
In the process of wiping object piece step (5) Suo Shu, check that whether write operation is successful simultaneously, if unsuccessful, record bad piece, upgrade bad piece mapping table, return to step (2);
In the data of combination swap block step (6) Suo Shu and the data that will write, generate new data, be written to page by page in the process of object piece, check that whether write operation is successful simultaneously, if unsuccessful, record bad piece, upgrade bad piece mapping table, return to step (2).
3. a kind of SCM Based NAND-FLASH write operation method according to claim 2, is characterized in that: whether described inspection write operation successfully adopts the mode of ECC verification to carry out.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410440206.6A CN104166627B (en) | 2014-09-02 | 2014-09-02 | A kind of SCM Based NAND FLASH write operation methods |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410440206.6A CN104166627B (en) | 2014-09-02 | 2014-09-02 | A kind of SCM Based NAND FLASH write operation methods |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104166627A true CN104166627A (en) | 2014-11-26 |
CN104166627B CN104166627B (en) | 2017-12-08 |
Family
ID=51910452
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410440206.6A Active CN104166627B (en) | 2014-09-02 | 2014-09-02 | A kind of SCM Based NAND FLASH write operation methods |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104166627B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107102821A (en) * | 2017-04-21 | 2017-08-29 | 济南浪潮高新科技投资发展有限公司 | A kind of NAND FLASH arrays write the processing method of failure |
WO2018103592A1 (en) * | 2016-12-06 | 2018-06-14 | 华为技术有限公司 | Method and device for managing storage medium in storage device, and storage device |
CN109086165A (en) * | 2018-07-06 | 2018-12-25 | 广东梯云科技有限公司 | A kind of data back up method based on single-chip microcontroller Flash, device and storage medium |
CN110737403A (en) * | 2018-07-18 | 2020-01-31 | 爱思开海力士有限公司 | Memory device and method of operating the same |
WO2023142161A1 (en) * | 2022-01-27 | 2023-08-03 | 福建时代星云科技有限公司 | Flash memory data exchange method and terminal based on single chip microcomputer |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040193786A1 (en) * | 2002-08-29 | 2004-09-30 | Yoshihisa Inagaki | Semiconductor memory device and method for writing data into flash memory |
CN1991788A (en) * | 2005-12-30 | 2007-07-04 | 深圳市桑达实业股份有限公司 | Method for treating broken block when using flash memory in tax-controlled cashing machine |
CN101030167A (en) * | 2007-01-17 | 2007-09-05 | 忆正存储技术(深圳)有限公司 | Flash-memory zone block management |
CN101425338A (en) * | 2007-10-29 | 2009-05-06 | 群联电子股份有限公司 | Writing method for nonvolatile memory and controller using the method |
CN102841851A (en) * | 2012-07-19 | 2012-12-26 | 深圳市江波龙电子有限公司 | Flash memory management method and flash memory device |
-
2014
- 2014-09-02 CN CN201410440206.6A patent/CN104166627B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040193786A1 (en) * | 2002-08-29 | 2004-09-30 | Yoshihisa Inagaki | Semiconductor memory device and method for writing data into flash memory |
CN1991788A (en) * | 2005-12-30 | 2007-07-04 | 深圳市桑达实业股份有限公司 | Method for treating broken block when using flash memory in tax-controlled cashing machine |
CN101030167A (en) * | 2007-01-17 | 2007-09-05 | 忆正存储技术(深圳)有限公司 | Flash-memory zone block management |
CN101425338A (en) * | 2007-10-29 | 2009-05-06 | 群联电子股份有限公司 | Writing method for nonvolatile memory and controller using the method |
CN102841851A (en) * | 2012-07-19 | 2012-12-26 | 深圳市江波龙电子有限公司 | Flash memory management method and flash memory device |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018103592A1 (en) * | 2016-12-06 | 2018-06-14 | 华为技术有限公司 | Method and device for managing storage medium in storage device, and storage device |
US10901629B2 (en) | 2016-12-06 | 2021-01-26 | Huawei Technologies Co., Ltd. | Method and apparatus for managing health of a storage medium in a storage device |
CN107102821A (en) * | 2017-04-21 | 2017-08-29 | 济南浪潮高新科技投资发展有限公司 | A kind of NAND FLASH arrays write the processing method of failure |
CN109086165A (en) * | 2018-07-06 | 2018-12-25 | 广东梯云科技有限公司 | A kind of data back up method based on single-chip microcontroller Flash, device and storage medium |
CN110737403A (en) * | 2018-07-18 | 2020-01-31 | 爱思开海力士有限公司 | Memory device and method of operating the same |
WO2023142161A1 (en) * | 2022-01-27 | 2023-08-03 | 福建时代星云科技有限公司 | Flash memory data exchange method and terminal based on single chip microcomputer |
Also Published As
Publication number | Publication date |
---|---|
CN104166627B (en) | 2017-12-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9880770B2 (en) | Supporting invalidation commands for non-volatile memory | |
KR101303524B1 (en) | Metadata redundancy schemes for non-volatile memories | |
US8775771B2 (en) | Block management method for a flash memory and flash memory controller and storage system using the same | |
KR101870521B1 (en) | Methods and systems for improving storage journaling | |
TWI423026B (en) | Data writing method, memory controller and memory storage apparatus | |
US20100180145A1 (en) | Data accessing method for flash memory, and storage system and controller system thereof | |
US8510502B2 (en) | Data writing method, and memory controller and memory storage apparatus using the same | |
TWI442230B (en) | Data writing method, memory controller and memory storage apparatus | |
US20120030411A1 (en) | Data protecting method, memory controller and portable memory storage apparatus | |
US9037814B2 (en) | Flash memory management method and flash memory controller and storage system using the same | |
CN104461935A (en) | Method, device and system for data storage | |
US9213629B2 (en) | Block management method, memory controller and memory stoarge apparatus | |
TW201437807A (en) | Method of recording mapping information method, and memory controller and memory storage apparatus using the same | |
US20120198131A1 (en) | Data writing method for rewritable non-volatile memory, and memory controller and memory storage apparatus using the same | |
CN104166627A (en) | NAND-FLASH writing operation method based on single-chip microcomputer | |
TWI470431B (en) | Data writing method, memory controller and memory storage apparatus | |
US9021218B2 (en) | Data writing method for writing updated data into rewritable non-volatile memory module, and memory controller, and memory storage apparatus using the same | |
WO2019174205A1 (en) | Trash recovery method and device and storage equipment | |
CN106557432B (en) | Buffer storage supervisory method, memorizer control circuit unit and storage device | |
KR20120060236A (en) | Power interrupt management | |
US10055162B2 (en) | Using a tree-based data structure to map logical addresses to physical addresses on a storage device | |
US8812772B2 (en) | Data merging method for non-volatile memory and controller and storage apparatus using the same | |
TWI820321B (en) | Flash memory controller and associated controlling method | |
TWI448892B (en) | Data moving mehod, memory controller and memory storage apparatus | |
TW200814088A (en) | Method for increasing read/write lifespan of flash memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |