1. Field of the Invention
The present invention relates to a NOR flash memory controller.
2. Description of the Prior Art
Nor (Not Or (electronic logic gate)) flash memory is commonly used in mobile devices due to its non-volatility, durability, and fast access times. Additionally, NOR flash may be read and/or programmed in a random-access manner. Because each bit of NOR flash is by default a “0”, and programming is only capable of changing a certain bit from a “0” to a “1”, and an entire Block (or Sector) must be erased and rewritten before being able to program a specific bit having a current value of 1 to have a new value of “0”.
Most mobile devices require one or more user or factory setting to be stored within the mobile device and NOR flash provides a convenient location for storage of the setting. However, if an error happens to occur within the mobile device before writing of the setting is completed properly, e.g. loss of device power, the mobile device will be unable to properly read that particular setting when the mobile device regains power. This inability to properly read that particular setting can result in malfunction or inoperability of the mobile device that when possible, is normally resolved by a rest of the setting to factory parameters requiring the user to re-enter sometimes numerous user setting by hand.
It is therefore an objective of this disclosure to provide a writing method for a NOR flash memory controller and to further provide an error recovery method for the NOR flash memory controller that solves the problems of the related art.
A method of operating a NOR flash memory controller may include sequentially writing to a sequentially first block of each sector of the NOR flash memory, followed by the memory controller sequentially writing to a sequentially second block of each sector of the NOR flash memory. When all blocks of all sectors of the NOR flash memory have been written, the memory controller erases a sequentially first sector and then writes to the sequentially first block of the sequentially first sector.
The method may further comprise after erasing the sequentially first sector and then writing to the sequentially first block of the sequentially first sector, erasing the sequentially second sector and then writing to the sequentially first block of the sequentially second sector.
The method may further comprise after the memory controller sequentially writing to a sequentially first block of each sector of the NOR flash memory and before the memory controller sequentially writing to a sequentially second block of each sector of the NOR flash memory, the memory controller sequentially writing to a sequentially third block of each sector of the NOR flash memory.
The method may further comprise error recovery including when there is an error reading from the sequentially first block of the sequentially sector, erasing the sequentially first sector and writing initial data into sequentially first block of the sequentially first sector.
The error recovery may further include an error is detected when reading from the sequentially first block of a sequentially second sector, erasing the sequentially second sector and reading data from the sequentially first block of the sequentially first sector.
The error recovery may further include when an error is detected when reading from a sequentially second block of the sequentially first sector, erasing the sequentially first sector, reading data from the sequentially first block of the sequentially second sector and the read data is written into the sequentially first block of the sequentially first sector.
The error recovery may further include when an error is detected when reading from the sequentially second block of the sequentially second sector, erasing the sequentially second sector, reading data from the sequentially second block of the sequentially first sector and the read data is written into the sequentially first block of the sequentially second sector.
A mobile device, e.g. a cellular phone or portable computer but not limited to these, is further disclosed that includes a NOR flash memory for storing settings of the mobile device, a NOR flash memory controller having a memory storing data and/or program code for controlling operations of the NOR flash memory, and a processor coupled to the memory and the NOR flash memory for executing the program code where the program code when executed by the processor causes the memory controller to sequentially write to a sequentially first block of each sector of the NOR flash memory, then write to a sequentially second block of each sector of the NOR flash memory, and when all blocks of all sectors of the NOR flash memory have been written, the memory controller erases a sequentially first sector and then writes to the sequentially first block of the sequentially first sector.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Please refer to
In
When the memory controller attempts to write a setting into the NOR flash memory, it will follow the flowchart 200 shown in
First, in Step 210, the memory controller will write to Block A of Sector “0”. In
In Step 220, the memory controller will write the setting into Block C of Sector “1” as is shown in the 2nd writing column of
In Step 230, the memory controller will write the setting into Block B of Sector “0” as is shown in 3rd writing column of
In Step 240, the memory controller will write the setting into Block D of Sector “1” as is shown in 4th writing column of
In Step 250, the memory controller will erase Sector “0”, and then write to Block A of Sector “0” as is shown in 5th writing column of
In Step 260, the memory controller will erase Sector “1”, and then write to Block C of Sector “1” as is shown in 6th writing column of
In Step 270, as can be seen from
This disclosed embodiment of a writing method to NOR flash memory helps ensure that if a current setting cannot be properly read from the NOR flash memory, error recovery is simplified, usually limited to a loss of only the most recent setting, rather than having to always return to the factory default.
Please refer now to
In
In
Please turn now to
As before, the method begins by writing to sequentially 1st blocks in each of the sectors, followed by 2nd blocks in each of the sectors, and finally to 3rd blocks in each of the sectors. If there are more than 3 blocks in each sector, they would be written to in a continuation of this sequence.
After the 6th writing in this example, all of the blocks in the NOR flash memory have been written so erasure is needed before any additional writing. Thus, as shown in
If an additional writing is necessary, Sector “1” should be erased and the additional setting written into Block D of Sector “1”. The process would then continue as before with the next writing going into Block B of Sector “1”. It is assumed that one skilled in the art can continue this process indefinitely without deviating from the disclosed method.
As before, the method begins by writing to sequentially 1st blocks in each of the sectors, followed by 2nd blocks in each of the sectors, and finally to 3rd blocks in each of the sectors. If there are more than 3 blocks in each sector, they would be written to in a continuation of this sequence.
After the 6th writing in this example, all of the blocks in the NOR flash memory have been written so erasure is needed before any additional writing. Thus, as shown in
If an additional writing is necessary, Sector “1” should be erased and the additional setting written into Block D of Sector “1”. When a subsequent writing is needed, Sector “2” should be erased and the subsequent setting written into Block E of Sector “2”. Again, the process would then continue as before with the next writing going into Block B of Sector “1”. It is assumed that one skilled in the art can continue this process indefinitely without deviating from the disclosed method.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
This application is a continuation of PCT/CN2010/079726, filed on Dec. 13, 2010. The contents of PCT/CN2010/079726 are all hereby incorporated by reference.
Number | Name | Date | Kind |
---|---|---|---|
7404028 | Baltes | Jul 2008 | B2 |
20060018152 | Kawai | Jan 2006 | A1 |
20090210774 | Godard et al. | Aug 2009 | A1 |
20120042201 | Resnick | Feb 2012 | A1 |
Number | Date | Country |
---|---|---|
100538658 | Sep 2009 | CN |
101529370 | Sep 2009 | CN |
Number | Date | Country | |
---|---|---|---|
20120151259 A1 | Jun 2012 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2010/079726 | Dec 2010 | US |
Child | 12977047 | US |