Modules | Macros | Enumerations | Functions

FLASH driver modules. More...

Collaboration diagram for FLASH:

Modules

 FLASH_Exported_Constants
 
 FLASH_Private_Functions
 
 FLASH_Exported_Types
 
 FLASH_Exported_Macros
 
 FLASH_Exported_Functions
 
 FLASH_Private_TypesDefinitions
 
 FLASH_Private_Defines
 
 FLASH_Private_Macros
 
 FLASH_Private_Variables
 
 FLASH_Private_FunctionPrototypes
 

Macros

#define RDPRT_MASK   ((uint32_t)0x00000002)
 
#define SECTOR_MASK   ((uint32_t)0xFFFFFF07)
 
#define WRP01_MASK   ((uint32_t)0x0000FFFF)
 
#define WRP23_MASK   ((uint32_t)0xFFFF0000)
 

Enumerations

enum  FLASH_Status {
  FLASH_BUSY = 1, FLASH_ERROR_PGS, FLASH_ERROR_PGP, FLASH_ERROR_PGA,
  FLASH_ERROR_WRP, FLASH_ERROR_PROGRAM, FLASH_ERROR_OPERATION, FLASH_COMPLETE,
  FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE,
  FLASH_TIMEOUT, FLASH_BUSY = 1, FLASH_ERROR_WRP, FLASH_ERROR_PROGRAM,
  FLASH_COMPLETE, FLASH_TIMEOUT
}
 FLASH Status. More...
 
enum  FLASH_Status {
  FLASH_BUSY = 1, FLASH_ERROR_PGS, FLASH_ERROR_PGP, FLASH_ERROR_PGA,
  FLASH_ERROR_WRP, FLASH_ERROR_PROGRAM, FLASH_ERROR_OPERATION, FLASH_COMPLETE,
  FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE,
  FLASH_TIMEOUT, FLASH_BUSY = 1, FLASH_ERROR_WRP, FLASH_ERROR_PROGRAM,
  FLASH_COMPLETE, FLASH_TIMEOUT
}
 FLASH Status. More...
 

Functions

void FLASH_DataCacheCmd (FunctionalState NewState)
 Enables or disables the Data Cache feature. More...
 
void FLASH_DataCacheReset (void)
 Resets the Data Cache. More...
 
FLASH_Status FLASH_EraseAllPages (void)
 Erases all FLASH pages. More...
 
FLASH_Status FLASH_EraseAllSectors (uint8_t VoltageRange)
 Erases all FLASH Sectors. More...
 
FLASH_Status FLASH_ErasePage (uint32_t Page_Address)
 Erases a specified FLASH page. More...
 
FLASH_Status FLASH_EraseSector (uint32_t FLASH_Sector, uint8_t VoltageRange)
 Erases a specified FLASH Sector. More...
 
void FLASH_HalfCycleAccessCmd (FunctionalState NewState)
 Enables or disables the Half cycle flash access. More...
 
void FLASH_InstructionCacheCmd (FunctionalState NewState)
 Enables or disables the Instruction Cache feature. More...
 
void FLASH_InstructionCacheReset (void)
 Resets the Instruction Cache. More...
 
FLASH_Status FLASH_OB_BOOTConfig (uint8_t OB_BOOT1)
 Sets or resets the BOOT1. More...
 
void FLASH_OB_BORConfig (uint8_t OB_BOR)
 Sets the BOR Level. More...
 
FLASH_Status FLASH_OB_EnableWRP (uint32_t OB_WRP)
 Write protects the desired pages. More...
 
FLASH_Status FLASH_OB_Erase (void)
 Erases the FLASH option bytes. More...
 
uint8_t FLASH_OB_GetBOR (void)
 Returns the FLASH BOR level. More...
 
uint16_t FLASH_OB_GetWRP1 (void)
 Returns the FLASH Write Protection Option Bytes value. More...
 
FLASH_Status FLASH_OB_SRAMParityConfig (uint8_t OB_SRAM_Parity)
 Sets or resets the SRAM partiy. More...
 
FLASH_Status FLASH_OB_VDDAConfig (uint8_t OB_VDDA_ANALOG)
 Sets or resets the analogue monitoring on VDDA Power source. More...
 
