[go: up one dir, main page]

TWI851083B - Electronic apparatus and memory data repairing method thereof - Google Patents

Electronic apparatus and memory data repairing method thereof Download PDF

Info

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
Application number
TW112109604A
Other languages
Chinese (zh)
Other versions
TW202439323A (en
Inventor
吳艷雄
杜維生
佘欽偉
黃建志
Original Assignee
大陸商星宸科技股份有限公司
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 大陸商星宸科技股份有限公司 filed Critical 大陸商星宸科技股份有限公司
Priority to TW112109604A priority Critical patent/TWI851083B/en
Application granted granted Critical
Publication of TWI851083B publication Critical patent/TWI851083B/en
Publication of TW202439323A publication Critical patent/TW202439323A/en

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

A memory data repairing method used in an electronic apparatus to repair data of a flash memory, in which the electronic apparatus includes a control circuit and the flash memory includes a memory array having storage blocks. The memory data repairing method includes steps outlined below. A data reading process is performed on stored data of the storage blocks by the control circuit. One of the storage blocks is determined to have a bit flip error and is determined to be an error block by the control circuit according to the data reading process. A memory data repair process is performed when a number of the bit flip error of the error block is larger than a predetermined error threshold value to control the flash memory writes a calibration data corresponding to the stored data generated by the data reading process to the error block.

Description

電子裝置及其記憶體資料修復方法Electronic device and memory data repair method thereof

本發明是關於快閃記憶體修復技術,尤其是關於一種具有快閃記憶體資料修復機制的電子裝置及其記憶體資料修復方法。 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 electronic device 100 having a flash memory data repair mechanism in one embodiment of the present invention. The electronic device 100 includes: a flash memory 110, a control circuit 120, and a random access memory 180. In one embodiment, the flash memory 110, the control circuit 120, and the random access memory 180 are respectively disposed in different chips.

快閃記憶體110、控制電路120以及隨機存取記憶體180可依實際需求以不同的架構實現,使控制電路120對快閃記憶體110進行資料讀取、資 料寫入與資料抹除的操作。對於資料讀取的操作來說,由於快閃記憶體110本身的特性,所儲存的數位資料會出現位元反轉的現象,使原本為0的資料變成1,亦或原本為1的資料變成0,而在讀取的資料中產生位元反轉錯誤。因此,本發明的電子裝置100具有快閃記憶體資料修復機制,以達到不僅對於讀取的資料進行校正,更對所儲存的資料進行修復的目的。 The flash memory 110, the control circuit 120 and the random access memory 180 can be implemented with different architectures according to actual needs, so that the control circuit 120 performs data reading, data writing and data erasing operations on the flash memory 110. For the data reading operation, due to the characteristics of the flash memory 110 itself, the stored digital data will have a bit inversion phenomenon, so that the data originally 0 becomes 1, or the data originally 1 becomes 0, and a bit inversion error is generated in the read data. Therefore, the electronic device 100 of the present invention has a flash memory data repair mechanism to achieve the purpose of not only correcting the read data but also repairing the stored data.

以下將以一個範例中的架構,說明電子裝置100的快閃記憶體資料修復機制。 The following will use a sample architecture to explain the flash memory data repair mechanism of the electronic device 100.

在本實施例中,快閃記憶體110包含記憶體陣列130、修復電路140、快取電路150以及從端電路160。快閃記憶體裝置110可為反及快閃記憶體(NAND Flash memory),然而本發明並不限於此。控制電路120包含主端電路170。 In this embodiment, the flash memory 110 includes a memory array 130, a repair circuit 140, a cache circuit 150, and a slave circuit 160. The flash memory device 110 may be a NAND flash memory, but the present invention is not limited thereto. The control circuit 120 includes a master circuit 170.

控制電路120控制快閃記憶體110中的記憶體陣列130中的複數儲存區塊所儲存的儲存資料SD執行資料讀取程序。以下將針對資料讀取程序進行說明。 The control circuit 120 controls the storage data SD stored in the plurality of storage blocks in the memory array 130 in the flash memory 110 to execute a data reading procedure. The data reading procedure will be described below.

在一實施例中,儲存資料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 master circuit 170 of the control circuit 120 is configured to generate a data read instruction (not shown). The master circuit 170 may include a control logic circuit and a transmission interface (not shown), so that the control logic circuit generates a data read instruction and transmits it to the flash memory 110 through the transmission interface. The slave circuit 160 of the flash memory 110 is configured to receive and process the data read instruction. The slave circuit 160 may also include a control logic circuit and a transmission interface (not shown), so that the data read instruction is received through the transmission interface and processed by the control logic circuit, and then the storage data SD stored in the storage block is read according to the data read instruction.

接著,由快閃記憶體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 repair circuit 140 is configured to execute a preset error checking and correction (ECC) algorithm to check whether there is a bit inversion error in the storage data SD read from the storage block, and to correct the storage data SD to generate correction data CD when the storage data SD is wrong. The cache circuit 150 is configured to receive the correction data CD for temporary storage.

最後,由快閃記憶體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 slave circuit 160 can retrieve the correction data CD from the cache circuit 150 and transmit it to the master circuit 170. The master circuit 170 can further store the correction data CD in the random access memory 180. In one embodiment, the random access memory 180 is, for example, but not limited to, a dynamic random access memory (DRAM).

在資料讀取程序結束後,控制電路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 repair circuit 140 while performing the error check algorithm to indicate the existence of the bit inversion error and the number of data with the bit inversion error, and then transmitted to the master circuit 170 through the slave circuit 160.

根據錯誤校驗狀態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 random access memory 180 according to the virtual line path of Figure 1, and write it to the memory array 130 through the master circuit 170, the slave circuit 160, and the cache circuit 150.

於一實施例中,在記憶體資料修復程序中,控制電路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 electronic device 200 in another embodiment of the present invention. Similar to the electronic device 100 in FIG1 , the electronic device 200 in FIG2 includes a flash memory 210, a control circuit 220, and a random access memory 280. However, in this embodiment, the flash memory 210 includes a memory array 230, a cache circuit 250, and a slave circuit 260. The control circuit 220 includes a master circuit 270 and a repair circuit 240.

相較於圖1的電子裝置100,圖2的電子裝置200係由控制電路220內的修復電路240對自快閃記憶體210之一儲存區塊所讀取的儲存資料SD進錯誤校驗,以據以產生校正資料CD及錯誤校驗狀態ES,電子裝置200其餘操作係相同或相似於電子裝置100的操作,在此不再贅述。 Compared with the electronic device 100 in FIG. 1 , the electronic device 200 in FIG. 2 performs error checking on the storage data SD read from a storage block of the flash memory 210 by the repair circuit 240 in the control circuit 220 to generate the correction data CD and the error checking state ES. The rest of the operation of the electronic device 200 is the same or similar to the operation of the electronic device 100 and will not be described in detail here.

然而,在進行記憶體資料修復程序時,因為環境或是電子裝置100自身的因素,可能會遇到無法順利修復的狀況。以下將對電子裝置100在遇到不同狀況下所進行的處理進行說明。 However, when performing the memory data repair process, due to environmental or electronic device 100 factors, it may be impossible to repair successfully. The following will explain the processing performed by the electronic device 100 in different situations.

就環境因素而言,電子裝置100在運作中可能會遇到偶發的斷電狀況。為使快閃記憶體的資料修復不受斷電狀況影響,快閃記憶體資料修復程序可透過備份機制進行。 In terms of environmental factors, the electronic device 100 may encounter occasional power outages during operation. In order to prevent the data repair of the flash memory from being affected by the power outage, the flash memory data repair process can be performed through a backup mechanism.

以下將對於記憶體資料修復程序中的備份機制進行說明。須注意的是,下述的操作是以快閃記憶體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 slave circuit 160 in the flash memory 110 can control the components inside the flash memory 110 to complete it.

請參照圖3A及圖3B。圖3A及圖3B顯示本發明一實施例中,記憶體陣列130的示意圖。如圖3所示,記憶體陣列130包含儲存區塊ST1~STN以及備份區塊BA1~BA3Please refer to FIG3A and FIG3B. FIG3A and FIG3B are schematic diagrams showing a memory array 130 in an embodiment of the present invention. As shown in FIG3, the memory array 130 includes storage blocks ST1 - STN and backup blocks BA1 - BA3 .

如圖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 memory array 130, such as but not limited to the backup block BA 1 for backup. After the backup is completed, the flash memory 110 records the error block as a repair block in the block status table TAB stored in the memory array 130.

區塊狀態表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 electronic device 100 itself, since the flash memory 110 has a limited read and write life, the storage block in the memory array 130 will be damaged when the number of read and write times reaches the upper limit and can no longer be read and written, becoming a damaged block. In this case, the electronic device 100 cannot repair the damaged block, and the data in the damaged block needs to be moved.

以下將針對資料搬移的機制進行說明。須注意的是,下述的操作是以快閃記憶體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 slave circuit 160 in the flash memory 110 can control the components inside the flash memory 110 to complete the operation.

請參照圖4A至圖4D。圖4A至圖4D分別顯示本發明一實施例中,記憶體陣列130在進行資料搬移時的示意圖。與圖3A以及圖3B所示相同,圖4A至圖4D的記憶體陣列130包含儲存區塊ST1~STN以及備份區塊BA1~BA3Please refer to FIG. 4A to FIG. 4D. FIG. 4A to FIG. 4D respectively show schematic diagrams of the memory array 130 during data migration in an embodiment of the present invention. Similar to FIG. 3A and FIG. 3B, the memory array 130 of FIG. 4A to FIG. 4D includes storage blocks ST 1 to ST N and backup blocks BA 1 to BA 3 .

儲存區塊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係相鄰於儲存區塊ST1The 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係相鄰於儲存區塊ST2The 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 data repair method 500 in an embodiment of the present invention.

除前述裝置外,本發明另揭露一種記憶體資料修復方法500,應用於例如,但不限於圖1的電子裝置100中。記憶體資料修復方法500之一實施例如圖5所示,包含下列步驟。 In addition to the aforementioned devices, the present invention further discloses a memory data repair method 500, which is applied to, for example, but not limited to, the electronic device 100 of FIG. 1. An implementation example of the memory data repair method 500 is shown in FIG. 5, and includes the following steps.

於步驟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 memory array 130 in the flash memory 110.

於步驟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 data repair procedure 600 in one embodiment of the present invention. One embodiment of the flash memory data repair procedure 600 is shown in Figure 6, and includes the following steps.

於步驟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 migration process 700 in an embodiment of the present invention. One embodiment of the migration process 700 is shown in Figure 7 and includes the following steps.

於步驟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)

