Skip to main content
  • Products
  • Software evaluation
  • Downloads
  • Free utilities
  • Purchase
  • Silicon Vendors
  • Support
  • About us
  • Blog
  • Forum
  • Search
  • Jobs
  • Newsletter
  • Blog
  • Contact
  • Shop
  • emFile
  • Flash Translation Layer for NAND Flash

    Flash Translation Layer for NAND Flash

    • SLC, MLC NAND Flash, and DataFlash support
    • ECC and fail-safe operation
    • Minimal RAM and ROM usage with high performance
    Contact us Downloads Documentation
    SEGGER emFile
    1. 1.Key features
      1. 1.1.Broad flash support
      2. 1.2.Active and passive wear leveling
      3. 1.3.Error correction
      4. 1.4.Bad-block management
      5. 1.5.Fail-safe operation
      6. 1.6.Low memory footprint
    2. 2.Supported devices
    3. 3.How the Flash Translation Layer works
      1. 3.1.NAND flash organization
      2. 3.2.DataFlash
    4. 4.Management data and spare area
    5. 5.Data reliability and integrity
      1. 5.1.Error correction
      2. 5.2.Data scrubbing
      3. 5.3.NAND write management
    6. 6.Wear leveling
    7. 7.Flash management
    8. 8.Performance and resource usage
    9. 9.Custom hardware support

    Key features

    Icon featuring three stacked rectangles with the letters "X," "Y," and "Z" on them, set against a teal circular background. The rectangles have small lines on either side, suggesting a stylized design.

    Broad flash support

    Supports modern SLC and MLC NAND flash devices using parallel or serial interfaces as well as DataFlash devices.

    A circular teal icon featuring two white arrows forming a loop, symbolizing refresh or synchronization.

    Active and passive wear leveling

    Distributes erase cycles across the NAND flash to extend device lifetime. Passive wear leveling also includes blocks containing static data.

    A teal circular icon featuring a magnifying glass. Inside the lens of the magnifying glass, there is a checkmark and an "X," symbolizing verification or evaluation.

    Error correction

    Detects and corrects single and multiple bit errors in user and management data using hardware ECC or software routines such as emLib ECC.

    A circular icon with a teal background featuring a white graphic of a microchip. The microchip has several small squares, one marked with an "X" and another accompanied by a checkmark.

    Bad-block management

    Automatically detects and excludes defective blocks from data storage, including factory-marked blocks and blocks that become defective during operation.

    A circular teal icon featuring a white padlock, a circular arrow suggesting a refresh or update, and a checkmark. The design symbolizes security and confirmation of a successful action, likely related to data protection or online safety.

    Fail-safe operation

    Uses atomic operations to maintain valid data in case of an unexpected power loss or reset. If a write operation is interrupted, the previously valid data is retained.

    A circular teal icon featuring a white stylized box with a smaller square in its center, representing packaging or storage. The design is simple and modern, emphasizing the box's shape. The background is a transparent grid.

    Low memory footprint

    Optimized for resource-constrained embedded systems, requiring less than 8 KB of RAM in a typical system using a 2 GBit NAND flash device.


    Supported devices

    In general, the Flash Translation Layer supports almost all popular Single-Level Cell NAND flashes (SLC) with a page size larger than 2048+64 bytes. The table below shows the NAND flash devices that have been tested or are compatible with a tested device:

    List of supported NAND flash devices


    How the Flash Translation Layer works

    NAND flash organization

    NAND flash devices consist of physical blocks and pages. A block is the smallest erasable unit, while a page is the smallest writable unit. Pages can be written individually, with bits changing from 1 to 0. Erasing is performed at block level and resets all bits within the block to logical 1.

    Small NAND flash devices with capacities up to 256 MB typically have a page size of 528 bytes, consisting of 512 bytes for user data and 16 spare bytes for management information. Larger NAND flash devices typically use pages of 2112 bytes, consisting of 2048 bytes for user data and 64 spare bytes.

    The Flash Translation Layer can handle common page and block sizes as well as logical sector sizes smaller than the physical page size. This allows emFile to use logical sectors of 512, 1024, or 2048 bytes, for example, on NAND flash with 2 KB pages.

    Signal and pin details

    DataFlash

    The Flash Translation Layer also supports DataFlash devices. DataFlash operates in a similar way to NAND flash but typically offers capacities of only a few megabytes. It is commonly used when a low pin count and simple data transfer are required.

    DataFlash uses an SPI interface for the data transfer with the data being exchanged 8 bits at a time. The most significant bit (MSB) is transferred first.

    Signal and pin details


    Management data and spare area

    The Flash Translation Layer uses the spare area of NAND flash pages to store information required for reliable flash management. This includes:

    • Information about whether a block is valid or defective
    • Mapping information between physical pages and logical sectors
    • Block erase counts for wear leveling
    • Information about whether a page contains valid data
    • Error Correction Codes (ECC) for data integrity

    This information enables the Flash Translation Layer to manage the physical characteristics of NAND flash transparently for the file system.


    Data reliability and integrity

    Error correction

    NAND flash is subject to bit errors that can occur in both user data and management data. The Flash Translation Layer uses Error Correction Codes (ECC) to detect and correct these errors.

    ECC can be calculated using dedicated hardware, such as ECC functionality integrated into the NAND flash device or memory controller, or entirely in software using routines such as those provided by emLib ECC.

    When data is written, the corresponding ECC is calculated and stored in the spare area. During a read operation, the stored ECC is compared with the ECC calculated from the retrieved data. If an error is detected, the Flash Translation Layer attempts to correct the data using the stored ECC.

    Data scrubbing

    Data stored in NAND flash can degrade over time. To maintain data integrity, the Flash Translation Layer performs data scrubbing during read operations.

    During scrubbing, the data is read and checked for errors. Correctable errors are repaired using ECC and the corrected data is written back to the flash, refreshing the stored information before degradation can result in an uncorrectable error.

    The threshold that determines when data is scrubbed is configurable at runtime. This allows the application to balance data integrity against the additional flash wear caused by refreshing data.

    NAND write management

    To increase data reliability, the Flash Translation Layer performs only a single write operation to a NAND flash page between two block erase cycles.

    Avoiding repeated partial-page programming reduces the risk of bit corruption and provides compatibility with modern SLC and MLC NAND flash devices.


    Wear leveling

    NAND flash blocks support only a limited number of erase cycles. The Flash Translation Layer therefore provides both active and passive wear leveling to distribute erase operations across the available flash blocks and extend the usable lifetime of the device.

    The Flash Translation Layer tracks erase counts and selects blocks in a way that prevents individual blocks from being erased significantly more often than others. Blocks containing static data are also taken into account, ensuring that they do not remain permanently unused while other blocks accumulate erase cycles.


    Flash management

    Block grouping

    Block grouping reduces the amount of RAM required for block management, enabling large-capacity NAND flash devices to be used with resource-constrained microcontrollers.

    When block grouping is enabled, multiple consecutive physical blocks are managed as a single block group. This considerably reduces the amount of memory required to administer the NAND flash. The size of a block group can be configured according to the requirements of the application.

    Garbage collection

    The Flash Translation Layer performs garbage collection automatically to reclaim storage occupied by invalid data. If no empty blocks are available for new data, blocks containing invalid data are erased and made available for subsequent write operations.

    Because block erase operations can temporarily reduce write throughput, garbage collection can also be performed while the file system is idle. This allows applications with high or time-critical write requirements to prepare free blocks before they are needed.


    Performance and resource usage

    The Flash Translation Layer is optimized for efficient use of RAM and ROM. Actual memory requirements depend on the runtime configuration and the connected NAND flash device.

    In a typical embedded system using a 2 GBit NAND flash device, the Flash Translation Layer requires less than 8 KB of RAM.

    High transfer speeds can be achieved even on microcontrollers. For example, on a Cortex-M CPU running at 168 MHz, the Flash Translation Layer reaches transfer speeds of up to:

    • 4.6 MB/s for writing
    • 8.0 MB/s for reading

    Actual performance depends on the target hardware, NAND flash device, interface, and system configuration.


    Custom hardware support

    The Flash Translation Layer can be adapted to custom hardware configurations.

    When GPIO pins or a simple memory controller are used to access the NAND flash, typically only the hardware layer needs to be ported. Changes to the physical layer are normally not required.

    When using a specialized memory controller, such as a custom FPGA implementation, the physical layer can be adapted to the controller. In this case, a separate hardware layer may not be required because the memory controller handles the hardware access.


    Interface reference

    Pin description of NAND flash

    PinMeaningDescription
    CEChip EnableThe CE input enables the device. Signal is active low. If the signal is inactive, device is in standby mode.
    WEWrite EnableThe WE input controls writes to the I/O port. Commands, address and data are latched on the rising edge of the WE pulse.
    RERead EnableThe RE input is the serial data-out control. When active (low) the device outputs data.
    CLECommand Latch EnableThis pin should be low, when writing commands to the command register.
    ALEAddress Latch EnableWhen active, an address can be written.
    WPWrite ProtectTypically connected to VCC (recommended), but may also be connected to port pin.
    R/BReady/Busy OutputThe R/B output indicates the status of the device operation. When low, it indicates that a program, erase or read operation is in process. It returns to high state when the operation is completed. It is an open drain output. Should be connected to a port pin with pull-up. If available a port pin which can trigger an interrupt should be used.
    I/O0 - I/O7Data Inputs/OutputsThe I/O pins are used to input command, address and data, and to output data during read operations.
    I/O8 - I/O15Data Inputs/OutputsI/O8 - I/O15 16-bit flashes only.

    Pin Description of DataFlash

    PinMeaningDescription
    CSChip SelectThis pin selects the DataFlash device. The device is selected, when CS pin is driven low.
    SCLKSerial ClockThe SCLK pin is an input-only pin and is used to control the flow of data to and from the DataFlash. Data is always clocked into the device on the rising edge of SCLK and clocked out of the device on the falling edge of SCLK.
    SISerial Data InThe SI pin is an input-only pin and is used to transfer data into the device. The SI pin is used for all data input including opcodes and address sequences.
    SOSerial Data OutThis SO pin is an output pin and is used to transfer data serially out of the device.
    • User manual
    • Online documentation
    • List of downloads
    • Download for evaluation
    • Release notes
    • Update notification
    • Pricing
    • Support
    • Silicon vendor resources

    Headquarters

    SEGGER Microcontroller GmbH

    Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    info@segger.com
    Tel.: +49-2173-99312-0
    Fax: +49-2173-99312-28

    Locations

    USA: SEGGER Microcontroller Systems LLC

    Boston area
    101 Suffolk Lane
    Gardner, MA 01440, USA
    us-east@segger.com
    Tel.: +1-978-874-0299
    Fax: +1-978-874-0599

    Silicon Valley
    Milpitas, CA 95035, USA
    us-west@segger.com
    Tel.: +1-408-767-4068

    China: SEGGER Microcontroller China Co., Ltd.

    Room 218, Block A, Dahongqiaoguoji
    No. 133 Xiulian Road
    Minhang District, Shanghai 201199, China
    china@segger.com
    Tel.: +86-133-619-907-60

    ISO 9001
    ISO 27001
    First-class embedded software tools since 1992
    Designed and made in Germany
    • Imprint
    • Disclaimer
    • Code of Conduct
    • Privacy Policy
    © 2026 SEGGER - All rights reserved.