STM32L486xx HAL User Manual
Functions
FLASHEx Private Functions
FLASHEx

Functions

HAL_StatusTypeDef FLASH_WaitForLastOperation (uint32_t Timeout)
 Wait for a FLASH operation to complete.
void FLASH_PageErase (uint32_t Page, uint32_t Banks)
 Erase the specified FLASH memory page.
static void FLASH_MassErase (uint32_t Banks)
 Mass erase of FLASH memory.
void FLASH_FlushCaches (void)
 Flush the instruction and data caches.
static HAL_StatusTypeDef FLASH_OB_WRPConfig (uint32_t WRPArea, uint32_t WRPStartOffset, uint32_t WRDPEndOffset)
 Configure the write protection of the desired pages.
static HAL_StatusTypeDef FLASH_OB_RDPConfig (uint32_t RDPLevel)
 Set the read protection level.
static HAL_StatusTypeDef FLASH_OB_UserConfig (uint32_t UserType, uint32_t UserConfig)
 Program the FLASH User Option Byte.
static HAL_StatusTypeDef FLASH_OB_PCROPConfig (uint32_t PCROPConfig, uint32_t PCROPStartAddr, uint32_t PCROPEndAddr)
 Configure the Proprietary code readout protection of the desired addresses.
static void FLASH_OB_GetWRP (uint32_t WRPArea, uint32_t *WRPStartOffset, uint32_t *WRDPEndOffset)
 Return the FLASH Write Protection Option Bytes value.
static uint32_t FLASH_OB_GetRDP (void)
 Return the FLASH Read Protection level.
static uint32_t FLASH_OB_GetUser (void)
 Return the FLASH User Option Byte value.
static void FLASH_OB_GetPCROP (uint32_t *PCROPConfig, uint32_t *PCROPStartAddr, uint32_t *PCROPEndAddr)
 Return the FLASH Write Protection Option Bytes value.

Function Documentation

void FLASH_FlushCaches ( void  )
static void FLASH_MassErase ( uint32_t  Banks) [static]

Mass erase of FLASH memory.

Parameters:
Banks,:Banks 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:
None

Definition at line 536 of file stm32l4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_2, and IS_FLASH_BANK.

Referenced by HAL_FLASHEx_Erase(), and HAL_FLASHEx_Erase_IT().

static void FLASH_OB_GetPCROP ( uint32_t *  PCROPConfig,
uint32_t *  PCROPStartAddr,
uint32_t *  PCROPEndAddr 
) [static]

Return the FLASH Write Protection Option Bytes value.

Parameters:
PCROPConfig[inout]: specifies the configuration (Bank to be configured and PCROP_RDP option). This parameter must be a combination of FLASH_BANK_1 or FLASH_BANK_2 with OB_PCROP_RDP_NOT_ERASE or OB_PCROP_RDP_ERASE
PCROPStartAddr[out]: specifies the address where to copied the start address of the Proprietary code readout protection
PCROPEndAddr[out]: specifies the address where to copied the end address of the Proprietary code readout protection
Return values:
None

Definition at line 1234 of file stm32l4xx_hal_flash_ex.c.

References FLASH_BANK_1, FLASH_BANK_2, FLASH_BANK_BOTH, and FLASH_BANK_SIZE.

Referenced by HAL_FLASHEx_OBGetConfig().

static uint32_t FLASH_OB_GetRDP ( void  ) [static]

Return the FLASH Read Protection level.

Return values:
FLASHReadOut Protection Status: This return value 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 1185 of file stm32l4xx_hal_flash_ex.c.

References OB_RDP_LEVEL_0, OB_RDP_LEVEL_1, and OB_RDP_LEVEL_2.

Referenced by HAL_FLASHEx_OBGetConfig().

static uint32_t FLASH_OB_GetUser ( void  ) [static]

Return the FLASH User Option Byte value.

Return values:
TheFLASH User Option Bytes values: For STM32L47x/STM32L48x devices : BOR_LEV(Bit8-10), nRST_STOP(Bit12), nRST_STDBY(Bit13), nRST_SHDW(Bit14), IWDG_SW(Bit16), IWDG_STOP(Bit17), IWDG_STDBY(Bit18), WWDG_SW(Bit19), BFB2(Bit20), DUALBANK(Bit21), nBOOT1(Bit23), SRAM2_PE(Bit24) and SRAM2_RST(Bit25). For STM32L43x/STM32L44x devices : BOR_LEV(Bit8-10), nRST_STOP(Bit12), nRST_STDBY(Bit13), nRST_SHDW(Bit14), IWDG_SW(Bit16), IWDG_STOP(Bit17), IWDG_STDBY(Bit18), WWDG_SW(Bit19), nBOOT1(Bit23), SRAM2_PE(Bit24), SRAM2_RST(Bit25), nSWBOOT0(Bit26) and nBOOT0(Bit27).

