Qdatasheet_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

AN2077 View Datasheet(PDF) - STMicroelectronics

Part Name
Description
MFG CO.
AN2077
ST-Microelectronics
STMicroelectronics ST-Microelectronics
'AN2077' PDF : 19 Pages View PDF
EEPROM Emulation with STR71x
4.2.1 EEPROM_Init
This function must be called only once at the beginning of the user code or when a full erase
is required.
This function initializes the Flash, erases the two correspondent sectors and marks the first as
valid by writing 0x600D in the last word of this sector.
The EEPROM_Init function is called as follows:
/* Initialize the EEPROM */
EEPROM_Init();
4.2.2 EEPROM_DataRead
This function allows the user to read the valid Data (the last Data-Set). This function returns
the following status messages:
– EEPROM_FULL_ERASE_REQUIRED: To indicate if a full erase is required,
– EEPROM_NO_VALID_DATA: To indicate if there is no valid data to be read,
– EEPROM_SUCCESSFUL_DATA_READ: To indicate if the data is read successfully.
It uses two internal functions:
– EEPROM_GetValidSector: This function returns the valid sector,
– EEPROM_ValidDataSet: This function returns the offset of the valid Data-set (if it exists).
For this function, use the following as an example:
/* Declaration */
u32 Read_Status; /* The status of the read operation */
u32 Data_Read; /* The valid Data-set */
/* Read the valid data from valid sector */
Read_Status = EEPROM_DataRead(&Data_Read);
4.2.3 EEPROM_DataWrite
This function allows the user to write a new Data-set to the valid sector without overwriting the
old Data-set and then updates the corresponding status bit.
When the valid sector is full, the function performs the following operations:
1) copies the last Data-set to the second sector,
2) writes the new Data-set,
3) updates the Status bits,
4) marks the second sector as valid,
5) and finally erases the first sector.
14/19
Share Link: GO URL

All Rights Reserved © qdatasheet.com  [ Privacy Policy ] [ Contact Us ]