CARME-M4 BSP  V1.5
FLASH Memory Programming functions

FLASH Memory Programming functions. More...

+ Collaboration diagram for FLASH Memory Programming functions:

Functions

void FLASH_Unlock (void)
 Unlocks the FLASH control register access. More...
 
void FLASH_Lock (void)
 Locks the FLASH control register access. More...
 
FLASH_Status FLASH_EraseSector (uint32_t FLASH_Sector, uint8_t VoltageRange)
 Erases a specified FLASH Sector. More...
 
FLASH_Status FLASH_EraseAllSectors (uint8_t VoltageRange)
 Erases all FLASH Sectors. More...
 
FLASH_Status FLASH_EraseAllBank1Sectors (uint8_t VoltageRange)
 Erases all FLASH Sectors in Bank 1. More...
 
FLASH_Status FLASH_EraseAllBank2Sectors (uint8_t VoltageRange)
 Erases all FLASH Sectors in Bank 2. More...
 
FLASH_Status FLASH_ProgramDoubleWord (uint32_t Address, uint64_t Data)
 Programs a double word (64-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramWord (uint32_t Address, uint32_t Data)
 Programs a word (32-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramHalfWord (uint32_t Address, uint16_t Data)
 Programs a half word (16-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramByte (uint32_t Address, uint8_t Data)
 Programs a byte (8-bit) at a specified address. More...
 

Detailed Description

FLASH Memory Programming functions.

 ===============================================================================
                ##### FLASH Memory Programming functions #####
 ===============================================================================   
    [..]
      This group includes the following functions:
      (+) void FLASH_Unlock(void)
      (+) void FLASH_Lock(void)
      (+) FLASH_Status FLASH_EraseSector(uint32_t FLASH_Sector, uint8_t VoltageRange)
      (+) FLASH_Status FLASH_EraseAllSectors(uint8_t VoltageRange)       
      (+) FLASH_Status FLASH_ProgramDoubleWord(uint32_t Address, uint64_t Data)
      (+) FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
      (+) FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
      (+) FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data)
          The following functions can be used only for STM32F42xxx/43xxx devices. 
      (+) FLASH_Status FLASH_EraseAllBank1Sectors(uint8_t VoltageRange)
      (+) FLASH_Status FLASH_EraseAllBank2Sectors(uint8_t VoltageRange)    
    [..]   
      Any operation of erase or program should follow these steps:
      (#) Call the FLASH_Unlock() function to enable the FLASH control register access

      (#) Call the desired function to erase sector(s) or program data

      (#) Call the FLASH_Lock() function to disable the FLASH control register access
          (recommended to protect the FLASH memory against possible unwanted operation)

Function Documentation

FLASH_Status FLASH_EraseAllBank1Sectors ( uint8_t  VoltageRange)

Erases all FLASH Sectors in Bank 1.

Note
This function can be used only for STM32F42xxx/43xxx devices.
If an erase and a program operations are requested simultaneously, the erase operation is performed before the program one.
Parameters
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • VoltageRange_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • VoltageRange_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • VoltageRange_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • VoltageRange_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit)
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 586 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_EraseAllBank2Sectors ( uint8_t  VoltageRange)

Erases all FLASH Sectors in Bank 2.

Note
This function can be used only for STM32F42xxx/43xxx devices.
If an erase and a program operations are requested simultaneously, the erase operation is performed before the program one.
Parameters
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • VoltageRange_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • VoltageRange_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • VoltageRange_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • VoltageRange_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit)
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 653 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_EraseAllSectors ( uint8_t  VoltageRange)

Erases all FLASH Sectors.

Note
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • VoltageRange_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • VoltageRange_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • VoltageRange_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • VoltageRange_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit)
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 505 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_EraseSector ( uint32_t  FLASH_Sector,
uint8_t  VoltageRange 
)

Erases a specified FLASH Sector.

Note
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
FLASH_SectorThe Sector number to be erased.
Note
For STM32F405xx/407xx and STM32F415xx/417xx devices this parameter can be a value between FLASH_Sector_0 and FLASH_Sector_11.

For STM32F42xxx/43xxx devices this parameter can be a value between FLASH_Sector_0 and FLASH_Sector_23.

For STM32F401xx devices this parameter can be a value between FLASH_Sector_0 and FLASH_Sector_5.

Parameters
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • VoltageRange_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • VoltageRange_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • VoltageRange_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • VoltageRange_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit)
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 437 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

void FLASH_Lock ( void  )

Locks the FLASH control register access.

Parameters
None
Return values
None

Definition at line 400 of file stm32f4xx_flash.c.

FLASH_Status FLASH_ProgramByte ( uint32_t  Address,
uint8_t  Data 
)

Programs a byte (8-bit) at a specified address.

Note
This function can be used within all the device supply voltage ranges.
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
Addressspecifies the address to be programmed. This parameter can be any address in Program memory zone or in OTP zone.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 837 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_ProgramDoubleWord ( uint32_t  Address,
uint64_t  Data 
)

Programs a double word (64-bit) at a specified address.

Note
This function must be used when the device voltage range is from 2.7V to 3.6V and an External Vpp is present.
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
Addressspecifies the address to be programmed.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 710 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_ProgramHalfWord ( uint32_t  Address,
uint16_t  Data 
)

Programs a half word (16-bit) at a specified address.

Note
This function must be used when the device voltage range is from 2.1V to 3.6V.
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
Addressspecifies the address to be programmed. This parameter can be any address in Program memory zone or in OTP zone.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 795 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

FLASH_Status FLASH_ProgramWord ( uint32_t  Address,
uint32_t  Data 
)

Programs a word (32-bit) at a specified address.

Note
This function must be used when the device voltage range is from 2.7V to 3.6V.
If an erase and a program operations are requested simustaneously, the erase operation is performed before the program one.
Parameters
Addressspecifies the address to be programmed. This parameter can be any address in Program memory zone or in OTP zone.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.

Definition at line 753 of file stm32f4xx_flash.c.

+ Here is the call graph for this function:

void FLASH_Unlock ( void  )

Unlocks the FLASH control register access.

Parameters
None
Return values
None

Definition at line 385 of file stm32f4xx_flash.c.