STM32F439xx HAL User Manual
Modules | Functions
FLASHEx Exported Functions
FLASHEx

Modules

 Extended IO operation functions
 

Extended IO operation functions.


Functions

void FLASH_Erase_Sector (uint32_t Sector, uint8_t VoltageRange)
 Erase the specified FLASH memory sector.
void FLASH_FlushCaches (void)
 Flush the instruction and data caches.
static void FLASH_MassErase (uint8_t VoltageRange, uint32_t Banks)
 Full erase of FLASH memory sectors.
static HAL_StatusTypeDef FLASH_OB_EnableWRP (uint32_t WRPSector, uint32_t Banks)
 Enable the write protection of the desired bank1 or bank 2 sectors.
static HAL_StatusTypeDef FLASH_OB_DisableWRP (uint32_t WRPSector, uint32_t Banks)
 Disable the write protection of the desired bank1 or bank 2 sectors.
static HAL_StatusTypeDef FLASH_OB_BootConfig (uint8_t BootConfig)
 Configure the Dual Bank Boot.
static HAL_StatusTypeDef FLASH_OB_EnablePCROP (uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks)
 Enable the read/write protection (PCROP) of the desired sectors of Bank 1 and/or Bank 2.
static HAL_StatusTypeDef FLASH_OB_DisablePCROP (uint32_t SectorBank1, uint32_t SectorBank2, uint32_t Banks)
 Disable the read/write protection (PCROP) of the desired sectors of Bank 1 and/or Bank 2.
static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig (uint8_t Level)
 Set the read protection level.
static HAL_StatusTypeDef FLASH_OB_UserConfig (uint8_t Iwdg, uint8_t Stop, uint8_t Stdby)
 Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig (uint8_t Level)
 Set the BOR Level.
static uint8_t FLASH_OB_GetUser (void)
 Return the FLASH User Option Byte value.
static uint16_t FLASH_OB_GetWRP (void)
 Return the FLASH Write Protection Option Bytes value.
static uint8_t FLASH_OB_GetRDP (void)
 Returns the FLASH Read Protection level.
static uint8_t FLASH_OB_GetBOR (void)
 Returns the FLASH BOR level.

Function Documentation

void FLASH_Erase_Sector ( uint32_t  Sector,
uint8_t  VoltageRange 
)

Erase the specified FLASH memory sector.

Parameters:
SectorFLASH sector to erase The value of this parameter depend on device used within the same series
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • FLASH_VOLTAGE_RANGE_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:
None

Definition at line 602 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_PSIZE_BYTE, FLASH_PSIZE_DOUBLE_WORD, FLASH_PSIZE_HALF_WORD, FLASH_PSIZE_WORD, FLASH_SECTOR_11, FLASH_VOLTAGE_RANGE_1, FLASH_VOLTAGE_RANGE_2, FLASH_VOLTAGE_RANGE_3, IS_FLASH_SECTOR, and IS_VOLTAGERANGE.

Referenced by HAL_FLASH_IRQHandler(), HAL_FLASHEx_Erase(), and HAL_FLASHEx_Erase_IT().

void FLASH_FlushCaches ( void  )
static void FLASH_MassErase ( uint8_t  VoltageRange,
uint32_t  Banks 
) [static]

Full erase of FLASH memory sectors.

Parameters:
VoltageRangeThe device voltage range which defines the erase parallelism. This parameter can be one of the following values:
  • FLASH_VOLTAGE_RANGE_1: when the device voltage range is 1.8V to 2.1V, the operation will be done by byte (8-bit)
  • FLASH_VOLTAGE_RANGE_2: when the device voltage range is 2.1V to 2.7V, the operation will be done by half word (16-bit)
  • FLASH_VOLTAGE_RANGE_3: when the device voltage range is 2.7V to 3.6V, the operation will be done by word (32-bit)
  • FLASH_VOLTAGE_RANGE_4: when the device voltage range is 2.7V to 3.6V + External Vpp, the operation will be done by double word (64-bit)
BanksBanks to be erased This parameter can be one of the following values:
  • FLASH_BANK_1: Bank1 to be erased
  • FLASH_BANK_2: Bank2 to be erased
  • FLASH_BANK_BOTH: Bank1 and Bank2 to be erased
