Segger Logo Embedded Software Solutions
Software productsHardware productsDownloadsPricesCustomersOur PartnersSitemapForumAbout us
emFile - NOR flash driver
| General Info | Journaling | Performance & Resource | CompactFlash card & IDE driver | MultiMedia & SD card driver | NAND flash driver | NOR flash driver | RAM disk driver | WinDrive driver |

Supported hardware

The NOR flash driver can be used with any CFI compliant 16-bit chip. The Common Flash Memory Interface (CFI) is an open specification which may be implemented freely by flash memory vendors in their devices. It was developed jointly by Intel, AMD, Sharp, and Fujitsu. The idea behind CFI was the interchangeability of current and future flash memory devices offered by different vendors. If you use only CFI compliant flash memory chips, you are able to use one driver for different flash products by reading identifying information out of the flash chip itself. The identifying information for the device, such as memory size, byte/word configuration, block configuration, necessary voltages, and timing information, is stored directly on the chip.

Tested and compatible NOR flashes

In general, the driver supports almost all serial and parallel NOR flashes which fulfill the listed requirements. This includes NOR flashes with 1x8-bit, 1x16-bit and 2x16- bit interfaces.
The table below shows the serial NOR flashes that have been tested or are compati- ble with a tested device:

Manufacturer Device Size
ST Microelectronics M25P40
M25P80
M25P16
M25P32
M25P128
4 Mbytes (512 Kbytes x 8)
8 Mbytes (1Mbytes x 8)
16 Mbytes (2Mbytes x 8)
32 Mbytes (4Mbytes x 8)
128 Mbytes (16Mbytes x 8)

The table below shows the parallel NOR flashes that have been tested or are compatible with a tested device:

Manufacturer Device Size [Bits]
Intel Intel 28FxxxP30
Intel 28FxxxP33
64 Mbytes - 1 Gbytes
64 Mbytes - 512 Mbytes
ST-Microelectronics M28W160
M28W320
M28W640
M29F080
M29W160
M29W320
M29W640
M58LW064
16 Mbytes (1 Mbytes x 16)
32 Mbytes (2 Mbytes x 16)
64 Mbytes (4 Mbytes x 16)
8 Mbytes (1 Mbytes x 8)
16 Mbytes (2 Mbytes x 8 or 1 Mbytes x 16)
32 Mbytes (4 Mbytes x 8 or 2 Mbytes x 16)
64 Mbytes (8 Mbytes x 8 or 4 Mbytes x 16)
64 Mbytes (8 Mbytes x 8, 4Mbytes x 16)
Micron MT28F128
MT28F256
MT28F320
MT28F640
128 Mbytes
256 Mbytes
32 Mbytes
64 Mbytes

Support for devices not available in this list

Most other NOR flash devices are compatible with one of the supported devices. Thus the driver can be used with these devices or may only need a little modification, which can be easily done. Get in touch with us, if you have questions about support for devices not in this list.

Theory of operation

Differentiating between "logical sectors" or "blocks" and "physical sectors" is very essential to understand this section. A logical sector/block is the base unit of any file system, its usual size is 512 bytes. A physical sector is an array of bytes on the flash chip that are erased together (typically between 2 Kbytes - 128 Kbytes). The flash chip driver is an abstraction layer between these two types of sectors. Every time a logical sector is being updated, it is marked as invalid and the new content of this sector is written into another area of the flash. The physical address and the order of physical sectors can change with every write access. Hence, there cannot exist a direct relation between the sector number and its physical location. The flash driver manages the logical sector numbers by writing it into special headers. It does not matter to the upper layer were the logical sector is stored or how much flash memory is used as a buffer. All logical sectors (starting with Sector #0) do always exist and are always available for user access. Using the same

NOR flash for code and data

Most NOR flashes cannot be read out during a program, erase or identify operation. This means that code cannot be read from the NOR flash during a program or erase operation. If code which resides in the same NOR flash used for data storage is executed during program or erase, a program crash is almost certain. There are multiple options to solve this:

  1. Use multiple NOR flashes. Use one flash for code and one for data.
  2. Use a NOR flash with multiple banks, which allows reading Bank A while BANK B is being programmed.
  3. Make sure the hardware routines which program, erase or identify the NOR flash are located in RAM and interrupts are disabled.

Physical interfaces

A device can consist of a single or two identical CFI compliant flash interfaces with a 16-bit interface. The most common is a CFI compliant NOR flash chip with a 16-bit interface.

Beside this solution, emFile supports two CFI compliant NOR flash chips with a 16-bit interface which are connected to the same address bus.

The emFile NOR flash driver supports both options.

Fail-safe operation

The emFile NOR driver is fail-safe. That means that the driver makes only atomic actions and takes the responsibility that the data managed by the file system is always valid. In case of power loss or power reset during a write operation it is always assured that only valid data is stored in the flash. If the power loss interrupts the write operation, the old data will be kept and not corrupted.

Wear leveling

Wear leveling is supported by the driver. Wear leveling makes sure that the number of erase cycles remains approximately equal for each sector. Maximum erase count difference is set to 5. This value specifies a maximum difference of erase counts for different physical sectors before the wear leveling uses the sector with the lowest erase count.