Referring to
According to the above method, for example, the flash memory 1 with 4096 blocks may be divided into 4 predetermined sectors with each predetermined sector having 1024 physical blocks, wherein when there are 80 defective physical blocks 12 evenly distributed in the flash memory 1, each predetermined sector will have 1004 good physical blocks 11, 992 logic blocks and 12 temporary blocks. Thus, there will be more number of good physical blocks 11 than the logic blocks so as to enable the flash memory 1 to function normally.
When the defective physical blocks 12 accumulate in one sector, based on the principle that the number of the logic blocks is non-proportional, such that each predetermined sector has 1024 physical blocks, 944 good physical blocks 11 and 932 logic blocks. Accordingly, there are 12 temporary blocks, 1024 good physical blocks 11 and 1012 logic blocks in another sector to maintain 12 temporary blocks. As shown in the Figure, there is greater number of the good physical blocks 11 than the logic blocks. Thus, there are sufficient number of temporary blocks, and the flash memory 1 can function normally.
Hereinafter, the procedure of initialization of the flash memory 1 with reference to
At step 300, the sum of all the good physical blocks 11 and the sum of the defective physical blocks 12 are calculated.
At step 301, the good and defective physical blocks 11, 12 are distributed among the defined sectors of the flash memory 1, wherein each predetermined sector has a predetermined number of temporary blocks to equalize the number of the logic blocks and the temporary blocks with the physical blocks therein.
At step 302, the distribution information is recorded into a good physical block 11.
At step 303, the initialization to the flash memory 1 is executed.
At step 304, the block where the definition of the sector information, the number of good physical blocks 11 and the border information of the predetermined sectors are stored is located, and then this information is stored into the SRAM of the control chip.
At step 305, a border and the predetermined sector in the flash memory 1 are built according to the border information and the predetermined sectors information stored in the SRAM.
At step 306, the number of the good physical blocks 11 in each block is determined.
At step 307, a block correspondence chart is created in the predetermined sector.
As can be seen from above description that when the flash memory 1 has too many defective physical blocks 12, the number of the good physical blocks 11 and the number of the logic blocks can be adjusted according to the non-proportionality principle by including a predetermined number of temporary blocks (for example 12 temporary blocks) in order to manage the flexibly flash memory.
Accordingly, the method of managing blocks of the flash memory of the present invention can overcome the disadvantages of the conventional art. According to the present invention, the sum of number of the good and defective blocks is calculated and then the blocks are distributed in the predetermined sectors in the flash memory, wherein each predetermined sector has a predetermined number of temporary blocks in order to equalize the number of the logic blocks and the temporary blocks with the physical blocks in the predetermined sector. This information is stored into the SRAM of the control chip so that the control chip can create a block correspondence chart in the predetermined sector during execution to initialize the flash memory. Accordingly, each predetermined sector has the number of the logic blocks non-proportional to the number of physical blocks, wherein the temporary blocks may be utilized to effectively operate the flash memory. Thus, the logic blocks and the physical blocks can be managed according to the method of the present invention regardless of whether the defective physical blocks accumulate in one or a plurality of predetermined sectors, or in one or a plurality of sectors of one or a plurality of flash memories. Thus, there will not be many invalid physical blocks.
While the invention has been described in conjunction with a specific best mode, it is to be understood that many alternatives, modifications, and variations will be apparent to those skilled in the art in light of the foregoing description. Accordingly, it is intended to embrace all such alternatives, modifications, and variations in which fall within the spirit and scope of the included claims. All matters set forth herein or shown in the accompanying drawings are to be interpreted in an illustrative and non-limiting sense.