4. Low-Level Access
Low-level access to a physical flash memory by device driver software is different from accessing common memories. Whereas a common RAM will simply respond to read and write operations by returning the contents or altering them immediately, flash memories need special considerations, especially when used as program memory to a read-only memory (ROM).
While reading data can be performed on individual addresses on NOR memories (not on NAND memories) unlocking (making available for erase or write), erasing and writing operations are performed block-wise on all flash memories. A typical block size will be 64, 128, or 256 KiB.
4.1 NOR Memories
The read-only mode of NOR memories is similar to reading from a common memory, provided address and data bus is mapped correctly, so NOR flash memory is much like any address-mapped memory. NOR flash memories can be used as execute-in-place memory, meaning it behaves as a ROM memory mapped to a certain address.
When unlocking, erasing or writing NOR memories, special commands are written to the first page of the mapped memory. These commands are defined as the common flash interface (defined by Intel) and the flash circuit will provide a list of all available commands to the physical driver.
Apart from being used as a ROM, the NOR memories can of course also be partitioned with a file system and used as any storage device.
4.2 NAND Memories
NAND flash memories cannot provide execute-in-place due to their different construction principles. These memories are accessed much like block devices such as hard disks or memory cards. When executing software from NAND memories, virtual memory strategies are used: memory contents must first be paged into memory-mapped RAM and executed there, making the presence of a memory management unit (MMU) on the system absolutely necessary.
4.3 Difference between NAND and NOR Flash memories
NOR offers faster read speed and random access capabilities, making it suitable for code storage in devices such as PDAs and cell phones. However, with NOR technology, write and erase functions are slow compared to NAND. NOR also has a larger memory cell size than NAND, limiting scaling capabilities and therefore achievable bit density compared to NAND.
Conversely, NAND offers fast write/erase capability and is slower than NOR in the area of read speed. NAND is, however, more than sufficient for a majority of consumer applications such as digital video, music or data storage. NAND's fast write/erase speed combined with its higher available densities and a lower cost-per-bit than NOR make it the favored technology for file storage in a host of consumer applications. Offering users the ability to rewrite data quickly and repeatedly, NAND is typically used for storing large quantities of information in devices such as Flash drives, MP3 players, multi-function cell phones, digital cameras and USB drives.
NAND vs. NOR
NAND's advantages are fast write (program) and erase operations, while NOR's advantages are random access and byte write capability. NOR's random access ability allows for execute in place (XiP) capability, which is often a requirement in embedded applications. The disadvantages for NAND are slow random access, while NOR is hampered by are slow write and erase performance. NAND is better suited for file applications. However, more processors include a direct NAND interface and can boot directly from NAND (without NOR).