STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
FLASH Private Functions
Collaboration diagram for FLASH Private 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)
 Mass erase of FLASH memory.
 
static HAL_StatusTypeDef FLASH_OB_EnableWRP (uint32_t WRPSector, uint32_t Banks)
 Enable the write protection of the desired bank 1 sectors.
 
static HAL_StatusTypeDef FLASH_OB_DisableWRP (uint32_t WRPSector, uint32_t Banks)
 Disable the write protection of the desired bank 1 sectors.
 
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.
 
static HAL_StatusTypeDef FLASH_OB_EnablePCROP (uint32_t Sector)
 Enable the read/write protection (PCROP) of the desired sectors.
 
static HAL_StatusTypeDef FLASH_OB_DisablePCROP (uint32_t Sector)
 Disable the read/write protection (PCROP) of the desired sectors.
 
HAL_StatusTypeDef FLASH_WaitForLastOperation (uint32_t Timeout)
 Wait for a FLASH operation to complete.
 

Detailed Description

Function Documentation

◆ FLASH_Erase_Sector()

void FLASH_Erase_Sector ( uint32_t Sector,
uint8_t VoltageRange )

#include <stm32f4xx_hal_flash_ex.h>

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 977 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_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().

◆ FLASH_FlushCaches()

◆ FLASH_MassErase()

static void FLASH_MassErase ( uint8_t VoltageRange,
uint32_t Banks )
static

#include <stm32f4xx_hal_flash_ex.c>

Mass erase of FLASH memory.

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
Return values
None

Definition at line 948 of file stm32f4xx_hal_flash_ex.c.

References assert_param, IS_FLASH_BANK, and IS_VOLTAGERANGE.

Referenced by HAL_FLASHEx_Erase(), and HAL_FLASHEx_Erase_IT().

◆ FLASH_OB_EnableWRP()

static HAL_StatusTypeDef FLASH_OB_EnableWRP ( uint32_t WRPSector,
uint32_t Banks )
static

#include <stm32f4xx_hal_flash_ex.c>

Enable the write protection of the desired bank 1 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. The value of this parameter depend on device used within the same series
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
Return values
HALStatus

Definition at line 1027 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), HAL_OK, IS_FLASH_BANK, IS_OB_WRP_SECTOR, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

◆ FLASH_OB_DisableWRP()

static HAL_StatusTypeDef FLASH_OB_DisableWRP ( uint32_t WRPSector,
uint32_t Banks )
static

#include <stm32f4xx_hal_flash_ex.c>

Disable the write protection of the desired bank 1 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. The value of this parameter depend on device used within the same series
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
Return values
HALStatus

Definition at line 1063 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), HAL_OK, IS_FLASH_BANK, IS_OB_WRP_SECTOR, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

◆ FLASH_OB_RDP_LevelConfig()

static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig ( uint8_t Level)
static

#include <stm32f4xx_hal_flash_ex.c>

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 1157 of file stm32f4xx_hal_flash_ex.c.

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

Referenced by HAL_FLASHEx_OBProgram().

◆ FLASH_OB_UserConfig()

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

#include <stm32f4xx_hal_flash_ex.c>

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 1191 of file stm32f4xx_hal_flash_ex.c.

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

Referenced by HAL_FLASHEx_OBProgram().

◆ FLASH_OB_BOR_LevelConfig()

static HAL_StatusTypeDef FLASH_OB_BOR_LevelConfig ( uint8_t Level)
static

#include <stm32f4xx_hal_flash_ex.c>

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 1226 of file stm32f4xx_hal_flash_ex.c.

References assert_param, HAL_OK, IS_OB_BOR_LEVEL, and OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_OBProgram().

◆ FLASH_OB_GetUser()

static uint8_t FLASH_OB_GetUser ( void )
static

#include <stm32f4xx_hal_flash_ex.c>

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 1244 of file stm32f4xx_hal_flash_ex.c.

Referenced by HAL_FLASHEx_OBGetConfig().

◆ FLASH_OB_GetWRP()

static uint16_t FLASH_OB_GetWRP ( void )
static

#include <stm32f4xx_hal_flash_ex.c>

Return the FLASH Write Protection Option Bytes value.

Return values
uint16_tFLASH Write Protection Option Bytes value

Definition at line 1254 of file stm32f4xx_hal_flash_ex.c.

References OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_OBGetConfig().

◆ FLASH_OB_GetRDP()

static uint8_t FLASH_OB_GetRDP ( void )
static

#include <stm32f4xx_hal_flash_ex.c>

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 1268 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().

◆ FLASH_OB_GetBOR()

static uint8_t FLASH_OB_GetBOR ( void )
static

#include <stm32f4xx_hal_flash_ex.c>

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 1296 of file stm32f4xx_hal_flash_ex.c.

References OPTCR_BYTE0_ADDRESS.

Referenced by HAL_FLASHEx_OBGetConfig().

◆ FLASH_OB_EnablePCROP()

static HAL_StatusTypeDef FLASH_OB_EnablePCROP ( uint32_t Sector)
static

#include <stm32f4xx_hal_flash_ex.c>

Enable the read/write protection (PCROP) of the desired sectors.

Note
This function can be used only for STM32F401xx devices.
Parameters
Sectorspecifies the sector(s) to be read/write protected or unprotected. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_Sector0 and OB_PCROP_Sector5
  • OB_PCROP_Sector_All
Return values
HALStatus

Definition at line 1096 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), HAL_OK, IS_OB_PCROP, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_AdvOBProgram().

◆ FLASH_OB_DisablePCROP()

static HAL_StatusTypeDef FLASH_OB_DisablePCROP ( uint32_t Sector)
static

#include <stm32f4xx_hal_flash_ex.c>

Disable the read/write protection (PCROP) of the desired sectors.

Note
This function can be used only for STM32F401xx devices.
Parameters
Sectorspecifies the sector(s) to be read/write protected or unprotected. This parameter can be one of the following values:
  • OB_PCROP: A value between OB_PCROP_Sector0 and OB_PCROP_Sector5
  • OB_PCROP_Sector_All
Return values
HALStatus

Definition at line 1124 of file stm32f4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), HAL_OK, IS_OB_PCROP, and OPTCR_BYTE2_ADDRESS.

Referenced by HAL_FLASHEx_AdvOBProgram().

◆ FLASH_WaitForLastOperation()

HAL_StatusTypeDef FLASH_WaitForLastOperation ( uint32_t Timeout)
extern

#include <stm32f4xx_hal_flash_ex.c>

Wait for a FLASH operation to complete.

Parameters
Timeoutmaximum flash operationtimeout
Return values
HALStatus

Definition at line 544 of file stm32f4xx_hal_flash.c.

Referenced by FLASH_OB_DisablePCROP(), FLASH_OB_DisableWRP(), FLASH_OB_EnablePCROP(), FLASH_OB_EnableWRP(), FLASH_OB_RDP_LevelConfig(), FLASH_OB_UserConfig(), HAL_FLASH_OB_Launch(), HAL_FLASH_Program(), and HAL_FLASHEx_Erase().