Memory Layout

A single logical RWW EEPROM page is physically stored as the page content and a header inside a single physical page, as shown in Figure 1.

Figure 1. Internal Layout of an Emulated RWW EEPROM Page
Note: In the following memory layout example, each physical row stores the contents of one logical RWW EEPROM page. Refer to "AT03265: SAM EEPROM Emulator Service (EEPROM)" for the example of two logical EEPROM pages in one row.
Within the RWW EEPROM memory reservation section at the top of the NVM memory space, this emulator will produce the layout as shown in Figure 2 when initialized for the first time.
Figure 2. Initial Physical Layout of the Emulated RWW EEPROM Memory
When an RWW EEPROM page needs to be committed to physical memory, the next free page in the same row will be chosen. This makes recovery simple, as the right-most version of a logical page in a row is considered the most current. With four pages to a physical NVM row, this allows for up to four updates to the same logical page to be made before an erase is needed. Figure 3 shows the result of the user writing an updated version of logical EEPROM page N-1 to the physical memory.
Figure 3. First Write to Logical RWW EEPROM Page N-1
A second write of the same logical RWW EEPROM page results in the layout shown in Figure 4.
Figure 4. Second Write to Logical RWW EEPROM Page N-1
A third write of the same logical RWW EEPROM page results in the layout shown in Figure 5.
Figure 5. Third Write to Logical RWW EEPROM Page N-1
A fourth write of the same logical page requires that the RWW EEPROM emulator erase the row, as it has become full. Prior to this, the content of the unmodified page in the same row as the page being updated will be copied into the spare row, along with the new version of the page being updated. The old (full) row is then erased, resulting in the layout shown in Figure 6.
Figure 6. Third Write to Logical RWW EEPROM Page N-1