# Flash wear leveling and life expectancy

#1

How is flash wear leveling performed? How to calculate the life expectancy of a flash device?

Life expectancy of any flash device is determined by the number of erase cycles that can be performed on the memory blocks. Sierra Wireless supports flash memory devices that can sustain at least 100,000 erase cycles. Flash wear leveling at the lower level is managed in the following way:
Flash objects are stored in dedicated 64KB flash memory blocks. Block allocations are performed in such a way that erase operations are spread as evenly as possible. Also when data objects need to be updated, a non-in-place update policy is adopted by our flash memory driver i.e., if the requirement is to update an entry X, instead of erasing that part of the flash to replace its old value by a new value, a new instance of X is created. The old instance of X is present but is marked as obsolete, by putting an erase flag on the same. All such objects marked with an erase flag are later removed by the garbage collection process. The threshold that triggers the background garbage collection process is 30% of the size of the block.
This reduces the number of erase operations and thus helps in increasing the life span of the flash device.

Formula for calculating the approximate life span of flash objects memory is:

Lifespan = ((7600 x 10^5)/n) x( t / (365x24x60) )
Where :
n = size of the data written (in bytes)
t = time between each writing (in minutes).

In case of A&D memory,for determining the life expectancy of A&D,following equation has to be used :

Lifespan=((M x 50000)/n).(t/(365x24x60))

Where :
M = Size of the A&D memory used (in bytes)
n = size of the data written (in bytes)
t = time between each writting (in minutes).

The unit of lifespan is ‘year’.

This formula is applicable if recompaction is done when the memory is completely full.

As auto-recompaction by firmware is done when memory is 50% full.So in that case the above formula should be devided by 2.

Please note that the formula above is only applicable for flash objects that is managed by adlFlash API. This does not refer to the wear endurance of the Application & Data area.

Thanks Davidc and MichaG for their contribution for improving the FAQ article.

Thanks.