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

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
    1. 1.1 Difference Between EEPROM and On-Chip Flash
  4. 2Implementation
    1. 2.1 Principle
    2. 2.2 Header
  5. 3Software Description
    1. 3.1 Software Functionality and Flow
    2. 3.2 EEPROM Functions
      1. 3.2.1 Global Variables
      2. 3.2.2 EEPROM_TypeB_readDataItem
      3. 3.2.3 EEPROM_TypeB_findDataItem
      4. 3.2.4 EEPROM_TypeB_write
      5. 3.2.5 EEPROM_TypeB_transferDataItem
      6. 3.2.6 EEPROM_TypeB_eraseGroup
      7. 3.2.7 EEPROM_TypeB_init
    3. 3.3 Application Integration
    4. 3.4 EEPROM Emulation Memory Footprint
    5. 3.5 EEPROM Emulation Timing
  6. 4Application Aspects
    1. 4.1 Selection of Configurable Parameters
      1. 4.1.1 Number of Data Items
      2. 4.1.2 Cycling Capability
    2. 4.2 Recovery in Case of Power Loss
  7. 5References

EEPROM_TypeB_write

EEPROM_TypeB_write is used to write provided data and identifier to the Flash. Through the function, a new data item is added to the Flash. If group is full, EEPROM_TypeB_transferDataItem is called and transfer is performed. The software flow is shown in Figure 3-5.

First, the function checks whether next data item is erased. Then it brings together the data and the identifier into a new data item, and set the end of write flag to ensure the data integrity. If the end of write flag is not set, the data item is invalid and all functions will skip this item.

Finally, the function checks whether the group is full. If so, transfer is performed. Refer to EEPROM_TypeB_transferDataItem to see more details.

This scheme allows users to choose which identifiers to use, but also requires users to pay attention to the number of identifiers used. The recommended number of identifiers is one-half to one-third of the maximum number of data items. If the number of identifiers is close to the maximum number of data items, frequent transfers and erasures will occur, increasing system overhead. An error is caused if the number of identifiers exceeds the maximum number of data items.

The input of the function is data and data identifier. The output of the function is the operation states. Besides, gActiveGroupNum and gActiveDataItemNum are updated to trace the active group.

  • Input: uint32_t data

uint16_t data identifier

  • Output:uint32_t operation state
GUID-AB3642D3-01B0-4BE6-9EFF-F29C7635BDCB-low.png Figure 3-5 The Software Flow of EEPROM_TypeB_write