Wear Leveling Sub-layer

The Wear Leveling sub-layer manages the following functionality:

1. Increase the endurance of the NVM

2. Translation of logical to Physical address

3. Maintaining information of File ID mapping to Physical address

As per the datasheet, an endurance cycle is a write and erase operation. For NVM Flash present in SAM R34 this endurance is around 100K cycles which is less when compared to millions of cycles for EEPROM. To emulate the endurance of EEPROM in Flash, instead of writing to the same Physical row in Flash and reducing the endurance, PDS module will write to a new Physical row each time the data is updated. The Wear Leveling sub-layer provides a translation of physical address abstraction and maintains the information.

The Wear Leveling sub-layer stores data in NVM in the form of Files. The Files are defined by Files and Items sub-layer. Each File is written in a NVM row and therefore, the maximum size of each File must not exceed 255 bytes.

The Wear Leveling sub-layer maintains used and free NVM rows. Based on that information, the Flash physical address is calculated and data is given to NVM sub-layer for storing. On the occurrence of all NVM rows used, the Wear Leveling sub-layer clears older data stored in NVM and frees some rows.

At any given time, the Wear Leveling sub-layer ensures that one copy of all the data stored NVM exists.