STM8L15x Standard Peripherals Drivers: FLASH Memory Programming functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

FLASH Memory Programming functions

FLASH Memory Programming functions. More...

Functions

void FLASH_DeInit (void)
 Deinitializes the FLASH registers to their default reset values.
void FLASH_EraseByte (uint32_t Address)
 Erases one byte in the program or data EEPROM memory.
void FLASH_Lock (FLASH_MemType_TypeDef FLASH_MemType)
 Locks the program or data EEPROM memory.
void FLASH_ProgramByte (uint32_t Address, uint8_t Data)
 Programs one byte in program or data EEPROM memory.
void FLASH_ProgramWord (uint32_t Address, uint32_t Data)
 Programs one word (4 bytes) in program or data EEPROM memory.
uint8_t FLASH_ReadByte (uint32_t Address)
 Reads one byte from flash memory.
void FLASH_Unlock (FLASH_MemType_TypeDef FLASH_MemType)
 Unlocks the program or data EEPROM memory.

Detailed Description

FLASH Memory Programming functions.

 ===============================================================================
                      FLASH Memory Programming functions
 ===============================================================================  

   The FLASH Memory Programming functions, includes the following functions:
    - void FLASH_DeInit(void);
    - void FLASH_Unlock(FLASH_MemType_TypeDef FLASH_MemType);
    - void FLASH_Lock(FLASH_MemType_TypeDef FLASH_MemType);
    - void FLASH_ProgramByte(uint32_t Address, uint8_t Data);
    - void FLASH_EraseByte(uint32_t Address);
    - void FLASH_ProgramWord(uint32_t Address, uint32_t Data);
    - uint8_t FLASH_ReadByte(uint32_t Address);
   
   Any operation of erase or program should follow these steps:

   1. Call the FLASH_Unlock(FLASH_MemType) function to enable the memory access

   2. Call the desired function to erase or program data

   3. Call the FLASH_Lock() function to disable the memory access 
     (it is recommended to protect the FLASH memory against possible unwanted operation)


Function Documentation

void FLASH_DeInit ( void  )

Deinitializes the FLASH registers to their default reset values.

Parameters:
None
Return values:
None

Definition at line 253 of file stm8l15x_flash.c.

References FLASH, FLASH_CR1_RESET_VALUE, FLASH_CR2_RESET_VALUE, and FLASH_IAPSR_RESET_VALUE.

void FLASH_EraseByte ( uint32_t  Address)

Erases one byte in the program or data EEPROM memory.

Parameters:
Address: Address of the byte to erase
Return values:
None

Definition at line 324 of file stm8l15x_flash.c.

References FLASH_CLEAR_BYTE, IS_FLASH_ADDRESS, and PointerAttr.

void FLASH_Lock ( FLASH_MemType_TypeDef  FLASH_MemType)

Locks the program or data EEPROM memory.

Parameters:
FLASH_MemType: Memory type This parameter can be one of the following values:
  • FLASH_MemType_Program: Program memory
  • FLASH_MemType_Data: Data EEPROM memory
Return values:
None

Definition at line 297 of file stm8l15x_flash.c.

References FLASH, and IS_FLASH_MEMORY_TYPE.

void FLASH_ProgramByte ( uint32_t  Address,
uint8_t  Data 
)

Programs one byte in program or data EEPROM memory.

Parameters:
Address: Address where the byte will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 311 of file stm8l15x_flash.c.

References IS_FLASH_ADDRESS, and PointerAttr.

void FLASH_ProgramWord ( uint32_t  Address,
uint32_t  Data 
)

Programs one word (4 bytes) in program or data EEPROM memory.

Parameters:
Address: The address where the data will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 338 of file stm8l15x_flash.c.

References FLASH, FLASH_CR2_WPRG, IS_FLASH_ADDRESS, and PointerAttr.

uint8_t FLASH_ReadByte ( uint32_t  Address)

Reads one byte from flash memory.

Parameters:
Address: Address to read
Return values:
Valueof the byte

Definition at line 360 of file stm8l15x_flash.c.

References PointerAttr.

void FLASH_Unlock ( FLASH_MemType_TypeDef  FLASH_MemType)

Unlocks the program or data EEPROM memory.

Parameters:
FLASH_MemType: Memory type to unlock This parameter can be one of the following values:
  • FLASH_MemType_Program: Program memory
  • FLASH_MemType_Data: Data EEPROM memory
Return values:
None

Definition at line 269 of file stm8l15x_flash.c.

References FLASH, FLASH_MemType_Data, FLASH_MemType_Program, FLASH_RASS_KEY1, FLASH_RASS_KEY2, and IS_FLASH_MEMORY_TYPE.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com