The present invention relates to flash memory, and in particular to a system and method for monitoring wear of flash memory in hardware.
Flash memory is a type of non-volatile memory used for storing information electronically. Flash memory can be implemented as NOR flash memory or NAND flash memory. In NOR flash memory, the default state of a bit is a logic “1.” To program the bit to a logic “0,” a voltage is applied to the bit's control gate that is large enough to cause electrons to jump onto a floating gate of the bit. To erase the bit, in effect returning it to its default state of a logic “1,” a voltage of opposite polarity is applied to the control gate, causing the electrons to jump off of the floating gate.
Flash memory can only handle so many erase cycles before the memory becomes unreliable. Although any bit may be individually programmed at any time, bits may only be erased on a sector-wide basis. Because of this, wear leveling has been implemented to control the number of erase cycles for each sector of flash memory. Wear leveling has been implemented in software, and erase counts for each sector are generally stored in the same flash memory device that is being monitored.
In critical systems, such as those onboard an aircraft, it is important to ensure that wear leveling is being performed properly so as to maximize the life of the flash memory device. In the past, wear monitoring has been implemented in the same software that is in charge of wear leveling. There is a need to provide a more reliable system for ensuring proper functionality of wear leveling techniques.
A system for monitoring wear in a flash memory device that is written by receiving program and erase commands from a microprocessor on a memory bus includes a non-volatile memory and a memory monitor circuit. The non-volatile memory is separate from the flash memory device and stores a number of completed erase cycles for each sector of the flash memory device. The memory monitor circuit monitors the memory bus for a completed erase cycle for an erased sector and updates the number of completed erase cycles in the non-volatile memory for the erased sector.
A flash memory monitor system is disclosed that is implemented in hardware. The system includes a microprocessor, a flash wear monitor circuit, and a non-volatile memory. The microprocessor issues program and erase commands to the flash memory device over a bus. The flash wear monitor circuit monitors the bus for an erase command sequence issued from the microprocessor to the flash memory device. When an erase command sequence is detected, the wear monitor circuit determines the sector that is being erased, verifies that the erase occurred, and updates an erase count for the erased sector in the non-volatile memory. In this way, hardware wear monitoring can be used to ensure that wear leveling techniques are functioning properly.
Microprocessor 16 issues program and erase command sequences to flash memory device 12. Microprocessor 16 is connected to flash memory device 12 through local bus 20. Local bus 20 is any data communication bus capable of transmitting digital signals. When microprocessor 16 wishes to overwrite data to flash memory 12, the entire sector that is being written must first be erased. When issuing an erase command sequence, microprocessor 16 provides a series of signals on bus 20 to indicate that a sector needs to be erased. Microprocessor 16 also provides the address of the sector to be erased on address bus 36.
Flash wear monitor circuit 14 tracks the erase cycles for each sector of flash memory 12. Flash wear monitor circuit 14 may be implemented as any type of microcontroller, such as a field-programmable gate array (FPGA). Local bus interface 24 receives the data on local bus 20 and provides that data to erase command sequence detector 28 over internal bus 32. Erase command sequence detector 28 is implemented, for example, using digital logic. Erase command sequence detector 28 monitors control bus 38 over internal bus 32 for a sequence of commands indicating an erase command. When an erase cycle is completed by flash memory device 12, flash memory device 12 provides an acknowledgement to microprocessor 16 on control bus 38 and data bus 40. Once an erase command sequence is detected by sequence detector 28, control bus 38 and data bus 40 are monitored for this acknowledgement signal. Once this acknowledgment signal is detected, erase command sequence detector 28 indicates that an erase cycle has occurred (via an “erase complete” signal) and provides an address of the sector that has been erased (via a “sector address” signal) to sector erase update counter 30. No action is taken by flash wear monitor circuit 14 for read commands issued from microprocessor 16 because reading data from flash memory device 12 is not detrimental to the device.
Sector erase update counter 30 tracks the number of completed erase cycles for each sector of flash memory device 12. Sector erase update counter 30 is implemented, for example, using digital logic. Sector erase update counter 30 interfaces with bus interface 26 through internal bus 34. Sector erase update counter 30 issues read and write command sequences on control bus 44 to update non-volatile memory 18. When sector erase update counter 30 receives an indication of a completed erase cycle from erase command sequence detector 28, sector erase update counter 30 updates an erase cycle count in non-volatile memory 18 that corresponds to the address provided by erase command sequence detector 28. To accomplish this, sector erase update counter 30 first obtains the current count for the erased sector by issuing a read command on control line 44 for the address of non-volatile memory that contains the erase count for the erased sector. The address is provided on address line 42 and the current count is returned from non-volatile memory 18 on data line 46. The count is then updated by sector erase update counter 30 and a write command is issued on control line 44 with the address on address line 42 and the updated count on data line 46 to store the updated count in non-volatile memory 18.
Erase counts may be accessed from non-volatile memory by microprocessor 16 through flash wear monitor circuit 14. Microprocessor 16 sends read and write bus cycles on local bus 20 that are intended for non-volatile memory 18. These command sequences are received at local bus interface 24 and are passed along to local bus interface 26 over microprocessor access bus 35. The requests go to non-volatile memory 18 over non-volatile memory bus 22 and data is returned along the same path. In this way, software can be executed on microprocessor 16 to retrieve and analyze the erase cycle counts that have been accumulated in non-volatile memory 18, which is separate hardware from flash memory device 12. Therefore, it can be verified that all erase cycle counts are similar and wear leveling is therefore being performed properly for flash memory device 12.
In this way, the present invention describes a system and method for monitoring wear in a flash memory device. Although the present invention has been described with reference to preferred embodiments, workers skilled in the art will recognize that changes may be made in form and detail without departing from the spirit and scope of the invention.