EMMC Lifetime (AN50)

From conga-wiki
Affected Products All congatec products with eMMC

Preface

This application note explains how to estimate, increase, and monitor eMMC lifetime.

Terminology

Term Description
eMMC Embedded Multi-Media Card
OTP One Time Programmable
ECC Error Correction Code
P/E Program-Erase
SLC Single Level Cell
MLC Multi Level Cell
TLC Triple Level Cell
QLC Quadruple Level Cell
pSLC Pseudo  Single Level Cell

Introduction to eMMC Lifetime

Embedded Multi-Media Cards (eMMCs) are based on NAND flash. All NAND flash-based storage devices have a limited lifetime.

In simple terms, programming and erasing data gradually weakens a NAND flash cell until it can no longer properly hold a charge or differentiate between the voltage levels. This phenomenon limits the lifetime of an eMMC. A detailed explanation of this phenomenon is outside the scope of this application note.

Flash Controller

The flash controller is part of an eMMC. It improves the lifetime of the NAND flash via various features, such as:

  • Wear Leveling Repeated writes to the same memory cell eventually lead to the cell no longer being able to retain data. The wear leveling feature ensures that the data is distributed evenly.
  • Bad Block Management A bad block is a flash block that cannot be successfully written or erased without bit-errors. Information about existing bad blocks is stored on the device by the manufacturer. Additional bad blocks can develop over time. The flash controller recognizes them and adds them to the list of bad blocks. Future write/erase procedures can work around these bad blocks.
  • ECC Error correction code is used to identify and correct errors. This is typically achieved by adding a number of redundant bits to a data string. The encoded message can then be decoded by the controller to check for and correct bit errors in the message.
  • Garbage Collection If data within certain pages of a block is no longer needed, the controller can just read back and rewrite the necessary data to a previously erased empty block. The leftover pages can then be used for new data.

Flash Cell Types

eMMCs implement one main flash cell type. The different types can store different numbers of bits per cell. Flash cell types with a lower number of bits per cell can typically endure a significantly higher number of Program-Erase (P/E) cycles.

The table below compares the different flash cell types. Use the stated P/E cycles as a guideline only and request them from your FAE for a particular congatec product.

SLC

Single Level Cell

3D-MLC

Multi Level Cell

3D-TLC

Triple Level Cell

3D-QLC

Quadrupel Level Cell

Bits/Cell 1 2 3 4
Density Low Mid High Highest
P/E Cycles ~100,000 ~5,000 ~3,000 ~1,000


Note:

The flash cell types with planar (2D) or 3D NAND technology feature different P/E cycle values. 3D NAND flash increases capacity and reliability of an eMMC.

Enhanced User Area and pSLC Mode

The JEDEC JESD84-B51 standard describes a storage mode, whereas all or parts of the eMMCs memory can be reconfigured to a more robust and reliable mode.

How the enhanced user area is implemented is up to the eMMC manufacturer.

For eMMCs that are used on congatec products, the enhanced user area is pseudo-SLC mode.

This mode greatly increases the maximum number of P/E cycles by reducing the bits per cell to one, same as SLC. That’s why this mode is called pseudo-SLC.

The trade-off is a greatly reduced storage capacity – it is divided by the bits per cell of the flash cell type (e.g., leaves 1/3 of the original storage capacity of an eMMC with TLC flash cell type).

To enable this mode, refer to section 3.2.


Note:

The enhanced user area mode for eMMCs on congatec products is pSLC.

Estimating the eMMC Lifetime

The amount of logic data that can be written to the eMMC until the end of its lifetime can be estimated with this formula:

TBW = DC * EF / WAF
TBW Total Bytes Written throughout the lifetime of the eMMC.
DC Device Capacity in bytes.
EF Endurance Factor. Use the max. P/E cycles of the eMMC. Request it from your FAE for a particular congatec product.
WAF Write Amplification Factor. Basically, NAND flash organizes data in groups. Data can only be programmed in groups (pages) and erased in groups of pages (blocks).  A page can be several KB or even MB in size and a block can consist of hundreds of pages. This typically means that the actual amount of physical data written to the NAND flash is a factor of 8 to 20 times greater than the logic data written by the host. This phenomenon is called Write Amplification (WA). A more detailed description of this phenomenon is beyond the scope of this application note.  

Divede the TBW by the average logic data written to estimate the lifetime in number of days.

Example

In this example, we estimate the lifetime of a conga-SA5/i-E3950-4G eMMC32 (Revision B.3). This module uses an eMMC with 3D TLC NAND flash technology that supports 3,000 P/E cycles. We assume an inefficient WAF of 20 for our specific use case.

Filling in these values into the previously mentioned formula gives us the following TBW:

TBW = 32 GB * 3,000 / 20 = 4.8 TB

If we assume that 1 GB of logic data is written to the eMMC on average per day, we can estimate the lifetime in days:

Lifetime = 4,8 TB / 1 GB / day = 4800 days or 13.15 years


Note:

Request the P/E cycle value from your FAE for a particular congatec product.

Increasing the eMMC Lifetime

The sections below provide some general guidelines and special procedures that can increase the lifetime of eMMCs. Section 3.2.1 describes prerequisites that apply to several procedures.

General Guidelines

The formula in section 2 introduced variables that influence the lifetime of all eMMC devices. Based on these variables, the following general guidelines can be deduced:

  1. Use a congatec product with a larger device capacity (DC)
  2. Decrease the amount of logic data Adjust applications to decrease the writing frequency and only writing necessary data. Outsource frequently changed data to a different medium whenever possible (i.e. logs).
  3. Decrease the amount of physical data (WAF)
Adjust applications to write more efficient, bigger sequential writes to the eMMC instead of smaller randomized writes. The ideal size depends on the page sized. Another way is described in section "Enabling eMMC Cache"