Return values:
HALStatus

Definition at line 558 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_BOTH, FLASH_MER_BIT, IS_FLASH_BANK, and IS_VOLTAGERANGE.

Referenced by HAL_FLASHEx_Erase(), and HAL_FLASHEx_Erase_IT().

static HAL_StatusTypeDef FLASH_OB_BootConfig ( uint8_t  BootConfig) [static]

Configure the Dual Bank Boot.

Note:
This function can be used only for STM32F42xxx/43xxx devices.
Parameters:
BootConfigspecifies the Dual Bank Boot Option byte. This parameter can be one of the following values:
  • OB_Dual_BootEnabled: Dual Bank Boot Enable
  • OB_Dual_BootDisabled: Dual Bank Boot Disabled
Return values:
None

Definition at line 794 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_OB_BOOT, and OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_AdvOBProgram().

static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig ( uint8_t  Level) [static]

Set the BOR Level.

Parameters:
Levelspecifies 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:
HALStatus

Definition at line 1247 of file stm32f4xx_hal_flash_ex.c.

References assert_param, IS_OB_BOR_LEVEL, and OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_DisablePCROP ( uint32_t  SectorBank1,
uint32_t  SectorBank2,
uint32_t  Banks 
) [static]

Disable the read/write protection (PCROP) of the desired sectors of Bank 1 and/or Bank 2.

Note:
This function can be used only for STM32F42xxx/43xxx devices.
Parameters:
SectorBank1specifies the sector(s) to be read/write protected or unprotected for bank1. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_SECTOR_0 and OB_PCROP_SECTOR_11
  • OB_PCROP_SECTOR__All
SectorBank2Specifies the sector(s) to be read/write protected or unprotected for bank2. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_SECTOR_12 and OB_PCROP_SECTOR_23
  • OB_PCROP_SECTOR__All
BanksDisable PCROP protection on all the sectors for the specific bank This parameter can be one of the following values:
  • FLASH_BANK_1: WRP on all sectors of bank1
  • FLASH_BANK_2: WRP on all sectors of bank2
  • FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2
Return values:
HALStatus

Definition at line 898 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_BOTH, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_BANK, IS_OB_PCROP, OPTCR1_BYTE2_ADDRESS, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_AdvOBProgram().

static HAL_StatusTypeDef FLASH_OB_DisableWRP ( uint32_t  WRPSector,
uint32_t  Banks 
) [static]

Disable the write protection of the desired bank1 or bank 2 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:
WRPSectorspecifies the sector(s) to be write protected. This parameter can be one of the following values:
  • WRPSector: A value between OB_WRP_SECTOR_0 and OB_WRP_SECTOR_23
  • OB_WRP_Sector_All
Note:
BANK2 starts from OB_WRP_SECTOR_12
Parameters:
BanksDisable write protection on all the sectors for the specific bank This parameter can be one of the following values:
  • FLASH_BANK_1: Bank1 to be erased
  • FLASH_BANK_2: Bank2 to be erased
  • FLASH_BANK_BOTH: Bank1 and Bank2 to be erased
Return values:
HALStatus

Definition at line 733 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_BOTH, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_BANK, IS_OB_WRP_SECTOR, OB_WRP_SECTOR_12, OB_WRP_SECTOR_All, OPTCR1_BYTE2_ADDRESS, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_EnablePCROP ( uint32_t  SectorBank1,
uint32_t  SectorBank2,
uint32_t  Banks 
) [static]

Enable the read/write protection (PCROP) of the desired sectors of Bank 1 and/or Bank 2.

Note:
This function can be used only for STM32F42xxx/43xxx devices.
Parameters:
SectorBank1Specifies the sector(s) to be read/write protected or unprotected for bank1. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_SECTOR_0 and OB_PCROP_SECTOR_11
  • OB_PCROP_SECTOR__All
SectorBank2Specifies the sector(s) to be read/write protected or unprotected for bank2. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_SECTOR_12 and OB_PCROP_SECTOR_23
  • OB_PCROP_SECTOR__All
BanksEnable PCROP protection on all the sectors for the specific bank This parameter can be one of the following values:
  • FLASH_BANK_1: WRP on all sectors of bank1
  • FLASH_BANK_2: WRP on all sectors of bank2
  • FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2
