The invention relates to an electronic device with memory erased by page. More particularly the invention is related to memory having an erasing by page with strong timing constraints.
Electronic memories are today essential for electronic devices using a microprocessor. Non volatile memories are memory that retains information when power is switch off. Amongst the non volatile memories there are memories that are electrically erasable, well known under the name of EEPROM or E2PROM. Typically a floating gate memorizes an electrical charge when the power is off. The charged state and the discharged state of the gate are associated to a logical level, zero or one of a binary information called bit. The charging and the discharging of the floating gate are made according two different polarizations of the floating gate transistor. In term of memory management two operations are performed. An erasing operation is performed for placing the bit in a first state and a writing operation is made for placing the bit in the other state. For making these operations, the floating gate transistor must be selected and several selection transistors are required.
In view to make big matrix of memories, it is well known to reduce the number of selection transistors. The memory matrix is often divided in groups of bits that can be selected simultaneously. Groups of bits have different names like words, pages and blocks depending of the size. Commonly, a word corresponds to one or two bytes, a page comprises several words, for example 256 to 1024 words and a blocks may comprises several pages, for example 16 to 64 pages. The different groups are used depending of the memory size. Small E2PROM can be written and erased by word. Very large Flash memory are written by page and erased by block. Intermediate memory can be written and erased by pages. The time and consumption for writing or erasing operations depends of the size of the group of bits. The larger the group is, the larger the capacity to charge is. In view to limit current peaks, it is known to increase the time of the operation. Commonly, a page to erase can take 1 to 10 ms depending of the block size and around the same time to be write
In case of a memory managed by pages (and/or blocks), some status bits are associated to each page for indicating that the page is currently in use, is written but no more in use, or is erased. Commonly, the page management is made like the sectors of an hard drive: a page is erased just before to be reuse, such a method authorizes to retrieve an “erased” file till the page is not re-used. For avoiding too much stress on the memory cells, it is known to manage the pages in a circular manner, i.e. all the pages have to be used before reusing a page.
According to a conventional memory management, when a data is to be modified inside a file, the corresponding page has to be re-written in another page with the modified data. The memory controller has to find the next available page that is erased or no more in use. After all pages are used at least once, the memory controller can only find pages that are no more in use. The writing time is transformed into the addition of an erasing time and a writing time.
Considering a contactless device compliant with ISO14443, the contactless device may have not got a battery or may work in a battery off mode. In that case the contactless device is powered by the electromagnetic field provided by a reader device. A contactless communication according ISO 14443 is very fast, in general it should be done in few hundreds of milliseconds. Sometimes, a request necessitates the rewriting of few data at different places. With a conventional memory management, when the all the memory has been write at least one, the time to perform such a request can be very long and as an example more than one second. To be sure to complete the request, the user of the device must maintain the contactless device inside the electromagnetic field preferably without move to be sure to have the optimal transmission. In case of a move before the completion of the request, an error transmission may occur in the last feed-back message and the request is to be re-sent a second time.
The aim of the invention is to reduce the time for processing a request in a contactless transaction in such a way to reduce transmission error. The invention proposes to manage differently the memory by the use of a pool of free pages that prevent any page erasing during the writing of data. The pool of free pages can be erased during a non critical time in such a way during the processing of a contactless request, no time is required for the erasing of a page.
More particularly the invention is a method for managing a memory erasable by block. The method comprises an index management of the memory block wherein the index indicates if a block is erased or to be erased. A memory manager performs a block erasing when the memory is not in use and a block is to be erased and when the number of erased blocks is lower than a predetermined number.
Preferentially, the block erasing is made on the oldest available block that is not erased. The index management is made on a number of blocks lower than the total number of blocks of the memory.
On a preferred embodiment, the memory is inside an electronic device receiving commands according ISO7816 or ISO14443, and wherein the block erasing is made during an idle time of said commands.
On another point of view, the invention is an electronic device comprising at least one electrically erasable memory which is erasable by blocks and a memory controller. The memory controller performs a block erasing when the memory is not in use and a block is to be erased and when the number of erased blocks is lower than a predetermined number.
The invention will be better understood after the reading of the following Description of the Preferred Embodiments that makes references to the annexed drawings in which:
As indicated before, the problem solved by the invention is related to the time needed for performing a transaction in some contactless transaction which are commonly used in the smartcard world. So the preferred example of device implementing the invention is a smartcard SC as shown on
The Smartcard SC comprises a microprocessor μC coupled to a central bus BUS to which are connected a first interface I1, a second interface I2, a volatile memory RAM, a short and fast non volatile memory SNVM and a large non volatile memory LNVM. The first interface is for example a communication interface according to ISO7816 that can receive and answer to commands when the smartcard SC is plugged into a reader. The second interface is a for example a contactless interface according to ISO14443 that can receive and answer to commands when the smartcard SC is inside the electromagnetic field of a reader.
The volatile memory RAM is commonly used for storing temporarily part of the code and the data during the running of programs, for preparing the messages to send and also as buffer before data storage in the large non volatile memory LNVM. The small and fast non volatile memory SNVM is a non volatile memory that can be accessed in read write by words so it can be used like a volatile memory that can be saved when power is turned off. The SNVM is relatively expensive in term of space occupation so the operating system uses it for storing some parameters that change a lot and that should be memorized between two powered sessions. The large non volatile memory LNVM is used as a mass memory, as an example Flash memory is used. To have a high integration level, such a memory is accessed by block.
The memory structure of a block inside a Flash memory comprises a data area and metadata area, as disclosed on
For the following explanation, we take into consideration that the memory is a NAND Flash, i.e. with erased state at level 1 for each bit. With such a memory it is possible to write several times a same block but in that case only the bits at level 1 can be write at level zero. Once a bit is at level 0, a complete erasing of the block is needed for putting the bit to level 1. Such a multiple write is commonly implemented for modifying bit by bit the metadata.
On
As indicated, a block can be subdivided into pages for the writing.
The man of the art will understand that other kind of memory structures can be used with the invention. In addition, the definition of the “memory block” in the invention correspond to the size used for the erasing of data and that, depending of the memory structure, it could be the same than a memory page. In addition the size of the memory will influence the size of the fields used for the address or the number in the erasing queue.
Now, it is explained in relation with
The address@ corresponds to the physical address in the memory also indicated in the index as Phy@. The virtual address Virt@ corresponds to the address inside the index. In the index, the binary information Erased corresponds to the reverse of the bit Used in the memory, and the binary information TBE corresponds to the bit NMU.
In the index of
The processor performs the erasing operation only to maintain a predetermined number of erased page in such a way that a reserve of blocks always exists. Each time the number of erased blocks is below the predetermined number and each time the memory is not used, the microprocessor launches an erasing operation.
With a smart card compliant with ISO7816 or ISO14443, the reception of a command has a time duration that can be of the same time of a block erasing. During the reception of a command only the RAM is used for buffering the command. So each time the microprocessor detects the reception of a command on its interface I1 or I2, he can use the reception time as an idle time for erasing a block to be erased. In addition, after the sending of an answer, the microprocessor can try to launch an erasing before the reception of a next command but in that case there is a risk of tearing with a power cut off during the erasing. If the erasing is not performed completely, the bits of the LNVM and the index still indicate that the block is to be erased. So the erasing can be made again at the next command reception. Of course if a smart card is plug into a card reader without command reception, the microprocessor can try to erase as many blocks than needed.
On
The man of the art will understand that the example was done on a reduced size of index and limited number of pre-erased page for explanation purpose. In the practice, the indicated number can be strongly increased.
Number | Date | Country | Kind |
---|---|---|---|
15306881.2 | Nov 2015 | EP | regional |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/EP2016/078823 | 11/25/2016 | WO | 00 |