FLASH_Status FLASH_OB_WriteUser (uint8_t OB_USER)
 Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG. More...
 
void FLASH_OB_WRP1Config (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors. More...
 
void FLASH_OB_WRPConfig (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors. More...
 
FLASH_Status FLASH_ProgramByte (uint32_t Address, uint8_t Data)
 Programs a byte (8-bit) at a specified address. 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_ProgramOptionByteData (uint32_t Address, uint8_t Data)
 Programs a half word at a specified Option Byte Data address. More...
 
FLASH_Status FLASH_WaitForLastOperation (uint32_t Timeout)
 Waits for a Flash operation to complete or a TIMEOUT to occur. More...
 
FLASH_Status FLASH_WaitForLastOperation (void)
 Waits for a FLASH operation to complete. More...
 

Detailed Description

FLASH driver modules.

Macro Definition Documentation

#define RDPRT_MASK   ((uint32_t)0x00000002)

Definition at line 91 of file stm32f30x_flash.c.

#define SECTOR_MASK   ((uint32_t)0xFFFFFF07)

Definition at line 85 of file stm32f4xx_flash.c.

#define WRP01_MASK   ((uint32_t)0x0000FFFF)

Definition at line 92 of file stm32f30x_flash.c.

#define WRP23_MASK   ((uint32_t)0xFFFF0000)

Definition at line 93 of file stm32f30x_flash.c.

Enumeration Type Documentation

FLASH Status.

Enumerator
FLASH_BUSY 
FLASH_ERROR_PGS 
FLASH_ERROR_PGP 
FLASH_ERROR_PGA 
FLASH_ERROR_WRP 
FLASH_ERROR_PROGRAM 
FLASH_ERROR_OPERATION 
FLASH_COMPLETE 
FLASH_BUSY 
FLASH_ERROR_PG 
FLASH_ERROR_WRP 
FLASH_COMPLETE 
FLASH_TIMEOUT 
FLASH_BUSY 
FLASH_ERROR_WRP 
FLASH_ERROR_PROGRAM 
FLASH_COMPLETE 
FLASH_TIMEOUT 

Definition at line 52 of file stm32f4xx_flash.h.

FLASH Status.

Enumerator
FLASH_BUSY 
FLASH_ERROR_PGS 
FLASH_ERROR_PGP 
FLASH_ERROR_PGA 
FLASH_ERROR_WRP 
FLASH_ERROR_PROGRAM 
FLASH_ERROR_OPERATION 
FLASH_COMPLETE 
FLASH_BUSY 
FLASH_ERROR_PG 
FLASH_ERROR_WRP 
FLASH_COMPLETE 
FLASH_TIMEOUT 
FLASH_BUSY 
FLASH_ERROR_WRP 
FLASH_ERROR_PROGRAM 
FLASH_COMPLETE 
FLASH_TIMEOUT 

Definition at line 52 of file stm32f30x_flash.h.

Function Documentation

void FLASH_DataCacheCmd ( FunctionalState  NewState)

Enables or disables the Data Cache feature.

Parameters
NewStatenew state of the Data Cache. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 241 of file stm32f4xx_flash.c.

void FLASH_DataCacheReset ( void  )

Resets the Data Cache.

Note
This function must be used only when the Data Cache is disabled.
Parameters
None
Return values
None

Definition at line 273 of file stm32f4xx_flash.c.

FLASH_Status FLASH_EraseAllPages ( void  )

Erases all FLASH pages.

Note
This function can be used for all STM32F10x devices.
Parameters
None
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Note
To correctly run this function, the FLASH_Unlock() function must be called before. all the FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
Parameters
None
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 492 of file stm32f10x_flash.c.

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 432 of file stm32f4xx_flash.c.

FLASH_Status FLASH_ErasePage ( uint32_t  Page_Address)

Erases a specified FLASH page.

Note
This function can be used for all STM32F10x devices.
Parameters
Page_AddressThe page address to be erased.
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Erases a specified FLASH page.

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_AddressThe 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
FLASHStatus: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 419 of file stm32f10x_flash.c.

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. For STM32F40xx/41xx devices this parameter can be a value between FLASH_Sector_0 and FLASH_Sector_11. For STM32F427x/437x devices this parameter can be a value between FLASH_Sector_0 and FLASH_Sector_23.
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 364 of file stm32f4xx_flash.c.

void FLASH_HalfCycleAccessCmd ( FunctionalState  NewState)

Enables or disables the Half cycle flash access.

Parameters
FLASH_HalfCycleAccessspecifies the FLASH Half cycle Access mode. This parameter can be one of the following values:
  • FLASH_HalfCycleAccess_Enable: FLASH Half Cycle Enable
  • FLASH_HalfCycleAccess_Disable: FLASH Half Cycle Disable
Return values
None

Definition at line 156 of file stm32f30x_flash.c.

void FLASH_InstructionCacheCmd ( FunctionalState  NewState)

Enables or disables the Instruction Cache feature.

Parameters
NewStatenew state of the Instruction Cache. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 220 of file stm32f4xx_flash.c.

void FLASH_InstructionCacheReset ( void  )

Resets the Instruction Cache.

Note
This function must be used only when the Instruction Cache is disabled.
Parameters
None
Return values
None

Definition at line 262 of file stm32f4xx_flash.c.

FLASH_Status FLASH_OB_BOOTConfig ( uint8_t  OB_BOOT1)

Sets or resets the BOOT1.

Parameters
OB_BOOT1Set or Reset the BOOT1. This parameter can be one of the following values:
  • OB_BOOT1_RESET: BOOT1 Reset
  • OB_BOOT1_SET: BOOT1 Set
Return values
None

Definition at line 758 of file stm32f30x_flash.c.

void FLASH_OB_BORConfig ( uint8_t  OB_BOR)

Sets the BOR Level.

Parameters
OB_BORspecifies the Option Bytes BOR Reset Level. This parameter can be one of the following values:
  • OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V
  • OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V
  • OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V
  • OB_BOR_OFF: Supply voltage ranges from 1.62 to 2.1 V
Return values
None

Definition at line 898 of file stm32f4xx_flash.c.

FLASH_Status FLASH_OB_EnableWRP ( uint32_t  OB_WRP)

Write protects the desired pages.

Note
To correctly run this function, the FLASH_OB_Unlock() function must be called before.
Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
Parameters
OB_WRPspecifies the address of the pages to be write protected. This parameter can be:
  • value between OB_WRP_Pages0to35 and OB_WRP_Pages60to63
  • OB_WRP_AllPages
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 591 of file stm32f30x_flash.c.

FLASH_Status FLASH_OB_Erase ( void  )

Erases the FLASH option bytes.

Note
This functions erases all option bytes except the Read protection (RDP).
Parameters
None
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 521 of file stm32f30x_flash.c.

uint8_t FLASH_OB_GetBOR ( void  )

Returns the FLASH BOR level.

Parameters
None
Return values
TheFLASH BOR level:
  • OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V
  • OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V
  • OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V
  • OB_BOR_OFF : Supply voltage ranges from 1.62 to 2.1 V

Definition at line 994 of file stm32f4xx_flash.c.

uint16_t FLASH_OB_GetWRP1 ( void  )

Returns the FLASH Write Protection Option Bytes value.

Note
This function can be used only for STM32F427x/437x devices.
Parameters
None
Return values
TheFLASH Write Protection Option Bytes value

Definition at line 957 of file stm32f4xx_flash.c.

FLASH_Status FLASH_OB_SRAMParityConfig ( uint8_t  OB_SRAM_Parity)

Sets or resets the SRAM partiy.

Parameters
OB_SRAM_ParitySet or Reset the SRAM partiy enable bit. This parameter can be one of the following values:
  • OB_SRAM_PARITY_SET: Set SRAM partiy.
  • OB_SRAM_PARITY_RESET: Reset SRAM partiy.
Return values
None

Definition at line 842 of file stm32f30x_flash.c.

FLASH_Status FLASH_OB_VDDAConfig ( uint8_t  OB_VDDA_ANALOG)

Sets or resets the analogue monitoring on VDDA Power source.

Parameters
OB_VDDA_ANALOGSelects the analog monitoring on VDDA Power source. This parameter can be one of the following values:
  • OB_VDDA_ANALOG_ON: Analog monitoring on VDDA Power source ON
  • OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source OFF
Return values
None

Definition at line 800 of file stm32f30x_flash.c.

FLASH_Status FLASH_OB_WriteUser ( uint8_t  OB_USER)

Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG.

Note
To correctly run this function, the FLASH_OB_Unlock() function must be called before.
Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
Parameters
OB_USERSelects all user option bytes This parameter is a combination of the following values:
  • OB_IWDG_SW / OB_IWDG_HW: Software / Hardware WDG selected
  • OB_STOP_NoRST / OB_STOP_RST: No reset / Reset generated when entering in STOP
  • OB_STDBY_NoRST / OB_STDBY_RST: No reset / Reset generated when entering in STANDBY
  • OB_BOOT1_RESET / OB_BOOT1_SET: BOOT1 Reset / Set
  • OB_VDDA_ANALOG_ON / OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source ON / OFF
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 888 of file stm32f30x_flash.c.

void FLASH_OB_WRP1Config ( uint32_t  OB_WRP,
FunctionalState  NewState 
)

Enables or disables the write protection of the desired sectors.

Note
This function can be used only for STM32F427x/437x devices.
When the memory read out protection is selected (RDP level = 1), it is not possible to program or erase the flash sector i if CortexM4 debug features are connected or boot code is executed in RAM, even if nWRPi = 1
Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1).
Parameters
OB_WRPspecifies the sector(s) to be write protected or unprotected. This parameter can be one of the following values:
  • OB_WRP: A value between OB_WRP_Sector12 and OB_WRP_Sector23
  • OB_WRP_Sector_All
Newstatenew state of the Write Protection. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 798 of file stm32f4xx_flash.c.

void FLASH_OB_WRPConfig ( uint32_t  OB_WRP,
FunctionalState  NewState 
)

Enables or disables the write protection of the desired sectors.

Note
When the memory read protection level is selected (RDP level = 1), it is not possible to program or erase the flash sector i if CortexM4 debug features are connected or boot code is executed in RAM, even if nWRPi = 1
Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1).
Parameters
OB_WRPspecifies the sector(s) to be write protected or unprotected. This parameter can be one of the following values:
  • OB_WRP: A value between OB_WRP_Sector0 and OB_WRP_Sector11
  • OB_WRP_Sector_All
