SLAAE58 april   2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3106 , MSPM0G3107 , MSPM0G3505 , MSPM0G3506 , MSPM0G3507 , MSPM0L1105 , MSPM0L1106 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Implementation
  6. 3Software Description
  7. 4Application Aspects
  8. 5References

Application Aspects

This section describes the application-level features of EEPROM emulation solution and how to configure it to meet the application needs.

Selection of configurable parameters

There are three user-configurable parameters in eeprom_emulation_type_a.h. These parameters can be configured accordingly, depending on the requirements of the application.

  • Record size: 64, 128, or 256 bytes
  • Number of sectors used: at least 2
  • Sector address

Memory Space Utilization

Although the header takes up 8 bytes of space in the structure, memory space utilization depends on the user’s application.

Memory space utilization = User’s data size Record size

The largest memory space utilization = Record size - Header size Record size

It is recommended to evaluate the virtual EEPROM size required for the application before selecting the appropriate record size. For example, if there are 40 bytes of data to be stored, it is recommended to select the record size of 64 bytes.

Cycling Capability

Flash endurance is typically 10000 cycles, far less than real EEPROM. One feature of EEPROM emulation is that its endurance is extended compared to flash. By dividing the flash sector into multiple records and writing data one by one, the flash sector does not need to erase each time it writes, but only after it is full. And the equivalent endurance is further enhanced by the use of multiple flash sectors.

Number of records = Sector size Record size × Number of sectors

Equivalent endurance = Number of records × flash endurance

For example, if there are 2 1KB sectors used and record size is 128 bytes, equivalent endurance is 160k cycles. If there are 3 1KB sectors used and record size is 128 bytes, equivalent endurance is 240k cycles. If there are 2 1KB sectors used and record size is 64 bytes, equivalent endurance is 320k cycles.

It is recommended that the user evaluate the cycling capability required by the application before selecting the appropriate number of sectors to use.

For three user-configurable parameters, a recommended design process is as follows:

  1. Evaluate the data size required by application and select the appropriate record size.
  2. Evaluate the cycling capability required by application, and select the appropriate number of sectors to use.
  3. Select the appropriate flash address

For example, if there is an application which needs to update data in EEPROM every 10 minutes. The data size is 40 bytes and 10 years of continuous service is guaranteed. Firstly, record size could be 64 bytes. Secondly, cycling capability required by application is 525600 cycles(10 years × 365 days × 24 hours × 6 cycles per hour). 4 sectors are needed and the equivalent endurance is 640000 cycles.

Recovery in case of power loss

Data or header corruption is possible in case of a power loss during a EEPROM_TypeA_writeData or EEPROM_TypeA_eraseLastSector.

To detect the corruption and recover from it, EEPROM_TypeA_init is implemented. It should be called immediately after power-up. EEPROM_TypeA_init checks all records’ header to confirm whether data storage of EEPROM emulation is correct, and performs format-repair if necessary.

In the structure of EEPROM emulation, headers show the status of corresponding records. There are 4 states in total. The changes between the four states are described in detail in the previous section.