Background technology
Nand type Flash (NandFlash) is a kind of widely used nonvolatile memory NVM (Non-VolatileMemory), and its maximum characteristics are that capacity is large.At present, mass-memory unit is all NandFlash as the memory bank that uses on USB flash disk, SD card.
Although NandFlash has advantage capacious, its interface is more complicated.Together with Data-Link and control line, NandFlash needs at least 16 could be by main controller controls with connection.
Following table has listed control and the data-interface of typical N andFlash, and its effect separately has been described take K9F series NandFlash as example.
I: the representative data direction is input;
O: the representative data direction is output;
I/O: the representative data direction is two-way time-sharing multiplex.
The NandFlash interface is realized all equipment operatings according to a cover agreement, and NandFlash can be completed by 14 orders as all operations of example take K9F series, specifically sees the following form:
Function |
1st Cycle |
2nd Cycle |
Accentable Command during Busy |
Read |
00h |
30h |
|
Read for Copy Back |
00h |
35h |
|
Read ID |
90h |
- |
|
Reset |
FFh |
- |
○ |
Page Program |
80h |
10h |
|
Two-Plane Page Program(3) |
80h---11h |
81h---10h |
|
Copy-Back Program |
85h |
10h |
|
Two-Plane Copy-Back Program(3) |
85h---11h |
81h---10h |
|
Block Erase |
60h |
D0h |
|
Two-Plane Block Erase |
60h---60h |
D0h |
|
Random Data Input(1) |
85h |
- |
|
Random Data Output(1) |
05h |
E0h |
|
Read Status |
70h |
|
○ |
Read EDC Status(2) |
7Bh |
|
○ |
Summary of the invention
Purpose of the present invention will solve the problems of the technologies described above just, and a kind of method of controlling and read and write NandFlash by four-way IO interface is provided.
The present invention solves the technical scheme that its technical matters adopts: this method of controlling and read and write NandFlash by four-way IO interface, a kind of command analysis device is set between QS interface and NF interface, the QS interface protocol is converted to original NF interface protocol, and adopts the QS interface with the master controller communication.
As preferably, described QS interface is a kind of 5 mouthfuls of line serial line interfaces.
As preferably, the command analysis device is made of two 4 latchs, code translator, data latches, WE/RE clock generator and auxiliary circuits; Two 4 latchs are responsible for the 8 bit parallel data that become the NF interface to need to 4 bit serial data-switching of QS interface under the clock controller effect; Code translator is responsible for 8 bit parallel data are resolved, to differentiate the various command pattern; Data latches is responsible for guaranteeing that the state of data bus remains unchanged in needs, prevent that the operation of other orders from destroying the data mode of data bus; The WE/RE clock generator is responsible for producing the needed WE/RE sequential of NF interface.
The effect that the present invention is useful is:
1, substitute the NF interface of original complexity with the QS interface of 5 mouthfuls of lines, reduced the complicacy of NandFlash interface, enlarged the usable range of NandFlash.
2, introduce the command analysis device between QS interface and NF interface, made the design that need not to change existing NandFlash can introduce the QS interface.
3, formulate the agreement of QS interface, when realizing new interface, realized the repertoire of original NF agreement.
Embodiment
The invention will be further described below in conjunction with drawings and Examples:
This method of controlling and read and write NandFlash by four-way IO interface of the present invention, substitute the original complex interface (hereinafter being called for short the NF interface) of NandFlash with a kind of 5 mouthfuls of line serial line interfaces (hereinafter being called for short the QS interface), and adopt with the QS interface with the master controller communication.Benefit is, has simplified Interface design, has reduced the IO expense of using NandFlash.Design and set up a kind of command analysis device between QS interface and NF interface, be responsible for the QS interface protocol is converted to original NF interface protocol.The benefit of setting up the command analysis device is, needn't revise the former design of NandFlash, can realize the application of new interface.For the QS interface, design one cover standard agreement is to cover the repertoire of original NF agreement.So that the address is programmed for 0x55 as example as the content of 0x01008000, realization flow as shown in Figure 1.
1, the command analysis device is introduced (block diagram as shown in Figure 2) in detail
The command analysis device is responsible for the QS interface of 5 passages with the protocol conversion of NandFlash standard NF interface.The command analysis device mainly is made of two 4 latchs, code translator, data latches, WE/RE clock generator and auxiliary circuits.
● 4 latchs
Two 4 latchs are responsible for the 8 bit parallel data that become the NF interface to need to 4 bit serial data-switching of QS interface under the clock controller effect.
● code translator
Code translator is responsible for 8 bit parallel data are resolved, to differentiate the various command pattern.
● data latches
Data latches is responsible for guaranteeing that the state of data bus remains unchanged in needs, prevent that the operation of other orders from destroying the data mode of data bus.
● the WE/RE clock generator
The WE/RE clock generator is responsible for producing the needed WE/RE sequential of NF interface.
2, the QS agreement is introduced in detail
For satisfying the characteristics of QS interface work in series, can also cover all functions of original NF interface protocol simultaneously, the present invention has designed the QS interface protocol.The QS interface protocol is comprised of 15 orders, and being divided into is two classes.One class is the order of signal handling type, and another kind of is the order of data manipulation type.
● the order of signal handling type
The order of signal handling type is responsible for hardware signal is driven, and the hardware signal of demand motive is CEx, WP, ALE, CLE.
The order of signal handling type is divided into four sections, is respectively type codes 1, type codes 2, signal code, numeric data code.Every segment data length is 4.
The content of type codes 1 is fixed as 0xf; The content of type codes 2 is fixed as 0x8.The combination 0xf8 of two type codes represents that this order is the order of signal handling class.
Signal code length is 4, and object is controlled in representative, and valid data are 0x0,0x1, and 0x2,0x3, concrete meaning sees the following form.
Numeric data code length is 4, when controlling object and be CEx, the number of significant digit of numeric data code is decided (to suppose to have 3 CE lines according to the number of CE signal, the numeric data code effective length is 3), bits per inch represents the high-low level state (1 is high level, and 0 is low level) of every CE data line according to the data of code.When controlling object for other signals, numeric data code only lowest order is effective, the high-low level state of its data representation signal line (1 is high level, and 0 is low level).For example concrete meaning sees the following form.
The concrete form of signal handling order is:
● the order of data manipulation type
The order of data manipulation type is mainly to complete reading and writing to the NandFlash data, the function such as wipe.The instruction of data manipulation type comprises totally 14 orders (concrete form see below form), 14 command functions of corresponding NF interface protocol respectively.Concrete method is, increases 0xf before original order, and the type codes that 0x7 is two 4 is with expression order kind; Simultaneously, each 8 bit field of NF protocol command are changed into two 4 bit fields.Such benefit is, after the command analysis device parses concrete order, directly by code translator the IO bus that latchs respectively data in two 4 latchs and send to NF, can be identified by the NF agreement.
In addition to the implementation, the present invention can also have other embodiments.All employings are equal to the technical scheme of replacement or equivalent transformation formation, all drop on the protection domain of requirement of the present invention.