SLAAEN3A February   2025  – August 2025 MSPM0C1103 , MSPM0C1103-Q1 , MSPM0C1104 , MSPM0C1104-Q1 , MSPM0C1105 , MSPM0C1106 , MSPM0C1106-Q1 , MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3518 , MSPM0G3518-Q1 , MSPM0G3519 , MSPM0G3519-Q1 , MSPM0H3216 , MSPM0H3216-Q1 , MSPM0L1105 , MSPM0L1106 , MSPM0L1116 , MSPM0L1117 , MSPM0L1227 , MSPM0L1227-Q1 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2227-Q1 , MSPM0L2228 , MSPM0L2228-Q1

 

  1.   1
  2. 1Description
  3. 2Required Peripherals
  4. 3Design Steps
  5. 4Design Considerations
  6. 5Software Flow Chart
  7. 6Application Code
  8. 7Additional Resources
  9. 8Revision History
  10.   Trademarks

Design Steps

  1. Add the EEPROM emulation library. The MSPM0 software development kit (SDK) has included the EEPROM emulation library.
    Note: The EEPROM emulation library is based on the Flash API so the drivelib from SDK is also required.
    For Type B, the following files are needed:
    1. eeprom_emulation_type_b.c
    2. eeprom_emulation_type_b.h
    MSPM0L1306, MSPM0G3507, MSPM0C1104 EEPROM Emulation
                            Files Figure 3-1 EEPROM Emulation Files
  2. Add the include path in the code for eeprom_emulation_type_b.h. MSPM0L1306, MSPM0G3507, MSPM0C1104

    Users can modify the start address, the number of groups (at least 2) and the number of sectors in one group (at least 1) in eeprom_emulation_type_b.h. The default Flash address used for EEPROM emulation is 0x00001400, and 6 sectors (3 groups, 2 sectors in every group) are used by default, so 0x00001400-0x00002bff is occupied.

    1. #define EEPROM_EMULATION_ADDRESS (0x00001400)
    2. #define EEPROM_EMULATION_GROUP_ACCOUNT (3)
    3. #define EEPROM_EMULATION_SECTOR_INGROUP_ACCOUNT (2)
  3. Add the initialize function at the beginning of main(), typically after SYSCFG_DL_init(). This allows the relevant Flash areas to be formatted correctly and global variables to be allocated correctly to trace the active group and latest data item.
    • EEPROMEmulationState = EEPROM_TypeB_init();
    MSPM0L1306, MSPM0G3507, MSPM0C1104 EEPROM Emulation
                            Initialization Figure 3-2 EEPROM Emulation Initialization
  4. Use EEPROM_TypeB_write to write 32-bit data with a 16-bit identifier.
    • EEPROMEmulationState = EEPROM_TypeB_write(var_id, var_data);
    MSPM0L1306, MSPM0G3507, MSPM0C1104 EEPROM Emulation
                            Write Figure 3-3 EEPROM Emulation Write
  5. Use EEPROM_TypeB_readDataItem to read the data according to the input identifier.
    • var_data_read = EEPROM_TypeB_readDataItem(var_id);
    MSPM0L1306, MSPM0G3507, MSPM0C1104 EEPROM Emulation
                            Read Figure 3-4 EEPROM Emulation Read
  6. Add the erase function according to the gEEPROMTypeBEraseFlag. Flash needs to be erased before writing data again and the smallest unit of erasure is sector. For EEPROM emulation Type B, after one group is full, gEEPROMTypeBEraseFlag is set. Users can call EEPROM_TypeB_eraseGroup() according to the flag. For example add the following code after EEPROM_TypeB_write() from step 4. Users can also choose an appropriate timepoint to erase the full group, as needed.
    • EEPROM_TypeB_eraseGroup();
    MSPM0L1306, MSPM0G3507, MSPM0C1104 EEPROM Emulation
                            Erase Figure 3-5 EEPROM Emulation Erase

After steps 1 through 6, the EEPROM emulation Type B is implemented in the application. See Section 5 for the flow.