APPLICATION NOTE SFDP Introduction Serial Flash Discoverable Parameter Structure Publication Number: AN-114 APPLICATION NOTE SFDP Introduction Contents 1. Introduction.......................................................................................................................................2 2. SFDP Structure.................................................................................................................................3 2-1. SFDP Specification.................................................................................................................3 Table 1: Brief SFDP Table Structure............................................................................................... 3 2-2. SFDP Header & Parameter Header Definition......................................................................4 Figure 1: Overall SFDP Header Structure...................................................................................... 5 2-3. SFDP Parameter Table Definition..........................................................................................6 Table 2. SFDP Parameter Table Definition and Content................................................................ 6 2-4. SFDP Parameter Header and Table Mapping.......................................................................7 Figure 2: SFDP Mapping Diagram................................................................................................. 7 3. SFDP Timing Diagram......................................................................................................................8 3-1. Single I/O (1-1-1*) read timing diagram................................................................................8 Figure 3: Single I/O Timing Diagram for SFDP Read..................................................................... 8 3-2. Quad I/O (4-4-4, QPI) read timing diagram...........................................................................9 Figure 4: QPI Timing Diagram for SFDP Read.............................................................................. 9 4. Access SFDP..................................................................................................................................10 Figure 5: SFDP Read Flow by Continuous Read......................................................................... 10 Figure 6: SFDP Read Flow by Random Read............................................................................. 11 5. Summary.........................................................................................................................................12 6. References......................................................................................................................................12 7. Appendix: Sample Code................................................................................................................13 Publication Number: AN-114 1 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 111 Introduction Serial Flash Discoverable Parameter (SFDP) standard provides a consistent method of describing the functional and feature capabilities of Serial Flash devices in a standard set of internal parameter tables. These parameter tables can be interrogated by host system software to enable adjustments needed to accommodate divergent features from multiple vendors. SFDP provides more flexibility in vendor selection; reduces engineering resources for firmware upgrades and effectively shortens the time to bring product to the market. The value of SFDP mirrors that of Common Flash Interface (CFI) for Parallel Flash. The software engineers have been asking for a standard like this since the increased adoption of Serial Flash. Right now, SFDP was approved by JEDEC BOD on the end of April, 2011 which is named as JESD 216. Publication Number: AN-114 2 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 222 SFDP Structure SFDP specification defines the structure of SFDP database in flash device and the method is to read data out. The basic database is constructed by header and table. The JEDEC-defined header and basic flash parameter table is mandatory. Additional flash vender-defined header and tables can be added. 22222 SFDP Specification SFDP specification is the combination of SFDP Header, SFDP Parameter and Parameter tables. (1) SFDP Header: Indicate existed SFDP function information (2) SFDP Parameter Header: Indicate SFDP table information, and is defined by JEDEC or vender. (3) SFDP Parameter Table: The database stores the functions and capabilities of serial flash, and is defined by JEDEC or vender. Table 1: Brief SFDP Table Structure Table Type Maker Description SFDP Header JEDEC STD Identify SFDP signatures, number of parameter header and revision Parameter Header (0) JEDEC STD Identify JEDEC ID, revision, length and table pointer Parameter Header (n) JEDEC/Vender define Identify JECEC or vender ID, revision, length and table pointer (optional) Parameter Table (0) JEDEC STD Identify the basic features of flash memory device Parameter Table (n) JEDEC/Vender define Publication Number: AN-114 3 Identify features by JEDEC or flash vender (optional) REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 22222 SFDP Header & Parameter Header Definition The ‘SFDP Header’ is located at address 0x0000 of the SFDP data structure and use 2 DWords (8 bytes). Each ‘Parameter Header’ also uses 2 DWords following by the ‘SFDP Header’. (1) SFDP Header: It combines with 2 DWords. 1st DWord is SFDP signature, and it indicates serial flash supporting SFDP. 2nd DWord defines SFDP revision, and the total number of parameter header. (2) Parameter Header: SFDP may include one or more parameter headers; each header is fixed to 2 DWords length. The 1st parameter header is defined by 3rd and 4th DWords from JEDEC, which includes parameter table length, revision, JEDEC ID and parameter table pointer that specified mapping parameter table. Following header may be defined by JEDEC or flash vender, and the format is same as first parameter header. (Each header will be mapped to an individual parameter table.) Figure 1 displays the ‘SFDP Header’ & ‘Parameter Header’ structure; address 0x00 ~ 0x07 (2 DWords or 8 bytes) are for the SFDP Header, and address 0x08 ~ 0x0F are the ‘1st Parameter Header’ area. Other headers are optional, which continue after the 1st parameter header. Publication Number: AN-114 4 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction Figure 1: Overall SFDP Header Structure Publication Number: AN-114 5 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 22222 SFDP Parameter Table Definition The SFDP Parameter Table locates after the Parameter Header; each ‘Parameter Table’ will be mapped by a pointer of individual ‘Parameter Header’, and parameter table address is re-locatable. Parameter tables may be located anywhere in the SFDP space, and they don’t need to immediately follow the parameter headers. The table content shows serial flash specifications, which value may be various depending on different density and different serial flash product lines. Macronix Serial Flash provides two parameter tables currently, Parameter Table (0) is JEDEC standard, which defines serial flash standard features, and Parameter Table (1) is defined by Macronix, which includes enhanced functions of serial flash. Table 2 is the summary of SFDP parameter tables’ definition, including JEDEC-defined table and Macronix-defined table. Table 2. SFDP Parameter Table Definition and Content Table Length JEDEC Parameter Table (0) 9 DWords STD 4 DWords Macronix defines Parameter Table (1) Publication Number: AN-114 Maker Definition / Function Sector size, BP bits type 4KB Erase opcode Read mode, Address mode, DTR mode Flash density Read mode interface, Mode bits, dummy cycle Sector size, Sector erase opcode Voltage range Reset#, Hold# pin, Deep Power Down, S/W Reset function, Suspend/Resume,Wrap-Around read Security function 6 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 22222 SFDP Parameter Header and Table Mapping Number of Parameter (NPH) information can be received from SFDP Header; Macronix supports 2 Parameter Header now. The SFDP parameter table located address is from Header’s pointer, so designer should get Header’s pointer address first, then knows parameter table location. Each Header’s pointer indicates one individual table. Figure 2 shows the SFDP Structure of NPH and how Parameter Table Pointer indicates parameter table location. The flowchart will be introduced by the following section. Figure 2: SFDP Mapping Diagram Function Type Address SFDP Signature: 0x50444653 (“SFDP” string) SFDP Header 1st Parameter Header 2nd Parameter Header Unused 0xFF Number of Parameter Header (NPH)*: 0x01 0x04 SFDP version JEDEC ID, Parameter version, Parameter Table length Unused 0xFF Parameter Table (0) Pointer: PTP0 JEDEC ID, Parameter version, Parameter Table length Unused 0xFF 0x00 Parameter Table (1) Pointer: PTP1 0x08 0x0C 0x10 0x14 Reserved Area (for new Header) Parameter Table (0) Parameter Table (0) PTP0* Reserved Area Parameter Table (1) Parameter Table (1) PTP1* Reserved Area (for new Table) Remark: * Number of Parameter Header (NPH): 0x01 means 2 Parameter Headers * PTP0: Parameter Table Pointer for Table 0, Macronix defines as 0x30 * PTP1: Parameter Table Pointer for Table 1, Macronix defines as 0x60 Parameter Table (0) starts from address 0x30, Parameter Table (1) starts from address 0x60 Publication Number: AN-114 7 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 333 SFDP Timing Diagram The simple 5Ah command enters SFDP mode and a uniform timing to access SFDP data. 33333 Single I/O (1-1-1*) read timing diagram Single I/O read is the basic I/O mode to read SFDP. The sequence of issuing RDSFDP instruction with single I/O mode: “CS# low → RDSFDP (5Ah) command → 24-bit address on SI pin → 8-bit dummy cycles on SI pin → read SFDP data … → CS# high.” Remark: *(x-y-z): Indicate the opcode (x), address (y), and data (z). Figure 3: Single I/O Timing Diagram for SFDP Read CS# 0 1 2 3 4 5 6 7 8 9 30 31 39 40 41 42 43 44 45 46 SCLK 24-bit address Opcode SI SO 0 1 0 1 1 0 1 0 23 22 1 0 DOUT1 High Impedance Publication Number: AN-114 Dummy cycles (8) 7 8 6 5 4 3 DOUT2 2 1 0 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 33333 Quad I/O (4-4-4, QPI) read timing diagram Some flash support QPI read mode. The sequence of issuing RDSFDP instruction in QPI mode: “CS# low → RDSFDP 5Ah command (2 cycles) → 24-bit address (6 cycles) → send 8 dummy cycles (8 cycles) → read SFDP data … → CS# high.” Remark: (x-y-z): Indicate the opcode (x), address (y), and data (z). Figure 4: QPI Timing Diagram for SFDP Read CS# 0 1 2 3 6 7 15 16 SCLK Opcode 24-bit address 0 1 5 1 6 2 6 2 7 3 7 3 1 0 20 16 4 0 SO/SIO1 0 1 21 17 5 WP#/SIO2 1 0 22 18 HOLD#/SIO3 0 1 23 19 9 DOUT1 4 SI/SIO0 Publication Number: AN-114 Dummy cycles (8) DOUT2 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 444 Access SFDP RDSFDP (0x5A) command could identify SFDP supporting. Designer gets serial flash specification information from parameter table. Figure 5 shows the continuous read SFDP, and Figure 6 shows random read SFDP. Figure 5: SFDP Read Flow by Continuous Read Start RDSFDP (0x5A) Command @ address 0x0000 Data output = 0x50444653 (SFDP)? * SFDP command: 5Ah * Use exact IO mode No Yes * Identify SFDP supporting: Data = 50444653h (SFDP) * Check version information if necessary * NPH: Check Number of Parameter Header NPH = 0x00: 1 parameter header / table NPH = 0x01: 2 parameter headers / tables Get NPH @ address 0x0006 Set m = 0 as check point * PTP: Parameter Table Point * PTP0 @ 0x0C~0x0E PTP1 @ 0x14 ~ 0x16 Get PTPm @ address [0x0C+8m : 0x0E+8m] * Read Parameter Table PTP0 = 0x30, parameter table (0) PTP1= 0x60: parameter table (1) Read Parameter Table (m) from PTPm address Configure System F/W or System Setup No * SFDP to configure system setup * Read all Parameter Table? m = NPH? m+1 Yes End Publication Number: AN-114 Device doesn’t support SFDP 10 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction Figure 6: SFDP Read Flow by Random Read Start RDSFDP (0x5A) Command @ address 0x0000 Data output = 0x50444653 (SFDP)? * SFDP command: 5Ah * Use exact IO mode * Identify SFDP supporting: Data = 50444653h (SFDP) * Check version information if necessary No Yes * NPH: Check Number of Parameter Header NPH = 0x00: 1 parameter header / table NPH = 0x01: 2 parameter headers / tables Get NPH @ address 0x0006 Set m = desirous header * PTP: Parameter Table Point * PTP0 @ 0x0C~0x0E PTP1 @ 0x14 ~ 0x16 Get PTPm @ address [0x0C+8m : 0x0E+8m] * Read desirous parameter from PTP + offset address Read Parameter Table (m) from PTPm + offset address Configure System F/W or System Setup End Publication Number: AN-114 * SFDP to configure system setup Device doesn’t support SFDP 11 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 555 Summary Serial Flash Discoverable Parameter (SFDP) provides a standard to describe the features of serial flash. It provides a format of table and is similar as CFI mode in parallel flash. Core chip designers can more simply identify serial flash with different vender and density by SFDP read. It not only save development time but also make users use serial flash easily. 666 References The following document content was partially cited for preparing this application note: Document Location Date Issued JEDEC Standard No. 216 Serial Flash Discoverable Parameters (SFDP), for Serial NOR Flash www.jedec.org Apr., 2011 For more functional and parametric specifications, please refer to the datasheet on the Macronix Website at http://www.macronix.com/ and go to: Products/Flash Memory/Serial Flash. Publication Number: AN-114 12 REV. 1.0, SEP 23, 2011 APPLICATION NOTE SFDP Introduction 777 Appendix: Sample Code The Section briefly introduces SFDP read sample code. It is a simple example how designer modifies S/W to read SFDP data out from serial flash. Blue words show main SFDP read action. Read SFDP( ) { } U16 i; CS# low (); // CS# goes low, serial flash starts receive command Send data (0x5A); // Write Read SFDP command Send data (AD1); // Write Sector address = AD1 = A23 – A16 Send data (AD2); // Write Sector address = AD2 = A15 – A8 Send data (AD3); // Write Sector address = AD3 A7 – A0 Send data (0xFF); // Write dummy data For (i=0; i<n; i++) // set a loop to read data into flash’s buffer { // n bytes read out until /CS goes high Array_data = Get data(); } CS# high (); // CS# goes high, SFDP read end Send data (unsigned char indata) { } unsigned char k; for ( k = 0; k++; k< 8) { if( (indata & 0x80) == 0x80) SI = 1; else SI = 0; SCLK = 1; SCLK = 0; indata = (indata << 1); } Unsigned char Get data () { } // Send 1 byte data to Serial flash //Receive a byte from Serial flash unsigned char k, temdata =0, i; for ( k = 0; k++; k< 8) { if ( SO == 1 ) { i = (0x80 >> k); temdata = (temdata || i); } SCLK = 1; SCLK = 0; } return (temdata); Publication Number: AN-114 13 REV. 1.0, SEP 23, 2011 APPLICATION NOTE Except for customized products which has been expressly identified in the applicable agreement, Macronix's products are designed, developed, and/or manufactured for ordinary business, industrial, personal, and/or household applications only, and not for use in any applications which may, directly or indirectly, cause death, personal injury, or severe property damages. In the event Macronix products are used in contradicted to their target usage above, the buyer shall take any and all actions to ensure said Macronix's product qualified for its actual use in accordance with the applicable laws and regulations; and Macronix as well as it’s suppliers and/or distributors shall be released from any and all liability arisen therefrom. Copyright© Macronix International Co., Ltd. 2011. All rights reserved. Macronix, MXIC, MXIC Logo, MX Logo, Integrated Solutions Provider, NBit, NBiit, Macronix NBit, eLiteFlash, XtraROM, Phines, BE-SONOS, KSMC, Kingtech, MXSMIO, Macronix vEE are trademarks or registered trademarks of Macronix International Co., Ltd. The names and brands of other companies are for identification purposes only and may be claimed as the property of the respective companies. For the contact and order information, please visit Macronix’s Web site at: http://www.macronix.com MACRONIX INTERNATIONAL CO., LTD. reserves the right to change product and specifications without notice. 14