STM32F103xB HAL User Manual
Functions
FLASHEx Memory Erasing functions
FLASHEx Exported Functions

FLASH Memory Erasing functions. More...

Functions

HAL_StatusTypeDef HAL_FLASHEx_Erase (FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError)
 Perform a mass erase or erase the specified FLASH memory pages.
HAL_StatusTypeDef HAL_FLASHEx_Erase_IT (FLASH_EraseInitTypeDef *pEraseInit)
 Perform a mass erase or erase the specified FLASH memory pages with interrupt enabled.

Detailed Description

FLASH Memory Erasing functions.

  ==============================================================================
                ##### FLASH Erasing Programming functions ##### 
  ==============================================================================

    [..] The FLASH Memory Erasing functions, includes the following functions:
    (+) @ref HAL_FLASHEx_Erase: return only when erase has been done
    (+) @ref HAL_FLASHEx_Erase_IT: end of erase is done when @ref HAL_FLASH_EndOfOperationCallback 
        is called with parameter 0xFFFFFFFF

    [..] Any operation of erase should follow these steps:
    (#) Call the @ref HAL_FLASH_Unlock() function to enable the flash control register and 
        program memory access.
    (#) Call the desired function to erase page.
    (#) Call the @ref HAL_FLASH_Lock() to disable the flash program memory access 
       (recommended to protect the FLASH memory against possible unwanted operation).


Function Documentation

HAL_StatusTypeDef HAL_FLASHEx_Erase ( FLASH_EraseInitTypeDef pEraseInit,
uint32_t *  PageError 
)

Perform a mass erase or erase the specified FLASH memory pages.

Note:
To correctly run this function, the HAL_FLASH_Unlock() function must be called before. Call the HAL_FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
Parameters:
[in]pEraseInitpointer to an FLASH_EraseInitTypeDef structure that contains the configuration information for the erasing.
[out]PageErrorpointer to variable that contains the configuration information on faulty page in case of error (0xFFFFFFFF means that all the pages have been correctly erased)
Return values:
HAL_StatusTypeDefHAL Status

Definition at line 159 of file stm32f1xx_hal_flash_ex.c.

References assert_param, FLASH_EraseInitTypeDef::Banks, FLASH_BANK_1, FLASH_MassErase(), FLASH_PAGE_SIZE, FLASH_PageErase(), FLASH_TIMEOUT_VALUE, FLASH_TYPEERASE_MASSERASE, FLASH_WaitForLastOperation(), IS_FLASH_NB_PAGES, IS_FLASH_PROGRAM_ADDRESS, IS_FLASH_TYPEERASE, FLASH_EraseInitTypeDef::NbPages, FLASH_EraseInitTypeDef::PageAddress, and FLASH_EraseInitTypeDef::TypeErase.

HAL_StatusTypeDef HAL_FLASHEx_Erase_IT ( FLASH_EraseInitTypeDef pEraseInit)

Perform a mass erase or erase the specified FLASH memory pages with interrupt enabled.

Note:
To correctly run this function, the HAL_FLASH_Unlock() function must be called before. Call the HAL_FLASH_Lock() to disable the flash memory access (recommended to protect the FLASH memory against possible unwanted operation)
Parameters:
pEraseInitpointer to an FLASH_EraseInitTypeDef structure that contains the configuration information for the erasing.
Return values:
HAL_StatusTypeDefHAL Status

Definition at line 319 of file stm32f1xx_hal_flash_ex.c.

References __HAL_FLASH_ENABLE_IT, FLASH_ProcessTypeDef::Address, assert_param, FLASH_EraseInitTypeDef::Banks, FLASH_ProcessTypeDef::DataRemaining, FLASH_IT_EOP, FLASH_IT_ERR, FLASH_MassErase(), FLASH_PageErase(), FLASH_PROC_MASSERASE, FLASH_PROC_NONE, FLASH_PROC_PAGEERASE, FLASH_TYPEERASE_MASSERASE, IS_FLASH_NB_PAGES, IS_FLASH_PROGRAM_ADDRESS, IS_FLASH_TYPEERASE, FLASH_EraseInitTypeDef::NbPages, FLASH_EraseInitTypeDef::PageAddress, FLASH_ProcessTypeDef::ProcedureOnGoing, and FLASH_EraseInitTypeDef::TypeErase.