TWI851083B - Electronic apparatus and memory data repairing method thereof - Google Patents
Electronic apparatus and memory data repairing method thereof Download PDFInfo
- Publication number
- TWI851083B TWI851083B TW112109604A TW112109604A TWI851083B TW I851083 B TWI851083 B TW I851083B TW 112109604 A TW112109604 A TW 112109604A TW 112109604 A TW112109604 A TW 112109604A TW I851083 B TWI851083 B TW I851083B
- Authority
- TW
- Taiwan
- Prior art keywords
- data
- block
- error
- flash memory
- storage
- Prior art date
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
- Read Only Memory (AREA)
Abstract
Description
本發明是關於快閃記憶體修復技術,尤其是關於一種具有快閃記憶體資料修復機制的電子裝置及其記憶體資料修復方法。 The present invention relates to flash memory repair technology, and more particularly to an electronic device having a flash memory data repair mechanism and a memory data repair method thereof.
在記憶體中,是以數位的形式儲存資料。更詳細的說,資料是以包含0與1位元進行儲存。然而在快閃記憶體中,由於本身硬體的特性,會出現位元反轉(bit flip)的現象,使原本為0的資料變成1,亦或原本為1的資料變成0。這樣的現象所造成的資料錯誤,稱為位元反轉錯誤。 In memory, data is stored in digital form. More specifically, data is stored as bits containing 0 and 1. However, in flash memory, due to the characteristics of its own hardware, bit flipping occurs, causing data that was originally 0 to become 1, or data that was originally 1 to become 0. The data error caused by this phenomenon is called a bit flip error.
位元反轉錯誤往往透過錯誤檢測和校正(Error Checking and Correcting)的機制,在資料讀取出來後進行資料校正。然而隨著快閃記憶體使用次數以及時間的增加,往往會使位元反轉錯誤的資料數目超過一個預設門檻值,而無法再進行資料校正。部分技術則採用將快閃記憶體中的主區塊資料備份於備份區塊中,以在主區塊損壞時由備份區塊讀取資料。然而這樣的配置方式將使得硬體成本上升,且位元反轉錯誤資料數目過多而無法再校正的問題依舊存在。 Bit reversal errors are often corrected after the data is read out through an error checking and correcting mechanism. However, as the number of times the flash memory is used and the time increases, the number of bit reversal error data often exceeds a preset threshold value, and data correction can no longer be performed. Some technologies use the method of backing up the main block data in the flash memory in the backup block so that the data can be read from the backup block when the main block is damaged. However, such a configuration will increase the hardware cost, and the problem of too many bit reversal error data that cannot be corrected still exists.
鑑於先前技術的問題,本發明之一目的在於提供一種具有快閃記憶體資料修復機制的記憶體裝置及其記憶體資料修復方法,以改善先前技術。 In view of the problems of the prior art, one purpose of the present invention is to provide a memory device with a flash memory data repair mechanism and a memory data repair method thereof to improve the prior art.
本發明包含一種電子裝置,用以修復快閃記憶體的資料,快閃記憶體包含具有複數儲存區塊之記憶體陣列。電子裝置包含:控制電路。控制電路配置以對快閃記憶體執行記憶體資料修復方法。記憶體資料修復方法包含:對儲存區塊的儲存資料執行資料讀取程序;根據資料讀取程序判斷對應儲存資料的其中之一儲存區塊具有位元反轉(bit flip)錯誤而為錯誤區塊;以及當錯誤區塊的位元反轉錯誤的數目大於預設錯誤門檻值時進行快閃記憶體資料修復程序,以控制快閃記憶體將資料讀取程序對應儲存資料所產生的校正資料寫入錯誤區塊。 The present invention includes an electronic device for repairing data of a flash memory, wherein the flash memory includes a memory array having a plurality of storage blocks. The electronic device includes a control circuit. The control circuit is configured to execute a memory data repair method for the flash memory. The memory data repair method includes: executing a data reading procedure for the storage data of the storage block; judging that one of the storage blocks corresponding to the storage data has a bit flip error and is an error block according to the data reading procedure; and performing a flash memory data repair procedure when the number of bit flip errors of the error block is greater than a preset error threshold value, so as to control the flash memory to write the correction data generated by the data reading procedure corresponding to the storage data into the error block.
本發明另包含一種記憶體資料修復方法,應用於電子裝置中以修復快閃記憶體的資料,電子裝置包含控制電路,快閃記憶體包含具有複數儲存區塊之記憶體陣列。記憶體資料修復方法包含:由控制電路對儲存區塊的儲存資料執行資料讀取程序;由控制電路根據資料讀取程序判斷對應儲存資料的其中之一儲存區塊具有位元反轉錯誤而為錯誤區塊;以及當錯誤區塊的位元反轉錯誤的數目大於預設錯誤門檻值時進行記憶體資料修復程序,以控制快閃記憶體將資料讀取程序對應儲存資料所產生的校正資料寫入錯誤區塊。 The present invention also includes a memory data repair method, which is applied to an electronic device to repair data in a flash memory. The electronic device includes a control circuit, and the flash memory includes a memory array having a plurality of storage blocks. The memory data repair method includes: executing a data reading procedure on the storage data of the storage block by the control circuit; judging that one of the storage blocks corresponding to the storage data has a bit inversion error and is an error block according to the data reading procedure by the control circuit; and performing a memory data repair procedure when the number of bit inversion errors of the error block is greater than a preset error threshold value to control the flash memory to write the correction data generated by the data reading procedure corresponding to the storage data into the error block.
有關本案的特徵、實作與功效,茲配合圖式作較佳實施例詳細說明如下。 The features, implementation and effects of this case are described in detail below with reference to the diagrams for a preferred embodiment.
本發明之一目的在於提供一種具有快閃記憶體資料修復機制的電子裝置及其記憶體資料修復方法,透過資料讀取程序判斷錯誤區塊的存在,進而在錯誤區塊的錯誤資料數目大於預設錯誤門檻值時進行記憶體資料修復程序,將校正資料寫入錯誤區塊,達到修復儲存區塊的目的。 One purpose of the present invention is to provide an electronic device with a flash memory data repair mechanism and a memory data repair method thereof, which determines the existence of an error block through a data reading procedure, and then performs a memory data repair procedure when the number of error data in the error block is greater than a preset error threshold value, and writes the correction data into the error block to achieve the purpose of repairing the storage block.
請參照圖1。圖1顯示本發明一實施例中,一種具有快閃記憶體資料修復機制的電子裝置100的方塊圖。電子裝置100包含:快閃記憶體110、控制電路120以及隨機存取記憶體180。在一實施例中,快閃記憶體110、控制電路120以及隨機存取記憶體180分別設置於不同晶片中。
Please refer to Figure 1. Figure 1 shows a block diagram of an
快閃記憶體110、控制電路120以及隨機存取記憶體180可依實際需求以不同的架構實現,使控制電路120對快閃記憶體110進行資料讀取、資
料寫入與資料抹除的操作。對於資料讀取的操作來說,由於快閃記憶體110本身的特性,所儲存的數位資料會出現位元反轉的現象,使原本為0的資料變成1,亦或原本為1的資料變成0,而在讀取的資料中產生位元反轉錯誤。因此,本發明的電子裝置100具有快閃記憶體資料修復機制,以達到不僅對於讀取的資料進行校正,更對所儲存的資料進行修復的目的。
The flash memory 110, the control circuit 120 and the
以下將以一個範例中的架構,說明電子裝置100的快閃記憶體資料修復機制。
The following will use a sample architecture to explain the flash memory data repair mechanism of the
在本實施例中,快閃記憶體110包含記憶體陣列130、修復電路140、快取電路150以及從端電路160。快閃記憶體裝置110可為反及快閃記憶體(NAND Flash memory),然而本發明並不限於此。控制電路120包含主端電路170。
In this embodiment, the flash memory 110 includes a
控制電路120控制快閃記憶體110中的記憶體陣列130中的複數儲存區塊所儲存的儲存資料SD執行資料讀取程序。以下將針對資料讀取程序進行說明。
The control circuit 120 controls the storage data SD stored in the plurality of storage blocks in the
在一實施例中,儲存資料SD可為用以對一個電腦系統進行開機的開機程式碼的一部分,且開機程式碼可以影像檔(image file)的形式儲存。然而本發明並不限於此。 In one embodiment, the storage data SD may be a part of a boot code for booting a computer system, and the boot code may be stored in the form of an image file. However, the present invention is not limited thereto.
控制電路120的主端電路170配置以產生資料讀取指令(未繪示)。主端電路170可包含控制邏輯電路以及傳輸介面(未繪示),以由控制邏輯電路產生資料讀取指令並由傳輸介面傳送至快閃記憶體110。快閃記憶體110的從端電路160配置以接收並處理資料讀取指令。從端電路160亦可包含控制邏輯電路以及傳輸介面(未繪示),以由傳輸介面接收資料讀取
指令並由控制邏輯電路處理,進而根據資料讀取指令,對儲存區塊所儲存的儲存資料SD進行資料讀取。
The
接著,由快閃記憶體110根據校驗機制,對儲存資料SD進行錯誤檢驗,並在儲存資料SD錯誤時進行錯誤校正以產生校正資料CD。 Then, the flash memory 110 performs error checking on the stored data SD according to the verification mechanism, and performs error correction when the stored data SD is erroneous to generate correction data CD.
修復電路140配置以執行預設的錯誤校驗(error checking and correction;ECC)演算法,對自儲存區塊讀取出的儲存資料SD檢驗是否存在位元反轉錯誤,並在儲存資料SD錯誤時進行校正產生校正資料CD。快取電路150配置以接收校正資料CD進行暫存。
The
最後,由快閃記憶體110傳送校正資料CD至控制電路120,完成資料讀取程序。 Finally, the flash memory 110 transmits the calibration data CD to the control circuit 120 to complete the data reading process.
更詳細的說,從端電路160可自快取電路150擷取校正資料CD,並傳送至主端電路170。主端電路170可進而將校正資料CD儲存至隨機存取記憶體180。於一實施例中,隨機存取記憶體180為例如,但不限於動態隨機存取記憶體(dynamic random access memory;DRAM)。
In more detail, the
在資料讀取程序結束後,控制電路120根據資料讀取程序判斷對應儲存資料SD的其中之一儲存區塊中具有位元反轉錯誤而為錯誤區塊。 After the data reading process is completed, the control circuit 120 determines that one of the storage blocks corresponding to the storage data SD has a bit inversion error and is an error block according to the data reading process.
於一實施例中,控制電路120根據快閃記憶體110的校驗機制所產生的錯誤校驗狀態ES判斷對應儲存資料SD的儲存區塊為錯誤區塊。其中,錯誤校驗狀態ES可由修復電路140在進行錯誤校驗演算法的同時產生,以標示位元反轉錯誤的存在以及具有位元反轉錯誤的資料數目,並進而透過從端電路160傳送至主端電路170。
In one embodiment, the control circuit 120 determines that the storage block corresponding to the storage data SD is an error block according to the error check state ES generated by the verification mechanism of the flash memory 110. The error check state ES can be generated by the
根據錯誤校驗狀態ES,控制電路120在當錯誤區塊的位元反轉錯誤的數目大於預設錯誤門檻值時進行記憶體資料修復程序,以控制快閃記憶體110將資料讀取程序對應儲存資料SD所產生的校正資料CD寫入錯誤區塊。控制電路120可依圖1的虛線路徑,將校正資料CD自隨機存取記憶體180取出,並透過主端電路170、從端電路160、快取電路150,寫入至記憶體陣列130。
According to the error check status ES, the control circuit 120 performs a memory data repair procedure when the number of bit inversion errors in the error block is greater than a preset error threshold value, so as to control the flash memory 110 to write the correction data CD generated by the data read procedure corresponding to the storage data SD into the error block. The control circuit 120 can take the correction data CD from the
於一實施例中,在記憶體資料修復程序中,控制電路120控制快閃記憶體110先對錯誤區塊進行資料抹除,再將校正資料CD寫入錯誤區塊。因此,經過修復的儲存區塊將儲存有正確的資料,而不再具有位元反轉錯誤。 In one embodiment, in the memory data repair process, the control circuit 120 controls the flash memory 110 to first erase the data of the error block, and then write the correction data CD into the error block. Therefore, the repaired storage block will store correct data and no longer have bit inversion errors.
預設錯誤門檻值可依實際需求設置不同的數值。最極端的狀況下,預設錯誤門檻值可為0,亦即只要有一個錯誤資料數目就進行快閃記憶體資料修復程序。然而實務上由於快閃記憶體的讀寫壽命限制,預設錯誤門檻值可設置為大為0的數值。在錯誤資料數目不大於此預設錯誤門檻值時,控制電路120將不進行記憶體資料修復程序,而僅由前述的錯誤校驗將資料校正。 The default error threshold value can be set to different values according to actual needs. In the most extreme case, the default error threshold value can be 0, that is, the flash memory data repair process is performed as long as there is a number of error data. However, in practice, due to the read and write life limit of the flash memory, the default error threshold value can be set to a value greater than 0. When the number of error data is not greater than this default error threshold value, the control circuit 120 will not perform the memory data repair process, but only correct the data by the aforementioned error check.
圖2顯示本發明另一實施例中,電子裝置200的方塊圖。與圖1的電子裝置100類似,圖2的電子裝置200包含快閃記憶體210、控制電路220以及隨機存取記憶體280。然而,在本實施例中,快閃記憶體210包含記憶體陣列230、快取電路250以及從端電路260。控制電路220包含主端電路270以及修復電路240。
FIG2 shows a block diagram of an
相較於圖1的電子裝置100,圖2的電子裝置200係由控制電路220內的修復電路240對自快閃記憶體210之一儲存區塊所讀取的儲存資料SD進錯誤校驗,以據以產生校正資料CD及錯誤校驗狀態ES,電子裝置200其餘操作係相同或相似於電子裝置100的操作,在此不再贅述。
Compared with the
然而,在進行記憶體資料修復程序時,因為環境或是電子裝置100自身的因素,可能會遇到無法順利修復的狀況。以下將對電子裝置100在遇到不同狀況下所進行的處理進行說明。
However, when performing the memory data repair process, due to environmental or
就環境因素而言,電子裝置100在運作中可能會遇到偶發的斷電狀況。為使快閃記憶體的資料修復不受斷電狀況影響,快閃記憶體資料修復程序可透過備份機制進行。
In terms of environmental factors, the
以下將對於記憶體資料修復程序中的備份機制進行說明。須注意的是,下述的操作是以快閃記憶體110進行的動作來描述,然而實際上可由快閃記憶體110中的從端電路160控制快閃記憶體110內部的元件完成。
The following will explain the backup mechanism in the memory data repair process. It should be noted that the following operations are described based on the actions performed by the flash memory 110, but in fact, the
請參照圖3A及圖3B。圖3A及圖3B顯示本發明一實施例中,記憶體陣列130的示意圖。如圖3所示,記憶體陣列130包含儲存區塊ST1~STN以及備份區塊BA1~BA3。
Please refer to FIG3A and FIG3B. FIG3A and FIG3B are schematic diagrams showing a
如圖3A所示,儲存資料SD是對應儲存在儲存區塊ST1中且具有位元反轉錯誤,因此儲存區塊ST1為錯誤區塊。在將校正資料CD寫入錯誤區塊前,快閃記憶體110先將校正資料CD寫入記憶體陣列130的備份區塊BA1~BA3其中之一,例如但不限於備份區塊BA1進行備份。在備份完成後,由快閃記憶體110在記憶體陣列130儲存之區塊狀態表TAB將錯誤區塊紀錄為修復區塊。
As shown in FIG3A , the storage data SD is stored in the storage block ST 1 and has a bit inversion error, so the storage block ST 1 is an error block. Before writing the correction data CD into the error block, the flash memory 110 first writes the correction data CD into one of the backup blocks BA 1 to BA 3 of the
區塊狀態表TAB配置以紀錄儲存區塊ST1~STN的狀態。在一實施例中,儲存區塊ST1~STN的狀態包含例如但不限於仍可讀寫正常的良好區塊、無法讀寫的損壞區塊以及正在修復中的修復區塊。實作上,區塊狀態表TAB可儲存於儲存區塊ST1~STN的一個良好區塊中。 The block status table TAB is configured to record the status of the storage blocks ST 1 to ST N. In one embodiment, the status of the storage blocks ST 1 to ST N includes, for example but not limited to, a good block that can still be read and written normally, a damaged block that cannot be read and written, and a repair block that is being repaired. In practice, the block status table TAB can be stored in a good block of the storage blocks ST 1 to ST N.
如圖3B所示,快閃記憶體110將校正資料CD自備份區塊BA1寫入被資料抹除的錯誤區塊。在校正資料CD寫入完成後,記憶體110在區塊狀態表TAB將錯誤區塊(儲存區塊ST1)紀錄為良好區塊。 As shown in FIG3B , the flash memory 110 writes the calibration data CD backup block BA 1 into the erased error block. After the calibration data CD is written, the memory 110 records the error block (storage block ST 1 ) as a good block in the block status table TAB.
在上述過程中,當快閃記憶體110在備份完成前發生斷電狀況且又回復供電時,重新將校正資料CD寫入備份區塊BA1進行備份。而當快閃記憶體110在備份完成後且校正資料寫入錯誤區塊完成前發生斷電狀況且又回復供電時,直接將校正資料CD自備份區塊BA1寫入錯誤區塊。 In the above process, when the flash memory 110 is powered off before the backup is completed and then the power is restored, the correction data CD is rewritten into the backup block BA 1 for backup. When the flash memory 110 is powered off after the backup is completed and before the correction data is written into the error block and then the power is restored, the correction data CD is directly written from the backup block BA 1 into the error block.
就電子裝置100自身因素而言,由於快閃記憶體110具有讀寫壽命的限制,記憶體陣列130中的儲存區塊將在讀寫次數到達上限時損壞而無法再進行讀寫,成為損壞區塊。在這樣的狀況下,電子裝置100無法對損壞區塊修復,而需要對損壞區塊的資料進行搬移。
As for the factors of the
以下將針對資料搬移的機制進行說明。須注意的是,下述的操作是以快閃記憶體110進行的動作來描述,然而實際上可由快閃記憶體110中的從端電路160控制快閃記憶體110內部的元件完成。
The following will explain the mechanism of data migration. It should be noted that the following operations are described based on the actions performed by the flash memory 110, but in reality, the
請參照圖4A至圖4D。圖4A至圖4D分別顯示本發明一實施例中,記憶體陣列130在進行資料搬移時的示意圖。與圖3A以及圖3B所示相同,圖4A至圖4D的記憶體陣列130包含儲存區塊ST1~STN以及備份區塊BA1~BA3。
Please refer to FIG. 4A to FIG. 4D. FIG. 4A to FIG. 4D respectively show schematic diagrams of the
儲存區塊ST1~STN中儲存有資料者是以點狀區塊繪示,未儲存有資料者是以空白區塊繪示。備份區塊BA1~BA3中儲存有備份且尚未回寫至儲存區塊ST1~STN的資料者是以斜線區塊繪示,儲存有備份且已回寫至儲存區塊ST1~STN的資料者與未儲存有資料者是以空白區塊繪示。 The storage blocks ST 1 to ST N that have data stored in them are indicated by dotted blocks, and the blocks that do not have data stored in them are indicated by blank blocks. The backup blocks BA 1 to BA 3 that have data stored in them that have been backed up and not yet written back to the storage blocks ST 1 to ST N are indicated by slashed blocks, and the blocks that have data stored in them that have been backed up and written back to the storage blocks ST 1 to ST N and the blocks that do not have data stored in them are indicated by blank blocks.
如圖4A所示,儲存區塊ST1~ST4中儲存有資料SD1~SD4,且儲存區塊ST5之後的儲存區塊並未儲存資料。 As shown in FIG. 4A , data SD 1 -SD 4 are stored in storage blocks ST 1 -ST 4 , and no data is stored in storage blocks after storage block ST 5 .
於本實施例中,儲存區塊ST1是具有位元反轉錯誤的錯誤區塊。快閃記憶體110將錯誤區塊對應的校正資料CD1寫入備份區塊BA1~BA3其中之一進行備份。於本實施例中,校正資料CD1被寫入備份區塊BA1中進行備份。 In this embodiment, the storage block ST 1 is an error block with a bit flip error. The flash memory 110 writes the correction data CD 1 corresponding to the error block into one of the backup blocks BA 1 to BA 3 for backup. In this embodiment, the correction data CD 1 is written into the backup block BA 1 for backup.
快閃記憶體110註記第M個儲存區塊為待修復區塊,且待修復區塊初始為錯誤區塊(儲存區塊ST1,因此M為1)。 The flash memory 110 marks the Mth storage block as a block to be repaired, and the block to be repaired is initially an error block (storage block ST 1 , so M is 1).
由快閃記憶體110在將校正資料CD1寫入待修復區塊的失敗次數大於預設門檻值,例如但不限於3次時,在區塊狀態表TAB將第M個儲存區塊紀錄為損壞區塊。在圖4A中,區塊狀態表TAB並未被繪示出,僅在儲存區塊ST1標示「損壞」。 When the number of failures of writing the correction data CD 1 into the block to be repaired by the flash memory 110 is greater than a preset threshold value, for example but not limited to 3 times, the Mth storage block is recorded as a damaged block in the block status table TAB. In FIG. 4A , the block status table TAB is not shown, and only the storage block ST 1 is marked as "damaged".
快閃記憶體110將進行搬移程序。首先,快閃記憶體110使M遞增1(此時M為2),以註記第M個儲存區塊為待修復區塊。因此,儲存區塊ST2被註記為待修復區塊。在一實施例中,儲存區塊ST2係相鄰於儲存區塊ST1。 The flash memory 110 will perform the migration process. First, the flash memory 110 increments M by 1 (M is 2 at this time) to mark the Mth storage block as a block to be repaired. Therefore, the storage block ST 2 is marked as a block to be repaired. In one embodiment, the storage block ST 2 is adjacent to the storage block ST 1 .
快閃記憶體110判斷待修復區塊是否儲存有既有資料。在待修復區塊(儲存區塊ST2)儲存有既有資料SD2時,快閃記憶體110將既有資料SD2寫入快閃記憶體110的備份區塊BA1~BA3其中之一進行備份。於一實施例 中,備份區塊BA1~BA3為環狀緩衝器(ring buffer),以循序進行資料寫入。因此,既有資料SD2被寫入備份區塊BA2中進行備份。 The flash memory 110 determines whether the block to be repaired stores existing data. When the block to be repaired (storage block ST 2 ) stores existing data SD 2 , the flash memory 110 writes the existing data SD 2 into one of the backup blocks BA 1 to BA 3 of the flash memory 110 for backup. In one embodiment, the backup blocks BA 1 to BA 3 are ring buffers for sequential data writing. Therefore, the existing data SD 2 is written into the backup block BA 2 for backup.
如圖4B所示,快閃記憶體110將校正資料CD1寫入待修復區塊(儲存區塊ST2)。快閃記憶體110進一步註記既有資料SD2為校正資料CD2,以重新執行搬移程序。 As shown in FIG4B , the flash memory 110 writes the correction data CD 1 into the block to be repaired (storage block ST 2 ). The flash memory 110 further marks the existing data SD 2 as the correction data CD 2 to re-execute the migration process.
快閃記憶體110使M遞增1(此時M為3),以註記第M個儲存區塊為待修復區塊。因此,儲存區塊ST3被註記為待修復區塊。在一實施例中,儲存區塊ST3係相鄰於儲存區塊ST2。 The flash memory 110 increments M by 1 (M is 3 at this time) to mark the Mth storage block as a block to be repaired. Therefore, the storage block ST 3 is marked as a block to be repaired. In one embodiment, the storage block ST 3 is adjacent to the storage block ST 2 .
快閃記憶體110判斷待修復區塊是否儲存有既有資料。在待修復區塊(儲存區塊ST3)儲存有既有資料SD3時,快閃記憶體110將既有資料SD3寫入快閃記憶體110的備份區塊BA3進行備份。 The flash memory 110 determines whether the block to be repaired stores existing data. When the block to be repaired (storage block ST 3 ) stores existing data SD 3 , the flash memory 110 writes the existing data SD 3 into the backup block BA 3 of the flash memory 110 for backup.
如圖4C所示,快閃記憶體110將校正資料CD2(既有資料SD2)寫入待修復區塊(儲存區塊ST3)。快閃記憶體110進一步註記既有資料SD3為校正資料CD3,以重新執行搬移程序。 As shown in FIG4C , the flash memory 110 writes the correction data CD 2 (existing data SD 2 ) into the block to be repaired (storage block ST 3 ). The flash memory 110 further marks the existing data SD 3 as the correction data CD 3 to re-execute the migration process.
快閃記憶體110使M遞增1(此時M為4),以註記第M個儲存區塊為待修復區塊。因此,儲存區塊ST4被註記為待修復區塊。 The flash memory 110 increases M by 1 (M is 4 at this time) to mark the Mth storage block as a block to be repaired. Therefore, the storage block ST 4 is marked as a block to be repaired.
快閃記憶體110判斷待修復區塊是否儲存有既有資料。在待修復區塊(儲存區塊ST4)儲存有既有資料SD4時,快閃記憶體110將既有資料SD4寫入快閃記憶體110的備份區塊BA1進行備份。 The flash memory 110 determines whether the block to be repaired stores existing data. When the block to be repaired (storage block ST 4 ) stores existing data SD 4 , the flash memory 110 writes the existing data SD 4 into the backup block BA 1 of the flash memory 110 for backup.
如圖4D所示,快閃記憶體110將校正資料CD3(既有資料SD3)寫入待修復區塊(儲存區塊ST4)。快閃記憶體110進一步註記既有資料SD4為校正資料CD4,以重新執行搬移程序。 As shown in FIG4D , the flash memory 110 writes the correction data CD 3 (existing data SD 3 ) into the block to be repaired (storage block ST 4 ). The flash memory 110 further marks the existing data SD 4 as the correction data CD 4 to re-execute the migration process.
快閃記憶體110使M遞增1(此時M為5),以註記第M個儲存區塊為待修復區塊。因此,儲存區塊ST5被註記為待修復區塊。 The flash memory 110 increases M by 1 (M is 5 at this time) to mark the Mth storage block as a block to be repaired. Therefore, the storage block ST 5 is marked as a block to be repaired.
快閃記憶體110判斷待修復區塊是否儲存有既有資料。在待修復區塊(儲存區塊ST5)並未儲存有既有資料時,快閃記憶體110將校正資料CD4(既有資料SD4)寫入待修復區塊中。此時,快閃記憶體110已完成搬移程序。 The flash memory 110 determines whether the block to be repaired stores existing data. If the block to be repaired (storage block ST 5 ) does not store existing data, the flash memory 110 writes the correction data CD 4 (existing data SD 4 ) into the block to be repaired. At this time, the flash memory 110 has completed the migration process.
藉由上述機制,儲存在快閃記憶體110中的資料(例如以影像檔形式儲存的開機程式碼)在對應的部分儲存區塊損壞而無法修復時,可以透過資料搬移的方式達到修復的效果,直到整體資料均完整搬移至良好的儲存區塊。並且,這樣的方式不需直接對整體資料進行備份,而透過逐個儲存區塊進行資料搬移來節省備份區塊的數量。以圖4A至圖4D的實施例而言,原本占用四個儲存區塊的資料,僅需要三個備份區塊即可完成搬移。 By means of the above mechanism, when the corresponding part of the storage block of the data stored in the flash memory 110 (e.g., the boot code stored in the form of an image file) is damaged and cannot be repaired, the data can be moved to achieve the effect of repair until the entire data is completely moved to a good storage block. Moreover, this method does not need to directly back up the entire data, but saves the number of backup blocks by moving the data one by one. For the embodiment of Figures 4A to 4D, the data that originally occupies four storage blocks only needs three backup blocks to complete the move.
請參照圖5。圖5顯示本發明一實施例中,一種記憶體資料修復方法500的流程圖。
Please refer to Figure 5. Figure 5 shows a flow chart of a memory
除前述裝置外,本發明另揭露一種記憶體資料修復方法500,應用於例如,但不限於圖1的電子裝置100中。記憶體資料修復方法500之一實施例如圖5所示,包含下列步驟。
In addition to the aforementioned devices, the present invention further discloses a memory
於步驟S510:由控制電路120對快閃記憶體110中的記憶體陣列130包含的複數儲存區塊所儲存的儲存資料SD執行資料讀取程序。
In step S510: the control circuit 120 executes a data reading procedure on the storage data SD stored in the plurality of storage blocks included in the
於步驟S520:由控制電路120根據資料讀取程序判斷對應儲存儲存資料SD的其中之一儲存區塊具有位元反轉錯誤而為錯誤區塊。 In step S520: the control circuit 120 determines according to the data reading procedure that one of the storage blocks corresponding to the storage data SD has a bit inversion error and is an error block.
於步驟S530:由控制電路120在位元反轉錯誤的數目大於預設錯誤門檻值時進行記憶體資料修復程序,以控制快閃記憶體將資料讀取程序對應儲存資料SD所產生的校正資料CD寫入錯誤區塊。 In step S530: the control circuit 120 performs a memory data repair procedure when the number of bit inversion errors is greater than a preset error threshold value, so as to control the flash memory to write the correction data CD generated by the data reading procedure corresponding to the storage data SD into the error block.
請參照圖6。圖6顯示本發明一實施例中,快閃記憶體資料修復程序600的流程圖。快閃記憶體資料修復程序600之一實施例如圖6所示,包含下列步驟。
Please refer to Figure 6. Figure 6 shows a flow chart of a flash memory
於步驟S610:由控制電路120對錯誤區塊進行資料抹除。 In step S610: the control circuit 120 erases the data in the error block.
於步驟S620:由控制電路120將校正資料寫入備份區塊進行備份。 In step S620: the control circuit 120 writes the calibration data into the backup block for backup.
於步驟S630:由控制電路120註記第M個儲存區塊為待修復區塊,且待修復區塊初始為錯誤區塊。 In step S630: the control circuit 120 marks the Mth storage block as a block to be repaired, and the block to be repaired is initially an error block.
於步驟S640:由控制電路120將校正資料寫入待修復區塊。 In step S640: the control circuit 120 writes the correction data into the block to be repaired.
於步驟S650:由控制電路120判斷是否寫入失敗。 In step S650: the control circuit 120 determines whether the write fails.
於步驟S660:在寫入失敗時,由控制電路120判斷失敗次數是否大於預設門檻值。如果失敗次數不大於預設門檻值,則流程回至步驟S640再次寫入。 In step S660: when writing fails, the control circuit 120 determines whether the number of failures is greater than the preset threshold value. If the number of failures is not greater than the preset threshold value, the process returns to step S640 to write again.
於步驟S670:如果失敗次數大於預設門檻值,由控制電路120進行搬移程序。 In step S670: If the number of failures is greater than the preset threshold value, the control circuit 120 performs the migration process.
於步驟S680:當步驟S650中控制電路120判斷寫入成功時,結束流程。 In step S680: When the control circuit 120 determines that the write is successful in step S650, the process ends.
請參照圖7。圖7顯示本發明一實施例中,搬移程序700的流程圖。搬移程序700之一實施例如圖7所示,包含下列步驟。
Please refer to Figure 7. Figure 7 shows a flow chart of a
於步驟S710,快閃記憶體110使M的數值遞增1,以註記第M個儲存區塊為待修復區塊。 In step S710, the flash memory 110 increases the value of M by 1 to mark the Mth storage block as a block to be repaired.
於步驟S720,判斷待修復區塊是否儲存有既有資料。 In step S720, determine whether the block to be repaired stores existing data.
於步驟S730,在待修復區塊儲存有既有資料時,將既有資料寫入備份區塊其中之一進行備份。 In step S730, when the block to be repaired stores existing data, the existing data is written into one of the backup blocks for backup.
於步驟S740,將校正資料寫入待修復區塊。 In step S740, the correction data is written into the block to be repaired.
於步驟S750,註記既有資料為校正資料,以重新執行搬移程序。因此,流程將回頭執行步驟S710。 In step S750, the existing data is marked as calibration data to re-execute the migration process. Therefore, the process will return to step S710.
於步驟S760,在待修復區塊並未儲存有既有資料時,將校正資料寫入待修復區塊。 In step S760, when the block to be repaired does not store existing data, the correction data is written into the block to be repaired.
需注意的是,上述的實施方式僅為一範例。於其他實施例中,本領域的通常知識者當可在不違背本發明的精神下進行更動。應瞭解到,在上述的實施方式中所提及的步驟,除特別敘明其順序者外,均可依實際需要調整其前後順序,甚至可同時或部分同時執行。 It should be noted that the above implementation is only an example. In other implementations, those skilled in the art can make changes without violating the spirit of the present invention. It should be understood that the steps mentioned in the above implementation, except for those whose sequence is specifically described, can be adjusted in sequence according to actual needs, and can even be executed simultaneously or partially simultaneously.
雖然本發明之實施例如上所述,然而該些實施例並非用來限定本發明,本技術領域具有通常知識者可依據本發明之明示或隱含之內容對本發明之技術特徵施以變化,凡此種種變化均可能屬於本發明所尋求之專利保護範疇,換言之,本發明之專利保護範圍須視本說明書之申請專利範圍所界定者為準。 Although the embodiments of the present invention are described above, these embodiments are not intended to limit the present invention. Those with ordinary knowledge in the technical field may make changes to the technical features of the present invention based on the explicit or implicit content of the present invention. All these changes may fall within the scope of patent protection sought by the present invention. In other words, the scope of patent protection of the present invention shall be subject to the scope of the patent application defined in this specification.
100、200:電子裝置 100, 200: Electronic devices
110、210:快閃記憶體 110, 210: Flash memory
120、220:控制電路 120, 220: Control circuit
130、230:記憶體陣列 130, 230: memory array
140、240:修復電路 140, 240: Repair circuits
150、250:快取電路 150, 250: Cache circuit
160、260:從端電路 160, 260: Slave end circuit
170、270:主端電路 170, 270: Main end circuit
180、280:隨機存取記憶體 180, 280: Random Access Memory
500:記憶體資料修復方法 500: Memory data repair method
S510~S530:步驟 S510~S530: Steps
600:記憶體資料修復程序 600: Memory data repair process
S610~S680:步驟 S610~S680: Steps
700:搬移程序 700: Migration procedures
S710~S760:步驟 S710~S760: Steps
BA1~BA3:備份區塊 BA 1 ~BA 3 : Backup area
CD、CD1~CD4:校正資料 CD, CD 1 ~ CD 4 : Calibration data
ES:錯誤校驗狀態 ES: Error verification status
SD:儲存資料 SD: Save data
SD1~SD4:資料 SD 1 ~SD 4 : Data
ST1~STN:儲存區塊 ST 1 ~ST N : Storage block
TAB:區塊狀態表 TAB: Block status table
〔圖1〕顯示本發明一實施例中,一種具有快閃記憶體資料修復機制的電子裝置的方塊圖;〔圖2〕顯示本發明另一實施例中,電子裝置的方塊圖;〔圖3A〕及〔圖3B〕顯示本發明一實施例中,快閃記憶體陣列的示意圖;〔圖4A〕至〔圖4D〕顯示本發明一實施例中,快閃記憶體陣列在進行資料搬移時的示意圖;〔圖5〕顯示本發明一實施例中,一種記憶體資料修復方法的流程圖;〔圖6〕顯示本發明一實施例中,快閃記憶體資料修復程序的流程圖;以及〔圖7〕顯示本發明一實施例中,搬移程序的流程圖。 [Figure 1] shows a block diagram of an electronic device having a flash memory data repair mechanism in one embodiment of the present invention; [Figure 2] shows a block diagram of an electronic device in another embodiment of the present invention; [Figure 3A] and [Figure 3B] show schematic diagrams of a flash memory array in one embodiment of the present invention; [Figure 4A] to [Figure 4D] show schematic diagrams of a flash memory array during data migration in one embodiment of the present invention; [Figure 5] shows a flow chart of a memory data repair method in one embodiment of the present invention; [Figure 6] shows a flow chart of a flash memory data repair procedure in one embodiment of the present invention; and [Figure 7] shows a flow chart of a migration procedure in one embodiment of the present invention.
500:記憶體資料修復方法 500: Memory data repair method
S510~S530:步驟 S510~S530: Steps
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW112109604A TWI851083B (en) | 2023-03-15 | 2023-03-15 | Electronic apparatus and memory data repairing method thereof |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW112109604A TWI851083B (en) | 2023-03-15 | 2023-03-15 | Electronic apparatus and memory data repairing method thereof |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TWI851083B true TWI851083B (en) | 2024-08-01 |
| TW202439323A TW202439323A (en) | 2024-10-01 |
Family
ID=93283707
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW112109604A TWI851083B (en) | 2023-03-15 | 2023-03-15 | Electronic apparatus and memory data repairing method thereof |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI851083B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080189588A1 (en) * | 2007-02-07 | 2008-08-07 | Megachips Corporation | Bit error prevention method and information processing apparatus |
| TW201944426A (en) * | 2018-04-20 | 2019-11-16 | 美商美光科技公司 | Error correction using hierarchical decoders |
-
2023
- 2023-03-15 TW TW112109604A patent/TWI851083B/en active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080189588A1 (en) * | 2007-02-07 | 2008-08-07 | Megachips Corporation | Bit error prevention method and information processing apparatus |
| TW201944426A (en) * | 2018-04-20 | 2019-11-16 | 美商美光科技公司 | Error correction using hierarchical decoders |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202439323A (en) | 2024-10-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20220269572A1 (en) | Storage device and method for operating storage device | |
| US6931582B2 (en) | Memory card and memory controller | |
| US12093140B2 (en) | Data recovery method, apparatus, and solid state drive | |
| US8271515B2 (en) | System and method for providing copyback data integrity in a non-volatile memory system | |
| JP5492679B2 (en) | Storage device and memory controller | |
| TWI389122B (en) | Method for accessing a flash memory, and associated memory device and controller thereof | |
| KR20180128235A (en) | Storage device and Method of operating the storage device | |
| CN110459259A (en) | Method, system and storage medium for testing write error correction capability of storage device | |
| US7944747B2 (en) | Flash memory device and method for programming flash memory device having leakage bit lines | |
| JP2000099405A (en) | Electronic device having flash memory | |
| US10340025B2 (en) | Data-storage device and block-releasing method | |
| TW201312573A (en) | Flash memory storage device and method for determining bad storage area thereof | |
| CN114758689A (en) | Erasing method and power-on repair method for nonvolatile memory | |
| KR20030065355A (en) | Storage, data processing method and data processing program | |
| US9490022B2 (en) | Data storage device and data maintenance method | |
| JP2007310916A (en) | Memory card | |
| US20200409808A1 (en) | Systems And Methods For Evaluating Integrity Of Adjacent Sub Blocks Of Data Storage Apparatuses | |
| US20070294588A1 (en) | Performing a diagnostic on a block of memory associated with a correctable read error | |
| JP2002222599A (en) | Initial defective block marking method, search method, and semiconductor memory device | |
| TWI851083B (en) | Electronic apparatus and memory data repairing method thereof | |
| US20240231987A1 (en) | Storage device, method of operating storage device, and method of operating non-volatile memory | |
| US8448017B2 (en) | Memory apparatus, memory controlling method and program | |
| CN116483616A (en) | Electronic device and memory data restoration method thereof | |
| JP3267320B2 (en) | Nonvolatile semiconductor memory device and method of controlling nonvolatile semiconductor memory device | |
| CN119473700B (en) | System protection method for NAND FLASH abnormal bit overturning |