Definition at line 1211 of file stm32l4xx_hal_flash_ex.c.

Referenced by HAL_FLASHEx_OBGetConfig().

static void FLASH_OB_GetWRP ( uint32_t  WRPArea,
uint32_t *  WRPStartOffset,
uint32_t *  WRDPEndOffset 
) [static]

Return the FLASH Write Protection Option Bytes value.

Parameters:
[in]WRPArea,:specifies the area to be returned. This parameter can be one of the following values:
  • OB_WRPAREA_BANK1_AREAA: Flash Bank 1 Area A
  • OB_WRPAREA_BANK1_AREAB: Flash Bank 1 Area B
  • OB_WRPAREA_BANK2_AREAA: Flash Bank 2 Area A (don't apply to STM32L43x/STM32L44x devices)
  • OB_WRPAREA_BANK2_AREAB: Flash Bank 2 Area B (don't apply to STM32L43x/STM32L44x devices)
[out]WRPStartOffset,:specifies the address where to copied the start page of the write protected area
[out]WRDPEndOffset,:specifies the address where to copied the end page of the write protected area
Return values:
None

Definition at line 1144 of file stm32l4xx_hal_flash_ex.c.

References OB_WRPAREA_BANK1_AREAA, OB_WRPAREA_BANK1_AREAB, OB_WRPAREA_BANK2_AREAA, and OB_WRPAREA_BANK2_AREAB.

Referenced by HAL_FLASHEx_OBGetConfig().

static HAL_StatusTypeDef FLASH_OB_PCROPConfig ( uint32_t  PCROPConfig,
uint32_t  PCROPStartAddr,
uint32_t  PCROPEndAddr 
) [static]

Configure the Proprietary code readout protection of the desired addresses.

Note:
To configure the PCROP options, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_OB_Unlock() function.
To validate the PCROP options, the option bytes must be reloaded through the call of the HAL_FLASH_OB_Launch() function.
Parameters:
PCROPConfig,:specifies the configuration (Bank to be configured and PCROP_RDP option). This parameter must be a combination of FLASH_BANK_1 or FLASH_BANK_2 with OB_PCROP_RDP_NOT_ERASE or OB_PCROP_RDP_ERASE
PCROPStartAddr,:specifies the start address of the Proprietary code readout protection This parameter can be an address between begin and end of the bank
PCROPEndAddr,:specifies the end address of the Proprietary code readout protection This parameter can be an address between PCROPStartAddr and end of the bank
Return values:
HALStatus

Definition at line 1016 of file stm32l4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, FLASH_BANK_2, FLASH_BANK_BOTH, FLASH_BANK_SIZE, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_BANK_EXCLUSIVE, IS_FLASH_MAIN_MEM_ADDRESS, and IS_OB_PCROP_RDP.

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_RDPConfig ( uint32_t  RDPLevel) [static]

Set the read protection level.

Note:
To configure the RDP level, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_OB_Unlock() function.
To validate the RDP level, the option bytes must be reloaded through the call of the HAL_FLASH_OB_Launch() function.
!!! Warning : When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0 !!!
Parameters:
RDPLevel,:specifies 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
Return values:
HALstatus

Definition at line 754 of file stm32l4xx_hal_flash_ex.c.

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

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_UserConfig ( uint32_t  UserType,
uint32_t  UserConfig 
) [static]

Program the FLASH User Option Byte.

Note:
To configure the user option bytes, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_OB_Unlock() function.
To validate the user option bytes, the option bytes must be reloaded through the call of the HAL_FLASH_OB_Launch() function.
Parameters:
UserType,:The FLASH User Option Bytes to be modified
UserConfig,:The FLASH User Option Bytes values: BOR_LEV(Bit8-10), nRST_STOP(Bit12), nRST_STDBY(Bit13), IWDG_SW(Bit16), IWDG_STOP(Bit17), IWDG_STDBY(Bit18), WWDG_SW(Bit19), BFB2(Bit20), DUALBANK(Bit21), nBOOT1(Bit23), SRAM2_PE(Bit24) and SRAM2_RST(Bit25).
Return values:
HALstatus

Definition at line 798 of file stm32l4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_OB_USER_BFB2, IS_OB_USER_BOOT1, IS_OB_USER_BOR_LEVEL, IS_OB_USER_DUALBANK, IS_OB_USER_IWDG, IS_OB_USER_IWDG_STDBY, IS_OB_USER_IWDG_STOP, IS_OB_USER_SHUTDOWN, IS_OB_USER_SRAM2_PARITY, IS_OB_USER_SRAM2_RST, IS_OB_USER_STANDBY, IS_OB_USER_STOP, IS_OB_USER_TYPE, IS_OB_USER_WWDG, OB_USER_BFB2, OB_USER_BOR_LEV, OB_USER_DUALBANK, OB_USER_IWDG_STDBY, OB_USER_IWDG_STOP, OB_USER_IWDG_SW, OB_USER_nBOOT1, OB_USER_nRST_SHDW, OB_USER_nRST_STDBY, OB_USER_nRST_STOP, OB_USER_SRAM2_PE, OB_USER_SRAM2_RST, and OB_USER_WWDG_SW.

Referenced by HAL_FLASHEx_OBProgram().

static HAL_StatusTypeDef FLASH_OB_WRPConfig ( uint32_t  WRPArea,
uint32_t  WRPStartOffset,
uint32_t  WRDPEndOffset 
) [static]

Configure the write protection of the desired pages.

Note:
When the memory read protection level is selected (RDP level = 1), it is not possible to program or erase Flash memory if the CPU debug features are connected (JTAG or single wire) or boot code is being executed from RAM or System flash, even if WRP is not activated.
To configure the WRP options, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_OB_Unlock() function.
To validate the WRP options, the option bytes must be reloaded through the call of the HAL_FLASH_OB_Launch() function.
Parameters:
WRPArea,:specifies the area to be configured. This parameter can be one of the following values:
  • OB_WRPAREA_BANK1_AREAA: Flash Bank 1 Area A
  • OB_WRPAREA_BANK1_AREAB: Flash Bank 1 Area B
  • OB_WRPAREA_BANK2_AREAA: Flash Bank 2 Area A (don't apply for STM32L43x/STM32L44x devices)
  • OB_WRPAREA_BANK2_AREAB: Flash Bank 2 Area B (don't apply for STM32L43x/STM32L44x devices)
WRPStartOffset,:specifies the start page of the write protected area This parameter can be page number between 0 and (max number of pages in the bank - 1)
WRDPEndOffset,:specifies the end page of the write protected area This parameter can be page number between WRPStartOffset and (max number of pages in the bank - 1)
Return values:
HALStatus

Definition at line 679 of file stm32l4xx_hal_flash_ex.c.

References assert_param, FLASH_TIMEOUT_VALUE, FLASH_WaitForLastOperation(), IS_FLASH_PAGE, IS_OB_WRPAREA, OB_WRPAREA_BANK1_AREAA, OB_WRPAREA_BANK1_AREAB, OB_WRPAREA_BANK2_AREAA, and OB_WRPAREA_BANK2_AREAB.

Referenced by HAL_FLASHEx_OBProgram().

void FLASH_PageErase ( uint32_t  Page,
uint32_t  Banks 
)

Erase the specified FLASH memory page.

Parameters:
Page,:FLASH page to erase This parameter must be a value between 0 and (max number of pages in the bank - 1)
Banks,:Bank(s) where the page will be erased This parameter can be one of the following values:
  • FLASH_BANK_1: Page in bank 1 to be erased
  • FLASH_BANK_2: Page in bank 2 to be erased
Return values:
None

Definition at line 582 of file stm32l4xx_hal_flash_ex.c.

References assert_param, FLASH_BANK_1, IS_FLASH_BANK_EXCLUSIVE, and IS_FLASH_PAGE.

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

HAL_StatusTypeDef FLASH_WaitForLastOperation ( uint32_t  Timeout)

Wait for a FLASH operation to complete.

Parameters:
Timeout,:maximum flash operation timeout
Return values:
HAL_StatusTypeDefHAL Status

Definition at line 662 of file stm32l4xx_hal_flash.c.

References __HAL_FLASH_CLEAR_FLAG, __HAL_FLASH_GET_FLAG, FLASH_ProcessTypeDef::ErrorCode, FLASH_FLAG_BSY, FLASH_FLAG_ECCD, FLASH_FLAG_EOP, FLASH_FLAG_SR_ERRORS, and HAL_GetTick().

Referenced by FLASH_OB_PCROPConfig(), FLASH_OB_RDPConfig(), FLASH_OB_UserConfig(), FLASH_OB_WRPConfig(), HAL_FLASH_OB_Launch(), HAL_FLASH_Program(), and HAL_FLASHEx_Erase().