TECHNICAL NOTE Migrating Low Density SPI EEPROM to Macronix Serial Flash 1. Introduction This application note serves as a guide to migrate low density SPI EEPROM to Macronix 512Kb low density Serial Flash. The application note does not apply to I2C EEPROMs. Due to architecture differences, EEPROM and Flash memory require different sequences to program data into their memory array. EEPROM Write and Erase operations are performed on a byte-per-byte basis with only one command. When using flash memory however, the system must use two different commands to complete program operations. Flash memory requires a sector erase, block erase or chip erase to be completed before programming data into the memory array. In this application note, the Macronix MX25V512E Serial Flash and Atmel AT25256B SPI EEPROM are used for comparison. The document does not provide detailed information on each individual device, but highlights the similarities and differences between them. The comparison covers the general features, performance, command codes, and other differences. Newer versions of the datasheets may override the contents of this document. 2. Features Macronix serial flash and SPI EEPROM have similar features and functions as shown in Table 1. Significant differences are highlighted in blue and may require special considerations. Table 2-1: Feature Comparison Type / Function Supply Voltage Range Fast Read (1-1-1)1 Macronix Serial Flash MX25V512E Atmel SPI EEPROM AT25256B 2.35V-3.6V 1.8V-5.5V Yes - Dual Output (1-1-2)1 Normal Read Clock Frequency Fast Read Clock Frequency (x1) Sector Size Yes - 33MHz 75MHz 5~20MHz2 - 4KB - 256Byte 64Byte HOLD# Pin Yes Yes Block Protection Mode Yes Yes 3 100K 20Yr 1M 100Yr 8-USON (2x3mm) Yes - 8-TSSOP (173mil) Yes Yes 8-SOP (150mil) Yes Yes - Yes Program Buffer Size Endurance (Program/Erase Cycles) Data Retention (min.) Packages 8-VFBGA Notes: 1. x-y-z in I/O mode indicates the number of active pins used for op-code(x), address(y) and data(z). 2. 5MHz at VCC = 1.8V-5.5V to 20MHz with restricted voltage range = 4.5V-5.5V. 3. Atmel endurance characterized at 3.3V, 25C, Page Mode. Macronix endurance per 4KB sector. Publication Number: AN- 0254 1 Rev. 01 July 1, 2013, 2013 TECHNICAL NOTE 3. Key Feature and Operational Differences This section will describe some of the key features and operational differences in depth. 3-1. Programming SPI EEPROMs do not require an erase before a write data operation. However, the Macronix Serial Flash does require an erase before program data operation. This will require firmware modification as even a single byte write to serial flash will require at least a 4KB sector to be erased first, followed by a re-write of the entire sector. A read-modify-write scheme may need to be utilized where the sector is first read to an external buffer where data is modified, the sector is erased, and the modified data is rewritten to the flash. SPI EEPROM receives command 02h for a programming operation directly after a 06h Write Enable command is issued. The MX25V512E must utilize an Erase command such as Sector Erase(20h), Block Erase(52h/D8h), or Chip Erase(60h/C7h) before a Page Programming command (02h). The MX25V512E Sector Erase command (20h) erases 4K bytes. After the sector erase operation is done, all of the data within the erased sector are FFh. The system can then issue the Program command (02h) to program one or more bytes (maximum is one page or 256 bytes) anywhere in the sector. Additional bytes may be programmed later to unused locations in the same sector without another erase operation. Because the MX25V512E flash memory array is comprised of one 64KB block (subdivided into sixteen 4KB sectors) the Block Erase and Chip Erase commands (60h/C7h) can be used interchangeably, as they both erase the entire chip (64KB = 512Kb). A Block Erase performs the same function as Sector Erase, but the erased area is increased from 4K bytes to 64K bytes. After the block erase operation (52h/D8h) is done, all data within the erased block/chip are FFh. Again, the system can then issue a Program command (02h) to program one or more bytes (maximum is one page or 256 bytes) anywhere in the block/chip. Additional bytes may be programmed later to unused locations in the same block/chip without another erase operation. The SPI Flash Erase and Program Flow is shown in Figure 3-1. 3-1. ID command Some SPI EEPROM devices do not support the read identification command. The MX25V512E supports the Read ID command (9Fh) and returns the Macronix manufacturer ID of C2h and memory type ID 20h. Table 3-1: Manufacturer and Device ID Comparison ID Type Macronix Serial Flash MX25V512E Atmel SPI EEPROM AT25256B C2h N/A Manufacture ID Device ID Memory Type 20h N/A Memory Density 10h N/A Publication Number: AN- 0254 2 Rev. 01 July 1, 2013, 2013 TECHNICAL NOTE Figure 3-1. SPI Flash Erase and Program Flow * Assumes device is idle and no error conditions exist Start WREN command RDSR command WEL = 1? No * Check Status Register bit-1 Yes Program command+Addr+Data or Erase command+Addr * No Addr required for Chip Erase RDSR command WIP and WEL = 0? No * Check Status Reg. bits 1 and 2 Yes Read Array Data (same addr of PGM/ERS) No Verify OK? Yes Program/Erase successful Program/Erase another block? Program/Erase fail Yes Program/Erase completed End Publication Number: AN- 0254 3 Rev. 01 July 1, 2013, 2013 TECHNICAL NOTE 4. Package and Pinout Comparison Both device types are available in 150mil 8-SOP and 173mil 8-TSSOP packages with similar footprints and pinouts as shown in Table 4-1. Table 4-1: Package Pin Comparison 8-SOP and 8-TSSOP MX25V512E CS# SO/SIO1 WP# GND AT25256B CS# SO WP# GND Publication Number: AN- 0254 AT25256B 1 2 3 4 8 7 6 5 4 VCC HOLD# SCK SI MX25V512E VCC HOLD# SCLK SI/SIO0 Rev. 01 July 1, 2013, 2013 Macronix Confidential APPLICATION NOTE 5. Performance Tables 5-1 and Table 5-2 show AC and DC information for the two devices. Table 5-1: AC Parameter Comparison Symbol Parameter Macronix Atmel Condition Macronix MX25V512E Atmel AT25256B - 2.35V -3.6 V 1.8V – 5.5V Supply Voltage Range - Normal Read Frequency - - - 25MHz Fast Read Frequency - - 1 I/O 75MHz Clock High/Low Time tCH/tCL tCLQV tWH/tWL min 6~13ns 20~80ns Clock Low to Output Valid tV max@10pF 6ns 20~80ns Data In Setup Time tDVCH tSU min 2ns 5~20ns Data In Hold Time tCHDX tH min 5ns 5~30ns typ 0.7ms - max 1ms 5ms typ 60ms - max 300ms - typ 0.5s - max 1s - Page Program Time Sector Erase (4KB) Time Block Erase (64KB) Time and Chip Erase Time - tPP tWC tSE - tBE / tCE - Table 5-2: DC Parameter Comparison Symbol Parameter Macronix Atmel Condition Macronix MX25V512E 5~20MHz - Atmel AT25256B Leakage Current ILI/ILO IIL/IOL max. +/- 2uA +/-3 uA Standby Current ISB1 ISB3 max 25uA 5uA Deep Power Down Current ISB2 - typ 5uA - max 10uA - 4mA 10mA 10mA - 20mA 15mA 15mA 20mA 7mA - VCC Read Current ICC1 ICC1 max @ 20MHz max @ 33MHz max @ 66MHz VCC Program Current VCC Write Status Register Current VCC Sector Erase Current VCC Chip Erase Current ICC2 ICC3 ICC4 ICC5 ICC2 - max max max max Publication Number: AN- 0254 5 Rev. 01 July 1, 2013, 2013 APPLICATION NOTE 6. Command Code Table 6-1: Command Code Comparison Command Symbol RDID RES ID Read REMS READ FAST READ READ SFDP SE BE (64K) CE PP WREN WRDI DP RDP WRSR RDSR Read Erase Program Mode Register Description Macronix MX25V512E Atmel AT25256B 9Fh ABh - 90h - 03h 0Bh 5Ah 20h 52h/D8h 60h/C7h 02h 06h 04h B9h ABh 01h 05h 03h 02h 06h 04h 01h 05h Read Identification Read Electronic ID Read Electronic Manufacturer & Device ID Read Data Fast Read (1-1-1) Read SFDP (MX25L512E) only) Sector Erase (4KB) Block Erase (64KB) Chip Erase Page Program Write Enable Write Disable Deep Power Down Release from Deep Power Down Write Status Register Read Status Register 7. Summary The Macronix MX25V512E Serial NOR flash and Atmel SPI EEPROM have similar commands, functions, features, supported package types and pinout definitions. The primary difference that needs to be accommodated is that SPI EEPROM does not require an erase before a write data operation while flash does. This will require firmware modification as even a single byte write to serial flash will require at least a 4KB sector to be erased first, followed by a re-write of the entire sector. A read-modify-write scheme may need to st be utilized where the sector is 1 read to an external buffer where data is modified, the sector is erased, and the modified data is rewritten to the flash. 8. References Table 8-1 shows the datasheet versions used for comparison in this application note. For the most current, detailed Macronix specification, please refer to the Macronix Website at http://www.macronix.com Table 8-1: Datasheet Version Datasheet MX25V512E AT25256B Location Date Issued Version Macronix Website May 2013 1.1 Atmel Website Aug. 2011 8698C 9. Revision History Revision Date Description 01 July 1, 2013 Initial Release Publication Number: AN- 0254 6 Rev. 01 July 1, 2013, 2013 APPLICATION NOTE Except for customized products which have 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. 2013. All rights reserved, including the trademarks and tradename thereof, such as Macronix, MXIC, MXIC Logo, MX Logo, Integrated Solutions Provider, NBit, NBiit, Macronix NBit, eLiteFlash, XtraROM, Phines, KH Logo, BE-SONOS, KSMC, Kingtech, MXSMIO, Macronix vEE, Macronix MAP, Rich Audio, Rich Book, Rich TV, and FitCAM. The names and brands of third party referred thereto (if any) are for identification purposes only. For the contact and order information, please visit Macronix’s Web site at: http://www.macronix.com Publication Number: AN- 0254 7 Rev. 01 July 1, 2013, 2013