Return values:
HALStatus

Definition at line 834 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_BOTH, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_BANK, IS_OB_PCROP, OPTCR1_BYTE2_ADDRESS, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_AdvOBProgram().

static HAL_StatusTypeDef FLASH_OB_EnableWRP ( uint32_t  WRPSector,
uint32_t  Banks 
) [static]

Enable the write protection of the desired bank1 or bank 2 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:
WRPSectorspecifies the sector(s) to be write protected. This parameter can be one of the following values:
  • WRPSector: A value between OB_WRP_SECTOR_0 and OB_WRP_SECTOR_23
  • OB_WRP_SECTOR_All
Note:
BANK2 starts from OB_WRP_SECTOR_12
Parameters:
BanksEnable write protection on all the sectors for the specific bank This parameter can be one of the following values:
  • FLASH_BANK_1: WRP on all sectors of bank1
  • FLASH_BANK_2: WRP on all sectors of bank2
  • FLASH_BANK_BOTH: WRP on all sectors of bank1 & bank2
Return values:
HALFLASH State

Definition at line 662 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_BOTH, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_BANK, IS_OB_WRP_SECTOR, OB_WRP_SECTOR_12, OB_WRP_SECTOR_All, OPTCR1_BYTE2_ADDRESS, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

static uint8_t FLASH_OB_GetBOR ( void  ) [static]

Returns the FLASH BOR level.

Return values:
uint8_tThe FLASH 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 1317 of file stm32f4xx_hal_flash_ex.c.

References OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_OBGetConfig().

static uint8_t FLASH_OB_GetRDP ( void  ) [static]

Returns the FLASH Read Protection level.

Return values:
FLASHReadOut Protection Status: This parameter can be one of the following values:
  • OB_RDP_LEVEL_0: No protection
  • OB_RDP_LEVEL_1: Read protection of the memory
  • OB_RDP_LEVEL_2: Full chip protection

Definition at line 1289 of file stm32f4xx_hal_flash_ex.c.

References OB_RDP_LEVEL_0, OB_RDP_LEVEL_1, OB_RDP_LEVEL_2, and OPTCR_BYTE1_ADDRESS.

Referenced by HAL_FLASHEx_OBGetConfig().

static uint8_t FLASH_OB_GetUser ( void  ) [static]

Return the FLASH User Option Byte value.

Return values:
uint8_tFLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1) and RST_STDBY(Bit2).

Definition at line 1265 of file stm32f4xx_hal_flash_ex.c.

Referenced by HAL_FLASHEx_OBGetConfig().

static uint16_t FLASH_OB_GetWRP ( void  ) [static]

Return the FLASH Write Protection Option Bytes value.

Return values:
uint16_tFLASH Write Protection Option Bytes value

Definition at line 1275 of file stm32f4xx_hal_flash_ex.c.

References OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBGetConfig().

static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig ( uint8_t  Level) [static]

Set the read protection level.

Parameters:
Levelspecifies the read protection level. This parameter can be one of the following values:
  • OB_RDP_LEVEL_0: No protection
  • OB_RDP_LEVEL_1: Read protection of the memory
  • OB_RDP_LEVEL_2: Full chip protection
Note:
WARNING: When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0
Return values:
HALStatus

Definition at line 1178 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_OB_RDP_LEVEL, and OPTCR_BYTE1_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_UserConfig ( uint8_t  Iwdg,
uint8_t  Stop,
uint8_t  Stdby 
) [static]

Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.

Parameters:
IwdgSelects the IWDG mode This parameter can be one of the following values:
  • OB_IWDG_SW: Software IWDG selected
  • OB_IWDG_HW: Hardware IWDG selected
StopReset event when entering STOP mode. This parameter can be one of the following values:
  • OB_STOP_NO_RST: No reset generated when entering in STOP
  • OB_STOP_RST: Reset generated when entering in STOP
StdbyReset event when entering Standby mode. This parameter can be one of the following values:
  • OB_STDBY_NO_RST: No reset generated when entering in STANDBY
  • OB_STDBY_RST: Reset generated when entering in STANDBY
Return values:
HALStatus

Definition at line 1212 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_OB_IWDG_SOURCE, IS_OB_STDBY_SOURCE, IS_OB_STOP_SOURCE, and OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().