Enabling Enhanced Mode (pSLC)

This section explains how to enable the enhanced mode. As explained is section "Enhanced User Area and pSLC Mode", the pSLC enhanced mode can be enabled on some eMMCs to greatly increases their lifetime at the expense of storage capacity.


Note:

The procedure was tested on Ubuntu 2.04.1 LTS with kernel 5.8.0-38-generic.

Prerequisites

Follow the instructions below to prepare for enbaling the pSLC mode:

  1. Install a Linux based operating system on a medium that is not the target eMMC
  2. Install mmc-utils
sudo apt-get install mmc-utils
  1. List all available eMMC devices
dmesg | grep mmc Example console output: […] mmc1: new HS400 MMC card at address 0001 mmcblk1: mmc1:0001 M5232 28.5GiB
  1. Identify your target eMMC disk name from the output (e.g. mmcblk1)
  2. Ensure that the target eMMC is of standard 5.0 or higher with extended CSD register revision 1.7 or higher
sudo mmc extcsd read /dev/yourtargetdiskname | head -n 3
Example console output:
==========================================
Extended CSD rev 1.7 (MMC 5.0)
==========================================


Note:

Replace "yourtargetdiskname" with your target eMMC disk name in all commands.

If these two conditions are met, the pSLC mode can be enabled on the target eMMC.

Enabling Enhanced Mode (pSLC)

Caution:

The procedures described in this section erase all data on your target eMMC and permanently decrease its storage capacity. This procedure is non-reversible (OTP).


Note:

The procedure described in this section can also be used to enable pSLC on one or more partitions. The storage capacity of the other partitions is not reduced. This way, write-intensive tasks may be relocated to a pSLC partition while other partitions can keep their original (larger) storage capacity for less write-intensive tasks.

Replace "yourtargetdiskname" with your target eMMC disk name in all commands.

Follow the instructions below to enable the pSLC mode on the target eMMC.

The example console outputs refer to a setup with a 32GB 3D-MLC device.

  1. Find the maximum size of the target eMMC disk after reconfiguring to pSLC mode:
sudo mmc extcsd read /dev/yourtargetdiskname | grep ENH_SIZE_MULT -A 1
Example console output:
Max Enhanced Area Size[MAX_ENH_SIZE_MULT]: 0x0001c8 i.e. 14942208 KiB
  1. Set the enhanced attribute for the target partition to the size reported from the previous step
sudo mmc enh_area set -y 0 14942208 /dev/yourtargetdiskname
  1. Perform a power cycle.
  1. Confirm ENH_SIZE_MULT:
sudo mmc extcsd read /dev/yourtargetdiskname | grep ENH_SIZE_MULT -A 1
Check if the reported MAX_ENH_SIZE_MULT matches ENH_SIZE_MULT.
  1. Confirm new size of the target partition with the size reported from step 1:
sudo fdisk -l /dev/yourtargetdiskname
Example console output:
Disk /dev/yourtargetdiskname : 14,26 GiB [...]

The pSLC mode is now enabled on your target eMMC.

Enabling eMMC Chache

eMMC cache decreases the WAF in case small blocks must be written and cannot be avoided by an application. The eMMC cache is usually turned on by default.

Follow the instructions below to check if the eMMC cache is enabled and, if necessary, to enable it:

  1. Follow the instructions in section "Prerequisites" until step 4
  1. Retrieve cache information from EXT_CSD register
sudo mmc extcsd read /dev/yourtargetdiskname | grep CACHE_CTRL
Example console output (0x00 means cache is OFF; 0x01 means cache is ON):
Control to turn the Cache ON/OFF [CACHE_CTRL]: 0x00
==========================================

Note:

Replace "yourtargetdiskname" with your target eMMC in all commands.

  1. Enable eMMC Cache
sudo mmc cache enable /dev/yourtargetdiskname
  1. Perform a Powe Cycle
  2. Repeat step 2 to verify that the value is 0x01
The eMMC cache is enabled now.

Monitoring eMMC Health Status

Beginning with the JEDEC eMMC 5.0 standard, the Extended Card-Specific Data register features lifespan monitoring data.

Follow the instructions below to retrieve this data:

  1. Follow the instructions in section "Prerequisites" until step 4
  2. Retrieve lifespan information from the EXT_CSD register
sudo mmc extcsd read /dev/yourtargetdiskname | grep -A 1 LIFE

Example console output:

eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x01
eMMC Life Time Estimation B [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x01
eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x01

For DEVICE_LIFE_TIME_EXT_TYP_[A;B], eMMC manufacturers must adhere to a scheme where:

  • 0x01 -  0%-10% of device lifetime is used
  • 0x02 - 10%-20% of device lifetime used
  • … and so on in steps of 10%
  • 0x0B - Lifetime of the device is exceeded


DEVICE_LIFE_TIME_EXT_TYP_A reports the lifespan data of flash cells that are in their base configuration.

DEVICE_LIFE_TIME_EXT_TYP_B reports the lifespan data of flash cells configured to enhanced mode (pSLC).


Note:

DEVICE_LIFE_TIME_TYP_B is always reported for eMMCs that feature the enhanced mode - even if an enhanced user area is not configured - because specific partitions are permanently configured to this mode. Refer to JEDEC standard JESD84_B51 for more information about default partitions.

For PRE_EOL_INFO, eMMC manufacturers must adhere to a scheme where:

  • 0x01 - Normal: Consumed less than 80% of the reserved blocks
  • 0x02 - Warning: Consumed 80% of the reserved blocks
  • 0x03 - Urgent: Consumed 90% of the reserved blocks. Urgent end-of-life warning.

Caution:

The eMMC becomes read-only when 100% of the reserved blocks are consumed. New data will not be saved and may get lost.