EEPROM Memory Library
This library provides routines for accessing microcontroller's (internal) EEPROM memory. Only the STM32L series of MCU have internal EEPROM memory.
Library Routines
- EEPROM_Unlock
- EEPROM_Lock
- EEPROM_EraseSector
- EEPROM_EraseAllSectors
- EEPROM_Write_Word
- EEPROM_Write_HalfWord
- EEPROM_Write_Byte
EEPROM_Unlock
Prototype |
void EEPROM_Unlock(); |
---|---|
Description |
This routine will unlock the EEPROM control register access. This routine is valid only for STM32L devices. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Example |
EEPROM_Unlock(); |
Notes |
This routine is valid only for STM32L devices. |
EEPROM_lock
Prototype |
void EEPROM_lock(); |
---|---|
Description |
This routine will lock the EEPROM control register access. This routine is valid only for STM32L devices. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Example |
EEPROM_lock(); |
Notes |
This routine is valid only for STM32L devices. It is recommended that EEPROM lock is performed right after the EEPROM write is finished to avoid any unwanted subsequent EEPROM writing. |
EEPROM_EraseWord
Prototype |
unsigned long EEPROM_EraseWord(unsigned long Address); |
---|---|
Description |
This routine will erase a word (32-bit) from the specified EEPROM address. This routine is valid only for STM32L devices. |
Parameters |
|
Returns |
|
Requires |
Requires unlock procedure to be performed afterwards. |
Example |
status = EEPROM_EraseWord(0); |
Notes |
This routine is valid only for STM32L devices. The address has to be in the EEPROM address range or else the result can be unpredictable. |
EEPROM_Write_Word
Prototype |
unsigned long EEPROM_Write_Word(unsigned long Address, unsigned long lData); |
---|---|
Description |
Writes a word (32-bit) at a specified address. The address has to be in the EEPROM address range or else the result can be unpredictable. This routine is valid only for STM32L devices. |
Parameters |
|
Returns |
|
Requires |
Requires unlock procedure to be performed afterwards. |
Example |
status = EEPROM_Write_Word(); |
Notes |
This routine is valid only for STM32L devices. The address has to be in the EEPROM address range or else the result can be unpredictable. |
EEPROM_Write_HalfWord
Prototype |
unsigned long EEPROM_Write_HalfWord(unsigned long Address, unsigned int lData); |
---|---|
Description |
Writes a half word (16-bit) at a specified address. The address has to be in the EEPROM address range or else the result can be unpredictable. This routine is valid only for STM32L devices. |
Parameters |
|
Returns |
|
Requires |
Requires unlock procedure to be performed afterwards. |
Example |
status = EEPROM_Write_HalfWord(); |
Notes |
This routine is valid only for STM32L devices. The address has to be in the EEPROM address range or else the result can be unpredictable. |
EEPROM_Write_Byte
Prototype |
unsigned long EEPROM_Write_Byte(unsigned long Address, unsigned char lData); |
---|---|
Description |
Writes a byte (8-bit) at a specified address. The address has to be in the EEPROM address range or else the result can be unpredictable. This routine is valid only for STM32L devices. |
Parameters |
|
Returns |
|
Requires |
Requires unlock procedure to be performed afterwards. |
Example |
status = EEPROM_Write_Byte(); |
Notes |
This routine is valid only for STM32L devices. The address has to be in the EEPROM address range or else the result can be unpredictable. |
Library Example
What do you think about this topic ? Send us feedback!