FLASH Memory Programming functions.
More...
FLASH Memory Programming functions.
===============================================================================
##### FLASH Memory Programming functions #####
===============================================================================
[..] The FLASH Memory Programming functions, includes the following functions:
(+) void FLASH_Unlock(void);
(+) void FLASH_Lock(void);
(+) FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
(+) FLASH_Status FLASH_EraseAllPages(void);
(+) FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
(+) FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
[..] Any operation of erase or program should follow these steps:
(#) Call the FLASH_Unlock() function to enable the flash control register and
program memory access
(#) Call the desired function to erase page or program data
(#) Call the FLASH_Lock() to disable the flash program memory access
(recommended to protect the FLASH memory against possible unwanted operation)
Erases all FLASH pages.
- Note
- To correctly run this function, the FLASH_Unlock() function must be called before.
-
Call the FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters
-
- Return values
-
FLASH | Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. |
Erases a specified page in program memory.
- Note
- To correctly run this function, the FLASH_Unlock() function must be called before.
-
Call the FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters
-
Page_Address,: | The page address in program memory to be erased. |
- Note
- A Page is erased in the Program memory only if the address to load is the start address of a page (multiple of 1024 bytes).
- Return values
-
FLASH | Status: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. |
Locks the FLASH control register access.
- Parameters
-
- Return values
-
FLASH_Status FLASH_ProgramHalfWord |
( |
uint32_t |
Address, |
|
|
uint16_t |
Data |
|
) |
| |
Programs a half word at a specified address.
- Note
- To correctly run this function, the FLASH_Unlock() function must be called before.
-
Call the FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters
-
Address,: | specifies the address to be programmed. |
Data,: | specifies the data to be programmed. |
- Return values
-
FLASH | Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. |
FLASH_Status FLASH_ProgramWord |
( |
uint32_t |
Address, |
|
|
uint32_t |
Data |
|
) |
| |
Programs a word at a specified address.
- Note
- To correctly run this function, the FLASH_Unlock() function must be called before.
-
Call the FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters
-
Address,: | specifies the address to be programmed. |
Data,: | specifies the data to be programmed. |
- Return values
-
FLASH | Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. |
void FLASH_Unlock |
( |
void |
| ) |
|
Unlocks the FLASH control register and program memory access.
- Parameters
-
- Return values
-