一種電子裝置,用以修復一快閃記憶體的資料,該快閃記憶體包含具有複數儲存區塊之一記憶體陣列,該電子裝置包含:一控制電路,配置以對該快閃記憶體執行一記憶體資料修復方法,該記憶體資料修復方法包含:對該等儲存區塊的一儲存資料執行一資料讀取程序;根據該資料讀取程序判斷對應該儲存資料的其中之一該等儲存區塊具有一位元反轉錯誤而為一錯誤區塊;以及當該錯誤區塊的該位元反轉錯誤的數目大於一預設錯誤門檻值時進行一記憶體資料修復程序,以控制該快閃記憶體將該資料讀取程序對應該儲存資料所產生的一校正資料寫入該錯誤區塊,其中該記憶體資料修復程序包含:將該校正資料寫入該記憶體陣列的複數備份區塊其中之一進行備份;在備份完成後,在該記憶體陣列儲存之一區塊狀態表將該錯誤區塊紀錄為一待修復區塊;將該校正資料自該等備份區塊寫入該錯誤區塊;以及在該校正資料寫入該錯誤區塊後,在該區塊狀態表將該待修復區塊紀錄為一良好區塊。 An electronic device is used to repair 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 configured to execute a memory data repair method on the flash memory, wherein the memory data repair method includes: A data reading procedure is performed on a storage block of a storage data; according to the data reading procedure, it is determined that one of the storage blocks corresponding to the storage data has a bit inversion error and is an error block; and when the number of the bit inversion errors of the error block is greater than a preset error threshold value, a A memory data repair program is used to control the flash memory to write a correction data generated by the data reading program corresponding to the stored data into the error block, wherein the memory data repair program includes: writing the correction data into one of the plurality of backup blocks of the memory array for backup; after the backup is completed, recording the error block as a block to be repaired in a block status table stored in the memory array; writing the correction data from the backup blocks into the error block; and after the correction data is written into the error block, recording the block to be repaired as a good block in the block status table. 如請求項1所述之電子裝置,其中該資料讀取程序更包含:由該快閃記憶體讀取該儲存資料; 由該快閃記憶體根據一校驗機制對該儲存資料進行一錯誤檢驗,並在該儲存資料錯誤時進行一錯誤校正以產生該校正資料;以及由該快閃記憶體傳送該校正資料至該控制電路;其中該控制電路根據該校驗機制所產生之一錯誤校驗狀態判斷對應儲存該儲存資料的其中之一該等儲存區塊為該錯誤區塊。 The electronic device as described in claim 1, wherein the data reading procedure further comprises: reading the storage data from the flash memory; performing an error check on the storage data by the flash memory according to a verification mechanism, and performing an error correction to generate the correction data when the storage data is erroneous; and transmitting the correction data to the control circuit by the flash memory; wherein the control circuit determines that one of the storage blocks corresponding to the storage data is the error block according to an error verification state generated by the verification mechanism. 如請求項1所述之電子裝置,其中該資料讀取程序更包含:由該快閃記憶體讀取該儲存資料;由該快閃記憶體傳送該儲存資料至該控制電路;以及由該控制電路根據一校驗機制對該儲存資料進行一錯誤檢驗,並在該儲存資料錯誤時進行一錯誤校正以產生該校正資料;其中該控制電路根據該校驗機制所產生之一錯誤校驗狀態判斷對應儲存該儲存資料的其中之一該等儲存區塊為該錯誤區塊。 The electronic device as described in claim 1, wherein the data reading procedure further comprises: reading the storage data from the flash memory; transmitting the storage data from the flash memory to the control circuit; and the control circuit performing an error check on the storage data according to a verification mechanism, and performing an error correction to generate the correction data when the storage data is erroneous; wherein the control circuit determines that one of the storage blocks corresponding to the storage data is the erroneous block according to an error verification state generated by the verification mechanism. 如請求項1所述之電子裝置,其中該記憶體資料修復程序更包含:當該快閃記憶體在備份完成前發生一斷電狀況且又回復供電時,重新將該校正資料寫入該快閃記憶體的該等備份區塊其中之一;以及當該快閃記憶體在備份完成後且該校正資料寫入該錯誤區塊完成前發生該斷電狀況且又回復供電時,將該校正資料自該等備份區塊寫入該錯誤區塊。 The electronic device as described in claim 1, wherein the memory data repair procedure further comprises: when the flash memory experiences a power outage before the backup is completed and the power is restored, rewriting the correction data into one of the backup blocks of the flash memory; and when the flash memory experiences a power outage after the backup is completed and before the correction data is written into the error block and the power is restored, writing the correction data from the backup blocks into the error block. 如請求項1所述之電子裝置,其中該記憶體資料修復程序更包含:當將該校正資料寫入該錯誤區塊的一失敗次數大於一預設門檻值時,在該區塊狀態表將該錯誤區塊紀錄為一損壞區塊,其中該錯誤區塊在該區塊狀態表為第M個儲存區塊;以及 在該快閃記憶體進行一搬移程序,其包含:使M的數值遞增1,以註記第M個該等儲存區塊為該待修復區塊;判斷該待修復區塊是否儲存有一既有資料;在該待修復區塊儲存有該既有資料時,將該既有資料寫入該等備份區塊其中之一進行備份;將該校正資料寫入該待修復區塊;註記該既有資料為該校正資料,以重新執行該搬移程序;以及在該待修復區塊並未儲存有該既有資料時,將該校正資料寫入該待修復區塊。 The electronic device as described in claim 1, wherein the memory data repair procedure further comprises: when the number of failures of writing the correction data into the error block is greater than a preset threshold value, the error block is recorded as a damaged block in the block status table, wherein the error block is the Mth storage block in the block status table; and a migration procedure is performed in the flash memory, which comprises: increasing the value of M by 1 to mark the Mth storage block The block is the block to be repaired; determining whether the block to be repaired stores an existing data; when the block to be repaired stores the existing data, writing the existing data into one of the backup blocks for backup; writing the correction data into the block to be repaired; marking the existing data as the correction data to re-execute the migration procedure; and when the block to be repaired does not store the existing data, writing the correction data into the block to be repaired. 如請求項1所述之電子裝置,其中該記憶體資料修復程序更包含:當將該校正資料寫入該錯誤區塊的一失敗次數大於一預設門檻值時,將該校正資料寫入與該錯誤區塊相鄰的一第一相鄰區塊,並將該第一相鄰區塊所儲存的一既有資料搬移到與該第一相鄰區塊相鄰的一第二相鄰區塊。 The electronic device as described in claim 1, wherein the memory data repair procedure further comprises: when the number of failures of writing the correction data into the error block is greater than a preset threshold value, writing the correction data into a first adjacent block adjacent to the error block, and moving an existing data stored in the first adjacent block to a second adjacent block adjacent to the first adjacent block. 一種記憶體資料修復方法,應用於一電子裝置中以修復一快閃記憶體的資料,該電子裝置包含一控制電路,該快閃記憶體包含具有複數儲存區塊之一記憶體陣列,該記憶體資料修復方法包含:由該控制電路對該等儲存區塊的一儲存資料執行一資料讀取程序;由該控制電路根據該資料讀取程序判斷對應該儲存資料的其中之一該等儲存區塊具有一位元反轉錯誤而為一錯誤區塊;以及當該錯誤區塊的該位元反轉錯誤的數目大於一預設錯誤門檻值時進行一記憶體資料修復程序,以控制該快閃記憶體將該資料讀取程序對應該儲存資料所產生的一校正資料寫入該錯誤區塊,其中該記憶體資料修復程序包含: 由該控制電路將該校正資料寫入該記憶體陣列的複數備份區塊其中之一進行備份;在備份完成後,由該控制電路在該記憶體陣列儲存之一區塊狀態表將該錯誤區塊紀錄為一待修復區塊;由該控制電路將該校正資料自該等備份區塊寫入該錯誤區塊;以及在該校正資料寫入該錯誤區塊後,由該控制電路在該區塊狀態表將該待修復區塊紀錄為一良好區塊。 A memory data repair method is applied in an electronic device to repair data of a flash memory. The electronic device includes a control circuit. The flash memory includes a memory array having a plurality of storage blocks. The memory data repair method includes: the control circuit executes a storage data of the storage blocks a data reading procedure; the control circuit determines according to the data reading procedure that one of the storage blocks corresponding to the storage data has a bit inversion error and is an error block; and when the number of the bit inversion errors of the error block is greater than a preset error threshold value, a memory data repair procedure is performed to control The flash memory is controlled to write a correction data generated by the data reading process corresponding to the stored data into the error block, wherein the memory data repair process includes: the control circuit writes the correction data into one of the plurality of backup blocks of the memory array for backup; after the backup is completed, the control circuit A block status table stored in the memory array records the error block as a block to be repaired; the control circuit writes the correction data from the backup blocks into the error block; and after the correction data is written into the error block, the control circuit records the block to be repaired as a good block in the block status table. 如請求項7所述之記憶體資料修復方法,其中該資料讀取程序更包含:由該快閃記憶體讀取該儲存資料;由該快閃記憶體根據一校驗機制對該儲存資料進行一錯誤檢驗,並在該儲存資料錯誤時進行一錯誤校正以產生該校正資料;以及由該快閃記憶體傳送該校正資料至該控制電路;其中該控制電路根據該校驗機制所產生之一錯誤校驗狀態判斷對應儲存該儲存資料的其中之一該等儲存區塊為該錯誤區塊。 The memory data repair method as described in claim 7, wherein the data reading procedure further comprises: reading the storage data from the flash memory; performing an error check on the storage data by the flash memory according to a verification mechanism, and performing an error correction to generate the correction data when the storage data is erroneous; and transmitting the correction data to the control circuit by the flash memory; wherein the control circuit determines that one of the storage blocks corresponding to the storage data is the error block according to an error verification state generated by the verification mechanism. 如請求項7所述之記憶體資料修復方法,其中該資料讀取程序更包含:由該快閃記憶體讀取該儲存資料;由該快閃記憶體傳送該儲存資料至該控制電路;以及由該控制電路根據一校驗機制對該儲存資料進行一錯誤檢驗,並在該儲存資料錯誤時進行一錯誤校正以產生該校正資料; 其中該控制電路根據該校驗機制所產生之一錯誤校驗狀態判斷對應儲存該儲存資料的其中之一該等儲存區塊為該錯誤區塊。 The memory data repair method as described in claim 7, wherein the data reading procedure further comprises: reading the storage data from the flash memory; transmitting the storage data to the control circuit from the flash memory; and performing an error check on the storage data by the control circuit according to a verification mechanism, and performing an error correction to generate the correction data when the storage data is erroneous; wherein the control circuit determines that one of the storage blocks corresponding to the storage data is the erroneous block according to an error verification state generated by the verification mechanism. 如請求項7所述之記憶體資料修復方法,其中該快閃記憶體資料修復程序更包含:當該快閃記憶體在備份完成前發生一斷電狀況且又回復供電時,由該控制電路重新將該校正資料寫入該快閃記憶體的該等備份區塊其中之一;以及當該快閃記憶體在備份完成後且該校正資料寫入該錯誤區塊完成前發生該斷電狀況且又回復供電時,由該控制電路將該校正資料自該等備份區塊寫入該錯誤區塊。 The memory data repair method as described in claim 7, wherein the flash memory data repair procedure further comprises: when the flash memory experiences a power outage before the backup is completed and the power supply is restored, the control circuit rewrites the correction data into one of the backup blocks of the flash memory; and when the flash memory experiences a power outage after the backup is completed and before the correction data is written into the error block and the power supply is restored, the control circuit writes the correction data from the backup blocks into the error block. 如請求項7所述之記憶體資料修復方法,更包含:當將該校正資料寫入該錯誤區塊的一失敗次數大於一預設門檻值時,在該區塊狀態表將該錯誤區塊紀錄為一損壞區塊,其中該錯誤區塊在該區塊狀態表為第M個該等儲存區塊;以及在該快閃記憶體進行一搬移程序,其包含:使M的數值遞增1,以註記第M+1個該等儲存區塊為該待修復區塊;判斷該待修復區塊是否儲存有一既有資料;在該待修復區塊儲存有該既有資料時,將該既有資料寫入該等備份區塊其中之一進行備份;將該校正資料寫入該待修復區塊;註記該既有資料為該校正資料,以重新執行該搬移程序;以及在該待修復區塊並未儲存有該既有資料時,將該校正資料寫入該待修復區塊。 The memory data repair method as described in claim 7 further comprises: when the number of failures of writing the correction data into the error block is greater than a preset threshold value, recording the error block as a damaged block in the block status table, wherein the error block is the Mth of the storage blocks in the block status table; and performing a migration procedure in the flash memory, which comprises: increasing the value of M by 1 to mark the M+1th of the storage blocks for the block to be repaired; determining whether the block to be repaired stores an existing data; when the block to be repaired stores the existing data, writing the existing data into one of the backup blocks for backup; writing the correction data into the block to be repaired; marking the existing data as the correction data to re-execute the migration procedure; and when the block to be repaired does not store the existing data, writing the correction data into the block to be repaired.
TW112109604A 2023-03-15 2023-03-15 Electronic apparatus and memory data repairing method thereof TWI851083B (en)

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)

* Cited by examiner, † Cited by third party
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

Patent Citations (2)

* Cited by examiner, † Cited by third party
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