1. Field of the Invention
The present invention relates to a semiconductor storage device such as a semiconductor card, equipped with flash memories of which the number of rewriting actions is limited, and particularly to a semiconductor storage device having spare sectors for replacing error sectors in rewriting data and arranged to give a warning when the number of rewriting actions is close to its limit.
2. Description of the Prior Art
Recently, as semiconductor storage devices such as semiconductor cards using flash memories have been increased in storage capacity scale, they are now used as data storage devices in mobile terminals such as portable information apparatuses (PDAs) or factory automation system (referred to as xe2x80x9cFAxe2x80x9d, hereinafter). In particular, FA system requires a higher level of environmental durability and commonly employs a hard disk drive. Recently, many FA systems utilize semiconductor cards which have much higher environmental durability.
For example, a flash ATAPC card, compact flash (registered trademark) card and flash drive are used as the semiconductor storage device for a substitute for a hard disk drive in various applications. These examples include nonvolatile or flash memories built therein, each memory having a floating gate structure of memory cells and capable of writing and reading data with protocols compatible with a hard disk drive.
A flash memory has a floating gate structure where the number of rewriting actions is limited. It is hence schemed for increasing the operating life of the flash memory to prepare and use spare sectors (blocks) for replacing error sectors (blocks) of which the number of rewriting actions is exhausted. Accordingly, as each flash memory is increased in the number of rewriting actions more than that of rewritable actions per sector (block), it can favorably be used in a semiconductor storage device.
However, when all the spare sectors (blocks) are used up and another error sector (block) is generated in the rewriting, the semiconductor storage device fails to replace the error sector (block) with a spare one and will thus be defective due to causing a rewriting error.
Such a conventional semiconductor storage device having a flash memory includes no means for notifying a host apparatus of the exhaustion condition of the spare sectors (blocks). This results in that the operating life of the conventional semiconductor storage device is identified only at the time when a rewriting error suddenly occurs during a continuous operation.
FIG. 8 is a block diagram showing a conventional semiconductor card as a semiconductor storage device equipped with flash memories. As shown in the figure, the semiconductor card 82 comprises a card controller 83, flash memories 84, and a power supply circuit 86. The card controller 83 includes a CPU 85, a buffer portion 88, and an error correction coding circuit 89 (referred to as xe2x80x9cECC circuitxe2x80x9d, hereinafter). The card controller 83 is linked with an oscillator 87. The card controller 83 executes data transmission to and from an external system 81 of various data signals including I/O signals, address signals, and control signals.
The operation of the conventional semiconductor card will now be explained in brief. When acknowledging a message of a command received from the external system 81, the card controller 83 starts control actions for implementation of the command. The control actions of the card controller 83 are basically programmed and executed by the CPU 85 provided in the card controller 83. The read and write actions on the flash memories 84 are based on data transfer via the buffer portion 88 built in the card controller 83.
Generally, as each flash memory has a limited life in rewriting defective sectors, the semiconductor card prepares spare storage areas for prolonging the life of rewriting actions. The spare storage areas of the semiconductor card have specific rewritable size at each replacement action and entire replacement storage size, which are individually determined and managed depending on the type of equipped flash memories and the controlling method.
The conventional semiconductor card is designed to notify the external system 81 of the occurrence of error only when the spare storage areas have been used up and a counteraction is needed, but not give an early warning to the system 81 before the spare storage areas are exhausted. In other words, exhaustion of the spare storage areas is not known before the occurrence of error is notified. Therefore, the degree of the used spare storage areas is hardly examined, which results in that the rewriting action may exceed the rewritable limit without precaution. This disables the function of the flash memories and causes the semiconductor card to have an erratic action.
When the conventional flash memory provided in the semiconductor card is used in an FA system, the end of the rewriting life of the flash memories may suddenly cause an error, which hence results in functional faults of the system such as a sudden stop of the system line. It is thus urgently necessary to provide a method of warning that the life of the semiconductor card in storage capacity thereof comes close to its end or limit.
The present invention has been developed for eliminating the foregoing drawbacks and its object is to provide a system and a method of generating a warning signal in a semiconductor card equipped with a set of flash memories which is arranged for examining a remaining size of a spare storage area in rewriting actions to judge that the life of each flash memory comes close to its end before the flash memory is completely used up, thus preventing any malfunction derived from careless use after the end of the life.
It is another object of the present invention to provide a semiconductor storage device having flash memories capable of rewriting data in sector (block) units, employing a command for examining consumption of spare sectors (blocks) and the storage device is arranged for, when receiving the command from an external system such as a host apparatus, notifying the host apparatus of the consumption of spare sectors (blocks) that the number of spare sectors (blocks) comes close to its end. Namely, the time for replacement of the semiconductor device with a new device is notified before any fault resulting in malfunction occurs in the system.
For achievement of the above objects, a first aspect of the present invention provides a semiconductor storage device equipped with flash memories each having a limited size of a spare storage area, which comprises: an error decision unit for judging whether or not an error occurs during writing of data; a replacing unit for rewriting data to the spare storage area when the error decision unit judges that an error occurs; a spare area size calculating unit for calculating a remaining size of the spare storage area after the data has been re-written to the spare storage area; a spare area checking unit for comparing the remaining size of the spare storage area with a predetermined value; and a warning generator for generating a warning when the remaining size of the spare storage area is smaller than the predetermined value.
In this arrangement, the replacing unit may acquire a start address of the spare storage area from a spare storage area management table which is saved in a management area of each flash memory to thereby rewrite the data to the spare storage area of the acquired address, and after the completion of the data rewriting, the replacing unit updates the spare storage area management table and a logic-to-physic conversion table saved in the management area.
A second aspect of the present invention provides a warning generating system of a semiconductor storage device exchanging commands and data with an external system, the semiconductor storage device being equipped with flash memories each having a limited size of a spare storage area, where the system comprises: an error decision unit for judging whether or not an error occurs during writing of data; a replacing unit for rewriting data to the spare storage area when the error decision unit judges that an error occurs; a spare area size calculating unit for calculating a remaining size of the spare storage area after the data has been re-written to the spare storage area; a spare area checking unit for comparing the remaining size of the spare storage area with a predetermined value; and a warning generator for generating a warning when the remaining size of the spare storage area is smaller than the predetermined value.
A third aspect of the present invention provides a warning generating method of a semiconductor storage device equipped with flash memories each having a limited size of a spare storage area, where the method comprising the steps of: judging whether or not an error occurs during writing of data; rewriting data to the spare storage area when it is judged that an error occurs; calculating a remaining size of the spare storage area after the data has been rewritten to the spare storage area; comparing the remaining size of the spare storage area with a predetermined value; and generating a warning when the remaining size of the spare storage area is smaller than the predetermined value.
By the arrangements set forth in the first to third aspects of the present invention, when an error occurs during the writing of the data on the flash memory in the semiconductor storage device, after the data is rewritten to the spare storage area, the remaining size of the spare storage area is examined, and when the remaining size is smaller than the predetermined value, a warning is generated from a warning generating unit. As a result, the user of the semiconductor storage device such as a semiconductor card can timely be notified of the fact that the life of the device comes close to its end.
The spare area size calculating unit may calculate the remaining size of the spare storage area in response to a check command for checking the remaining size of the spare storage area which is issued by an external system. Thus, it is decided whether or not a warning be raised only when the external system requests for the examination of the remaining size, and accordingly, the warning can effectively given to a user.
The semiconductor storage device may further comprise a register for flagging a specific bit indicative of the warning when it is judged that the remaining size of the spare storage area is smaller than the predetermined value.
Moreover, it may be further modified such that a warning indication signal is provided for transmission to an external system and when the spare area checking unit judges that the remaining size of the spare storage area is smaller than the predetermined value, the warning indication signal is changed in level to notify the external system of the warning.
By this arrangement, it is decided whether or not a warning be raised only when the external system requests for the examination of the remaining size, and accordingly, the warning can effectively be notified to the system.
The semiconductor storage device may further comprise an external switch wherein the spare area size calculating unit executes the calculation of the remaining size of the spare storage area when the external switch is turned on. As a result, the semiconductor storage device such as a semiconductor card can check the end of its life independently of the external system without giving any load to the external system.
A fourth aspect of the present invention provides a semiconductor storage device equipped with flash memories each having a limited number of rewriting operations to be subjected and each flash memory being provided with a spare storage area for replacing a defective portion caused in a data writing operation, where the semiconductor storage device comprises: an error decision unit for judging whether or not an error occurs in a defective portion during a data writing operation; a replacing unit for replacing the defective portion by the spare storage area to write the data when the error decision unit judges that an error occurs; a command receiving unit for receiving a remaining number examination command from an external equipment requesting an examination of a remaining size of the spare storage area; a remaining spare size calculating unit for calculating a remaining size in number of the spare storage area in response to the remaining number examination command after the data has been written to the spare storage area; and a spare area checking unit for comparing the calculated remaining size of the spare storage area with a predetermined value.
This allows the remaining number of the spare sectors to be monitored. The time for replacement with a new device can thus be acknowledged before any write error occurs due to the exhaustion of the spare sectors.
In this fourth aspect, entry and response procedure of the remaining number examination command may be based on a non-data transfer command protocol.
Moreover, it may be modified such that, in response to the remaining number examination command, the remaining spare size calculating unit obtains the minimum of count numbers of good sectors existing in the spare storage areas of the entire flash memories and determines the minimum as the remaining number of the spare sectors of the semiconductor storage device and when the remaining number of the spare sectors is smaller than the predetermined value, the remaining number of the spare sectors is notified to the external equipment. Thus, the external host equipment can readily be notified of the remaining number of the spare sectors of the semiconductor storage device.
Moreover, it may further be modified in which in response to the remaining number examination command, a particular code indicative of a consumption condition of the spare sectors is delivered. This allows the external host to readily judge whether or not the semiconductor storage device needs to be replaced with a new one through merely checking the returned value of each sector count register after the execution of the command.