Newstatenew state of the Write Protection. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 759 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 631 of file stm32f4xx_flash.c.

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 504 of file stm32f4xx_flash.c.

FLASH_Status FLASH_ProgramOptionByteData ( uint32_t  Address,
uint8_t  Data 
)

Programs a half word at a specified Option Byte Data address.

Note
This function can be used for all STM32F10x devices.
Parameters
Addressspecifies the address to be programmed. This parameter can be 0x1FFFF804 or 0x1FFFF806.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Note
To correctly run this function, the FLASH_OB_Unlock() function must be called before. Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
Parameters
Addressspecifies the address to be programmed. This parameter can be 0x1FFFF804 or 0x1FFFF806.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 929 of file stm32f10x_flash.c.

FLASH_Status FLASH_WaitForLastOperation ( uint32_t  Timeout)

Waits for a Flash operation to complete or a TIMEOUT to occur.

Note
This function can be used for all STM32F10x devices, it is equivalent to FLASH_WaitForLastBank1Operation.
  • For STM32F10X_XL devices this function waits for a Bank1 Flash operation to complete or a TIMEOUT to occur.
  • For all other devices it waits for a Flash operation to complete or a TIMEOUT to occur.
Parameters
TimeoutFLASH programming Timeout
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Waits for a Flash operation to complete or a TIMEOUT to occur.

Parameters
TimeoutFLASH programming Timeout
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 1595 of file stm32f10x_flash.c.

FLASH_Status FLASH_WaitForLastOperation ( void  )

Waits for a FLASH operation to complete.

Parameters
None
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 1142 of file stm32f4xx_flash.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:29