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
drivelib from SDK is also required.
Figure 3-1 EEPROM Emulation
Files
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.
#define
EEPROM_EMULATION_ADDRESS (0x00001400)#define
EEPROM_EMULATION_GROUP_ACCOUNT (3)#define
EEPROM_EMULATION_SECTOR_INGROUP_ACCOUNT (2)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();
Figure 3-2 EEPROM Emulation
InitializationEEPROM_TypeB_write to write 32-bit data with a 16-bit
identifier. EEPROMEmulationState = EEPROM_TypeB_write(var_id,
var_data);
Figure 3-3 EEPROM Emulation
WriteEEPROM_TypeB_readDataItem to read the data according to the
input identifier.var_data_read =
EEPROM_TypeB_readDataItem(var_id);
Figure 3-4 EEPROM Emulation
ReadgEEPROMTypeBEraseFlag. 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();
Figure 3-5 EEPROM Emulation
EraseAfter steps 1 through 6, the EEPROM emulation Type B is implemented in the application. See Section 5 for the flow.